@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
@@ -46,105 +46,6 @@ const digitToVal = new Uint8Array(128);
46
46
  }
47
47
  }
48
48
 
49
- // The sparse base64 codec is best for buffers which contains a lot of
50
- // small u32 integer values. Those small u32 integer values are better
51
- // represented with stringified integers, because small values can be
52
- // represented with fewer bits than the usual base64 codec. For example,
53
- // 0 become '0 ', i.e. 16 bits instead of 48 bits with official base64
54
- // codec.
55
-
56
- const sparseBase64 = {
57
- magic: 'Base64_1',
58
-
59
- encode: function(arrbuf, arrlen) {
60
- const inputLength = (arrlen + 3) >>> 2;
61
- const inbuf = new Uint32Array(arrbuf, 0, inputLength);
62
- const outputLength = this.magic.length + 7 + inputLength * 7;
63
- const outbuf = new Uint8Array(outputLength);
64
- // magic bytes
65
- let j = 0;
66
- for ( let i = 0; i < this.magic.length; i++ ) {
67
- outbuf[j++] = this.magic.charCodeAt(i);
68
- }
69
- // array size
70
- let v = inputLength;
71
- do {
72
- outbuf[j++] = valToDigit[v & 0b111111];
73
- v >>>= 6;
74
- } while ( v !== 0 );
75
- outbuf[j++] = 0x20 /* ' ' */;
76
- // array content
77
- for ( let i = 0; i < inputLength; i++ ) {
78
- v = inbuf[i];
79
- do {
80
- outbuf[j++] = valToDigit[v & 0b111111];
81
- v >>>= 6;
82
- } while ( v !== 0 );
83
- outbuf[j++] = 0x20 /* ' ' */;
84
- }
85
- if ( typeof TextDecoder === 'undefined' ) {
86
- return JSON.stringify(
87
- Array.from(new Uint32Array(outbuf.buffer, 0, j >>> 2))
88
- );
89
- }
90
- const textDecoder = new TextDecoder();
91
- return textDecoder.decode(new Uint8Array(outbuf.buffer, 0, j));
92
- },
93
-
94
- decode: function(instr, arrbuf) {
95
- if ( instr.charCodeAt(0) === 0x5B /* '[' */ ) {
96
- const inbuf = JSON.parse(instr);
97
- if ( arrbuf instanceof ArrayBuffer === false ) {
98
- return new Uint32Array(inbuf);
99
- }
100
- const outbuf = new Uint32Array(arrbuf);
101
- outbuf.set(inbuf);
102
- return outbuf;
103
- }
104
- if ( instr.startsWith(this.magic) === false ) {
105
- throw new Error('Invalid µBlock.base64 encoding');
106
- }
107
- const inputLength = instr.length;
108
- const outputLength = this.decodeSize(instr) >> 2;
109
- const outbuf = arrbuf instanceof ArrayBuffer === false
110
- ? new Uint32Array(outputLength)
111
- : new Uint32Array(arrbuf);
112
- let i = instr.indexOf(' ', this.magic.length) + 1;
113
- if ( i === -1 ) {
114
- throw new Error('Invalid µBlock.base64 encoding');
115
- }
116
- // array content
117
- let j = 0;
118
- for (;;) {
119
- if ( j === outputLength || i >= inputLength ) { break; }
120
- let v = 0, l = 0;
121
- for (;;) {
122
- const c = instr.charCodeAt(i++);
123
- if ( c === 0x20 /* ' ' */ ) { break; }
124
- v += digitToVal[c] << l;
125
- l += 6;
126
- }
127
- outbuf[j++] = v;
128
- }
129
- if ( i < inputLength || j < outputLength ) {
130
- throw new Error('Invalid µBlock.base64 encoding');
131
- }
132
- return outbuf;
133
- },
134
-
135
- decodeSize: function(instr) {
136
- if ( instr.startsWith(this.magic) === false ) { return 0; }
137
- let v = 0, l = 0, i = this.magic.length;
138
- for (;;) {
139
- const c = instr.charCodeAt(i++);
140
- if ( c === 0x20 /* ' ' */ ) { break; }
141
- v += digitToVal[c] << l;
142
- l += 6;
143
- }
144
- return v << 2;
145
- },
146
- };
147
-
148
49
  // The dense base64 codec is best for typed buffers which values are
149
50
  // more random. For example, buffer contents as a result of compression
150
51
  // contain less repetitive values and thus the content is more
@@ -154,7 +55,7 @@ const sparseBase64 = {
154
55
  // ArrayBuffer fails, the content of the resulting Uint8Array is
155
56
  // non-sensical. WASM-related?
156
57
 
157
- const denseBase64 = {
58
+ export const denseBase64 = {
158
59
  magic: 'DenseBase64_1',
159
60
 
160
61
  encode: function(input) {
@@ -242,5 +143,3 @@ const denseBase64 = {
242
143
  };
243
144
 
244
145
  /******************************************************************************/
245
-
246
- export { denseBase64, sparseBase64 };
@@ -74,8 +74,8 @@ const loadBenchmarkDataset = (( ) => {
74
74
  datasetPromise = undefined;
75
75
  });
76
76
 
77
- return function() {
78
- ttlTimer.offon({ min: 5 });
77
+ return async function() {
78
+ ttlTimer.offon({ min: 2 });
79
79
 
80
80
  if ( datasetPromise !== undefined ) {
81
81
  return datasetPromise;
@@ -84,7 +84,7 @@ const loadBenchmarkDataset = (( ) => {
84
84
  const datasetURL = µb.hiddenSettings.benchmarkDatasetURL;
85
85
  if ( datasetURL === 'unset' ) {
86
86
  console.info(`No benchmark dataset available.`);
87
- return Promise.resolve();
87
+ return;
88
88
  }
89
89
  console.info(`Loading benchmark dataset...`);
90
90
  datasetPromise = io.fetchText(datasetURL).then(details => {
@@ -136,7 +136,7 @@ const loadBenchmarkDataset = (( ) => {
136
136
 
137
137
  // action: 1=test
138
138
 
139
- µb.benchmarkStaticNetFiltering = async function(options = {}) {
139
+ export async function benchmarkStaticNetFiltering(options = {}) {
140
140
  const { target, redirectEngine } = options;
141
141
 
142
142
  const requests = await loadBenchmarkDataset();
@@ -231,11 +231,11 @@ const loadBenchmarkDataset = (( ) => {
231
231
  const s = output.join('\n');
232
232
  console.info(s);
233
233
  return s;
234
- };
234
+ }
235
235
 
236
236
  /******************************************************************************/
237
237
 
238
- µb.tokenHistograms = async function() {
238
+ export async function tokenHistogramsfunction() {
239
239
  const requests = await loadBenchmarkDataset();
240
240
  if ( Array.isArray(requests) === false || requests.length === 0 ) {
241
241
  console.info('No requests found to benchmark');
@@ -272,11 +272,11 @@ const loadBenchmarkDataset = (( ) => {
272
272
  const tophits = Array.from(hitTokenMap).sort(customSort).slice(0, 100);
273
273
  console.info('Misses:', JSON.stringify(topmisses));
274
274
  console.info('Hits:', JSON.stringify(tophits));
275
- };
275
+ }
276
276
 
277
277
  /******************************************************************************/
278
278
 
279
- µb.benchmarkDynamicNetFiltering = async function() {
279
+ export async function benchmarkDynamicNetFiltering() {
280
280
  const requests = await loadBenchmarkDataset();
281
281
  if ( Array.isArray(requests) === false || requests.length === 0 ) {
282
282
  console.info('No requests found to benchmark');
@@ -299,17 +299,19 @@ const loadBenchmarkDataset = (( ) => {
299
299
  const dur = t1 - t0;
300
300
  console.info(`Evaluated ${requests.length} requests in ${dur.toFixed(0)} ms`);
301
301
  console.info(`\tAverage: ${(dur / requests.length).toFixed(3)} ms per request`);
302
- };
302
+ }
303
303
 
304
304
  /******************************************************************************/
305
305
 
306
- µb.benchmarkCosmeticFiltering = async function() {
306
+ export async function benchmarkCosmeticFiltering() {
307
307
  const requests = await loadBenchmarkDataset();
308
308
  if ( Array.isArray(requests) === false || requests.length === 0 ) {
309
309
  console.info('No requests found to benchmark');
310
310
  return;
311
311
  }
312
- console.info('Benchmarking cosmeticFilteringEngine.retrieveSpecificSelectors()...');
312
+ const output = [
313
+ 'Benchmarking cosmeticFilteringEngine.retrieveSpecificSelectors()...',
314
+ ];
313
315
  const details = {
314
316
  tabId: undefined,
315
317
  frameId: undefined,
@@ -320,6 +322,7 @@ const loadBenchmarkDataset = (( ) => {
320
322
  const options = {
321
323
  noSpecificCosmeticFiltering: false,
322
324
  noGenericCosmeticFiltering: false,
325
+ dontInject: true,
323
326
  };
324
327
  let count = 0;
325
328
  const t0 = performance.now();
@@ -334,19 +337,26 @@ const loadBenchmarkDataset = (( ) => {
334
337
  }
335
338
  const t1 = performance.now();
336
339
  const dur = t1 - t0;
337
- console.info(`Evaluated ${count} requests in ${dur.toFixed(0)} ms`);
338
- console.info(`\tAverage: ${(dur / count).toFixed(3)} ms per request`);
339
- };
340
+ output.push(
341
+ `Evaluated ${count} retrieval in ${dur.toFixed(0)} ms`,
342
+ `\tAverage: ${(dur / count).toFixed(3)} ms per document`
343
+ );
344
+ const s = output.join('\n');
345
+ console.info(s);
346
+ return s;
347
+ }
340
348
 
341
349
  /******************************************************************************/
342
350
 
343
- µb.benchmarkScriptletFiltering = async function() {
351
+ export async function benchmarkScriptletFiltering() {
344
352
  const requests = await loadBenchmarkDataset();
345
353
  if ( Array.isArray(requests) === false || requests.length === 0 ) {
346
354
  console.info('No requests found to benchmark');
347
355
  return;
348
356
  }
349
- console.info('Benchmarking scriptletFilteringEngine.retrieve()...');
357
+ const output = [
358
+ 'Benchmarking scriptletFilteringEngine.retrieve()...',
359
+ ];
350
360
  const details = {
351
361
  domain: '',
352
362
  entity: '',
@@ -369,13 +379,18 @@ const loadBenchmarkDataset = (( ) => {
369
379
  }
370
380
  const t1 = performance.now();
371
381
  const dur = t1 - t0;
372
- console.info(`Evaluated ${count} requests in ${dur.toFixed(0)} ms`);
373
- console.info(`\tAverage: ${(dur / count).toFixed(3)} ms per request`);
374
- };
382
+ output.push(
383
+ `Evaluated ${count} retrieval in ${dur.toFixed(0)} ms`,
384
+ `\tAverage: ${(dur / count).toFixed(3)} ms per document`
385
+ );
386
+ const s = output.join('\n');
387
+ console.info(s);
388
+ return s;
389
+ }
375
390
 
376
391
  /******************************************************************************/
377
392
 
378
- µb.benchmarkOnBeforeRequest = async function() {
393
+ export async function benchmarkOnBeforeRequest() {
379
394
  const requests = await loadBenchmarkDataset();
380
395
  if ( Array.isArray(requests) === false || requests.length === 0 ) {
381
396
  console.info('No requests found to benchmark');
@@ -417,6 +432,6 @@ const loadBenchmarkDataset = (( ) => {
417
432
  console.info(`\tBlocked ${blockCount} requests`);
418
433
  console.info(`\tAverage: ${(dur / requests.length).toFixed(3)} ms per request`);
419
434
  });
420
- };
435
+ }
421
436
 
422
437
  /******************************************************************************/
@@ -576,34 +576,19 @@ class BidiTrieContainer {
576
576
  };
577
577
  }
578
578
 
579
- serialize(encoder) {
580
- if ( encoder instanceof Object ) {
581
- return encoder.encode(
582
- this.buf32.buffer,
583
- this.buf32[CHAR1_SLOT]
584
- );
585
- }
586
- return Array.from(
587
- new Uint32Array(
588
- this.buf32.buffer,
589
- 0,
590
- this.buf32[CHAR1_SLOT] + 3 >>> 2
591
- )
579
+ toSelfie() {
580
+ return this.buf32.subarray(
581
+ 0,
582
+ this.buf32[CHAR1_SLOT] + 3 >>> 2
592
583
  );
593
584
  }
594
585
 
595
- unserialize(selfie, decoder) {
596
- const shouldDecode = typeof selfie === 'string';
597
- let byteLength = shouldDecode
598
- ? decoder.decodeSize(selfie)
599
- : selfie.length << 2;
586
+ fromSelfie(selfie) {
587
+ if ( selfie instanceof Uint32Array === false ) { return false; }
588
+ let byteLength = selfie.length << 2;
600
589
  if ( byteLength === 0 ) { return false; }
601
590
  this.reallocateBuf(byteLength);
602
- if ( shouldDecode ) {
603
- decoder.decode(selfie, this.buf8.buffer);
604
- } else {
605
- this.buf32.set(selfie);
606
- }
591
+ this.buf32.set(selfie);
607
592
  return true;
608
593
  }
609
594
 
@@ -19,9 +19,7 @@
19
19
  Home: https://github.com/gorhill/uBlock
20
20
  */
21
21
 
22
- /* globals browser */
23
-
24
- 'use strict';
22
+ import webext from './webext.js';
25
23
 
26
24
  /******************************************************************************/
27
25
 
@@ -47,7 +45,7 @@ export async function broadcastToAll(message) {
47
45
  });
48
46
  const bcmessage = Object.assign({ broadcast: true }, message);
49
47
  for ( const tab of tabs ) {
50
- browser.tabs.sendMessage(tab.id, bcmessage);
48
+ webext.tabs.sendMessage(tab.id, bcmessage).catch(( ) => { });
51
49
  }
52
50
  }
53
51