diff options
author | hackademix | 2020-03-18 22:51:07 +0100 |
---|---|---|
committer | hackademix | 2020-03-18 22:51:07 +0100 |
commit | 5aff2e1d83cbe6bbaf6ae6db0fed41adc456286d (patch) | |
tree | d5c3242b8d7b11e365ec5f3fe033632f2a71a445 /src/content/content.js | |
parent | 9b3a12f9a3a7a12420b759475b1983f6d387a195 (diff) | |
download | noscript-5aff2e1d83cbe6bbaf6ae6db0fed41adc456286d.tar.gz noscript-5aff2e1d83cbe6bbaf6ae6db0fed41adc456286d.tar.xz noscript-5aff2e1d83cbe6bbaf6ae6db0fed41adc456286d.zip |
Prevent ANY redirection to data: URIs in documents.
Diffstat (limited to 'src/content/content.js')
-rw-r--r-- | src/content/content.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/content/content.js b/src/content/content.js index 3862a58..43827a2 100644 --- a/src/content/content.js +++ b/src/content/content.js @@ -114,3 +114,14 @@ ns.on("capabilities", () => { ns.fetchPolicy(); notifyPage(); + +addEventListener("DOMContentLoaded", e => { + if (ns.canScript) return; + for (let m of document.querySelectorAll("meta[http-equiv=refresh]")) { + if (/^[^,;]*[,;]url[^\w=]*=\s*data:/.test(m.getAttribute("content"))) { + let url = m.getAttribute("content").replace(/.*?(?=data:)/, ""); + log(`Blocking refresh to ${url}`); + window.stop(); + } + } +}); |