From 1fe3b54acce700703584932b26beb7bad8f943b0 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Wed, 15 May 2019 14:43:59 -0400 Subject: [PATCH] Fix cosmetic exception filters not applying Related issue: - https://github.com/uBlockOrigin/uBlock-issues/issues/575 Regression from: - https://github.com/gorhill/uBlock/commit/93f80eedfa4ef5e127d2679378b1c78cae3c3d4b Specific cosmetic exception filters need to be returned so that they can be applied to generic cosmetic filters. --- src/js/cosmetic-filtering.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/js/cosmetic-filtering.js b/src/js/cosmetic-filtering.js index c11a8f571..3cc890fbc 100644 --- a/src/js/cosmetic-filtering.js +++ b/src/js/cosmetic-filtering.js @@ -670,6 +670,7 @@ FilterContainer.prototype.skipGenericCompiledContent = function(reader) { // hash, example.com, .promoted-tweet // hash, example.*, .promoted-tweet case 8: + this.duplicateBuster.add(fingerprint); this.specificFilters.store(args[1], args[2], args[3]); break; @@ -1004,11 +1005,14 @@ FilterContainer.prototype.retrieveSpecificSelectors = function( ); } - // Apply exceptions. - for ( const exception of exceptionSet ) { - specificSet.delete(exception); - proceduralSet.delete(exception); + if ( exceptionSet.size !== 0 ) { + out.exceptionFilters = Array.from(exceptionSet); + for ( const exception of exceptionSet ) { + specificSet.delete(exception); + proceduralSet.delete(exception); + } } + if ( specificSet.size !== 0 ) { out.declarativeFilters = Array.from(specificSet); }