@browserless.io/browserless 2.5.0-beta-4 → 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (191) hide show
  1. package/CHANGELOG.md +14 -2
  2. package/README.md +65 -34
  3. package/build/config.d.ts +2 -2
  4. package/build/config.js +3 -3
  5. package/build/data/classes.json +1 -1
  6. package/build/data/selectors.json +1 -1
  7. package/build/http.d.ts +1 -0
  8. package/build/http.js +1 -0
  9. package/build/routes/chrome/http/content.post.body.json +8 -8
  10. package/build/routes/chrome/http/pdf.post.body.json +8 -8
  11. package/build/routes/chrome/http/scrape.post.body.json +8 -8
  12. package/build/routes/chrome/http/screenshot.post.body.json +9 -9
  13. package/build/routes/chromium/http/content.post.body.json +8 -8
  14. package/build/routes/chromium/http/pdf.post.body.json +8 -8
  15. package/build/routes/chromium/http/scrape.post.body.json +8 -8
  16. package/build/routes/chromium/http/screenshot.post.body.json +9 -9
  17. package/build/routes/management/http/active.get.d.ts +16 -0
  18. package/build/routes/management/http/active.get.js +17 -0
  19. package/build/routes/management/tests/management.spec.js +7 -0
  20. package/build/server.js +1 -1
  21. package/build/types.d.ts +6 -4
  22. package/build/types.js +1 -0
  23. package/build/utils.d.ts +1 -1
  24. package/docker/base/Dockerfile +1 -1
  25. package/extensions/ublock/1p-filters.html +4 -3
  26. package/extensions/ublock/3p-filters.html +3 -3
  27. package/extensions/ublock/_locales/ar/messages.json +16 -4
  28. package/extensions/ublock/_locales/az/messages.json +16 -4
  29. package/extensions/ublock/_locales/be/messages.json +19 -7
  30. package/extensions/ublock/_locales/bg/messages.json +16 -4
  31. package/extensions/ublock/_locales/bn/messages.json +33 -21
  32. package/extensions/ublock/_locales/br_FR/messages.json +33 -21
  33. package/extensions/ublock/_locales/bs/messages.json +16 -4
  34. package/extensions/ublock/_locales/ca/messages.json +16 -4
  35. package/extensions/ublock/_locales/cs/messages.json +16 -4
  36. package/extensions/ublock/_locales/cv/messages.json +16 -4
  37. package/extensions/ublock/_locales/cy/messages.json +16 -4
  38. package/extensions/ublock/_locales/da/messages.json +21 -9
  39. package/extensions/ublock/_locales/de/messages.json +17 -5
  40. package/extensions/ublock/_locales/el/messages.json +16 -4
  41. package/extensions/ublock/_locales/en/messages.json +16 -4
  42. package/extensions/ublock/_locales/en_GB/messages.json +16 -4
  43. package/extensions/ublock/_locales/eo/messages.json +17 -5
  44. package/extensions/ublock/_locales/es/messages.json +16 -4
  45. package/extensions/ublock/_locales/et/messages.json +16 -4
  46. package/extensions/ublock/_locales/eu/messages.json +16 -4
  47. package/extensions/ublock/_locales/fa/messages.json +24 -12
  48. package/extensions/ublock/_locales/fi/messages.json +16 -4
  49. package/extensions/ublock/_locales/fil/messages.json +16 -4
  50. package/extensions/ublock/_locales/fr/messages.json +16 -4
  51. package/extensions/ublock/_locales/fy/messages.json +16 -4
  52. package/extensions/ublock/_locales/gl/messages.json +16 -4
  53. package/extensions/ublock/_locales/gu/messages.json +16 -4
  54. package/extensions/ublock/_locales/he/messages.json +25 -13
  55. package/extensions/ublock/_locales/hi/messages.json +31 -19
  56. package/extensions/ublock/_locales/hr/messages.json +16 -4
  57. package/extensions/ublock/_locales/hu/messages.json +16 -4
  58. package/extensions/ublock/_locales/hy/messages.json +17 -5
  59. package/extensions/ublock/_locales/id/messages.json +16 -4
  60. package/extensions/ublock/_locales/it/messages.json +17 -5
  61. package/extensions/ublock/_locales/ja/messages.json +16 -4
  62. package/extensions/ublock/_locales/ka/messages.json +16 -4
  63. package/extensions/ublock/_locales/kk/messages.json +16 -4
  64. package/extensions/ublock/_locales/kn/messages.json +74 -62
  65. package/extensions/ublock/_locales/ko/messages.json +16 -4
  66. package/extensions/ublock/_locales/lt/messages.json +23 -11
  67. package/extensions/ublock/_locales/lv/messages.json +16 -4
  68. package/extensions/ublock/_locales/mk/messages.json +16 -4
  69. package/extensions/ublock/_locales/ml/messages.json +19 -7
  70. package/extensions/ublock/_locales/mr/messages.json +16 -4
  71. package/extensions/ublock/_locales/ms/messages.json +16 -4
  72. package/extensions/ublock/_locales/nb/messages.json +16 -4
  73. package/extensions/ublock/_locales/nl/messages.json +16 -4
  74. package/extensions/ublock/_locales/no/messages.json +16 -4
  75. package/extensions/ublock/_locales/oc/messages.json +16 -4
  76. package/extensions/ublock/_locales/pa/messages.json +16 -4
  77. package/extensions/ublock/_locales/pl/messages.json +17 -5
  78. package/extensions/ublock/_locales/pt_BR/messages.json +16 -4
  79. package/extensions/ublock/_locales/pt_PT/messages.json +16 -4
  80. package/extensions/ublock/_locales/ro/messages.json +17 -5
  81. package/extensions/ublock/_locales/ru/messages.json +16 -4
  82. package/extensions/ublock/_locales/si/messages.json +16 -4
  83. package/extensions/ublock/_locales/sk/messages.json +16 -4
  84. package/extensions/ublock/_locales/sl/messages.json +16 -4
  85. package/extensions/ublock/_locales/so/messages.json +16 -4
  86. package/extensions/ublock/_locales/sq/messages.json +16 -4
  87. package/extensions/ublock/_locales/sr/messages.json +16 -4
  88. package/extensions/ublock/_locales/sv/messages.json +20 -8
  89. package/extensions/ublock/_locales/sw/messages.json +16 -4
  90. package/extensions/ublock/_locales/ta/messages.json +16 -4
  91. package/extensions/ublock/_locales/te/messages.json +16 -4
  92. package/extensions/ublock/_locales/th/messages.json +42 -30
  93. package/extensions/ublock/_locales/tr/messages.json +19 -7
  94. package/extensions/ublock/_locales/uk/messages.json +16 -4
  95. package/extensions/ublock/_locales/ur/messages.json +16 -4
  96. package/extensions/ublock/_locales/vi/messages.json +16 -4
  97. package/extensions/ublock/_locales/zh_CN/messages.json +16 -4
  98. package/extensions/ublock/_locales/zh_TW/messages.json +42 -30
  99. package/extensions/ublock/assets/assets.json +95 -78
  100. package/extensions/ublock/assets/resources/scriptlets.js +70 -24
  101. package/extensions/ublock/assets/thirdparties/easylist/easylist.txt +6258 -3453
  102. package/extensions/ublock/assets/thirdparties/easylist/easyprivacy.txt +277 -40
  103. package/extensions/ublock/assets/thirdparties/pgl.yoyo.org/as/serverlist +8 -32
  104. package/extensions/ublock/assets/thirdparties/publicsuffix.org/list/effective_tld_names.dat +107 -12
  105. package/extensions/ublock/assets/thirdparties/urlhaus-filter/urlhaus-filter-online.txt +1160 -954
  106. package/extensions/ublock/assets/ublock/badlists.txt +1 -2
  107. package/extensions/ublock/assets/ublock/badware.min.txt +395 -270
  108. package/extensions/ublock/assets/ublock/filters.min.txt +1176 -1238
  109. package/extensions/ublock/assets/ublock/privacy.min.txt +32 -31
  110. package/extensions/ublock/assets/ublock/quick-fixes.min.txt +120 -110
  111. package/extensions/ublock/assets/ublock/unbreak.min.txt +75 -36
  112. package/extensions/ublock/css/1p-filters.css +2 -1
  113. package/extensions/ublock/css/3p-filters.css +1 -16
  114. package/extensions/ublock/css/advanced-settings.css +1 -0
  115. package/extensions/ublock/css/asset-viewer.css +1 -0
  116. package/extensions/ublock/css/code-viewer.css +1 -0
  117. package/extensions/ublock/css/codemirror.css +37 -10
  118. package/extensions/ublock/css/common.css +36 -2
  119. package/extensions/ublock/css/dashboard.css +9 -3
  120. package/extensions/ublock/css/devtools.css +1 -0
  121. package/extensions/ublock/css/document-blocked.css +3 -3
  122. package/extensions/ublock/css/dom-inspector.css +1 -0
  123. package/extensions/ublock/css/dyna-rules.css +1 -0
  124. package/extensions/ublock/css/epicker-ui.css +76 -66
  125. package/extensions/ublock/css/fa-icons.css +1 -0
  126. package/extensions/ublock/css/logger-ui.css +2 -0
  127. package/extensions/ublock/css/popup-fenix.css +1 -0
  128. package/extensions/ublock/css/whitelist.css +1 -0
  129. package/extensions/ublock/dashboard.html +20 -13
  130. package/extensions/ublock/devtools.html +2 -0
  131. package/extensions/ublock/dyna-rules.html +2 -2
  132. package/extensions/ublock/img/flags-of-the-world/np.png +0 -0
  133. package/extensions/ublock/img/fontawesome/fontawesome-defs.svg +1 -0
  134. package/extensions/ublock/js/1p-filters.js +72 -23
  135. package/extensions/ublock/js/3p-filters.js +71 -25
  136. package/extensions/ublock/js/asset-viewer.js +1 -0
  137. package/extensions/ublock/js/assets.js +83 -89
  138. package/extensions/ublock/js/background.js +20 -27
  139. package/extensions/ublock/js/base64-custom.js +1 -102
  140. package/extensions/ublock/js/benchmarks.js +36 -21
  141. package/extensions/ublock/js/biditrie.js +8 -23
  142. package/extensions/ublock/js/broadcast.js +2 -4
  143. package/extensions/ublock/js/cachestorage.js +594 -396
  144. package/extensions/ublock/js/codemirror/search.js +49 -37
  145. package/extensions/ublock/js/codemirror/ubo-static-filtering.js +233 -215
  146. package/extensions/ublock/js/contentscript-extra.js +31 -1
  147. package/extensions/ublock/js/cosmetic-filtering.js +35 -33
  148. package/extensions/ublock/js/dashboard.js +11 -7
  149. package/extensions/ublock/js/devtools.js +22 -0
  150. package/extensions/ublock/js/dom.js +2 -2
  151. package/extensions/ublock/js/dyna-rules.js +17 -16
  152. package/extensions/ublock/js/epicker-ui.js +41 -16
  153. package/extensions/ublock/js/fa-icons.js +1 -0
  154. package/extensions/ublock/js/hntrie.js +10 -25
  155. package/extensions/ublock/js/i18n.js +15 -15
  156. package/extensions/ublock/js/logger-ui.js +9 -6
  157. package/extensions/ublock/js/messaging.js +51 -26
  158. package/extensions/ublock/js/pagestore.js +21 -23
  159. package/extensions/ublock/js/popup-fenix.js +35 -22
  160. package/extensions/ublock/js/redirect-engine.js +15 -30
  161. package/extensions/ublock/js/reverselookup.js +1 -1
  162. package/extensions/ublock/js/s14e-serializer.js +1405 -0
  163. package/extensions/ublock/js/scriptlet-filtering-core.js +1 -1
  164. package/extensions/ublock/js/scriptlets/epicker.js +27 -18
  165. package/extensions/ublock/js/settings.js +32 -21
  166. package/extensions/ublock/js/start.js +121 -62
  167. package/extensions/ublock/js/static-ext-filtering-db.js +6 -6
  168. package/extensions/ublock/js/static-ext-filtering.js +17 -28
  169. package/extensions/ublock/js/static-filtering-parser.js +26 -4
  170. package/extensions/ublock/js/static-net-filtering.js +69 -168
  171. package/extensions/ublock/js/storage.js +178 -155
  172. package/extensions/ublock/js/traffic.js +11 -7
  173. package/extensions/ublock/js/vapi-background.js +49 -62
  174. package/extensions/ublock/js/vapi-client.js +13 -16
  175. package/extensions/ublock/js/webext.js +10 -2
  176. package/extensions/ublock/js/whitelist.js +27 -25
  177. package/extensions/ublock/lib/publicsuffixlist/publicsuffixlist.js +3 -7
  178. package/extensions/ublock/manifest.json +2 -1
  179. package/extensions/ublock/web_accessible_resources/epicker-ui.html +5 -8
  180. package/extensions/ublock/whitelist.html +3 -4
  181. package/package.json +13 -13
  182. package/src/config.ts +3 -4
  183. package/src/http.ts +1 -0
  184. package/src/routes/management/http/active.get.ts +30 -0
  185. package/src/routes/management/tests/management.spec.ts +13 -0
  186. package/src/server.ts +1 -1
  187. package/src/types.ts +2 -1
  188. package/static/docs/swagger.json +57 -11
  189. package/static/docs/swagger.min.json +56 -10
  190. package/static/function/client.js +4155 -3350
  191. package/extensions/ublock/_locales/ku/messages.json +0 -1294
@@ -221,7 +221,7 @@ const reEscapeSequence = /\\([0-9A-Fa-f]+ |.)/g;
221
221
  // Generic filters can only be enforced once the main document is loaded.
222
222
  // Specific filers can be enforced before the main document is loaded.
223
223
 
224
- const FilterContainer = function() {
224
+ const CosmeticFilteringEngine = function() {
225
225
  this.reSimpleHighGeneric = /^(?:[a-z]*\[[^\]]+\]|\S+)$/;
226
226
 
227
227
  this.selectorCache = new Map();
@@ -269,7 +269,7 @@ const FilterContainer = function() {
269
269
 
270
270
  // Reset all, thus reducing to a minimum memory footprint of the context.
271
271
 
272
- FilterContainer.prototype.reset = function() {
272
+ CosmeticFilteringEngine.prototype.reset = function() {
273
273
  this.frozen = false;
274
274
  this.acceptedCount = 0;
275
275
  this.discardedCount = 0;
@@ -292,12 +292,12 @@ FilterContainer.prototype.reset = function() {
292
292
  this.highlyGeneric.complex.str = '';
293
293
  this.highlyGeneric.complex.mru.reset();
294
294
 
295
- this.selfieVersion = 1;
295
+ this.selfieVersion = 2;
296
296
  };
297
297
 
298
298
  /******************************************************************************/
299
299
 
300
- FilterContainer.prototype.freeze = function() {
300
+ CosmeticFilteringEngine.prototype.freeze = function() {
301
301
  this.duplicateBuster.clear();
302
302
  this.specificFilters.collectGarbage();
303
303
 
@@ -311,7 +311,7 @@ FilterContainer.prototype.freeze = function() {
311
311
 
312
312
  /******************************************************************************/
313
313
 
314
- FilterContainer.prototype.compile = function(parser, writer) {
314
+ CosmeticFilteringEngine.prototype.compile = function(parser, writer) {
315
315
  if ( parser.hasOptions() === false ) {
316
316
  this.compileGenericSelector(parser, writer);
317
317
  return true;
@@ -337,7 +337,7 @@ FilterContainer.prototype.compile = function(parser, writer) {
337
337
 
338
338
  /******************************************************************************/
339
339
 
340
- FilterContainer.prototype.compileGenericSelector = function(parser, writer) {
340
+ CosmeticFilteringEngine.prototype.compileGenericSelector = function(parser, writer) {
341
341
  if ( parser.isException() ) {
342
342
  this.compileGenericUnhideSelector(parser, writer);
343
343
  } else {
@@ -347,7 +347,7 @@ FilterContainer.prototype.compileGenericSelector = function(parser, writer) {
347
347
 
348
348
  /******************************************************************************/
349
349
 
350
- FilterContainer.prototype.compileGenericHideSelector = function(
350
+ CosmeticFilteringEngine.prototype.compileGenericHideSelector = function(
351
351
  parser,
352
352
  writer
353
353
  ) {
@@ -403,7 +403,7 @@ FilterContainer.prototype.compileGenericHideSelector = function(
403
403
 
404
404
  /******************************************************************************/
405
405
 
406
- FilterContainer.prototype.compileGenericUnhideSelector = function(
406
+ CosmeticFilteringEngine.prototype.compileGenericUnhideSelector = function(
407
407
  parser,
408
408
  writer
409
409
  ) {
@@ -432,7 +432,7 @@ FilterContainer.prototype.compileGenericUnhideSelector = function(
432
432
 
433
433
  /******************************************************************************/
434
434
 
435
- FilterContainer.prototype.compileSpecificSelector = function(
435
+ CosmeticFilteringEngine.prototype.compileSpecificSelector = function(
436
436
  parser,
437
437
  hostname,
438
438
  not,
@@ -471,7 +471,7 @@ FilterContainer.prototype.compileSpecificSelector = function(
471
471
 
472
472
  /******************************************************************************/
473
473
 
474
- FilterContainer.prototype.fromCompiledContent = function(reader, options) {
474
+ CosmeticFilteringEngine.prototype.fromCompiledContent = function(reader, options) {
475
475
  if ( options.skipCosmetic ) {
476
476
  this.skipCompiledContent(reader, 'SPECIFIC');
477
477
  this.skipCompiledContent(reader, 'GENERIC');
@@ -560,7 +560,7 @@ FilterContainer.prototype.fromCompiledContent = function(reader, options) {
560
560
 
561
561
  /******************************************************************************/
562
562
 
563
- FilterContainer.prototype.skipCompiledContent = function(reader, sectionId) {
563
+ CosmeticFilteringEngine.prototype.skipCompiledContent = function(reader, sectionId) {
564
564
  reader.select(`COSMETIC_FILTERS:${sectionId}`);
565
565
  while ( reader.next() ) {
566
566
  this.acceptedCount += 1;
@@ -570,21 +570,23 @@ FilterContainer.prototype.skipCompiledContent = function(reader, sectionId) {
570
570
 
571
571
  /******************************************************************************/
572
572
 
573
- FilterContainer.prototype.toSelfie = function() {
573
+ CosmeticFilteringEngine.prototype.toSelfie = function() {
574
574
  return {
575
575
  version: this.selfieVersion,
576
576
  acceptedCount: this.acceptedCount,
577
577
  discardedCount: this.discardedCount,
578
578
  specificFilters: this.specificFilters.toSelfie(),
579
- lowlyGeneric: Array.from(this.lowlyGeneric),
580
- highSimpleGenericHideArray: Array.from(this.highlyGeneric.simple.dict),
581
- highComplexGenericHideArray: Array.from(this.highlyGeneric.complex.dict),
579
+ lowlyGeneric: this.lowlyGeneric,
580
+ highSimpleGenericHideDict: this.highlyGeneric.simple.dict,
581
+ highSimpleGenericHideStr: this.highlyGeneric.simple.str,
582
+ highComplexGenericHideDict: this.highlyGeneric.complex.dict,
583
+ highComplexGenericHideStr: this.highlyGeneric.complex.str,
582
584
  };
583
585
  };
584
586
 
585
587
  /******************************************************************************/
586
588
 
587
- FilterContainer.prototype.fromSelfie = function(selfie) {
589
+ CosmeticFilteringEngine.prototype.fromSelfie = function(selfie) {
588
590
  if ( selfie.version !== this.selfieVersion ) {
589
591
  throw new Error(
590
592
  `cosmeticFilteringEngine: mismatched selfie version, ${selfie.version}, expected ${this.selfieVersion}`
@@ -593,17 +595,17 @@ FilterContainer.prototype.fromSelfie = function(selfie) {
593
595
  this.acceptedCount = selfie.acceptedCount;
594
596
  this.discardedCount = selfie.discardedCount;
595
597
  this.specificFilters.fromSelfie(selfie.specificFilters);
596
- this.lowlyGeneric = new Map(selfie.lowlyGeneric);
597
- this.highlyGeneric.simple.dict = new Set(selfie.highSimpleGenericHideArray);
598
- this.highlyGeneric.simple.str = selfie.highSimpleGenericHideArray.join(',\n');
599
- this.highlyGeneric.complex.dict = new Set(selfie.highComplexGenericHideArray);
600
- this.highlyGeneric.complex.str = selfie.highComplexGenericHideArray.join(',\n');
598
+ this.lowlyGeneric = selfie.lowlyGeneric;
599
+ this.highlyGeneric.simple.dict = selfie.highSimpleGenericHideDict;
600
+ this.highlyGeneric.simple.str = selfie.highSimpleGenericHideStr;
601
+ this.highlyGeneric.complex.dict = selfie.highComplexGenericHideDict;
602
+ this.highlyGeneric.complex.str = selfie.highComplexGenericHideStr;
601
603
  this.frozen = true;
602
604
  };
603
605
 
604
606
  /******************************************************************************/
605
607
 
606
- FilterContainer.prototype.addToSelectorCache = function(details) {
608
+ CosmeticFilteringEngine.prototype.addToSelectorCache = function(details) {
607
609
  const hostname = details.hostname;
608
610
  if ( typeof hostname !== 'string' || hostname === '' ) { return; }
609
611
  const selectors = details.selectors;
@@ -621,7 +623,7 @@ FilterContainer.prototype.addToSelectorCache = function(details) {
621
623
 
622
624
  /******************************************************************************/
623
625
 
624
- FilterContainer.prototype.removeFromSelectorCache = function(
626
+ CosmeticFilteringEngine.prototype.removeFromSelectorCache = function(
625
627
  targetHostname = '*',
626
628
  type = undefined
627
629
  ) {
@@ -644,7 +646,7 @@ FilterContainer.prototype.removeFromSelectorCache = function(
644
646
 
645
647
  /******************************************************************************/
646
648
 
647
- FilterContainer.prototype.pruneSelectorCacheAsync = function() {
649
+ CosmeticFilteringEngine.prototype.pruneSelectorCacheAsync = function() {
648
650
  if ( this.selectorCache.size <= this.selectorCacheCountMax ) { return; }
649
651
  const cache = this.selectorCache;
650
652
  const hostnames = Array.from(cache.keys())
@@ -658,7 +660,7 @@ FilterContainer.prototype.pruneSelectorCacheAsync = function() {
658
660
 
659
661
  /******************************************************************************/
660
662
 
661
- FilterContainer.prototype.disableSurveyor = function(details) {
663
+ CosmeticFilteringEngine.prototype.disableSurveyor = function(details) {
662
664
  const hostname = details.hostname;
663
665
  if ( typeof hostname !== 'string' || hostname === '' ) { return; }
664
666
  const cacheEntry = this.selectorCache.get(hostname);
@@ -668,7 +670,7 @@ FilterContainer.prototype.disableSurveyor = function(details) {
668
670
 
669
671
  /******************************************************************************/
670
672
 
671
- FilterContainer.prototype.cssRuleFromProcedural = function(pfilter) {
673
+ CosmeticFilteringEngine.prototype.cssRuleFromProcedural = function(pfilter) {
672
674
  if ( pfilter.cssable !== true ) { return; }
673
675
  const { tasks, action } = pfilter;
674
676
  let mq, selector;
@@ -699,7 +701,7 @@ FilterContainer.prototype.cssRuleFromProcedural = function(pfilter) {
699
701
 
700
702
  /******************************************************************************/
701
703
 
702
- FilterContainer.prototype.retrieveGenericSelectors = function(request) {
704
+ CosmeticFilteringEngine.prototype.retrieveGenericSelectors = function(request) {
703
705
  if ( this.lowlyGeneric.size === 0 ) { return; }
704
706
  if ( Array.isArray(request.hashes) === false ) { return; }
705
707
  if ( request.hashes.length === 0 ) { return; }
@@ -757,7 +759,7 @@ FilterContainer.prototype.retrieveGenericSelectors = function(request) {
757
759
 
758
760
  /******************************************************************************/
759
761
 
760
- FilterContainer.prototype.retrieveSpecificSelectors = function(
762
+ CosmeticFilteringEngine.prototype.retrieveSpecificSelectors = function(
761
763
  request,
762
764
  options
763
765
  ) {
@@ -928,7 +930,7 @@ FilterContainer.prototype.retrieveSpecificSelectors = function(
928
930
  if ( injectedCSS.length !== 0 ) {
929
931
  out.injectedCSS = injectedCSS.join('\n\n');
930
932
  details.code = out.injectedCSS;
931
- if ( request.tabId !== undefined ) {
933
+ if ( request.tabId !== undefined && options.dontInject !== true ) {
932
934
  vAPI.tabs.insertCSS(request.tabId, details);
933
935
  }
934
936
  }
@@ -938,7 +940,7 @@ FilterContainer.prototype.retrieveSpecificSelectors = function(
938
940
  const networkFilters = [];
939
941
  if ( cacheEntry.retrieveNet(networkFilters) ) {
940
942
  details.code = `${networkFilters.join('\n')}\n{display:none!important;}`;
941
- if ( request.tabId !== undefined ) {
943
+ if ( request.tabId !== undefined && options.dontInject !== true ) {
942
944
  vAPI.tabs.insertCSS(request.tabId, details);
943
945
  }
944
946
  }
@@ -949,13 +951,13 @@ FilterContainer.prototype.retrieveSpecificSelectors = function(
949
951
 
950
952
  /******************************************************************************/
951
953
 
952
- FilterContainer.prototype.getFilterCount = function() {
954
+ CosmeticFilteringEngine.prototype.getFilterCount = function() {
953
955
  return this.acceptedCount - this.discardedCount;
954
956
  };
955
957
 
956
958
  /******************************************************************************/
957
959
 
958
- FilterContainer.prototype.dump = function() {
960
+ CosmeticFilteringEngine.prototype.dump = function() {
959
961
  const lowlyGenerics = [];
960
962
  for ( const selectors of this.lowlyGeneric.values() ) {
961
963
  lowlyGenerics.push(...selectors.split(',\n'));
@@ -976,7 +978,7 @@ FilterContainer.prototype.dump = function() {
976
978
 
977
979
  /******************************************************************************/
978
980
 
979
- const cosmeticFilteringEngine = new FilterContainer();
981
+ const cosmeticFilteringEngine = new CosmeticFilteringEngine();
980
982
 
981
983
  export default cosmeticFilteringEngine;
982
984
 
@@ -25,7 +25,7 @@ import { dom, qs$ } from './dom.js';
25
25
 
26
26
  /******************************************************************************/
27
27
 
28
- const discardUnsavedData = function(synchronous = false) {
28
+ function discardUnsavedData(synchronous = false) {
29
29
  const paneFrame = qs$('#iframe');
30
30
  const paneWindow = paneFrame.contentWindow;
31
31
  if (
@@ -66,9 +66,9 @@ const discardUnsavedData = function(synchronous = false) {
66
66
 
67
67
  dom.on(document, 'click', onClick, true);
68
68
  });
69
- };
69
+ }
70
70
 
71
- const loadDashboardPanel = function(pane, first) {
71
+ function loadDashboardPanel(pane, first) {
72
72
  const tabButton = qs$(`[data-pane="${pane}"]`);
73
73
  if ( tabButton === null || dom.cl.has(tabButton, 'selected') ) { return; }
74
74
  const loadPane = ( ) => {
@@ -76,8 +76,12 @@ const loadDashboardPanel = function(pane, first) {
76
76
  dom.cl.remove('.tabButton.selected', 'selected');
77
77
  dom.cl.add(tabButton, 'selected');
78
78
  tabButton.scrollIntoView();
79
- qs$('#iframe').contentWindow.location.replace(pane);
79
+ const iframe = qs$('#iframe');
80
+ iframe.contentWindow.location.replace(pane);
80
81
  if ( pane !== 'no-dashboard.html' ) {
82
+ iframe.addEventListener('load', ( ) => {
83
+ qs$('.wikilink').href = iframe.contentWindow.wikilink || '';
84
+ }, { once: true });
81
85
  vAPI.localStorage.setItem('dashboardLastVisitedPane', pane);
82
86
  }
83
87
  };
@@ -91,11 +95,11 @@ const loadDashboardPanel = function(pane, first) {
91
95
  if ( status === false ) { return; }
92
96
  loadPane();
93
97
  });
94
- };
98
+ }
95
99
 
96
- const onTabClickHandler = function(ev) {
100
+ function onTabClickHandler(ev) {
97
101
  loadDashboardPanel(dom.attr(ev.target, 'data-pane'));
98
- };
102
+ }
99
103
 
100
104
  if ( self.location.hash.slice(1) === 'no-dashboard.html' ) {
101
105
  dom.cl.add(dom.body, 'noDashboard');
@@ -187,6 +187,28 @@ vAPI.messaging.send('dashboard', {
187
187
  dom.attr(button, 'disabled', null);
188
188
  });
189
189
  });
190
+ dom.attr('#cfe-benchmark', 'disabled', null);
191
+ dom.on('#cfe-benchmark', 'click', ev => {
192
+ const button = ev.target;
193
+ dom.attr(button, 'disabled', '');
194
+ vAPI.messaging.send('devTools', {
195
+ what: 'cfeBenchmark',
196
+ }).then(result => {
197
+ log(result);
198
+ dom.attr(button, 'disabled', null);
199
+ });
200
+ });
201
+ dom.attr('#sfe-benchmark', 'disabled', null);
202
+ dom.on('#sfe-benchmark', 'click', ev => {
203
+ const button = ev.target;
204
+ dom.attr(button, 'disabled', '');
205
+ vAPI.messaging.send('devTools', {
206
+ what: 'sfeBenchmark',
207
+ }).then(result => {
208
+ log(result);
209
+ dom.attr(button, 'disabled', null);
210
+ });
211
+ });
190
212
  });
191
213
 
192
214
  /******************************************************************************/
@@ -161,9 +161,9 @@ dom.cl = class {
161
161
  }
162
162
  }
163
163
 
164
- static remove(target, name) {
164
+ static remove(target, ...names) {
165
165
  for ( const elem of normalizeTarget(target) ) {
166
- elem.classList.remove(name);
166
+ elem.classList.remove(...names);
167
167
  }
168
168
  }
169
169
 
@@ -174,7 +174,7 @@ const toggleOverlay = (( ) => {
174
174
  // - Scroll position preserved
175
175
  // - Minimum amount of text updated
176
176
 
177
- const rulesToDoc = function(clearHistory) {
177
+ function rulesToDoc(clearHistory) {
178
178
  const orig = thePanes.orig.doc;
179
179
  const edit = thePanes.edit.doc;
180
180
  orig.startOperation();
@@ -258,11 +258,11 @@ const rulesToDoc = function(clearHistory) {
258
258
  { line, ch: 0 },
259
259
  (clientHeight - ldoc.defaultTextHeight()) / 2
260
260
  );
261
- };
261
+ }
262
262
 
263
263
  /******************************************************************************/
264
264
 
265
- const filterRules = function(key) {
265
+ function filterRules(key) {
266
266
  const filter = qs$('#ruleFilter input').value;
267
267
  const rules = thePanes[key].modified;
268
268
  if ( filter === '' ) { return rules; }
@@ -272,11 +272,11 @@ const filterRules = function(key) {
272
272
  out.push(rule);
273
273
  }
274
274
  return out;
275
- };
275
+ }
276
276
 
277
277
  /******************************************************************************/
278
278
 
279
- const applyDiff = async function(permanent, toAdd, toRemove) {
279
+ async function applyDiff(permanent, toAdd, toRemove) {
280
280
  const details = await vAPI.messaging.send('dashboard', {
281
281
  what: 'modifyRuleset',
282
282
  permanent: permanent,
@@ -286,7 +286,7 @@ const applyDiff = async function(permanent, toAdd, toRemove) {
286
286
  thePanes.orig.original = details.permanentRules;
287
287
  thePanes.edit.original = details.sessionRules;
288
288
  onPresentationChanged();
289
- };
289
+ }
290
290
 
291
291
  /******************************************************************************/
292
292
 
@@ -345,14 +345,14 @@ function handleImportFilePicker() {
345
345
 
346
346
  /******************************************************************************/
347
347
 
348
- const startImportFilePicker = function() {
348
+ function startImportFilePicker() {
349
349
  const input = qs$('#importFilePicker');
350
350
  // Reset to empty string, this will ensure an change event is properly
351
351
  // triggered if the user pick a file, even if it is the same as the last
352
352
  // one picked.
353
353
  input.value = '';
354
354
  input.click();
355
- };
355
+ }
356
356
 
357
357
  /******************************************************************************/
358
358
 
@@ -562,7 +562,7 @@ const onTextChanged = (( ) => {
562
562
  }
563
563
  };
564
564
 
565
- return function(now) {
565
+ return function onTextChanged(now) {
566
566
  if ( timer !== undefined ) { self.cancelIdleCallback(timer); }
567
567
  timer = now ? process() : self.requestIdleCallback(process, { timeout: 57 });
568
568
  };
@@ -570,7 +570,7 @@ const onTextChanged = (( ) => {
570
570
 
571
571
  /******************************************************************************/
572
572
 
573
- const revertAllHandler = function() {
573
+ function revertAllHandler() {
574
574
  const toAdd = [], toRemove = [];
575
575
  const left = mergeView.leftOriginal();
576
576
  const edit = mergeView.editor();
@@ -587,11 +587,11 @@ const revertAllHandler = function() {
587
587
  toRemove.push(removedLines.trim());
588
588
  }
589
589
  applyDiff(false, toAdd.join('\n'), toRemove.join('\n'));
590
- };
590
+ }
591
591
 
592
592
  /******************************************************************************/
593
593
 
594
- const commitAllHandler = function() {
594
+ function commitAllHandler() {
595
595
  const toAdd = [], toRemove = [];
596
596
  const left = mergeView.leftOriginal();
597
597
  const edit = mergeView.editor();
@@ -608,11 +608,11 @@ const commitAllHandler = function() {
608
608
  toRemove.push(removedLines.trim());
609
609
  }
610
610
  applyDiff(true, toAdd.join('\n'), toRemove.join('\n'));
611
- };
611
+ }
612
612
 
613
613
  /******************************************************************************/
614
614
 
615
- const editSaveHandler = function() {
615
+ function editSaveHandler() {
616
616
  const editor = mergeView.editor();
617
617
  const editText = editor.getValue().trim();
618
618
  if ( editText === cleanEditText ) {
@@ -629,7 +629,7 @@ const editSaveHandler = function() {
629
629
  }
630
630
  }
631
631
  applyDiff(false, toAdd.join(''), toRemove.join(''));
632
- };
632
+ }
633
633
 
634
634
  /******************************************************************************/
635
635
 
@@ -648,6 +648,8 @@ self.cloud.onPull = function(data, append) {
648
648
 
649
649
  /******************************************************************************/
650
650
 
651
+ self.wikilink = 'https://github.com/gorhill/uBlock/wiki/Dashboard:-My-rules';
652
+
651
653
  self.hasUnsavedData = function() {
652
654
  return mergeView.editor().isClean(cleanEditToken) === false;
653
655
  };
@@ -706,4 +708,3 @@ mergeView.editor().on('updateDiff', ( ) => {
706
708
  });
707
709
 
708
710
  /******************************************************************************/
709
-
@@ -28,6 +28,7 @@ import './codemirror/ubo-static-filtering.js';
28
28
  import { hostnameFromURI } from './uri-utils.js';
29
29
  import punycode from '../lib/punycode.js';
30
30
  import * as sfp from './static-filtering-parser.js';
31
+ import { dom } from './dom.js';
31
32
 
32
33
  /******************************************************************************/
33
34
  /******************************************************************************/
@@ -46,7 +47,7 @@ const pickerRoot = document.documentElement;
46
47
  const dialog = $stor('aside');
47
48
  let staticFilteringParser;
48
49
 
49
- const svgRoot = $stor('svg');
50
+ const svgRoot = $stor('svg#sea');
50
51
  const svgOcean = svgRoot.children[0];
51
52
  const svgIslands = svgRoot.children[1];
52
53
  const NoPaths = 'M0 0';
@@ -594,8 +595,9 @@ const onStartMoving = (( ) => {
594
595
  let isTouch = false;
595
596
  let mx0 = 0, my0 = 0;
596
597
  let mx1 = 0, my1 = 0;
597
- let r0 = 0, b0 = 0;
598
- let rMax = 0, bMax = 0;
598
+ let pw = 0, ph = 0;
599
+ let dw = 0, dh = 0;
600
+ let cx0 = 0, cy0 = 0;
599
601
  let timer;
600
602
 
601
603
  const eatEvent = function(ev) {
@@ -605,10 +607,22 @@ const onStartMoving = (( ) => {
605
607
 
606
608
  const move = ( ) => {
607
609
  timer = undefined;
608
- const r1 = Math.min(Math.max(r0 - mx1 + mx0, 2), rMax);
609
- const b1 = Math.min(Math.max(b0 - my1 + my0, 2), bMax);
610
- dialog.style.setProperty('right', `${r1}px`);
611
- dialog.style.setProperty('bottom', `${b1}px`);
610
+ const cx1 = cx0 + mx1 - mx0;
611
+ const cy1 = cy0 + my1 - my0;
612
+ if ( cx1 < pw / 2 ) {
613
+ dialog.style.setProperty('left', `${Math.max(cx1-dw/2,2)}px`);
614
+ dialog.style.removeProperty('right');
615
+ } else {
616
+ dialog.style.removeProperty('left');
617
+ dialog.style.setProperty('right', `${Math.max(pw-cx1-dw/2,2)}px`);
618
+ }
619
+ if ( cy1 < ph / 2 ) {
620
+ dialog.style.setProperty('top', `${Math.max(cy1-dh/2,2)}px`);
621
+ dialog.style.removeProperty('bottom');
622
+ } else {
623
+ dialog.style.removeProperty('top');
624
+ dialog.style.setProperty('bottom', `${Math.max(ph-cy1-dh/2,2)}px`);
625
+ }
612
626
  };
613
627
 
614
628
  const moveAsync = ev => {
@@ -635,7 +649,7 @@ const onStartMoving = (( ) => {
635
649
  eatEvent(ev);
636
650
  };
637
651
 
638
- return function(ev) {
652
+ return ev => {
639
653
  const target = dialog.querySelector('#move');
640
654
  if ( ev.target !== target ) { return; }
641
655
  if ( dialog.classList.contains('moving') ) { return; }
@@ -648,12 +662,13 @@ const onStartMoving = (( ) => {
648
662
  mx0 = ev.pageX;
649
663
  my0 = ev.pageY;
650
664
  }
651
- const style = self.getComputedStyle(dialog);
652
- r0 = parseInt(style.right, 10);
653
- b0 = parseInt(style.bottom, 10);
654
665
  const rect = dialog.getBoundingClientRect();
655
- rMax = pickerRoot.clientWidth - 2 - rect.width ;
656
- bMax = pickerRoot.clientHeight - 2 - rect.height;
666
+ dw = rect.width;
667
+ dh = rect.height;
668
+ cx0 = rect.x + dw / 2;
669
+ cy0 = rect.y + dh / 2;
670
+ pw = pickerRoot.clientWidth;
671
+ ph = pickerRoot.clientHeight;
657
672
  dialog.classList.add('moving');
658
673
  if ( isTouch ) {
659
674
  self.addEventListener('touchmove', moveAsync, { capture: true });
@@ -787,14 +802,16 @@ const showDialog = function(details) {
787
802
  /******************************************************************************/
788
803
 
789
804
  const pausePicker = function() {
790
- pickerRoot.classList.add('paused');
805
+ dom.cl.add(pickerRoot, 'paused');
806
+ dom.cl.remove(pickerRoot, 'minimized');
791
807
  svgListening(false);
792
808
  };
793
809
 
794
810
  /******************************************************************************/
795
811
 
796
812
  const unpausePicker = function() {
797
- pickerRoot.classList.remove('paused', 'preview');
813
+ dom.cl.remove(pickerRoot, 'paused', 'preview');
814
+ dom.cl.add(pickerRoot, 'minimized');
798
815
  pickerContentPort.postMessage({
799
816
  what: 'togglePreview',
800
817
  state: false,
@@ -806,7 +823,7 @@ const unpausePicker = function() {
806
823
 
807
824
  const startPicker = function() {
808
825
  self.addEventListener('keydown', onKeyPressed, true);
809
- const svg = $stor('svg');
826
+ const svg = $stor('svg#sea');
810
827
  svg.addEventListener('click', onSvgClicked);
811
828
  svg.addEventListener('touchstart', onSvgTouch);
812
829
  svg.addEventListener('touchend', onSvgTouch);
@@ -820,6 +837,14 @@ const startPicker = function() {
820
837
  $id('preview').addEventListener('click', onPreviewClicked);
821
838
  $id('create').addEventListener('click', onCreateClicked);
822
839
  $id('pick').addEventListener('click', onPickClicked);
840
+ $id('minimize').addEventListener('click', ( ) => {
841
+ if ( dom.cl.has(pickerRoot, 'paused') === false ) {
842
+ pausePicker();
843
+ onCandidateChanged();
844
+ } else {
845
+ dom.cl.toggle(pickerRoot, 'minimized');
846
+ }
847
+ });
823
848
  $id('quit').addEventListener('click', onQuitClicked);
824
849
  $id('move').addEventListener('mousedown', onStartMoving);
825
850
  $id('move').addEventListener('touchstart', onStartMoving);
@@ -32,6 +32,7 @@ export const faIconsInit = (( ) => {
32
32
  [ 'arrow-right', { viewBox: '0 0 1472 1558', path: 'm 1472,779 q 0,54 -37,91 l -651,651 q -39,37 -91,37 -51,0 -90,-37 l -75,-75 q -38,-38 -38,-91 0,-53 38,-91 L 821,971 H 117 Q 65,971 32.5,933.5 0,896 0,843 V 715 Q 0,662 32.5,624.5 65,587 117,587 H 821 L 528,293 q -38,-36 -38,-90 0,-54 38,-90 l 75,-75 q 38,-38 90,-38 53,0 91,38 l 651,651 q 37,35 37,90 z' } ],
33
33
  [ 'bar-chart', { viewBox: '0 0 2048 1536', path: 'm 640,768 0,512 -256,0 0,-512 256,0 z m 384,-512 0,1024 -256,0 0,-1024 256,0 z m 1024,1152 0,128 L 0,1536 0,0 l 128,0 0,1408 1920,0 z m -640,-896 0,768 -256,0 0,-768 256,0 z m 384,-384 0,1152 -256,0 0,-1152 256,0 z' } ],
34
34
  [ 'bolt', { viewBox: '0 0 896 1664', path: 'm 885.08696,438 q 18,20 7,44 l -540,1157 q -13,25 -42,25 -4,0 -14,-2 -17,-5 -25.5,-19 -8.5,-14 -4.5,-30 l 197,-808 -406,101 q -4,1 -12,1 -18,0 -31,-11 Q -3.9130435,881 1.0869565,857 L 202.08696,32 q 4,-14 16,-23 12,-9 28,-9 l 328,0 q 19,0 32,12.5 13,12.5 13,29.5 0,8 -5,18 l -171,463 396,-98 q 8,-2 12,-2 19,0 34,15 z' } ],
35
+ [ 'book', { viewBox: '0 0 1664 1536', path: 'm 1639.2625,350 c 25,36 32,83 18,129 l -275,906 c -25,85 -113,151 -199,151 H 260.26251 c -102,0 -211,-81 -248,-185 -16,-45 -16,-89 -2,-127 2,-20 6,-40 7,-64 1,-16 -8,-29 -6,-41 4,-24 25,-41 41,-68 30,-50 64,-131 75,-183 5,-19 -5,-41 0,-58 5,-19 24,-33 34,-51 27,-46 62,-135 67,-182 2,-21 -8,-44 -2,-60 7,-23 29,-33 44,-53 24,-33 64,-128 70,-181 2,-17 -8,-34 -5,-52 4,-19 28,-39 44,-62 42,-62 50,-199 177,-163 l -1,3 c 17,-4 34,-9 51,-9 h 761 c 47,0 89,21 114,56 26,36 32,83 18,130 l -274,906 c -47,154 -73,188 -200,188 H 156.26251 c -13,0 -29,3 -38,15 -8,12 -9,21 -1,43 20,58 89,70 144,70 h 923 c 37,0 80,-21 91,-57 l 300,-987 c 6,-19 6,-39 5,-57 23,9 44,23 59,43 z m -1064,2 c -6,18 4,32 22,32 h 608 c 17,0 36,-14 42,-32 l 21,-64 c 6,-18 -4,-32 -22,-32 H 638.26251 c -17,0 -36,14 -42,32 z m -83,256 c -6,18 4,32 22,32 h 608 c 17,0 36,-14 42,-32 l 21,-64 c 6,-18 -4,-32 -22,-32 H 555.26251 c -17,0 -36,14 -42,32 z' } ],
35
36
  [ 'clipboard', { viewBox: '0 0 1792 1792', path: 'm 768,1664 896,0 0,-640 -416,0 q -40,0 -68,-28 -28,-28 -28,-68 l 0,-416 -384,0 0,1152 z m 256,-1440 0,-64 q 0,-13 -9.5,-22.5 Q 1005,128 992,128 l -704,0 q -13,0 -22.5,9.5 Q 256,147 256,160 l 0,64 q 0,13 9.5,22.5 9.5,9.5 22.5,9.5 l 704,0 q 13,0 22.5,-9.5 9.5,-9.5 9.5,-22.5 z m 256,672 299,0 -299,-299 0,299 z m 512,128 0,672 q 0,40 -28,68 -28,28 -68,28 l -960,0 q -40,0 -68,-28 -28,-28 -28,-68 l 0,-160 -544,0 Q 56,1536 28,1508 0,1480 0,1440 L 0,96 Q 0,56 28,28 56,0 96,0 l 1088,0 q 40,0 68,28 28,28 28,68 l 0,328 q 21,13 36,28 l 408,408 q 28,28 48,76 20,48 20,88 z' } ],
36
37
  [ 'clock-o', { viewBox: '0 0 1536 1536', path: 'm 896,416 v 448 q 0,14 -9,23 -9,9 -23,9 H 544 q -14,0 -23,-9 -9,-9 -9,-23 v -64 q 0,-14 9,-23 9,-9 23,-9 H 768 V 416 q 0,-14 9,-23 9,-9 23,-9 h 64 q 14,0 23,9 9,9 9,23 z m 416,352 q 0,-148 -73,-273 -73,-125 -198,-198 -125,-73 -273,-73 -148,0 -273,73 -125,73 -198,198 -73,125 -73,273 0,148 73,273 73,125 198,198 125,73 273,73 148,0 273,-73 125,-73 198,-198 73,-125 73,-273 z m 224,0 q 0,209 -103,385.5 Q 1330,1330 1153.5,1433 977,1536 768,1536 559,1536 382.5,1433 206,1330 103,1153.5 0,977 0,768 0,559 103,382.5 206,206 382.5,103 559,0 768,0 977,0 1153.5,103 1330,206 1433,382.5 1536,559 1536,768 Z' } ],
37
38
  [ 'cloud-download', { viewBox: '0 0 1920 1408', path: 'm 1280,800 q 0,-14 -9,-23 -9,-9 -23,-9 l -224,0 0,-352 q 0,-13 -9.5,-22.5 Q 1005,384 992,384 l -192,0 q -13,0 -22.5,9.5 Q 768,403 768,416 l 0,352 -224,0 q -13,0 -22.5,9.5 -9.5,9.5 -9.5,22.5 0,14 9,23 l 352,352 q 9,9 23,9 14,0 23,-9 l 351,-351 q 10,-12 10,-24 z m 640,224 q 0,159 -112.5,271.5 Q 1695,1408 1536,1408 l -1088,0 Q 263,1408 131.5,1276.5 0,1145 0,960 0,830 70,720 140,610 258,555 256,525 256,512 256,300 406,150 556,0 768,0 q 156,0 285.5,87 129.5,87 188.5,231 71,-62 166,-62 106,0 181,75 75,75 75,181 0,76 -41,138 130,31 213.5,135.5 Q 1920,890 1920,1024 Z' } ],
@@ -445,28 +445,17 @@ class HNTrieContainer {
445
445
  };
446
446
  }
447
447
 
448
- serialize(encoder) {
449
- if ( encoder instanceof Object ) {
450
- return encoder.encode(
451
- this.buf32.buffer,
452
- this.buf32[CHAR1_SLOT]
453
- );
454
- }
455
- return Array.from(
456
- new Uint32Array(
457
- this.buf32.buffer,
458
- 0,
459
- this.buf32[CHAR1_SLOT] + 3 >>> 2
460
- )
448
+ toSelfie() {
449
+ return this.buf32.subarray(
450
+ 0,
451
+ this.buf32[CHAR1_SLOT] + 3 >>> 2
461
452
  );
462
453
  }
463
454
 
464
- unserialize(selfie, decoder) {
455
+ fromSelfie(selfie) {
456
+ if ( selfie instanceof Uint32Array === false ) { return false; }
465
457
  this.needle = '';
466
- const shouldDecode = typeof selfie === 'string';
467
- let byteLength = shouldDecode
468
- ? decoder.decodeSize(selfie)
469
- : selfie.length << 2;
458
+ let byteLength = selfie.length << 2;
470
459
  if ( byteLength === 0 ) { return false; }
471
460
  byteLength = roundToPageSize(byteLength);
472
461
  if ( this.wasmMemory !== null ) {
@@ -477,14 +466,10 @@ class HNTrieContainer {
477
466
  this.buf = new Uint8Array(this.wasmMemory.buffer);
478
467
  this.buf32 = new Uint32Array(this.buf.buffer);
479
468
  }
480
- } else if ( byteLength > this.buf.length ) {
481
- this.buf = new Uint8Array(byteLength);
482
- this.buf32 = new Uint32Array(this.buf.buffer);
483
- }
484
- if ( shouldDecode ) {
485
- decoder.decode(selfie, this.buf.buffer);
486
- } else {
487
469
  this.buf32.set(selfie);
470
+ } else {
471
+ this.buf32 = selfie;
472
+ this.buf = new Uint8Array(this.buf32.buffer);
488
473
  }
489
474
  // https://github.com/uBlockOrigin/uBlock-issues/issues/2925
490
475
  this.buf[255] = 0;