mirror of https://github.com/gorhill/uBlock.git
Add `stackToMatch` vararg to json-prune-related scriptlets
As per discussion with filter list maintainers.
This commit is contained in:
parent
7416340144
commit
6b211f622c
|
@ -1257,6 +1257,7 @@ function jsonPruneFetchResponse(
|
|||
const logLevel = shouldLog({ log: rawPrunePaths === '' || extraArgs.log, });
|
||||
const log = logLevel ? ((...args) => { safe.uboLog(...args); }) : (( ) => { });
|
||||
const propNeedles = parsePropertiesToMatch(extraArgs.propsToMatch, 'url');
|
||||
const stackNeedle = safe.initPattern(extraArgs.stackToMatch || '', { canNegate: true });
|
||||
const applyHandler = function(target, thisArg, args) {
|
||||
const fetchPromise = Reflect.apply(target, thisArg, args);
|
||||
if ( logLevel === true ) {
|
||||
|
@ -1289,7 +1290,7 @@ function jsonPruneFetchResponse(
|
|||
objBefore,
|
||||
rawPrunePaths,
|
||||
rawNeedlePaths,
|
||||
{ matchAll: true },
|
||||
stackNeedle,
|
||||
extraArgs
|
||||
);
|
||||
if ( typeof objAfter !== 'object' ) { return responseBefore; }
|
||||
|
@ -1342,6 +1343,7 @@ function jsonPruneXhrResponse(
|
|||
const logLevel = shouldLog({ log: rawPrunePaths === '' || extraArgs.log, });
|
||||
const log = logLevel ? ((...args) => { safe.uboLog(...args); }) : (( ) => { });
|
||||
const propNeedles = parsePropertiesToMatch(extraArgs.propsToMatch, 'url');
|
||||
const stackNeedle = safe.initPattern(extraArgs.stackToMatch || '', { canNegate: true });
|
||||
self.XMLHttpRequest = class extends self.XMLHttpRequest {
|
||||
open(method, url, ...args) {
|
||||
const xhrDetails = { method, url };
|
||||
|
@ -1389,7 +1391,7 @@ function jsonPruneXhrResponse(
|
|||
objBefore,
|
||||
rawPrunePaths,
|
||||
rawNeedlePaths,
|
||||
{ matchAll: true },
|
||||
stackNeedle,
|
||||
extraArgs
|
||||
);
|
||||
let outerResponse;
|
||||
|
|
Loading…
Reference in New Issue