From 5a24fad8ad8997a40ca2cf3da1bfceb66b326ddb Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Mon, 16 Oct 2023 19:36:16 -0400 Subject: [PATCH] Make fine-tuned `json-prune-[...]` scriptlets the default behavior As discussed with filter list maintainers. --- assets/resources/scriptlets.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/assets/resources/scriptlets.js b/assets/resources/scriptlets.js index 57e8811eb..35d5ac988 100644 --- a/assets/resources/scriptlets.js +++ b/assets/resources/scriptlets.js @@ -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]);