mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-05 18:32:30 +01:00
This commit is contained in:
parent
22454df64c
commit
211048396f
@ -107,10 +107,6 @@ var onMessage = function(request, sender, callback) {
|
||||
|
||||
case 'cosmeticFiltersInjected':
|
||||
µb.cosmeticFilteringEngine.addToSelectorCache(request);
|
||||
// Net-based cosmetic filters are of no interest for logging purpose.
|
||||
if ( µb.logger.isEnabled() && request.type !== 'net' ) {
|
||||
µb.logCosmeticFilters(tabId);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'createUserFilter':
|
||||
@ -523,8 +519,8 @@ var onMessage = function(request, sender, callback) {
|
||||
if ( µb.canInjectScriptletsNow === false ) {
|
||||
response.scriptlets = µb.scriptletFilteringEngine.retrieve(request);
|
||||
}
|
||||
if ( request.isRootFrame && µb.logger.isEnabled() ) {
|
||||
µb.logCosmeticFilters(tabId);
|
||||
if ( response.noCosmeticFiltering !== true ) {
|
||||
µb.logCosmeticFilters(tabId, frameId);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -506,24 +506,14 @@ var matchBucket = function(url, hostname, bucket, start) {
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
µBlock.logCosmeticFilters = (function() {
|
||||
var tabIdToTimerMap = new Map();
|
||||
|
||||
var injectNow = function(tabId) {
|
||||
tabIdToTimerMap.delete(tabId);
|
||||
µBlock.scriptlets.injectDeep(tabId, 'cosmetic-logger');
|
||||
};
|
||||
|
||||
var injectAsync = function(tabId) {
|
||||
if ( tabIdToTimerMap.has(tabId) ) { return; }
|
||||
tabIdToTimerMap.set(
|
||||
tabId,
|
||||
vAPI.setTimeout(injectNow.bind(null, tabId), 100)
|
||||
);
|
||||
};
|
||||
|
||||
return injectAsync;
|
||||
})();
|
||||
µBlock.logCosmeticFilters = function(tabId, frameId) {
|
||||
if ( this.logger.isEnabled() ) {
|
||||
vAPI.tabs.injectScript(tabId, {
|
||||
file: '/js/scriptlets/cosmetic-logger.js',
|
||||
frameId: frameId
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user