Skip to content
This repository has been archived by the owner on Jul 21, 2021. It is now read-only.

Commit

Permalink
finally complete fix for #319
Browse files Browse the repository at this point in the history
  • Loading branch information
gorhill committed Dec 8, 2017
1 parent 038b047 commit b712754
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/js/contentscript.js
Original file line number Diff line number Diff line change
Expand Up @@ -474,16 +474,19 @@ var nodeListsAddedHandler = function(nodeLists) {
if ( noscripts.length === 0 ) { return; }

var redirectTimer,
reMetaContent = /^\s*(\d+)\s*;\s*url=(['"]?)(https?:\/\/[^'"]+)\2/;
reMetaContent = /^\s*(\d+)\s*;\s*url=(['"]?)([^'"]+)\2/,
reSafeURL = /^https?:\/\//;

var autoRefresh = function(root) {
var meta = root.querySelector('meta[http-equiv="refresh"][content]');
if ( meta === null ) { return; }
var match = reMetaContent.exec(meta.getAttribute('content'));
if ( match === null || match[3].trim() === '' ) { return; }
var url = new URL(match[3], document.baseURI);
if ( reSafeURL.test(url.href) === false ) { return; }
redirectTimer = setTimeout(
function() {
location.assign(match[3]);
location.assign(url.href);
},
parseInt(match[1], 10) * 1000 + 1
);
Expand Down

0 comments on commit b712754

Please sign in to comment.