diff options
author | hackademix | 2018-07-16 17:24:54 +0200 |
---|---|---|
committer | hackademix | 2018-07-16 17:24:54 +0200 |
commit | 37928bd2c3fad723595bbe3dbdcac4970ba91927 (patch) | |
tree | 8013f32f3eddd80edaab692f0d7f1fd4cb34e491 /src/content | |
parent | 909e96012c90c1f880593c2f5ccba4bc65b914fb (diff) | |
download | noscript-37928bd2c3fad723595bbe3dbdcac4970ba91927.tar.gz noscript-37928bd2c3fad723595bbe3dbdcac4970ba91927.tar.xz noscript-37928bd2c3fad723595bbe3dbdcac4970ba91927.zip |
Completed fix for quoted URLs confusing meta refresh emulation.
Diffstat (limited to 'src/content')
-rw-r--r-- | src/content/onScriptDisabled.js | 6 |
1 files changed, 4 insertions, 2 deletions
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); } } } |