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':
|
||||
µ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,25 +506,15 @@ 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');
|
||||
µBlock.logCosmeticFilters = function(tabId, frameId) {
|
||||
if ( this.logger.isEnabled() ) {
|
||||
vAPI.tabs.injectScript(tabId, {
|
||||
file: '/js/scriptlets/cosmetic-logger.js',
|
||||
frameId: frameId
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
var injectAsync = function(tabId) {
|
||||
if ( tabIdToTimerMap.has(tabId) ) { return; }
|
||||
tabIdToTimerMap.set(
|
||||
tabId,
|
||||
vAPI.setTimeout(injectNow.bind(null, tabId), 100)
|
||||
);
|
||||
};
|
||||
|
||||
return injectAsync;
|
||||
})();
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
µBlock.scriptlets = (function() {
|
||||
|
|
Loading…
Reference in New Issue