diff options
-rw-r--r-- | content/freezer.js | 24 | ||||
-rw-r--r-- | content/main.js | 6 |
2 files changed, 13 insertions, 17 deletions
diff --git a/content/freezer.js b/content/freezer.js index 1696f53..8e543a6 100644 --- a/content/freezer.js +++ b/content/freezer.js @@ -43,23 +43,21 @@ function sanitize_attributes(element) { element._frozen = true; } -function script_suppressor(nonce) { - const blockExecute = e => { - if (document.readyState === 'complete') { - removeEventListener('beforescriptexecute', blockExecute, true); - return; - } - else if (e.isTrusted && e.target.getAttribute('nonce') !== nonce) { // Prevent blocking of injected scripts - e.preventDefault(); - console.log('Suppressed script', e.target); - } - }; - return blockExecute; +function mozilla_suppress_scripts(e) { + if (document.readyState === 'complete') { + removeEventListener('beforescriptexecute', blockExecute, true); + console.log('Script suppressor has detached.'); + return; + } + else if (e.isTrusted) { // Prevent blocking of injected scripts + e.preventDefault(); + console.log('Suppressed script', e.target); + } }; /* * EXPORTS_START - * EXPORT script_suppressor + * EXPORT mozilla_suppress_scripts * EXPORT sanitize_attributes * EXPORTS_END */ diff --git a/content/main.js b/content/main.js index 5d88a6d..9acf749 100644 --- a/content/main.js +++ b/content/main.js @@ -14,7 +14,7 @@ * IMPORT csp_rule * IMPORT is_privileged_url * IMPORT sanitize_attributes - * IMPORT script_suppressor + * IMPORT mozilla_suppress_scripts * IMPORT is_chrome * IMPORT is_mozilla * IMPORT start_activity_info_server @@ -35,8 +35,6 @@ let url = url_item(document.URL); let unique = gen_unique(url); -const suppressor = script_suppressor(unique); - function is_http() { @@ -144,6 +142,6 @@ if (!is_privileged_url(document.URL)) { } if (is_mozilla) - addEventListener('beforescriptexecute', suppressor, true); + addEventListener('beforescriptexecute', mozilla_suppress_scripts, true); } } |