Log excepted scriptlets unconditionally

Regression from:
- efe2e0c78a
This commit is contained in:
Raymond Hill 2022-04-15 11:06:29 -04:00
parent 09666fd6d2
commit 647431d9f1
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
1 changed files with 22 additions and 22 deletions

View File

@ -222,6 +222,18 @@ const patchScriptlet = function(content, args) {
return content; return content;
}; };
const logOne = function(tabId, url, filter) {
µb.filteringContext
.duplicate()
.fromTabId(tabId)
.setRealm('extended')
.setType('dom')
.setURL(url)
.setDocOriginFromURL(url)
.setFilter({ source: 'extended', raw: filter })
.toLogger();
};
scriptletFilteringEngine.reset = function() { scriptletFilteringEngine.reset = function() {
scriptletDB.clear(); scriptletDB.clear();
duplicates.clear(); duplicates.clear();
@ -332,15 +344,12 @@ scriptletFilteringEngine.retrieve = function(request, options = {}) {
return; return;
} }
const mustLog = Array.isArray(options.logEntries);
// Wholly disable scriptlet injection? // Wholly disable scriptlet injection?
if ( $exceptions.has('') ) { if ( $exceptions.has('') ) {
if ( Array.isArray(options.logEntries) ) { if ( mustLog ) {
options.logEntries.push({ logOne(request.tabId, request.url, '#@#+js()');
isException: true,
token: '',
tabId: request.tabId,
url: request.url,
});
} }
return; return;
} }
@ -358,10 +367,12 @@ scriptletFilteringEngine.retrieve = function(request, options = {}) {
if ( isException === false ) { if ( isException === false ) {
out.push(code); out.push(code);
} }
if ( Array.isArray(options.logEntries) ) { if ( mustLog === false ) { continue; }
if ( isException ) {
logOne(request.tabId, request.url, `#@#+js(${token})`);
} else {
options.logEntries.push({ options.logEntries.push({
isException, token: `##+js(${token})`,
token,
tabId: request.tabId, tabId: request.tabId,
url: request.url, url: request.url,
}); });
@ -424,18 +435,7 @@ scriptletFilteringEngine.injectNow = function(details) {
promise.then(results => { promise.then(results => {
if ( Array.isArray(results) === false || results[0] !== 0 ) { return; } if ( Array.isArray(results) === false || results[0] !== 0 ) { return; }
for ( const entry of logEntries ) { for ( const entry of logEntries ) {
µb.filteringContext logOne(entry.tabId, entry.url, entry.token);
.duplicate()
.fromTabId(entry.tabId)
.setRealm('extended')
.setType('dom')
.setURL(entry.url)
.setDocOriginFromURL(entry.url)
.setFilter({
source: 'extended',
raw: (entry.isException ? '#@#' : '##') + `+js(${entry.token})`
})
.toLogger();
} }
}); });
}; };