mirror of https://github.com/gorhill/uBlock.git
Handle invalid meta refresh URLs in noscript scriptlet
Invalid URLs like "http://" and "http://foo@" trigger TypeErrors when they are passed to the URL constructor. These TypeErrors caused the scriptlet to stop processing subsequent noscript nodes due to uncaught exceptions. These exceptions are now caught to allow all noscript nodes to be processed.
This commit is contained in:
parent
bb20159495
commit
2b9aba2748
|
@ -42,7 +42,14 @@
|
|||
if ( meta === null ) { return; }
|
||||
let match = reMetaContent.exec(meta.getAttribute('content'));
|
||||
if ( match === null || match[3].trim() === '' ) { return; }
|
||||
let url = new URL(match[3], document.baseURI);
|
||||
|
||||
let url;
|
||||
try {
|
||||
url = new URL(match[3], document.baseURI);
|
||||
} catch(ex) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( reSafeURL.test(url.href) === false ) { return; }
|
||||
redirectTimer = setTimeout(( ) => {
|
||||
location.assign(url.href);
|
||||
|
|
Loading…
Reference in New Issue