Revision 0e002513
Added by jahoti about 2 years ago
content/freezer.js | ||
---|---|---|
43 | 43 |
element._frozen = true; |
44 | 44 |
} |
45 | 45 |
|
46 |
function script_suppressor(nonce) { |
|
47 |
const blockExecute = e => { |
|
48 |
if (document.readyState === 'complete') { |
|
49 |
removeEventListener('beforescriptexecute', blockExecute, true); |
|
50 |
return; |
|
51 |
} |
|
52 |
else if (e.isTrusted && e.target.getAttribute('nonce') !== nonce) { // Prevent blocking of injected scripts |
|
53 |
e.preventDefault(); |
|
54 |
console.log('Suppressed script', e.target); |
|
55 |
} |
|
56 |
}; |
|
57 |
return blockExecute; |
|
46 |
function mozilla_suppress_scripts(e) { |
|
47 |
if (document.readyState === 'complete') { |
|
48 |
removeEventListener('beforescriptexecute', blockExecute, true); |
|
49 |
console.log('Script suppressor has detached.'); |
|
50 |
return; |
|
51 |
} |
|
52 |
else if (e.isTrusted) { // Prevent blocking of injected scripts |
|
53 |
e.preventDefault(); |
|
54 |
console.log('Suppressed script', e.target); |
|
55 |
} |
|
58 | 56 |
}; |
59 | 57 |
|
60 | 58 |
/* |
61 | 59 |
* EXPORTS_START |
62 |
* EXPORT script_suppressor
|
|
60 |
* EXPORT mozilla_suppress_scripts
|
|
63 | 61 |
* EXPORT sanitize_attributes |
64 | 62 |
* EXPORTS_END |
65 | 63 |
*/ |
Also available in: Unified diff
Remove redundant nonce-based filtering in the script suppressor