finally complete fix for #319

pull/2/head
gorhill 7 years ago
parent 038b047116
commit b7127541a3
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2

@ -474,16 +474,19 @@ var nodeListsAddedHandler = function(nodeLists) {
if ( noscripts.length === 0 ) { return; } if ( noscripts.length === 0 ) { return; }
var redirectTimer, var redirectTimer,
reMetaContent = /^\s*(\d+)\s*;\s*url=(['"]?)(https?:\/\/[^'"]+)\2/; reMetaContent = /^\s*(\d+)\s*;\s*url=(['"]?)([^'"]+)\2/,
reSafeURL = /^https?:\/\//;
var autoRefresh = function(root) { var autoRefresh = function(root) {
var meta = root.querySelector('meta[http-equiv="refresh"][content]'); var meta = root.querySelector('meta[http-equiv="refresh"][content]');
if ( meta === null ) { return; } if ( meta === null ) { return; }
var match = reMetaContent.exec(meta.getAttribute('content')); var match = reMetaContent.exec(meta.getAttribute('content'));
if ( match === null || match[3].trim() === '' ) { return; } if ( match === null || match[3].trim() === '' ) { return; }
var url = new URL(match[3], document.baseURI);
if ( reSafeURL.test(url.href) === false ) { return; }
redirectTimer = setTimeout( redirectTimer = setTimeout(
function() { function() {
location.assign(match[3]); location.assign(url.href);
}, },
parseInt(match[1], 10) * 1000 + 1 parseInt(match[1], 10) * 1000 + 1
); );

Loading…
Cancel
Save