1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-09-03 17:49:39 +02:00

cosmetic filtering switch must disable ONLY cosmetic filtering.

Before this fix, the turning off cosmetic filtering through the per-site
cosmetic filtering switch was also disabling the blocked resources
collapser.
This commit is contained in:
gorhill 2015-12-13 00:33:53 -05:00
parent 47f6a565fa
commit 9c12ef02bb
3 changed files with 10 additions and 8 deletions

View File

@ -134,9 +134,11 @@ var netFilters = function(details) {
var filteringHandler = function(details) {
var styleTagCount = vAPI.styles.length;
vAPI.skipCosmeticFiltering = !details || details.skipCosmeticFiltering;
if ( details ) {
if ( details.cosmeticHide.length !== 0 || details.cosmeticDonthide.length !== 0 ) {
if (
(vAPI.skipCosmeticFiltering = details.skipCosmeticFiltering) !== true &&
(details.cosmeticHide.length !== 0 || details.cosmeticDonthide.length !== 0)
) {
cosmeticFilters(details);
}
if ( details.netHide.length !== 0 ) {

View File

@ -295,7 +295,8 @@ var popupDataFromTabId = function(tabId, tabTitle) {
pageAllowedRequestCount: 0,
pageBlockedRequestCount: 0,
tabId: tabId,
tabTitle: tabTitle
tabTitle: tabTitle,
tooltipsDisabled: µb.userSettings.tooltipsDisabled
};
var pageStore = µb.pageStoreFromTabId(tabId);
@ -469,8 +470,11 @@ var onMessage = function(request, sender, callback) {
switch ( request.what ) {
case 'retrieveDomainCosmeticSelectors':
if ( pageStore && pageStore.getSpecificCosmeticFilteringSwitch() ) {
if ( pageStore && pageStore.getNetFilteringSwitch() ) {
response = µb.cosmeticFilteringEngine.retrieveDomainSelectors(request);
if ( response && response.skipCosmeticFiltering !== true ) {
response.skipCosmeticFiltering = !pageStore.getSpecificCosmeticFilteringSwitch();
}
}
break;

View File

@ -447,10 +447,6 @@ PageStore.prototype.getNetFilteringSwitch = function() {
/******************************************************************************/
PageStore.prototype.getSpecificCosmeticFilteringSwitch = function() {
if ( this.getNetFilteringSwitch() === false ) {
return false;
}
var tabContext = µb.tabContextManager.mustLookup(this.tabId);
if ( µb.hnSwitches.evaluateZ('no-cosmetic-filtering', tabContext.rootHostname) ) {