Improve urlskip implementation

Support multiple instances of regex-based steps.

Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/3914
This commit is contained in:
Raymond Hill 2026-01-10 12:36:47 -05:00
parent 74b838cc03
commit 41ced43f03
No known key found for this signature in database
GPG key ID: F5630CAE62A14316

View file

@ -72,7 +72,7 @@
*
* */
export function urlSkip(url, blocked, steps, directive = {}) {
export function urlSkip(url, blocked, steps) {
try {
let redirectBlocked = false;
let urlout = url;
@ -132,10 +132,7 @@ export function urlSkip(url, blocked, steps, directive = {}) {
}
// Regex extraction from first capture group
if ( c0 === 0x2F ) { // /
const re = directive.cache ?? new RegExp(step.slice(1, -1));
if ( directive.cache === null ) {
directive.cache = re;
}
const re = new RegExp(step.slice(1, -1));
const match = re.exec(urlin);
if ( match === null ) { return; }
if ( match.length <= 1 ) { return; }