mirror of https://github.com/gorhill/uBlock.git
This commit is contained in:
parent
22454df64c
commit
211048396f
|
@ -107,10 +107,6 @@ var onMessage = function(request, sender, callback) {
|
||||||
|
|
||||||
case 'cosmeticFiltersInjected':
|
case 'cosmeticFiltersInjected':
|
||||||
µb.cosmeticFilteringEngine.addToSelectorCache(request);
|
µ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;
|
break;
|
||||||
|
|
||||||
case 'createUserFilter':
|
case 'createUserFilter':
|
||||||
|
@ -523,8 +519,8 @@ var onMessage = function(request, sender, callback) {
|
||||||
if ( µb.canInjectScriptletsNow === false ) {
|
if ( µb.canInjectScriptletsNow === false ) {
|
||||||
response.scriptlets = µb.scriptletFilteringEngine.retrieve(request);
|
response.scriptlets = µb.scriptletFilteringEngine.retrieve(request);
|
||||||
}
|
}
|
||||||
if ( request.isRootFrame && µb.logger.isEnabled() ) {
|
if ( response.noCosmeticFiltering !== true ) {
|
||||||
µb.logCosmeticFilters(tabId);
|
µb.logCosmeticFilters(tabId, frameId);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -506,24 +506,14 @@ var matchBucket = function(url, hostname, bucket, start) {
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
µBlock.logCosmeticFilters = (function() {
|
µBlock.logCosmeticFilters = function(tabId, frameId) {
|
||||||
var tabIdToTimerMap = new Map();
|
if ( this.logger.isEnabled() ) {
|
||||||
|
vAPI.tabs.injectScript(tabId, {
|
||||||
var injectNow = function(tabId) {
|
file: '/js/scriptlets/cosmetic-logger.js',
|
||||||
tabIdToTimerMap.delete(tabId);
|
frameId: frameId
|
||||||
µ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;
|
|
||||||
})();
|
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue