mirror of
https://github.com/gorhill/uBlock.git
synced 2026-03-11 09:04:36 +00:00
[mv3] Improve output og log.txt
This commit is contained in:
parent
1d2378e74e
commit
6ca28a5b3f
2 changed files with 8 additions and 5 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue