拒绝应用内联样式,因为它违反了以下内容安全策略指令。
拒绝应用内联样式,因为它违反了以下内容安全策略指令。
大约1小时后,我的扩展出现了严重故障。
我正在进行我的扩展,它正在按照我的预期工作。我做了一些更改,但是由于我不喜欢它们,我删除了它们,现在我的扩展程序出现了错误:
拒绝应用内联样式,因为它违反了以下内容安全策略指令:“default-src 'self'”。请注意,由于没有明确设置“style-src”,因此将使用“default-src”作为备用。
是什么原因导致了这个错误?
我在以下位置进行了更改:
popup.html
{{message}} PinIt
Page:
{{title}} {{url}}Imagens:
-
- Google+
popup.js
myApp.service('pageInfoService', function() { this.getInfo = function(callback) { var model = {}; chrome.tabs.query({ 'active': true }, function(tabs) { if (tabs.length > 0) { model.title = tabs[0].title; model.url = tabs[0].url; chrome.tabs.sendMessage(tabs[0].id, { 'action': 'PageInfo' }, function(response) { model.pageInfos = response; callback(model); }); } }); }; }); myApp.controller("PageController", function($scope, pageInfoService) { pageInfoService.getInfo(function(info) { $scope.title = info.title; $scope.url = info.url; $scope.pageInfos = info.pageInfos; $scope.fbshare = function($src) { chrome.windows.create({ url: "http://www.facebook.com/sharer/sharer.php?u=" + $src }); }; $scope.twshare = function($src) { chrome.windows.create({ url: "https://twitter.com/intent/tweet?url=" + $src }); }; $scope.gpshare = function($src) { chrome.windows.create({ url: "https://plus.google.com/share?url=" + $src }); }; $scope.mailshare = function($src) { chrome.windows.create({ url: "mailto:?subject=Imagem Partilhada por PinIt&body=" }); }; $scope.$apply(); }); });
这是我的清单文件:
{
"name": "PinIt",
"version": "1.0",
"manifest_version": 2,
"description": "Pin It",
"icons": {
"128": "icon128.png"
},
"browser_action": {
"default_icon": "img/defaultIcon19x19.png",
"default_popup": "popup.html",
"default_title": "PinIt"
},
"content_scripts": [{
"js": ["js/lib/jquery-1.8.2.min.js", "js/app/content.js", "js/jquery-ui-1.10.3.custom.js"],
"matches": ["*://*/*"],
"run_at": "document_start"
}],
"minimum_chrome_version": "18",
"permissions": ["http://*/*", "https://*/*", "unlimitedStorage", "contextMenus", "cookies", "tabs", "notifications"],
"content_security_policy": "default-src 'self'"
}
有什么建议吗?