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

Fix typo in new getScriptletArgs() method

Additionally, bring mv3 build up to date with latest changes
to scriptlet framework.
This commit is contained in:
Raymond Hill 2023-06-28 20:05:59 -04:00
parent fd036a51ee
commit de6b1d361d
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
4 changed files with 4 additions and 17 deletions

View File

@ -174,7 +174,7 @@ const fromExtendedFilter = async function(details) {
parser.parse(details.rawFilter); parser.parse(details.rawFilter);
let compiled; let compiled;
if ( parser.isScriptletFilter() ) { if ( parser.isScriptletFilter() ) {
compiled = JSON.stringify(parser.getScripletArgs()); compiled = JSON.stringify(parser.getScriptletArgs());
} }
worker.postMessage({ worker.postMessage({

View File

@ -158,7 +158,7 @@ const isolatedWorldInjector = (( ) => {
})(); })();
const normalizeRawFilter = function(parser, sourceIsTrusted = false) { const normalizeRawFilter = function(parser, sourceIsTrusted = false) {
const args = parser.getScripletArgs(); const args = parser.getScriptletArgs();
if ( args.length !== 0 ) { if ( args.length !== 0 ) {
let token = `${args[0]}.js`; let token = `${args[0]}.js`;
if ( reng.aliases.has(token) ) { if ( reng.aliases.has(token) ) {

View File

@ -101,20 +101,7 @@ function addExtendedToDNR(context, parser) {
context.scriptletFilters = new Map(); context.scriptletFilters = new Map();
} }
const exception = parser.isException(); const exception = parser.isException();
const root = parser.getBranchFromType(sfp.NODE_TYPE_EXT_PATTERN_SCRIPTLET); const args = parser.getScriptletArgs();
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 argsToken = JSON.stringify(args); const argsToken = JSON.stringify(args);
for ( const { hn, not, bad } of parser.getExtFilterDomainIterator() ) { for ( const { hn, not, bad } of parser.getExtFilterDomainIterator() ) {
if ( bad ) { continue; } if ( bad ) { continue; }

View File

@ -2374,7 +2374,7 @@ export class AstFilterParser {
return arg.replace(this.reUnescapeCommas, '$1,'); return arg.replace(this.reUnescapeCommas, '$1,');
} }
getScripletArgs() { getScriptletArgs() {
const args = []; const args = [];
if ( this.isScriptletFilter() === false ) { return args; } if ( this.isScriptletFilter() === false ) { return args; }
const root = this.getBranchFromType(NODE_TYPE_EXT_PATTERN_SCRIPTLET); const root = this.getBranchFromType(NODE_TYPE_EXT_PATTERN_SCRIPTLET);