mirror of
https://github.com/gorhill/uBlock.git
synced 2024-09-02 17:19:38 +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');
|
const noscripts = document.querySelectorAll('noscript');
|
||||||
if ( noscripts.length === 0 ) { return; }
|
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?:\/\//;
|
const reSafeURL = /^https?:\/\//;
|
||||||
let redirectTimer;
|
let redirectTimer;
|
||||||
|
|
||||||
@ -41,15 +41,14 @@
|
|||||||
const meta = root.querySelector('meta[http-equiv="refresh"][content]');
|
const meta = root.querySelector('meta[http-equiv="refresh"][content]');
|
||||||
if ( meta === null ) { return; }
|
if ( meta === null ) { return; }
|
||||||
const match = reMetaContent.exec(meta.getAttribute('content'));
|
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;
|
let url;
|
||||||
try {
|
try {
|
||||||
url = new URL(match[3], document.baseURI);
|
url = new URL(refreshURL, document.baseURI);
|
||||||
} catch(ex) {
|
} catch(ex) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( reSafeURL.test(url.href) === false ) { return; }
|
if ( reSafeURL.test(url.href) === false ) { return; }
|
||||||
redirectTimer = setTimeout(( ) => {
|
redirectTimer = setTimeout(( ) => {
|
||||||
location.assign(url.href);
|
location.assign(url.href);
|
||||||
|
Loading…
Reference in New Issue
Block a user