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 logLevel = shouldLog({ log: rawPrunePaths === '' || extraArgs.log, });
|
||||||
const log = logLevel ? ((...args) => { safe.uboLog(...args); }) : (( ) => { });
|
const log = logLevel ? ((...args) => { safe.uboLog(...args); }) : (( ) => { });
|
||||||
const propNeedles = parsePropertiesToMatch(extraArgs.propsToMatch, 'url');
|
const propNeedles = parsePropertiesToMatch(extraArgs.propsToMatch, 'url');
|
||||||
|
const stackNeedle = safe.initPattern(extraArgs.stackToMatch || '', { canNegate: true });
|
||||||
const applyHandler = function(target, thisArg, args) {
|
const applyHandler = function(target, thisArg, args) {
|
||||||
const fetchPromise = Reflect.apply(target, thisArg, args);
|
const fetchPromise = Reflect.apply(target, thisArg, args);
|
||||||
if ( logLevel === true ) {
|
if ( logLevel === true ) {
|
||||||
|
@ -1289,7 +1290,7 @@ function jsonPruneFetchResponse(
|
||||||
objBefore,
|
objBefore,
|
||||||
rawPrunePaths,
|
rawPrunePaths,
|
||||||
rawNeedlePaths,
|
rawNeedlePaths,
|
||||||
{ matchAll: true },
|
stackNeedle,
|
||||||
extraArgs
|
extraArgs
|
||||||
);
|
);
|
||||||
if ( typeof objAfter !== 'object' ) { return responseBefore; }
|
if ( typeof objAfter !== 'object' ) { return responseBefore; }
|
||||||
|
@ -1342,6 +1343,7 @@ function jsonPruneXhrResponse(
|
||||||
const logLevel = shouldLog({ log: rawPrunePaths === '' || extraArgs.log, });
|
const logLevel = shouldLog({ log: rawPrunePaths === '' || extraArgs.log, });
|
||||||
const log = logLevel ? ((...args) => { safe.uboLog(...args); }) : (( ) => { });
|
const log = logLevel ? ((...args) => { safe.uboLog(...args); }) : (( ) => { });
|
||||||
const propNeedles = parsePropertiesToMatch(extraArgs.propsToMatch, 'url');
|
const propNeedles = parsePropertiesToMatch(extraArgs.propsToMatch, 'url');
|
||||||
|
const stackNeedle = safe.initPattern(extraArgs.stackToMatch || '', { canNegate: true });
|
||||||
self.XMLHttpRequest = class extends self.XMLHttpRequest {
|
self.XMLHttpRequest = class extends self.XMLHttpRequest {
|
||||||
open(method, url, ...args) {
|
open(method, url, ...args) {
|
||||||
const xhrDetails = { method, url };
|
const xhrDetails = { method, url };
|
||||||
|
@ -1389,7 +1391,7 @@ function jsonPruneXhrResponse(
|
||||||
objBefore,
|
objBefore,
|
||||||
rawPrunePaths,
|
rawPrunePaths,
|
||||||
rawNeedlePaths,
|
rawNeedlePaths,
|
||||||
{ matchAll: true },
|
stackNeedle,
|
||||||
extraArgs
|
extraArgs
|
||||||
);
|
);
|
||||||
let outerResponse;
|
let outerResponse;
|
||||||
|
|
Loading…
Reference in New Issue