A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/gorhill/uBlock/commit/23c4c80136ba4974a6444488ef8162ba75b0cb84 below:

Add support for `elemhide` (through `specifichide`) · gorhill/uBlock@23c4c80 · GitHub

23 23 24 24

/******************************************************************************/

25 25 26 -

µBlock.cosmeticFilteringEngine = (function(){

26 +

µBlock.cosmeticFilteringEngine = (( ) => {

27 27 28 28

/******************************************************************************/

29 29

@@ -238,10 +238,12 @@ const FilterContainer = function() {

238 238

// is to prevent repeated allocation/deallocation overheads -- the

239 239

// constructors/destructors of javascript Set/Map is assumed to be costlier

240 240

// than just calling clear() on these.

241 -

this.setRegister0 = new Set();

242 -

this.setRegister1 = new Set();

243 -

this.setRegister2 = new Set();

244 -

this.mapRegister0 = new Map();

241 +

this.simpleSet$ = new Set();

242 +

this.complexSet$ = new Set();

243 +

this.specificSet$ = new Set();

244 +

this.exceptionSet$ = new Set();

245 +

this.proceduralSet$ = new Set();

246 +

this.dummySet$ = new Set();

245 247 246 248

this.reset();

247 249

};

@@ -830,11 +832,11 @@ FilterContainer.prototype.retrieveGenericSelectors = function(request) {

830 832 831 833

//console.time('cosmeticFilteringEngine.retrieveGenericSelectors');

832 834 833 -

const simpleSelectors = this.setRegister0;

834 -

const complexSelectors = this.setRegister1;

835 +

const simpleSelectors = this.simpleSet$;

836 +

const complexSelectors = this.complexSet$;

835 837 836 838

const cacheEntry = this.selectorCache.get(request.hostname);

837 -

const previousHits = cacheEntry && cacheEntry.cosmetic || this.setRegister2;

839 +

const previousHits = cacheEntry && cacheEntry.cosmetic || this.dummySet$;

838 840 839 841

for ( const type in this.lowlyGeneric ) {

840 842

const entry = this.lowlyGeneric[type];

@@ -891,6 +893,10 @@ FilterContainer.prototype.retrieveGenericSelectors = function(request) {

891 893

excepted,

892 894

};

893 895 896 +

// Important: always clear used registers before leaving.

897 +

simpleSelectors.clear();

898 +

complexSelectors.clear();

899 + 894 900

// Cache and inject (if user stylesheets supported) looked-up low generic

895 901

// cosmetic filters.

896 902

if (

@@ -931,10 +937,6 @@ FilterContainer.prototype.retrieveGenericSelectors = function(request) {

931 937

});

932 938

}

933 939 934 -

// Important: always clear used registers before leaving.

935 -

this.setRegister0.clear();

936 -

this.setRegister1.clear();

937 - 938 940

//console.timeEnd('cosmeticFilteringEngine.retrieveGenericSelectors');

939 941 940 942

return out;

@@ -946,8 +948,6 @@ FilterContainer.prototype.retrieveSpecificSelectors = function(

946 948

request,

947 949

options

948 950

) {

949 -

//console.time('cosmeticFilteringEngine.retrieveSpecificSelectors');

950 - 951 951

const hostname = request.hostname;

952 952

const cacheEntry = this.selectorCache.get(hostname);

953 953

@@ -976,7 +976,11 @@ FilterContainer.prototype.retrieveSpecificSelectors = function(

976 976

};

977 977 978 978

if ( options.noCosmeticFiltering !== true ) {

979 -

const specificSet = this.setRegister1;

979 +

const specificSet = this.specificSet$;

980 +

const proceduralSet = this.proceduralSet$;

981 +

const exceptionSet = this.exceptionSet$;

982 +

const dummySet = this.dummySet$;

983 + 980 984

// Cached cosmetic filters: these are always declarative.

981 985

if ( cacheEntry !== undefined ) {

982 986

cacheEntry.retrieve('cosmetic', specificSet);

@@ -986,17 +990,30 @@ FilterContainer.prototype.retrieveSpecificSelectors = function(

986 990

}

987 991

}

988 992 989 -

const exceptionSet = this.setRegister0;

990 -

const proceduralSet = this.setRegister2;

991 - 993 +

// Retrieve filters with a non-empty hostname

992 994

this.specificFilters.retrieve(

993 995

hostname,

994 -

[ specificSet, exceptionSet, proceduralSet, exceptionSet ]

996 +

options.noSpecificCosmeticFiltering !== true

997 +

? [ specificSet, exceptionSet, proceduralSet, exceptionSet ]

998 +

: [ dummySet, exceptionSet, dummySet, exceptionSet ],

999 +

1

995 1000

);

1001 +

// Retrieve filters with an empty hostname

1002 +

this.specificFilters.retrieve(

1003 +

hostname,

1004 +

options.noGenericCosmeticFiltering !== true

1005 +

? [ specificSet, exceptionSet, proceduralSet, exceptionSet ]

1006 +

: [ dummySet, exceptionSet, dummySet, exceptionSet ],

1007 +

2

1008 +

);

1009 +

// Retrieve filters with a non-empty entity

996 1010

if ( request.entity !== '' ) {

997 1011

this.specificFilters.retrieve(

998 1012

`${hostname.slice(0, -request.domain.length)}${request.entity}`,

999 -

[ specificSet, exceptionSet, proceduralSet, exceptionSet ]

1013 +

options.noSpecificCosmeticFiltering !== true

1014 +

? [ specificSet, exceptionSet, proceduralSet, exceptionSet ]

1015 +

: [ dummySet, exceptionSet, dummySet, exceptionSet ],

1016 +

1

1000 1017

);

1001 1018

}

1002 1019

@@ -1060,9 +1077,10 @@ FilterContainer.prototype.retrieveSpecificSelectors = function(

1060 1077

}

1061 1078 1062 1079

// Important: always clear used registers before leaving.

1063 -

this.setRegister0.clear();

1064 -

this.setRegister1.clear();

1065 -

this.setRegister2.clear();

1080 +

specificSet.clear();

1081 +

proceduralSet.clear();

1082 +

exceptionSet.clear();

1083 +

dummySet.clear();

1066 1084

}

1067 1085 1068 1086

// CSS selectors for collapsible blocked elements

@@ -1115,8 +1133,6 @@ FilterContainer.prototype.retrieveSpecificSelectors = function(

1115 1133

}

1116 1134

}

1117 1135 1118 -

//console.timeEnd('cosmeticFilteringEngine.retrieveSpecificSelectors');

1119 - 1120 1136

return out;

1121 1137

};

1122 1138

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4