0

I am trying to create a DevTools Page extension in chrome with angular 2 RC1 but i found some problems to do it. In previous versions of angular (beta-7) i don't have this type of problems.

I think the problems they are related with some cross origin request (XMLHttpRequest) in the Zone.js file or because there exist some violations of content / restrictions of chrome extensions.

Someone had a problem of this kind?

For angular 2 app i use to test the panel the tour of heroes tutorial of angular. And the configuration of the remaining files is more or less the following:

(manifest.json)

...
"content_security_policy": "script-src 'self'; object-src 'self'",   
"minimum_chrome_version": "10.0",
"devtools_page": "devtools/devtools.html",

(devtools.js)

chrome.devtools.panels.create("Heroes Panel","icon.png","index.html",null);

PS: I am newbie in this new world of angular. :shy: Thanks for the help possible!

EDITED. These are the mistakes that i got in the console:

Refused to execute inline script because it violates the following Content Security Policy directive: "script-src 'self'". Either the 'unsafe-inline' keyword, a hash ('sha256-G0mTaF6bWvyc4n9GAJfTdnuzxv4B+t1WU0aL2FBX94A='), or a nonce ('nonce-...') is required to enable inline execution.

5
  • For angular2 beta 17 see here working fine github.com/MrPardeep/Angular2_typescript_ChromeExtension Commented May 31, 2016 at 6:35
  • Error messages would probably be helpful in tracing the issues. You can debug Dev Tools panels while they are detached. Commented May 31, 2016 at 13:55
  • @Xan Thanks. I gonna edit the post with errors. Commented May 31, 2016 at 14:06
  • Thanks @PardeepJain for your suggestion. I will gonna try. Commented May 31, 2016 at 14:09
  • I think you need to wait until offline template compiler is available. It is supposed to solve the CSP problems. Commented Jun 15, 2016 at 4:29

1 Answer 1

1

This problem is chrome extension content security policy. You can see the doc https://developer.chrome.com/extensions/contentSecurityPolicy#relaxing-inline-script

if you have inline script in your html

<script>// js code</script>

change to

<script src="xxx.js"></script>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.