File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3030 filterDB = new µb . staticExtFilteringEngine . HostnameBasedDB ( ) ,
3131 pselectors = new Map ( ) ,
3232 duplicates = new Set ( ) ,
33+ acceptedCount = 0 ,
34+ discardedCount = 0 ,
3335 docRegister , loggerRegister ;
3436
3537 var PSelectorHasTask = function ( task ) {
224226 filterDB . clear ( ) ;
225227 pselectors . clear ( ) ;
226228 duplicates . clear ( ) ;
229+ acceptedCount = 0 ;
230+ discardedCount = 0 ;
227231 } ;
228232
229233 api . freeze = function ( ) {
260264 reader . select ( 1002 ) ;
261265
262266 while ( reader . next ( ) ) {
267+ acceptedCount += 1 ;
263268 var fingerprint = reader . fingerprint ( ) ;
264- if ( duplicates . has ( fingerprint ) ) { continue ; }
269+ if ( duplicates . has ( fingerprint ) ) {
270+ discardedCount += 1 ;
271+ continue ;
272+ }
265273 duplicates . add ( fingerprint ) ;
266274 var args = reader . args ( ) ;
267275 filterDB . add ( args [ 1 ] , {
374382 }
375383 } ;
376384
385+ Object . defineProperties ( api , {
386+ acceptedCount : {
387+ get : function ( ) {
388+ return acceptedCount ;
389+ }
390+ } ,
391+ discardedCount : {
392+ get : function ( ) {
393+ return discardedCount ;
394+ }
395+ }
396+ } ) ;
397+
377398 return api ;
378399} ) ( ) ;
379400
Original file line number Diff line number Diff line change 2929 var µb = µBlock ,
3030 scriptletDB = new µb . staticExtFilteringEngine . HostnameBasedDB ( ) ,
3131 duplicates = new Set ( ) ,
32+ acceptedCount = 0 ,
33+ discardedCount = 0 ,
3234 scriptletCache = new µb . MRUCache ( 32 ) ,
3335 exceptionsRegister = new Set ( ) ,
3436 scriptletsRegister = new Map ( ) ,
103105 api . reset = function ( ) {
104106 scriptletDB . clear ( ) ;
105107 duplicates . clear ( ) ;
108+ acceptedCount = 0 ;
109+ discardedCount = 0 ;
106110 } ;
107111
108112 api . freeze = function ( ) {
154158 reader . select ( 1001 ) ;
155159
156160 while ( reader . next ( ) ) {
161+ acceptedCount += 1 ;
157162 var fingerprint = reader . fingerprint ( ) ;
158- if ( duplicates . has ( fingerprint ) ) { continue ; }
163+ if ( duplicates . has ( fingerprint ) ) {
164+ discardedCount += 1 ;
165+ continue ;
166+ }
159167 duplicates . add ( fingerprint ) ;
160168 var args = reader . args ( ) ;
161169 if ( args . length < 4 ) { continue ; }
264272 scriptletDB = new µb . staticExtFilteringEngine . HostnameBasedDB ( selfie ) ;
265273 } ;
266274
275+ Object . defineProperties ( api , {
276+ acceptedCount : {
277+ get : function ( ) {
278+ return acceptedCount ;
279+ }
280+ } ,
281+ discardedCount : {
282+ get : function ( ) {
283+ return discardedCount ;
284+ }
285+ }
286+ } ) ;
287+
267288 return api ;
268289} ) ( ) ;
269290
Original file line number Diff line number Diff line change 668668 } ;
669669 } ;
670670
671+ Object . defineProperties ( api , {
672+ acceptedCount : {
673+ get : function ( ) {
674+ return µb . cosmeticFilteringEngine . acceptedCount +
675+ µb . scriptletFilteringEngine . acceptedCount +
676+ µb . htmlFilteringEngine . acceptedCount ;
677+ }
678+ } ,
679+ discardedCount : {
680+ get : function ( ) {
681+ return µb . cosmeticFilteringEngine . discardedCount +
682+ µb . scriptletFilteringEngine . discardedCount +
683+ µb . htmlFilteringEngine . discardedCount ;
684+ }
685+ }
686+ } ) ;
687+
671688 api . fromSelfie = function ( selfie ) {
672689 µb . cosmeticFilteringEngine . fromSelfie ( selfie . cosmetic ) ;
673690 µb . scriptletFilteringEngine . fromSelfie ( selfie . scriptlets ) ;
Original file line number Diff line number Diff line change 562562
563563 var applyCompiledFilters = function ( assetKey , compiled ) {
564564 var snfe = µb . staticNetFilteringEngine ,
565- cfe = µb . cosmeticFilteringEngine ,
566- acceptedCount = snfe . acceptedCount + cfe . acceptedCount ,
567- discardedCount = snfe . discardedCount + cfe . discardedCount ;
565+ sxfe = µb . staticExtFilteringEngine ,
566+ acceptedCount = snfe . acceptedCount + sxfe . acceptedCount ,
567+ discardedCount = snfe . discardedCount + sxfe . discardedCount ;
568568 µb . applyCompiledFilters ( compiled , assetKey === µb . userFiltersPath ) ;
569569 if ( µb . availableFilterLists . hasOwnProperty ( assetKey ) ) {
570570 var entry = µb . availableFilterLists [ assetKey ] ;
571- entry . entryCount = snfe . acceptedCount + cfe . acceptedCount - acceptedCount ;
572- entry . entryUsedCount = entry . entryCount - ( snfe . discardedCount + cfe . discardedCount - discardedCount ) ;
571+ entry . entryCount = snfe . acceptedCount + sxfe . acceptedCount -
572+ acceptedCount ;
573+ entry . entryUsedCount = entry . entryCount -
574+ ( snfe . discardedCount + sxfe . discardedCount - discardedCount ) ;
573575 }
574576 loadedListKeys . push ( assetKey ) ;
575577 } ;
You can’t perform that action at this time.
0 commit comments