@whotracksme/reporting 12.1.5 β†’ 12.1.6

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 (42) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/communication/package.json +1 -1
  3. package/communication/src/padding.js +0 -2
  4. package/eslint.config.js +34 -0
  5. package/package.json +5 -3
  6. package/reporting/package.json +3 -3
  7. package/reporting/src/alive-message-generator.js +1 -1
  8. package/reporting/src/doublefetch-page-handler.js +2 -2
  9. package/reporting/src/duplicate-detector.js +1 -3
  10. package/reporting/src/hash-detector-v2/index.js +1 -1
  11. package/reporting/src/http.js +2 -3
  12. package/reporting/src/md5.js +0 -1
  13. package/reporting/src/nav-tracking-detector.js +2 -2
  14. package/reporting/src/network.js +1 -1
  15. package/reporting/src/page-aggregator.js +1 -1
  16. package/reporting/src/page-quorum-check-handler.js +1 -1
  17. package/reporting/src/page-structure.js +1 -1
  18. package/reporting/src/pagedb.js +1 -1
  19. package/reporting/src/pages.js +2 -2
  20. package/reporting/src/patterns-updater.js +1 -1
  21. package/reporting/src/patterns.js +11 -11
  22. package/reporting/src/popularity-estimator.js +1 -1
  23. package/reporting/src/random.js +0 -2
  24. package/reporting/src/request/index.js +0 -1
  25. package/reporting/src/request/utils/time.js +5 -22
  26. package/reporting/src/sanitizer.js +1 -1
  27. package/reporting/src/search-extractor.js +2 -5
  28. package/reporting/src/url-cleaner.js +9 -6
  29. package/reporting/src/utils/url.js +2 -2
  30. package/reporting/test/duplicate-detector.spec.js +0 -1
  31. package/reporting/test/pages.spec.js +1 -1
  32. package/reporting/test/patterns-updater.spec.js +1 -1
  33. package/reporting/test/patterns.spec.js +1 -1
  34. package/reporting/test/popularity-estimator.spec.js +6 -0
  35. package/reporting/test/request/index.test.js +0 -1
  36. package/reporting/test/search-extractor.spec.js +1 -1
  37. package/reporting/test/seq-executor.spec.js +2 -2
  38. package/reporting/test/url-cleaner.spec.js +21 -0
  39. package/reporting/test/utils/url.spec.js +0 -1
  40. package/reporting/test/utils.spec.js +1 -1
  41. package/.eslintignore +0 -4
  42. package/.eslintrc +0 -16
package/CHANGELOG.md CHANGED
@@ -1,3 +1,25 @@
1
+ # v12.1.6 (Mon Oct 12 2026)
2
+
3
+ #### πŸ› Bug Fix
4
+
5
+ - Fixed: removeQueryParams incorrectly replaced parts of the fragment [#247](https://github.com/whotracksme/webextension-packages/pull/247) ([@philipp-classen](https://github.com/philipp-classen))
6
+
7
+ #### 🏠 Internal
8
+
9
+ - Update remaining dependencies [#245](https://github.com/whotracksme/webextension-packages/pull/245) ([@philipp-classen](https://github.com/philipp-classen))
10
+ - Upgrade eslint from 8.x to 10.12.0 [#244](https://github.com/whotracksme/webextension-packages/pull/244) ([@philipp-classen](https://github.com/philipp-classen))
11
+ - Simplification: getTime [#243](https://github.com/whotracksme/webextension-packages/pull/243) ([@philipp-classen](https://github.com/philipp-classen))
12
+
13
+ #### πŸ§ͺ Tests
14
+
15
+ - Fix flakey test [#246](https://github.com/whotracksme/webextension-packages/pull/246) ([@philipp-classen](https://github.com/philipp-classen))
16
+
17
+ #### Authors: 1
18
+
19
+ - Philipp Claßen ([@philipp-classen](https://github.com/philipp-classen))
20
+
21
+ ---
22
+
1
23
  # v12.1.5 (Mon Oct 12 2026)
2
24
 
3
25
  #### πŸ› Bug Fix
@@ -25,7 +25,7 @@
25
25
  "rollup-plugin-polyfill-node": "^0.13.0",
26
26
  "rollup-plugin-sourcemaps": "^0.6.3",
27
27
  "sinon": "^22.1.0",
28
- "web-ext": "^8.10.0"
28
+ "web-ext": "^10.7.0"
29
29
  },
30
30
  "dependencies": {
31
31
  "pako": "^3.0.2"
@@ -9,8 +9,6 @@
9
9
  * file, You can obtain one at http://mozilla.org/MPL/2.0
10
10
  */
11
11
 
12
- /* eslint-disable no-bitwise */
13
-
14
12
  import { inflate, deflate } from './zlib.js';
15
13
  import { TooBigMsgError } from './errors.js';
16
14
 
@@ -0,0 +1,34 @@
1
+ import js from '@eslint/js';
2
+ import globals from 'globals';
3
+ import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
4
+
5
+ const jsFilesOnly = (config) => ({ ...config, files: ['**/*.js'] });
6
+
7
+ export default [
8
+ {
9
+ // keep the lint scope at **/*.js (flat config would also collect .mjs/.cjs)
10
+ ignores: [
11
+ '**/*.bundle.js',
12
+ '**/trackers-preview-generated.js',
13
+ '**/scripts/**/*.js',
14
+ 'reporting/example/offscreen/**',
15
+ '**/*.mjs',
16
+ '**/*.cjs',
17
+ ],
18
+ },
19
+ jsFilesOnly({
20
+ languageOptions: {
21
+ ecmaVersion: 2022,
22
+ sourceType: 'module',
23
+ globals: {
24
+ ...globals.es2022,
25
+ ...globals.browser,
26
+ ...globals.serviceworker,
27
+ ...globals.webextensions,
28
+ ...globals.mocha,
29
+ },
30
+ },
31
+ }),
32
+ jsFilesOnly(js.configs.recommended),
33
+ jsFilesOnly(eslintPluginPrettierRecommended),
34
+ ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whotracksme/reporting",
3
- "version": "12.1.5",
3
+ "version": "12.1.6",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  "./sanitizer": "./reporting/src/sanitizer.js",
@@ -38,10 +38,12 @@
38
38
  "communication"
39
39
  ],
40
40
  "devDependencies": {
41
- "auto": "^11.3.0",
42
- "eslint": "^8.8.0",
41
+ "@eslint/js": "^10.0.1",
42
+ "auto": "^11.3.6",
43
+ "eslint": "^10.12.0",
43
44
  "eslint-config-prettier": "^10.1.8",
44
45
  "eslint-plugin-prettier": "^5.5.6",
46
+ "globals": "^17.13.0",
45
47
  "prettier": "3.9.9"
46
48
  },
47
49
  "dependencies": {
@@ -35,7 +35,7 @@
35
35
  "karma-rollup-preprocessor": "^7.0.8",
36
36
  "karma-sinon": "^1.0.5",
37
37
  "mocha": "^12.0.3",
38
- "puppeteer-core": "^24.42.0",
38
+ "puppeteer-core": "^25.12.0",
39
39
  "rollup": "^4.64.2",
40
40
  "rollup-plugin-copy": "^3.5.0",
41
41
  "rollup-plugin-polyfill-node": "^0.13.0",
@@ -43,8 +43,8 @@
43
43
  "sinon": "^22.1.0",
44
44
  "sinon-chai": "^4.0.1",
45
45
  "sinon-chrome": "^3.0.1",
46
- "web-ext": "^8.2.0",
47
- "webdriverio": "^9.27.0",
46
+ "web-ext": "^10.7.0",
47
+ "webdriverio": "^10.0.0",
48
48
  "ws": "^8.22.0"
49
49
  },
50
50
  "dependencies": {
@@ -154,7 +154,7 @@ export default class AliveMessageGenerator {
154
154
  return !!(
155
155
  this.navigatorApi.brave && (await this.navigatorApi.brave.isBrave())
156
156
  );
157
- } catch (e) {
157
+ } catch {
158
158
  return false;
159
159
  }
160
160
  }
@@ -53,7 +53,7 @@ export function toTrustedUrl(url, { baseUrl, log, logWarn }) {
53
53
  let from;
54
54
  try {
55
55
  from = new URL(baseUrl);
56
- } catch (e) {
56
+ } catch {
57
57
  logWarn('Invalid baseUrl (possible but unexpected):', baseUrl);
58
58
  return null;
59
59
  }
@@ -61,7 +61,7 @@ export function toTrustedUrl(url, { baseUrl, log, logWarn }) {
61
61
  let to;
62
62
  try {
63
63
  to = new URL(url, baseUrl);
64
- } catch (e) {
64
+ } catch {
65
65
  log('Ignore invalid url:', url);
66
66
  return null;
67
67
  }
@@ -149,9 +149,7 @@ function extractPath(obj, path, pos = 0) {
149
149
  */
150
150
  export function computeDeduplicationKey({ body, deduplicateBy = '' }) {
151
151
  let keys = body.payload;
152
- if (!deduplicateBy) {
153
- keys = body.payload;
154
- } else {
152
+ if (deduplicateBy) {
155
153
  keys = deduplicateBy
156
154
  .split(',')
157
155
  .map((path) => extractPath(body.payload, path.split('.'), 0).value);
@@ -52,7 +52,7 @@ export class HashProb {
52
52
  if (str.includes('%') && RE_PERCENT_ENCODED.test(str)) {
53
53
  try {
54
54
  str = decodeURIComponent(str);
55
- } catch (e) {
55
+ } catch {
56
56
  /* keep original */
57
57
  }
58
58
  if (str.length < 6) {
@@ -200,7 +200,6 @@ function headerOverrideViaWebRequestAPI({ url, headers, requestType }) {
200
200
  const headerNames = Object.keys(headers);
201
201
  const normalizedHeaders = headerNames.map((x) => x.toLowerCase());
202
202
 
203
- /* eslint-disable no-param-reassign */
204
203
  details.requestHeaders = details.requestHeaders.filter(
205
204
  (header) => !normalizedHeaders.includes(header.name.toLowerCase()),
206
205
  );
@@ -837,7 +836,7 @@ async function anonymousHttpGet_(originalUrl, params = {}) {
837
836
  'extraHeaders', // Note: needed for Chromium, but will be rejected by Firefox
838
837
  ],
839
838
  );
840
- } catch (e) {
839
+ } catch {
841
840
  chrome.webRequest.onBeforeSendHeaders.addListener(
842
841
  onBeforeSendHeaders,
843
842
  { urls: matchedUrls },
@@ -878,7 +877,7 @@ async function anonymousHttpGet_(originalUrl, params = {}) {
878
877
  'extraHeaders', // Note: needed for Chromium, but will be rejected by Firefox
879
878
  ],
880
879
  );
881
- } catch (e) {
880
+ } catch {
882
881
  chrome.webRequest.onHeadersReceived.addListener(
883
882
  onHeadersReceived,
884
883
  { urls: matchedUrls },
@@ -15,7 +15,6 @@ import MapCache from './fixed-size-cache.js';
15
15
  * Largely based on js-md5 (https://github.com/emn178/js-md5)
16
16
  * by Chen, Yi-Cyuan [emn178@gmail.com]
17
17
  */
18
- /* eslint-disable no-mixed-operators, no-bitwise, no-plusplus */
19
18
 
20
19
  const state = new Int32Array(4);
21
20
  const buffer = new ArrayBuffer(68);
@@ -19,7 +19,7 @@ const SECOND = 1000;
19
19
  function tryParseHostname(url) {
20
20
  try {
21
21
  return new URL(url).host;
22
- } catch (e) {
22
+ } catch {
23
23
  return null;
24
24
  }
25
25
  }
@@ -28,7 +28,7 @@ function hasQueryParams(url, params) {
28
28
  try {
29
29
  const { searchParams } = new URL(url);
30
30
  return params.every((key) => searchParams.has(key));
31
- } catch (e) {
31
+ } catch {
32
32
  return false;
33
33
  }
34
34
  }
@@ -285,7 +285,7 @@ export class DnsResolver {
285
285
  }
286
286
  try {
287
287
  return new URL(url).hostname;
288
- } catch (e) {
288
+ } catch {
289
289
  return null;
290
290
  }
291
291
  }
@@ -149,7 +149,7 @@ export default class PageAggregator {
149
149
  logger.debug('Creating', jobs.length, 'jobs for expired pages:', jobs);
150
150
  await this.jobScheduler.registerJobs(jobs);
151
151
  numJobsCreated += expiredPages.length;
152
- } catch (e) {
152
+ } catch {
153
153
  logger.error('Failed to register jobs:', jobs.length, 'jobs were lost');
154
154
  logger.debug('Lost jobs:', jobs);
155
155
  return { numJobsCreated };
@@ -144,7 +144,7 @@ export default class PageQuorumCheckHandler {
144
144
  : url;
145
145
  try {
146
146
  return [url, new URL(normalizedUrl)];
147
- } catch (e) {
147
+ } catch {
148
148
  throw new BadJobError(
149
149
  `Failed to parse URL (url=${url}, normalizedUrl=${normalizedUrl})`,
150
150
  );
@@ -166,7 +166,7 @@ export async function analyzePageStructure(doc) {
166
166
  // 2) some websites use arrays, some split it across multiple scripts
167
167
  // ==> everything becomes an array
168
168
  parsedJson = Array.isArray(parsedJson) ? parsedJson : [parsedJson];
169
- } catch (e) {
169
+ } catch {
170
170
  continue; // ignore broken JSON
171
171
  }
172
172
  for (const json of parsedJson) {
@@ -28,7 +28,7 @@ function normalizeUrl(url) {
28
28
  const tmp = new URL(url);
29
29
  tmp.hash = '';
30
30
  return tmp.toString();
31
- } catch (e) {
31
+ } catch {
32
32
  // It is not necessarily a bug this code path hits, but ideally
33
33
  // invalid URLs should have been filtered already.
34
34
  logger.warn('Bad URL detected:', url, '(ignore this page and continue)');
@@ -102,7 +102,7 @@ function isRealPage(url) {
102
102
  function sameHostname(url1, url2) {
103
103
  try {
104
104
  return new URL(url1).hostname === new URL(url2).hostname;
105
- } catch (e) {
105
+ } catch {
106
106
  return false;
107
107
  }
108
108
  }
@@ -880,7 +880,7 @@ export default class Pages {
880
880
  { urls: ['<all_urls>'] },
881
881
  ['responseHeaders'],
882
882
  );
883
- } catch (e) {
883
+ } catch {
884
884
  this.chrome.webRequest[type].addListener(handler, {
885
885
  urls: ['<all_urls>'],
886
886
  });
@@ -113,7 +113,7 @@ export default class PatternsUpdater {
113
113
  );
114
114
  force = true;
115
115
  }
116
- } catch (e) {
116
+ } catch {
117
117
  logger.warn(
118
118
  'Failed to load cached patterns from disk. Forcing an update.',
119
119
  );
@@ -118,7 +118,7 @@ const TRANSFORMS = new Map(
118
118
  // we only need the query parameter, but to handle relative
119
119
  // URLs we have to pass a base URL (any domain will work)
120
120
  return new URL(url, 'http://x').searchParams.get(queryParam);
121
- } catch (e) {
121
+ } catch {
122
122
  return null;
123
123
  }
124
124
  },
@@ -185,7 +185,7 @@ const TRANSFORMS = new Map(
185
185
  requireString(url);
186
186
  try {
187
187
  return sanitizeUrl(url).safeUrl;
188
- } catch (e) {
188
+ } catch {
189
189
  return null;
190
190
  }
191
191
  },
@@ -204,7 +204,7 @@ const TRANSFORMS = new Map(
204
204
  requireString(url);
205
205
  try {
206
206
  return sanitizeUrl(url, { strict: true }).safeUrl;
207
- } catch (e) {
207
+ } catch {
208
208
  return null;
209
209
  }
210
210
  },
@@ -219,7 +219,7 @@ const TRANSFORMS = new Map(
219
219
  try {
220
220
  return sanitizeUrl(url, { strict: false, tryPreservePath: true })
221
221
  .safeUrl;
222
- } catch (e) {
222
+ } catch {
223
223
  return null;
224
224
  }
225
225
  },
@@ -257,7 +257,7 @@ const TRANSFORMS = new Map(
257
257
  requireString(text);
258
258
  try {
259
259
  return decodeURIComponent(text);
260
- } catch (e) {
260
+ } catch {
261
261
  return null;
262
262
  }
263
263
  },
@@ -269,7 +269,7 @@ const TRANSFORMS = new Map(
269
269
  requireString(text);
270
270
  try {
271
271
  return decodeURIComponent(text);
272
- } catch (e) {
272
+ } catch {
273
273
  return text;
274
274
  }
275
275
  },
@@ -308,7 +308,7 @@ const TRANSFORMS = new Map(
308
308
  }
309
309
  // prevent uncontrolled text extraction
310
310
  return '';
311
- } catch (e) {
311
+ } catch {
312
312
  return '';
313
313
  }
314
314
  },
@@ -338,7 +338,7 @@ const TRANSFORMS = new Map(
338
338
  }
339
339
  try {
340
340
  return text.replace(new RegExp(pattern), '');
341
- } catch (e) {
341
+ } catch {
342
342
  return '';
343
343
  }
344
344
  },
@@ -360,7 +360,7 @@ const TRANSFORMS = new Map(
360
360
  }
361
361
  try {
362
362
  return text.replaceAll(new RegExp(pattern, 'g'), '');
363
- } catch (e) {
363
+ } catch {
364
364
  return '';
365
365
  }
366
366
  },
@@ -384,7 +384,7 @@ const TRANSFORMS = new Map(
384
384
  try {
385
385
  const m = new RegExp(pattern).exec(text);
386
386
  return m ? m[0] : '';
387
- } catch (e) {
387
+ } catch {
388
388
  return '';
389
389
  }
390
390
  },
@@ -435,7 +435,7 @@ const TRANSFORMS = new Map(
435
435
  // "match" is slightly faster for non-empty-matching patterns
436
436
  const matches = text.match(regexp);
437
437
  return matches ? matches.join('') : '';
438
- } catch (e) {
438
+ } catch {
439
439
  return '';
440
440
  }
441
441
  },
@@ -558,7 +558,7 @@ export default class PopularityEstimator {
558
558
  const allJobs = jobBatchesPerRotation.flat();
559
559
  try {
560
560
  await this.jobScheduler.registerJobs(allJobs);
561
- } catch (e) {
561
+ } catch {
562
562
  logger.error('Failed to register jobs. These were lost:', allJobs);
563
563
  }
564
564
  }
@@ -9,8 +9,6 @@
9
9
  * file, You can obtain one at http://mozilla.org/MPL/2.0
10
10
  */
11
11
 
12
- /* eslint-disable no-bitwise */
13
-
14
12
  // Random float in the interval [0, 1]
15
13
  export default function random() {
16
14
  return random53Bit() / 2 ** 53;
@@ -11,7 +11,6 @@
11
11
 
12
12
  import Bowser from 'bowser';
13
13
 
14
- /* eslint-disable no-param-reassign */
15
14
  import { isLocalIP } from '../network.js';
16
15
  import Config from './config.js';
17
16
  import Database from './database.js';
@@ -9,32 +9,15 @@
9
9
  * file, You can obtain one at http://mozilla.org/MPL/2.0
10
10
  */
11
11
 
12
- /* eslint prefer-template: 'off' */
13
-
14
- // this is the sanitised timestamp retrieved from humanweb.
15
- let hwTs = null;
16
-
17
12
  /** Get datetime string of the current hour in the format YYYYMMDDHH
18
13
  */
19
14
  export function getTime() {
20
15
  const date = new Date();
21
- const ts = hwTs;
22
- let _ts;
23
- let h = null;
24
- if (!ts) {
25
- let d = null;
26
- let m = null;
27
- let y = null;
28
- d = (date.getDate() < 10 ? '0' : '') + date.getDate();
29
- m = (date.getMonth() < 9 ? '0' : '') + parseInt(date.getMonth() + 1, 10);
30
- h = (date.getUTCHours() < 10 ? '0' : '') + date.getUTCHours();
31
- y = date.getFullYear();
32
- _ts = y + '' + m + '' + d + '' + h;
33
- } else {
34
- h = (date.getUTCHours() < 10 ? '0' : '') + date.getUTCHours();
35
- _ts = ts + '' + h;
36
- }
37
- return _ts;
16
+ const d = (date.getDate() < 10 ? '0' : '') + date.getDate();
17
+ const m = (date.getMonth() < 9 ? '0' : '') + (date.getMonth() + 1);
18
+ const y = date.getFullYear();
19
+ const h = (date.getUTCHours() < 10 ? '0' : '') + date.getUTCHours();
20
+ return `${y}${m}${d}${h}`;
38
21
  }
39
22
 
40
23
  export function newUTCDate() {
@@ -215,7 +215,7 @@ export function checkSuspiciousQuery(query) {
215
215
  function tryParseUrl(url) {
216
216
  try {
217
217
  return new URL(url);
218
- } catch (e) {
218
+ } catch {
219
219
  return null;
220
220
  }
221
221
  }
@@ -9,8 +9,6 @@
9
9
  * file, You can obtain one at http://mozilla.org/MPL/2.0
10
10
  */
11
11
 
12
- /* eslint-disable no-continue */
13
-
14
12
  import logger from './logger';
15
13
  import parseHtml from './html-parser';
16
14
  import { fastHash } from './utils';
@@ -259,7 +257,6 @@ export default class SearchExtractor {
259
257
  // "requiredKeys" property. If not specified, all keys of the array entry need
260
258
  // to be present; otherwise, the entry will be skipped.
261
259
  const messages = [];
262
- // eslint-disable-line no-labels, no-restricted-syntax
263
260
  nextaction: for (const [action, schema] of Object.entries(output)) {
264
261
  const payload = {};
265
262
  for (const {
@@ -277,7 +274,7 @@ export default class SearchExtractor {
277
274
  if (input[source].first) {
278
275
  // case 1: single extracted value
279
276
  if (!optional && !isPresent(found[source][key])) {
280
- continue nextaction; // eslint-disable-line no-labels
277
+ continue nextaction;
281
278
  }
282
279
  payload[key] = found[source][key] ?? null;
283
280
  } else if (input[source].all) {
@@ -298,7 +295,7 @@ export default class SearchExtractor {
298
295
  required.every((x) => isPresent(entry[x]));
299
296
  const cleanedResults = results.filter(allFieldsPresent);
300
297
  if (cleanedResults.length === 0 && !optional) {
301
- continue nextaction; // eslint-disable-line no-labels
298
+ continue nextaction;
302
299
  }
303
300
  payload[key] = { ...cleanedResults };
304
301
  } else {
@@ -25,11 +25,14 @@ export function removeQueryParams(url, queryParams) {
25
25
  if (searchStart === -1) {
26
26
  return url;
27
27
  }
28
- const searchEnd = url.indexOf('#', searchStart + 1);
29
- const search =
30
- searchEnd === -1
31
- ? url.slice(searchStart + 1)
32
- : url.slice(searchStart + 1, searchEnd);
28
+
29
+ const hashStart = url.indexOf('#');
30
+ const searchEnd = hashStart === -1 ? url.length : hashStart;
31
+ if (searchStart > searchEnd) {
32
+ return url;
33
+ }
34
+
35
+ const search = url.slice(searchStart + 1, searchEnd);
33
36
  if (!search) {
34
37
  return url;
35
38
  }
@@ -38,7 +41,7 @@ export function removeQueryParams(url, queryParams) {
38
41
  .filter((x) => !queryParams.includes(split0(x, '=')));
39
42
  const beforeSearch = url.slice(0, searchStart);
40
43
 
41
- const hash = searchEnd === -1 ? '' : url.slice(searchEnd);
44
+ const hash = url.slice(searchEnd);
42
45
  if (parts.length === 0) {
43
46
  return beforeSearch + hash;
44
47
  } else {
@@ -28,7 +28,7 @@ export function parse(url) {
28
28
  try {
29
29
  const parsed = new ImmutableURL(url);
30
30
  return parsed;
31
- } catch (e) {
31
+ } catch {
32
32
  return null;
33
33
  }
34
34
  }
@@ -51,7 +51,7 @@ function tryDecode(fn) {
51
51
 
52
52
  try {
53
53
  return fn(url);
54
- } catch (e) {
54
+ } catch {
55
55
  return url;
56
56
  }
57
57
  };
@@ -22,7 +22,6 @@ function getUniqueId() {
22
22
  return getUniqueId.uniqueId;
23
23
  }
24
24
 
25
- /* eslint-disable no-param-reassign */
26
25
  function mkMessage({ action = 'test-action', payload, deduplicateBy } = {}) {
27
26
  payload = payload || {
28
27
  testFieldWithSeq: `test-field-${getUniqueId()}`,
@@ -424,7 +424,7 @@ describe('#Pages', function () {
424
424
  try {
425
425
  expect(actual).to.eql(expectedPageEvent);
426
426
  return true;
427
- } catch (e) {
427
+ } catch {
428
428
  return false;
429
429
  }
430
430
  };
@@ -360,7 +360,7 @@ describe('#PatternsUpdater', function () {
360
360
  let detected = false;
361
361
  try {
362
362
  await uut.update({ now: ts, ignoreErrors: false });
363
- } catch (e) {
363
+ } catch {
364
364
  detected = true;
365
365
  }
366
366
  expect(detected).to.equal(true);
@@ -1074,7 +1074,7 @@ describe('Test builtin primitives', function () {
1074
1074
  let expected = '';
1075
1075
  try {
1076
1076
  expected = (text.match(new RegExp(pattern, 'g')) || []).join('');
1077
- } catch (e) {
1077
+ } catch {
1078
1078
  // invalid regular expression: expect the value to be cleared
1079
1079
  }
1080
1080
  expect(uut(text, pattern)).to.eql(expected);
@@ -91,6 +91,12 @@ describe('#PopularityEstimator', function () {
91
91
  const _jobsRegistered = jobsRegistered;
92
92
 
93
93
  jobScheduler = createInMemoryJobScheduler();
94
+
95
+ // Guarantees that we see "jobRegistered" events.
96
+ // (We are not clearing the queues by processing the jobs; so once the
97
+ // global job limit is reached, new jobs would be rejected.)
98
+ jobScheduler.globalJobLimit = Infinity;
99
+
94
100
  jobScheduler.addObserver('jobRegistered', (job) => {
95
101
  // Nasty pitfall: it would be nice to run assertions here, but they
96
102
  // will not be visible in the console when the user runs them.
@@ -388,7 +388,6 @@ describe('RequestReporter', function () {
388
388
 
389
389
  async function processRunloopUntil(timeout) {
390
390
  const start = Date.now();
391
- // eslint-disable-next-line no-constant-condition
392
391
  while (true) {
393
392
  const now = await clock.runToLast();
394
393
  if (now - start > timeout) {
@@ -121,7 +121,7 @@ describe('#SearchExtractor', function () {
121
121
  } finally {
122
122
  try {
123
123
  mockWindow?.close();
124
- } catch (e) {
124
+ } catch {
125
125
  // ignore
126
126
  }
127
127
  }
@@ -52,7 +52,7 @@ describe('#SeqExecutor', function () {
52
52
  await uut.run(() => {
53
53
  throw new Error(2);
54
54
  });
55
- } catch (e) {
55
+ } catch {
56
56
  gotError2 = true;
57
57
  }
58
58
  if (!gotError2) {
@@ -66,7 +66,7 @@ describe('#SeqExecutor', function () {
66
66
  await uut.run(async () => {
67
67
  throw new Error(4);
68
68
  });
69
- } catch (e) {
69
+ } catch {
70
70
  gotError4 = true;
71
71
  }
72
72
  if (!gotError4) {
@@ -26,6 +26,27 @@ describe('#removeQueryParams', function () {
26
26
  removeQueryParams('https://example.test/path?foo=1&bar=2#baz', ['foo']),
27
27
  ).to.eql('https://example.test/path?bar=2#baz');
28
28
  });
29
+
30
+ it('should not treat a "?" in the fragment as a query', function () {
31
+ expect(removeQueryParams('https://example.test/#?foo=1', ['foo'])).to.eql(
32
+ 'https://example.test/#?foo=1',
33
+ );
34
+ expect(
35
+ removeQueryParams('https://example.test/#/path?foo=1&bar=2', ['foo']),
36
+ ).to.eql('https://example.test/#/path?foo=1&bar=2');
37
+ expect(removeQueryParams('https://example.test/#?&', [''])).to.eql(
38
+ 'https://example.test/#?&',
39
+ );
40
+ expect(
41
+ removeQueryParams('https://example.test/?foo=1#?foo=1', ['foo']),
42
+ ).to.eql('https://example.test/#?foo=1');
43
+ });
44
+
45
+ it('should support complex examples with "?" and "#" appearing again in the fragment', function () {
46
+ expect(
47
+ removeQueryParams('https://example.test/a?b#c?d#e', ['b', 'c', 'd']),
48
+ ).to.eql('https://example.test/a#c?d#e');
49
+ });
29
50
  });
30
51
 
31
52
  describe('should handle non-valid URLs gracefully', function () {
@@ -514,7 +514,6 @@ const keyValueTestCases = [
514
514
 
515
515
  function fillInSpec(spec) {
516
516
  Object.keys(emptyParts).forEach(function (k) {
517
- // eslint-disable-next-line no-param-reassign
518
517
  spec[k] = spec[k] || emptyParts[k];
519
518
  });
520
519
  return spec;
@@ -357,7 +357,7 @@ describe('#lazyInitAsync', function () {
357
357
  for (let i = 0; i < 3; i += 1) {
358
358
  try {
359
359
  await Promise.all([x(), x(), x()]);
360
- } catch (e) {
360
+ } catch {
361
361
  // expected to throw
362
362
  }
363
363
  }
package/.eslintignore DELETED
@@ -1,4 +0,0 @@
1
- **/*.bundle.js
2
- **/trackers-preview-generated.js
3
- **/scripts/**/*.js
4
- reporting/example/offscreen/**
package/.eslintrc DELETED
@@ -1,16 +0,0 @@
1
- {
2
- "env": {
3
- "es2022": true,
4
- "browser": true,
5
- "serviceworker": true,
6
- "webextensions": true,
7
- "mocha": true
8
- },
9
- "extends": [
10
- "eslint:recommended",
11
- "plugin:prettier/recommended"
12
- ],
13
- "parserOptions": {
14
- "sourceType": "module"
15
- }
16
- }