1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-07-05 11:37:01 +02:00

Skip regex-testing context when no context provided

Related issue:
- https://github.com/uBlockOrigin/uAssets/issues/18725

Testing the context was causing the deprecated static property
RegExp.$1 to be clobbered, causing webpage breakage because this
property was subsequently used used by the caller.
This commit is contained in:
Raymond Hill 2023-06-28 18:12:17 -04:00
parent 8b7a5264de
commit e0b3b44080
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2

View File

@ -295,7 +295,7 @@ function abortCurrentScriptCore(
const e = document.currentScript;
if ( e instanceof HTMLScriptElement === false ) { return; }
if ( e === thisScript ) { return; }
if ( reContext.test(e.src) === false ) { return; }
if ( context !== '' && reContext.test(e.src) === false ) { return; }
if ( log && e.src !== '' ) { safe.uboLog(`matched src: ${e.src}`); }
const scriptText = getScriptText(e);
if ( reNeedle.test(scriptText) === false ) { return; }