Skip to content

Commit

Permalink
Skip regex-testing context when no context provided
Browse files Browse the repository at this point in the history
Related issue:
- uBlockOrigin/uAssets#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.
  • Loading branch information
gorhill committed Jun 28, 2023
1 parent 8b7a526 commit e0b3b44
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion assets/resources/scriptlets.js
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down

0 comments on commit e0b3b44

Please sign in to comment.