18 行
380 B
JavaScript
18 行
380 B
JavaScript
/* global browser */
|
|
|
|
const TYPE_MAP = {
|
|
'style-src': 'css',
|
|
'script-src': 'script',
|
|
'img-src': 'media',
|
|
};
|
|
|
|
document.addEventListener('securitypolicyviolation', event => {
|
|
var type = TYPE_MAP[event.violatedDirective];
|
|
if (type) {
|
|
browser.runtime.sendMessage({
|
|
type: 'securitypolicyviolation',
|
|
data: type,
|
|
});
|
|
}
|
|
});
|