当我尝试导入 firebase sdk 以在我的 firefox 扩展中使用它们时,我遇到了这个问题
Content-Security-Policy:该页面的设置阻止了 https://www.gstatic.com/firebasejs/10.14.0/firebase-app.js 处的脚本 (script-src-elem) 的执行,因为它违反了规定以下指令:“script-src 'self' 'wasm-unsafe-eval'”
manifest.json
:
{
"manifest_version": 2,
"name": "test",
"version": "0.1.32",
"description": "test",
"permissions": [
"tabs",
"webRequest",
"storage",
"notifications",
"webRequestBlocking",
"activeTab",
"tabs",
"<all_urls>"
],
"background": {
"scripts": [
"background.js", "connect.js"
],
"type": "module",
"persistent": true
},
"content_scripts": [
{
"matches": [
"*://www.test.com/*"
],
"js": [
"content.js"
]
}
],
"icons": {
"16": "icons/256x256_icon.png",
"48": "icons/256x256_icon.png",
"128": "icons/256x256_icon.png"
},
"browser_action": {
"default_icon": "icons/256x256_icon.png",
"default_popup": "popup.html",
"default_title": "test"
}
}
有什么办法可以解决吗?
也许您可以检查您的浏览器版本是否需要更新。 此外,您可以查看这些文件。
[参考][1] [1]:https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/content_security_policy
[参考][2] [2]:https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/script-src