1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-11-20 01:12:38 +01:00

Make fine-tuned json-prune-[...] scriptlets the default behavior

As discussed with filter list maintainers.
This commit is contained in:
Raymond Hill 2023-10-16 19:36:16 -04:00
parent 05ae51beb2
commit 5a24fad8ad
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2

View File

@ -982,12 +982,9 @@ function jsonPruneFetchResponseFn(
let outcome = 'match';
if ( propNeedles.size !== 0 ) {
const objs = [ args[0] instanceof Object ? args[0] : { url: args[0] } ];
if ( extraArgs.version === 2 && objs[0] instanceof Request ) {
try {
objs[0] = safe.Request_clone.call(objs[0]);
} catch(ex) {
safe.uboLog(ex);
}
if ( objs[0] instanceof Request ) {
try { objs[0] = safe.Request_clone.call(objs[0]); }
catch(ex) { log(ex); }
}
if ( args[1] instanceof Object ) {
objs.push(args[1]);
@ -1080,8 +1077,9 @@ function replaceFetchResponseFn(
let outcome = 'match';
if ( propNeedles.size !== 0 ) {
const objs = [ args[0] instanceof Object ? args[0] : { url: args[0] } ];
if ( extraArgs.version === 2 && objs[0] instanceof Request ) {
try { objs[0] = safe.Request_clone.call(objs[0]); } catch(ex) {}
if ( objs[0] instanceof Request ) {
try { objs[0] = safe.Request_clone.call(objs[0]); }
catch(ex) { log(ex); }
}
if ( args[1] instanceof Object ) {
objs.push(args[1]);