mirror of https://github.com/gorhill/uBlock.git
parent
09666fd6d2
commit
647431d9f1
|
@ -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();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue