diff --git a/platform/mv3/make-rulesets.js b/platform/mv3/make-rulesets.js index 9279ea6fe..9c62718ee 100644 --- a/platform/mv3/make-rulesets.js +++ b/platform/mv3/make-rulesets.js @@ -91,15 +91,18 @@ const uidint32 = (s) => { /******************************************************************************/ +const consoleLog = console.log; const stdOutput = []; const log = (text, silent = true) => { stdOutput.push(text); if ( silent === false ) { - console.log(text); + consoleLog(text); } }; +console.log = log; + /******************************************************************************/ const urlToFileName = url => { @@ -1126,7 +1129,7 @@ async function processScriptletFilters(assetDetails, mapin) { makeScriptlet.init(); for ( const details of mapin.values() ) { - makeScriptlet.compile(details); + makeScriptlet.compile(assetDetails, details); } const stats = await makeScriptlet.commit( assetDetails.id, diff --git a/platform/mv3/make-scriptlets.js b/platform/mv3/make-scriptlets.js index 27dc5d247..8cc651ff2 100644 --- a/platform/mv3/make-scriptlets.js +++ b/platform/mv3/make-scriptlets.js @@ -75,7 +75,7 @@ export function reset() { /******************************************************************************/ -export function compile(details) { +export function compile(assetDetails, details) { if ( details.args[0].endsWith('.js') === false ) { details.args[0] += '.js'; } @@ -85,8 +85,9 @@ export function compile(details) { const scriptletToken = details.args[0]; const resourceEntry = resourceDetails.get(scriptletToken); if ( resourceEntry === undefined ) { return; } + const argsToken = JSON.stringify(details.args.slice(1)); if ( resourceEntry.requiresTrust && details.trustedSource !== true ) { - console.log(`Rejecting ${scriptletToken}: source is not trusted`); + console.log(`Rejecting +js(${scriptletToken},${argsToken.slice(1,-1)}): ${assetDetails.id} is not trusted`); return; } if ( scriptletFiles.has(scriptletToken) === false ) { @@ -102,7 +103,6 @@ export function compile(details) { }); } const scriptletDetails = scriptletFiles.get(scriptletToken); - const argsToken = JSON.stringify(details.args.slice(1)); if ( scriptletDetails.args.has(argsToken) === false ) { scriptletDetails.args.set(argsToken, scriptletDetails.args.size); }