Bug Tracker

Opened 8 years ago

Last modified 7 years ago

#11249 closed bug

CSP error in Chrome 18 when loading jQuery 1.7.1 — at Initial Version

Reported by: adblockforchrome Owned by:
Priority: low Milestone: 1.8
Component: support Version: 1.7.1
Keywords: Cc:
Blocked by: Blocking:

Description

jQuery version 1.7.1 Chrome version 18.0.1003.1

Repro:

  1. Load in Chrome the extension that is attached to this post (unzip the .zip then drag the .crx onto Chrome).
  2. Open the Web Inspector Console on the page that appears.

Expected results: No errors. The page does nothing but load jQuery.

Actual results: 5 "Refused to apply inline style because of Content-Security-Policy." errors.

---

You can unzip the attachment and drag the .crx onto Chrome to install it. Here is the contents of the extension. The important part is that manifest.json enables CSP, and page.html includes jQuery.

manifest.json:

{
  "name": "jQuery CSP fail",
  "version": "1",
  "permissions": [ "http://*/*", "https://*/*" ],
  "content_security_policy": "default-src 'self'",
  "background_page": "background.html"
}

background.html:

<script src="background.js"></script>

background.js:

chrome.tabs.create({url:"page.html"});

page.html:

<!DOCTYPE html>
<html>
  <head><script src="jquery.min.js"></script></head>
  <body>
    Open the Web Inspector console to see the jQuery errors.
  </body>
</html>

jquery.min.js:

The minified jQuery 1.7.1 code.

Change History (0)

Note: See TracTickets for help on using tickets.