mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-01 16:33:06 +01:00
this fixes under-reporting of active cosmetic filters in logger
This commit is contained in:
parent
057611ba25
commit
0ce32af7af
@ -370,7 +370,7 @@ var uBlockCollapser = (function() {
|
||||
processHighHighGenericsAsync();
|
||||
}
|
||||
}
|
||||
if ( hideSelectors.length ) {
|
||||
if ( hideSelectors.length !== 0 ) {
|
||||
addStyleTag(hideSelectors);
|
||||
}
|
||||
contextNodes.length = 0;
|
||||
@ -687,6 +687,12 @@ var uBlockCollapser = (function() {
|
||||
idsFromNodeList(selectNodes('[id]'));
|
||||
classesFromNodeList(selectNodes('[class]'));
|
||||
retrieveGenericSelectors();
|
||||
|
||||
// This is required: a new element could be matching an already
|
||||
// injected but otherwise inactive cosmetic filter. This means
|
||||
// the already injected cosmetic filter become active (has an
|
||||
// effect on the document), and thus must be logged if needed.
|
||||
messager.send({ what: 'cosmeticFiltersActivated' });
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -140,7 +140,7 @@ var filteringHandler = function(details) {
|
||||
// This is just to inform the background process that cosmetic filters were
|
||||
// actually injected.
|
||||
if ( vAPI.styles.length !== styleTagCount ) {
|
||||
localMessager.send({ what: 'cosmeticFiltersInjected' });
|
||||
localMessager.send({ what: 'cosmeticFiltersActivated' });
|
||||
}
|
||||
|
||||
// https://github.com/chrisaljoudi/uBlock/issues/587
|
||||
|
@ -68,10 +68,10 @@ while ( i-- ) {
|
||||
if ( loggedSelectors.hasOwnProperty(selector) ) {
|
||||
continue;
|
||||
}
|
||||
loggedSelectors[selector] = true;
|
||||
if ( document.querySelector(selector) === null ) {
|
||||
continue;
|
||||
}
|
||||
loggedSelectors[selector] = true;
|
||||
matchedSelectors.push(selector);
|
||||
}
|
||||
|
||||
|
@ -62,10 +62,9 @@ var onMessage = function(request, sender, callback) {
|
||||
break;
|
||||
|
||||
case 'cosmeticFiltersInjected':
|
||||
// Is this a request to cache selectors?
|
||||
if ( Array.isArray(request.selectors) ) {
|
||||
µb.cosmeticFilteringEngine.addToSelectorCache(request);
|
||||
}
|
||||
µb.cosmeticFilteringEngine.addToSelectorCache(request);
|
||||
/* falls through */
|
||||
case 'cosmeticFiltersActivated':
|
||||
// Net-based cosmetic filters are of no interest for logging purpose.
|
||||
if ( µb.logger.isObserved(tabId) && request.type !== 'net' ) {
|
||||
µb.logCosmeticFilters(tabId);
|
||||
|
Loading…
Reference in New Issue
Block a user