Raymond Hill 2018-07-04 15:03:09 -04:00
parent 22454df64c
commit 211048396f
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
2 changed files with 10 additions and 24 deletions

View File

@ -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;

View File

@ -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() {