简体   繁体   中英

chrome extension permissions not working

the structure of my chrome extension is like this:

background.html
background.js
javascripts/angular...
javascripts/webRTC...

in background.js i am using the datachannel.js library from firebase, which essentially creates a remote call to firebaseio.com

var socket = new window.Firebase('https://' + 
    (self.firebase || 'webrtc-experiment') + '.firebaseIO.com/' + channel);

chrome returns this error to the console:

Refused to load the script 'https://webrtc-experiment.firebaseio.com/.lp?start=t&ser=24080204&cb=23&v=5' because it violates the following Content Security Policy directive: "script-src 'self' blob: filesystem: chrome-extension-resource:". (anonymous function) @ firebase.js:168

here is manifest.json:

 "manifest_version": 2,
    "background": {
        "page": "background.html"
    },
    "browser_action": {
        "default_popup": "main.html",
        "default_icon": "icon.png",
        "default_title": "title"

    },
    "minimum_chrome_version": "37.0",
    "name": "chromeextensionname",
    "permissions": [
        "<all_urls>",

solved with content-security-policy within manifest.json

"content_security_policy": "script-src 'self' https://*.firebase.com https://*.firebaseio.com; object-src 'self'",

references:

https://developer.chrome.com/extensions/contentSecurityPolicy

How to set Content Security Policy in Chrome Extension Manifest.json in order for Firebase to work

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM