mirror of
https://github.com/gorhill/uBlock.git
synced 2024-10-06 09:37:12 +02:00
Fix improper detection of quotes in quoted strings
Related issue: - https://github.com/uBlockOrigin/uBlock-issues/issues/2586
This commit is contained in:
parent
521c3dcd1d
commit
66c70cf746
@ -33,7 +33,7 @@
|
||||
const noscripts = document.querySelectorAll('noscript');
|
||||
if ( noscripts.length === 0 ) { return; }
|
||||
|
||||
const reMetaContent = /^\s*(\d+)\s*;\s*url=(['"]?)([^'"]+)\2/i;
|
||||
const reMetaContent = /^\s*(\d+)\s*;\s*url=(?:"([^"]+)"|'([^']+)'|(.+))/i;
|
||||
const reSafeURL = /^https?:\/\//;
|
||||
let redirectTimer;
|
||||
|
||||
@ -41,15 +41,14 @@
|
||||
const meta = root.querySelector('meta[http-equiv="refresh"][content]');
|
||||
if ( meta === null ) { return; }
|
||||
const match = reMetaContent.exec(meta.getAttribute('content'));
|
||||
if ( match === null || match[3].trim() === '' ) { return; }
|
||||
|
||||
if ( match === null ) { return; }
|
||||
const refreshURL = (match[2] || match[3] || match[4] || '').trim();
|
||||
let url;
|
||||
try {
|
||||
url = new URL(match[3], document.baseURI);
|
||||
url = new URL(refreshURL, document.baseURI);
|
||||
} catch(ex) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( reSafeURL.test(url.href) === false ) { return; }
|
||||
redirectTimer = setTimeout(( ) => {
|
||||
location.assign(url.href);
|
||||
|
Loading…
Reference in New Issue
Block a user