From 5aff2e1d83cbe6bbaf6ae6db0fed41adc456286d Mon Sep 17 00:00:00 2001 From: hackademix Date: Wed, 18 Mar 2020 22:51:07 +0100 Subject: Prevent ANY redirection to data: URIs in documents. --- src/content/content.js | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/content') 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(); + } + } +}); -- cgit v1.2.3