From de6b1d361de2ab9e93767e5ec948b8ed736befdb Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Wed, 28 Jun 2023 20:05:59 -0400 Subject: [PATCH] Fix typo in new getScriptletArgs() method Additionally, bring mv3 build up to date with latest changes to scriptlet framework. --- src/js/reverselookup.js | 2 +- src/js/scriptlet-filtering.js | 2 +- src/js/static-dnr-filtering.js | 15 +-------------- src/js/static-filtering-parser.js | 2 +- 4 files changed, 4 insertions(+), 17 deletions(-) diff --git a/src/js/reverselookup.js b/src/js/reverselookup.js index 2d40b5cc1..10616dc93 100644 --- a/src/js/reverselookup.js +++ b/src/js/reverselookup.js @@ -174,7 +174,7 @@ const fromExtendedFilter = async function(details) { parser.parse(details.rawFilter); let compiled; if ( parser.isScriptletFilter() ) { - compiled = JSON.stringify(parser.getScripletArgs()); + compiled = JSON.stringify(parser.getScriptletArgs()); } worker.postMessage({ diff --git a/src/js/scriptlet-filtering.js b/src/js/scriptlet-filtering.js index a16f4a560..951bedc64 100644 --- a/src/js/scriptlet-filtering.js +++ b/src/js/scriptlet-filtering.js @@ -158,7 +158,7 @@ const isolatedWorldInjector = (( ) => { })(); const normalizeRawFilter = function(parser, sourceIsTrusted = false) { - const args = parser.getScripletArgs(); + const args = parser.getScriptletArgs(); if ( args.length !== 0 ) { let token = `${args[0]}.js`; if ( reng.aliases.has(token) ) { diff --git a/src/js/static-dnr-filtering.js b/src/js/static-dnr-filtering.js index 2ccd2249f..99fa9241b 100644 --- a/src/js/static-dnr-filtering.js +++ b/src/js/static-dnr-filtering.js @@ -101,20 +101,7 @@ function addExtendedToDNR(context, parser) { context.scriptletFilters = new Map(); } const exception = parser.isException(); - const root = parser.getBranchFromType(sfp.NODE_TYPE_EXT_PATTERN_SCRIPTLET); - const walker = parser.getWalker(root); - const args = []; - for ( let node = walker.next(); node !== 0; node = walker.next() ) { - switch ( parser.getNodeType(node) ) { - case sfp.NODE_TYPE_EXT_PATTERN_SCRIPTLET_TOKEN: - case sfp.NODE_TYPE_EXT_PATTERN_SCRIPTLET_ARG: - args.push(parser.getNodeString(node)); - break; - default: - break; - } - } - walker.dispose(); + const args = parser.getScriptletArgs(); const argsToken = JSON.stringify(args); for ( const { hn, not, bad } of parser.getExtFilterDomainIterator() ) { if ( bad ) { continue; } diff --git a/src/js/static-filtering-parser.js b/src/js/static-filtering-parser.js index 7d3e0d529..cc70571b7 100644 --- a/src/js/static-filtering-parser.js +++ b/src/js/static-filtering-parser.js @@ -2374,7 +2374,7 @@ export class AstFilterParser { return arg.replace(this.reUnescapeCommas, '$1,'); } - getScripletArgs() { + getScriptletArgs() { const args = []; if ( this.isScriptletFilter() === false ) { return args; } const root = this.getBranchFromType(NODE_TYPE_EXT_PATTERN_SCRIPTLET);