google-chrome - EvalError:拒绝将字符串评估为 JavaScript,因为 'unsafe-eval' - Chrome 扩展
问题描述
我正在迁移到 manifest v3,我将所有需要的内容安全策略添加到 manifest.json 文件中。但是我收到以下错误:
EvalError:拒绝将字符串评估为 JavaScript,因为 unsafe-eval 不是以下内容安全策略指令中允许的脚本源:script-src self。
在 eval () 在 inboxsdk.js:1177
清单.json:
"content_scripts": [
{
"all_frames": false,
"css": [ "css/content.css", "style.css", "css/buttons.css" ],
"include_globs": [ "*://mail.google.*/*" ],
"js": [ "resources/jquery-3.3.1/jquery-3.3.1.min.js", "js/api.js", "js/inpage.js", "js/menus.js", "js/content.js", "js/background.js", "lib/q.js", "js/inboxsdk.js", "js/app.js" ],
"matches": [ "*://*/*", "<all_urls>" ],
"run_at": "document_start"
},
"manifest_version": 3,
"content_security_policy": {
"extension_pages":" object-src 'self'",
"sandbox": "sandbox allow-scripts; https://apis.google.com https://apis.google.com/js/client.js https://ajax.googleapis.com https://designshack.net/favicon.ico https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js https://aui-cdn.atlassian.com https://netdna.bootstrapcdn.com https://tarruda.github.com https://cdnjs.cloudflare.com https://ydn-src-2.storage.googleapis.com https://www.google.com/ ; default-src 'self'; object-src 'self'"
},
解决方案
请使用以下代码行更新您的“extension_pages”:“object-src 'self'”
"extension_pages":"script-src 'self'; object-src 'self'",
推荐阅读
- typescript - 打字稿中的记录类型是什么?
- netlogo - 流量问题,Netlogo
- c++ - c ++输出数组中的最高元素
- reactjs - 在 Redux 中更新深度嵌套数组的状态时遇到问题
- java - 如何在没有注入列表的情况下直接获取 Spring 中排序最高的 bean?
- reactjs - 如何在不重新渲染的情况下更改图标的颜色(TextField 失去焦点)
- java - 如何处理/优化 Android 应用程序中的高内存使用情况
- sql - SQL - 提取两个字符之间的子字符串
- vba - 为什么我在此 MyCell 范围错误中出现类型不匹配?
- ios - 如何将 UIDocumentPickerViewController 导入限制为 .archive 文件?(NSKeyedArchiver)