mirror of https://github.com/gorhill/uBlock.git
Log all by default when needle is empty in `aost` scriptlet
As discussed with filter list maintainers.
This commit is contained in:
parent
42f31b9d16
commit
fddca0b7cb
|
@ -87,7 +87,6 @@ function safeSelf() {
|
|||
const match = /^\/(.+)\/([gimsu]*)$/.exec(pattern);
|
||||
if ( match !== null ) {
|
||||
return {
|
||||
pattern,
|
||||
re: new this.RegExp(
|
||||
match[1],
|
||||
match[2] || options.flags
|
||||
|
@ -95,18 +94,23 @@ function safeSelf() {
|
|||
expect,
|
||||
};
|
||||
}
|
||||
if ( options.flags !== undefined ) {
|
||||
return {
|
||||
pattern,
|
||||
re: new this.RegExp(pattern.replace(
|
||||
/[.*+?^${}()|[\]\\]/g, '\\$&'),
|
||||
options.flags
|
||||
),
|
||||
expect,
|
||||
};
|
||||
}
|
||||
return { pattern, expect };
|
||||
},
|
||||
testPattern(details, haystack) {
|
||||
if ( details.matchAll ) { return true; }
|
||||
if ( details.re ) {
|
||||
return this.RegExp_test.call(details.re, haystack) === details.expect;
|
||||
}
|
||||
return haystack.includes(details.pattern) === details.expect;
|
||||
},
|
||||
patternToRegex(pattern, flags = undefined, verbatim = false) {
|
||||
if ( pattern === '' ) { return /^/; }
|
||||
|
@ -958,7 +962,7 @@ builtinScriptlets.push({
|
|||
});
|
||||
function matchesStackTrace(
|
||||
needleDetails,
|
||||
logLevel = 0
|
||||
logLevel = ''
|
||||
) {
|
||||
const safe = safeSelf();
|
||||
const exceptionToken = getExceptionToken();
|
||||
|
@ -989,11 +993,12 @@ function matchesStackTrace(
|
|||
}
|
||||
lines[0] = `stackDepth:${lines.length-1}`;
|
||||
const stack = lines.join('\t');
|
||||
const r = safe.testPattern(needleDetails, stack);
|
||||
const r = needleDetails.matchAll !== true &&
|
||||
safe.testPattern(needleDetails, stack);
|
||||
if (
|
||||
logLevel === 1 ||
|
||||
logLevel === 2 && r ||
|
||||
logLevel === 3 && !r
|
||||
logLevel === 'all' ||
|
||||
logLevel === 'match' && r ||
|
||||
logLevel === 'nomatch' && !r
|
||||
) {
|
||||
safe.uboLog(stack.replace(/\t/g, '\n'));
|
||||
}
|
||||
|
@ -1391,6 +1396,7 @@ function abortOnStackTrace(
|
|||
const safe = safeSelf();
|
||||
const needleDetails = safe.initPattern(needle, { canNegate: true });
|
||||
const extraArgs = safe.getExtraArgs(Array.from(arguments), 2);
|
||||
if ( needle === '' ) { extraArgs.log = 'all'; }
|
||||
const makeProxy = function(owner, chain) {
|
||||
const pos = chain.indexOf('.');
|
||||
if ( pos === -1 ) {
|
||||
|
|
Loading…
Reference in New Issue