@Hoa: Yeah that seems to do the trick. I was using a similar patch but wasn’t 
sure if it was the right way to go. By the way, the same adjustment has to be 
made in the ShadowDOM polyfill: 
https://github.com/Polymer/ShadowDOM/blob/master/src/wrappers.js#L14-L26

On 7. April 2014 at 21:37:00, Hoa V. Dinh ([email protected]) wrote:

I’m doing it.

-- 
Hoa V. Dinh

On Monday, April 7, 2014 at 12:29 PM, John Messerly wrote:

@Hoa, that's a nice workaround! Could it be submitted as a pull request to 
observe-js repository?


On Mon, Apr 7, 2014 at 12:08 PM, Hoa V. Dinh <[email protected]> wrote:
Hi,

For Chrome Apps, I would usually apply a change to the following function in 
observe.js (https://github.com/Polymer/observe-js/blob/master/src/observe.js):
Since eval is not supported in the Chrome platform and checking 
document.securityPolicy.allowsEval doesn’t help in Chrome Apps platform, I’m 
checking the presence of  chrome.app.runtime.

 function detectEval() {


    // don't test for eval if document has CSP securityPolicy object and we can 
see that


    // eval is not supported. This avoids an error message in console even when 
the exception


    // is caught


    if (global.document &&


        'securityPolicy' in global.document &&


        !global.document.securityPolicy.allowsEval) {


      return false;


    }

// Here’s the relevant change.
if (chrome.app.runtime) { // could probably be improved and be: chrome && 
chrome.app && chrome.app.runtime


return false; }


    try {


      var f = new Function('', 'return true;');


      return f();


    } catch (ex) {


      return false;


    }
  }

-- 
Hoa V. Dinh

On Monday, April 7, 2014 at 11:57 AM, Scott Miles wrote:

We have to know more about what you did to provide any support.


On Mon, Apr 7, 2014 at 11:53 AM, Martin Kleinschrodt <[email protected]> 
wrote:
What's the status on this? I've tried using vulcanize with the --csp flag but I 
still get the 'unsafe-eval' error:


Refused to
evaluate a string
as JavaScript because 'unsafe-eval' is not
an allowed source of script
in the
following Content
Security Policy directive:
"default-src 'self'
chrome-extension-resource:".
Note that 'script-src' was not
explicitly set,
so 'default-src' is used
as a
fallback.

On Thursday, December 5, 2013 8:01:57 PM UTC+1, Scott Miles wrote:
chrome-app-seed is deprecated now because the 'vulcanize' tool can usually 
produce CSP-safe application code directly without special libraries.

I believe there are some examples somewhere, I will make a note that we need to 
clean something up for demonstration. There is a very basic non-vulcanizer 
example here: https://github.com/Polymer/labs/tree/master/sjmiles/AppTracks.

Also, there is work happening to better document Vulcanizer.


On Sat, Nov 23, 2013 at 10:35 AM, <[email protected]> wrote:
chrome-app-seed is no longer found under https://github.com/Polymer.  Is there 
a new starter for Chrome App with Polymer?

Jun

On Wednesday, August 21, 2013 5:24:36 PM UTC-7, Dominic Cooney wrote:


On Thu, Aug 22, 2013 at 3:05 AM, Scott Miles <[email protected]> wrote:
(Apologies to Hoa, I sent this same message directly to him by mistake.)

The 'eval' warning is the binding code testing if eval is available for 
optimizations, it's harmless.

The 'InvalidCharacterError' is blocking Polymer in Chrome Apps right now, see 
this bug that Daniel referenced earlier:
https://code.google.com/p/chromium/issues/detail?id=273126

FYI this should be fixed in the next Canary.
 
The 'TypeError' is fallout from the previous error.


On Wed, Aug 21, 2013 at 9:57 AM, Hoa V. Dinh <[email protected]> wrote:
Hi,
I'm now using the following version of Chrome:
Google Chrome   31.0.1606.2 (Official Build 218471) canary
OS      Mac OS X 
Blink    537.36 (@156363)

It should include the fix you mentioned.
And I still got the following logs in the console:

<<
Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an 
allowed source of script in the following Content Security Policy directive: 
"default-src 'self' chrome-extension-resource:". Note that 'script-src' was not 
explicitly set, so 'default-src' is used as a fallback.
 deprecated.js:12
Uncaught InvalidCharacterError: Failed to call 'register' on 'Document' for 
type 'polymer-element': : 'polymer-element' is not a valid name. 
deprecated.js:12
Uncaught TypeError: Property 'Polymer' of object [object Object] is not a 
function build.js:29
>>

Let me know if there's something I'm missing here.

Thanks!

-- 
Hoa V. Dinh

On Tuesday, August 20, 2013 at 11:22 AM, Hoa V. Dinh wrote:

Cool! I'll try it tomorrow then.
Currently, I'm using Chrome dev and Canary >= 30.

-- 
Hoa V. Dinh

On Tuesday, August 20, 2013 at 11:17 AM, Daniel Freedman wrote:

Ah, this looks like https://code.google.com/p/chromium/issues/detail?id=273126. 
In Canary, document.register is heavily restricted in the packaged apps 
environment. The CL to fix this: 
http://src.chromium.org/viewvc/blink?view=revision&revision=156336, should land 
in tomorrow's Canary.

In the meantime, the sandbox <iframe> loader version is the only way to get a 
packaged app running on Canary.

calendar-nosandbox-app works ok on M28, but has a few styling issues because it 
uses the unprefixed flexbox syntax.


On Tue, Aug 20, 2013 at 11:05 AM, Hoa V. Dinh <[email protected]> wrote:
I also tried to use: calendar-nosandbox-app, which architecture is more similar 
to a chrome packaged app.
It shown the same issues as my sample application:

<<
Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an 
allowed source of script in the following Content Security Policy directive: 
"default-src 'self' chrome-extension-resource:". Note that 'script-src' was not 
explicitly set, so 'default-src' is used as a fallback.
 polymer.min.js:2215
Uncaught InvalidCharacterError: Failed to call 'register' on 'Document' for 
type 'polymer-element': : 'polymer-element' is not a valid name. 
polymer.min.js:6787
Uncaught TypeError: Property 'Polymer' of object [object Object] is not a 
function imports.js:19
>>

-- 
Hoa V. Dinh

On Tuesday, August 20, 2013 at 10:56 AM, Daniel Freedman wrote:

Ok, chrome-app-seed should be updated now. Also, our (now departed) intern 
Priyank made a good example (sandboxed) chrome packaged app here: 
https://github.com/Polymer/labs/tree/master/priyanks/calendar-chrome-app.


On Tue, Aug 20, 2013 at 10:52 AM, Daniel Freedman <[email protected]> wrote:
Oops, that's a bug! I'll fix it now.


On Tue, Aug 20, 2013 at 10:50 AM, Hoa V. Dinh <[email protected]> wrote:
Could you describe how I can use it?

I tried to use chrome-app-seed, which should be a chrome sample app using 
polymer-chrome-app and when I run it.

1/ Nothing shows in the window of the application

2/ When I open the console, I can see the following logs:
Uncaught Error: Polymer.register is deprecated in declaration of my-app. Please 
see http://www.polymer-project.org/getting-started.html deprecated.js:12

--
Hoa V. Dinh

On Tuesday, August 20, 2013 at 10:39 AM, Daniel Freedman wrote:

Polymer-chrome-app is an up to date, but still uses the sandboxed build of 
polymer.


On Tue, Aug 20, 2013 at 10:37 AM, Eric Bidelman <[email protected]> wrote:
The "shadowRoot redefined" error usually comes from loading platform.min.js and 
polymer.min.js. You should only need polymer.min.js.

There's also an old chrome app example here that uses polymer.sandbox.js:
https://github.com/Polymer/polymer-chrome-app

Folks, what's the status of polymer-chrome-app?




On Mon, Aug 19, 2013 at 3:00 PM, Hoa V. Dinh <[email protected]> wrote:
Hi polymer dev,

I'm trying to run Polymer in a Chrome Packaged Apps in Chrome Canary.

1. I checkout the following:
https://github.com/dinhviethoa/polymer-simple

polymer-simple/polymer/ folder contains the minified version of platform and 
polymer.

2. In chrome://flags, I enabled the following options:

> Enable experimental Web Platform features. Mac, Windows, Linux, Chrome OS, 
> Android
Enable experimental Web Platform features that are in development. 
#enable-experimental-web-platform-features

> Enable apps-devtool app. Mac, Windows, Linux, Chrome OS
An app to develop apps / extensions. #enable-apps-devtool-app

3. Restart Chrome

4. In chrome://extensions, I checked enabled "Developer Mode".

5. In a new tab page, from the application list, I run "Apps Developer Tools".

6. I used "Load Unpacked" and chose the folder polymer-simple/

7. In the list of application, I used the "launch" option for "polymer simple".

-> I don't see the polymer UI rendering.

8. Back in "Apps Developer Tools" window, polymer simple > Inspect views > 
simple.html.
It opens the web inspector. I clicked on "Console".

The following logs shown:
Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an 
allowed source of script in the following Content Security Policy directive: 
"default-src 'self' chrome-extension-resource:". Note that 'script-src' was not 
explicitly set, so 'default-src' is used as a fallback.
 tap.js:76
(anonymous function) tap.js:76
Uncaught TypeError: Cannot redefine property: shadowRoot deprecated.js:12
Uncaught ReferenceError: Polymer is not defined build.js:1

Could you help me investigate what's going on?
Especially, "shadowRoot redefined" and "Polymer not defined" looks strange.

Thanks!

--
Hoa V. Dinh

Follow Polymer on Google+: plus.google.com/107187849809354688692
---
You received this message because you are subscribed to the Google Groups 
"Polymer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].

For more options, visit https://groups.google.com/groups/opt_out.

Follow Polymer on Google+: plus.google.com/107187849809354688692
---
You received this message because you are subscribed to the Google Groups 
"Polymer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].

For more options, visit https://groups.google.com/groups/opt_out.





Follow Polymer on Google+: plus.google.com/107187849809354688692
---
You received this message because you are subscribed to the Google Groups 
"Polymer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].

For more options, visit https://groups.google.com/groups/opt_out.



Follow Polymer on Google+: plus.google.com/107187849809354688692
---
You received this message because you are subscribed to the Google Groups 
"Polymer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].

For more options, visit https://groups.google.com/groups/opt_out.

Follow Polymer on Google+: plus.google.com/107187849809354688692
---
You received this message because you are subscribed to the Google Groups 
"Polymer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].

For more options, visit https://groups.google.com/groups/opt_out.



--

Follow Polymer on Google+: plus.google.com/107187849809354688692
---
You received this message because you are subscribed to the Google Groups 
"Polymer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/polymer-dev/5474a3ea-2e87-4e51-bc32-de854b8e9f9d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Follow Polymer on Google+: plus.google.com/107187849809354688692
---
You received this message because you are subscribed to the Google Groups 
"Polymer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/polymer-dev/D06341B87CD9459D94FF5B8F68FF60E6%40google.com.

For more options, visit https://groups.google.com/d/optout.


Follow Polymer on Google+: plus.google.com/107187849809354688692
--- 
You received this message because you are subscribed to the Google Groups 
"Polymer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/polymer-dev/etPan.53431edf.6b8b4567.1d51%40Martins-MacBook-Air-2.local.
For more options, visit https://groups.google.com/d/optout.

Reply via email to