0
當上傳我的解壓後的Chrome擴展程序,我得到以下錯誤:Chrome的插件和內容安全策略的錯誤
Could not load extension from '/Users/me/example'. Invalid value for 'content_security_policy': Both 'script-src' and 'object-src' directives must be specified (either explicitly, or implicitly via 'default-src'), and both must whitelist only secure resources. You may include any of the following sources: "'self'", "'unsafe-eval'", "http://127.0.0.1", "http://localhost", or any "https://" or "chrome-extension://" origin. For more information, see http://developer.chrome.com/extensions/contentSecurityPolicy.html
我的清單如下所示:
{
"name": "Example Inc.",
"manifest_version" : 2,
"version": "0.4.4",
"content_scripts": [
{
"matches": [
"*://*.example.cc/*"
],
"js": [
"production/jquery.libs.min.js",
"https://example.cc/js/example.js"
],
"run_at": "document_end"
}
],
"permissions": [
"*://*.example.cc/*",
"tabs",
"activeTab",
"contextMenus",
"storage",
"management",
"cookies"
],
"content_security_policy": "script-src 'self' https://ssl.google-analytics.com/ga.js https://example.cc/js/*; object-src 'self'"
}
從我的所有例子我看過了,在閱讀了一些CSP文檔後,我不確定我錯過了什麼。我們的域名是完全https,example.js文件存在並且可以訪問等。
歡迎任何想法!
爲了使這更好的答案,說明了什麼問題。 – Xan
使用此條目時,嘗試上傳時出現以下錯誤:無法從'/ Users/me/example'加載擴展名。無法加載JavaScript內容腳本。 – dylst