From 37928bd2c3fad723595bbe3dbdcac4970ba91927 Mon Sep 17 00:00:00 2001 From: hackademix Date: Mon, 16 Jul 2018 17:24:54 +0200 Subject: Completed fix for quoted URLs confusing meta refresh emulation. --- src/content/onScriptDisabled.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/content/onScriptDisabled.js b/src/content/onScriptDisabled.js index a36707a..3841f94 100644 --- a/src/content/onScriptDisabled.js +++ b/src/content/onScriptDisabled.js @@ -10,15 +10,17 @@ function onScriptDisabled() { let content = meta.getAttribute("content"); if (content) { let [secs, url] = content.split(/\s*;\s*url\s*=\s*/i); + let urlObj; if (url) { try { - let urlObj = new URL(url.replace(/^(['"]?)(.+?)\1$/, '$2')); + urlObj = new URL(url.replace(/^(['"]?)(.+?)\1$/, '$2')); if (!/^https?:/.test(urlObj.protocol)) { continue; } } catch (e) { + continue; } - window.setTimeout(() => location.href = url, (parseInt(secs) || 0) * 1000); + window.setTimeout(() => location.href = urlObj, (parseInt(secs) || 0) * 1000); } } } -- cgit v1.2.3