@whotracksme/reporting 5.1.25 β†’ 5.1.26

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 (43) hide show
  1. package/.github/workflows/tests.yml +3 -1
  2. package/CHANGELOG.md +16 -0
  3. package/package.json +3 -2
  4. package/reporting/karma.conf.cjs +2 -0
  5. package/reporting/package.json +2 -1
  6. package/reporting/src/bloom-filters.js +4 -4
  7. package/reporting/src/fixed-size-cache.js +1 -1
  8. package/reporting/src/logger.js +0 -1
  9. package/reporting/src/md5.js +1 -1
  10. package/reporting/src/network.js +1 -1
  11. package/reporting/src/pages.js +84 -21
  12. package/reporting/src/persisted-bitarray.js +2 -2
  13. package/reporting/src/request/config.js +2 -2
  14. package/reporting/src/request/hash.js +2 -2
  15. package/reporting/src/request/index.js +28 -28
  16. package/reporting/src/request/page-telemetry.js +2 -2
  17. package/reporting/src/request/qs-whitelist2.js +3 -3
  18. package/reporting/src/request/steps/cookie-context.js +6 -6
  19. package/reporting/src/request/steps/oauth-detector.js +3 -3
  20. package/reporting/src/request/steps/page-logger.js +2 -1
  21. package/reporting/src/request/steps/redirect-tagger.js +1 -1
  22. package/reporting/src/request/steps/token-checker/index.js +3 -3
  23. package/reporting/src/request/steps/token-checker/token-domain.js +3 -3
  24. package/reporting/src/request/steps/token-examiner.js +5 -5
  25. package/reporting/src/request/steps/token-telemetry/cached-entry-pipeline.js +3 -3
  26. package/reporting/src/request/steps/token-telemetry/index.js +4 -4
  27. package/reporting/src/request/steps/token-telemetry/key-pipeline.js +1 -1
  28. package/reporting/src/request/steps/token-telemetry/token-pipeline.js +1 -1
  29. package/reporting/src/request/utils/bloom-filter-packed.js +1 -1
  30. package/reporting/src/request/utils/chrome-storage-map.js +6 -0
  31. package/reporting/src/request/utils/subject.js +1 -1
  32. package/reporting/src/request/utils/temp-set.js +1 -1
  33. package/reporting/src/request-reporter.js +3 -3
  34. package/reporting/src/sanitizer.js +11 -3
  35. package/reporting/src/utils/pacemaker.js +1 -1
  36. package/reporting/src/utils/url.js +0 -29
  37. package/reporting/test/helpers/fetch-mock.js +2 -2
  38. package/reporting/test/helpers/scenarios.js +85 -0
  39. package/reporting/test/pages.spec.js +52 -4
  40. package/reporting/test/request-reporter.test.js +251 -0
  41. package/reporting/test/sanitizer.spec.js +16 -0
  42. package/reporting/test/utils/url.spec.js +1 -26
  43. package/reporting/test/webrequest-pipeline/index.test.js +85 -0
@@ -14,4 +14,6 @@ jobs:
14
14
  - uses: actions/checkout@v2
15
15
  - uses: jdx/mise-action@v2
16
16
  - run: npm ci
17
- - run: npm test
17
+ - run: npm run lint
18
+ - run: npm run test
19
+ - run: npm run test.unit
package/CHANGELOG.md CHANGED
@@ -1,3 +1,19 @@
1
+ # v5.1.26 (Wed Oct 02 2024)
2
+
3
+ #### πŸ› Bug Fix
4
+
5
+ - Basic tp_events integration test [#103](https://github.com/whotracksme/webextension-packages/pull/103) ([@chrmod](https://github.com/chrmod))
6
+ - Preserve "openedFrom" information during redirects that are openend in a new tab. [#97](https://github.com/whotracksme/webextension-packages/pull/97) ([@philipp-classen](https://github.com/philipp-classen))
7
+ - Filter out uncommon URLs where the hostname is an IPv4 address. [#101](https://github.com/whotracksme/webextension-packages/pull/101) ([@philipp-classen](https://github.com/philipp-classen))
8
+ - Unit test: play pre-recorded events [#98](https://github.com/whotracksme/webextension-packages/pull/98) ([@chrmod](https://github.com/chrmod))
9
+
10
+ #### Authors: 2
11
+
12
+ - Krzysztof Modras ([@chrmod](https://github.com/chrmod))
13
+ - Philipp Claßen ([@philipp-classen](https://github.com/philipp-classen))
14
+
15
+ ---
16
+
1
17
  # v5.1.25 (Mon Sep 23 2024)
2
18
 
3
19
  #### πŸ› Bug Fix
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@whotracksme/reporting",
3
- "version": "5.1.25",
3
+ "version": "5.1.26",
4
4
  "type": "module",
5
5
  "description": "",
6
6
  "scripts": {
7
7
  "lint": "eslint reporting/ communication/",
8
8
  "lint.fix": "eslint --fix reporting/ communication/",
9
- "test": "npm run lint && npm run test --workspaces --if-present && npm run test.unit --workspaces --if-present",
9
+ "test": "npm run test --workspaces --if-present ",
10
+ "test.unit": "npm run test.unit --workspaces --if-present",
10
11
  "release": "auto shipit"
11
12
  },
12
13
  "publishConfig": {
@@ -17,6 +17,8 @@ module.exports = function (config) {
17
17
  client: {
18
18
  TEST_FIXTURES_URL: process.env.TEST_FIXTURES_URL, // for test/search-extractor.spec.js
19
19
  REPLAY_FIXTURES_URL: process.env.REPLAY_FIXTURES_URL, // for test/pages.spec.js
20
+ VERBOSE_REPLAY: process.env.VERBOSE_REPLAY, // for test/pages.spec.js (better debugging)
21
+ ENABLE_SELF_CHECKS: process.env.ENABLE_SELF_CHECKS, // for test/pages.spec.js (might catch different bugs)
20
22
  },
21
23
  });
22
24
  };
@@ -7,7 +7,7 @@
7
7
  "start.firefox": "cp example/manifests/firefox.json example/manifest.json && web-ext run -s ./example -t firefox-desktop",
8
8
  "build": "rollup -c",
9
9
  "watch": "rollup -c -w",
10
- "test.unit": "mocha --file ./test/setup.unit.js ./test/**/*.test.js",
10
+ "test.unit": "mocha --file ./test/setup.unit.js './test/**/*.test.js'",
11
11
  "test.unit.watch": "npm run test.unit -- --node-option=watch",
12
12
  "test": "karma start --single-run --browsers ChromeHeadless karma.conf.cjs"
13
13
  },
@@ -19,6 +19,7 @@
19
19
  "@rollup/plugin-node-resolve": "^13.3.0",
20
20
  "chai": "^4.3.6",
21
21
  "chai-as-promised": "^7.1.1",
22
+ "fake-indexeddb": "^6.0.0",
22
23
  "fast-check": "^3.3.0",
23
24
  "karma": "^6.4.1",
24
25
  "karma-chai": "^0.1.0",
@@ -9,10 +9,10 @@
9
9
  * file, You can obtain one at http://mozilla.org/MPL/2.0
10
10
  */
11
11
 
12
- import logger from './logger';
13
- import { fastHash } from './utils';
14
- import PersistedBitarray from './persisted-bitarray';
15
- import SelfCheck from './self-check';
12
+ import logger from './logger.js';
13
+ import { fastHash } from './utils.js';
14
+ import PersistedBitarray from './persisted-bitarray.js';
15
+ import SelfCheck from './self-check.js';
16
16
 
17
17
  const SECOND = 1000;
18
18
  const MINUTE = 60 * SECOND;
@@ -9,7 +9,7 @@
9
9
  * file, You can obtain one at http://mozilla.org/MPL/2.0
10
10
  */
11
11
 
12
- import LRU from './LRU';
12
+ import LRU from './LRU.js';
13
13
 
14
14
  /* Fixed length lookup cache. Allows expensive operations to be cached for later lookup. Once
15
15
  * the cache limit is exceeded, least recently used values are removed.
@@ -103,7 +103,6 @@ export function setLogLevel(level, { prefix = '*' } = {}) {
103
103
  if (!SUPPORTED_LOG_LEVELS.has(level)) {
104
104
  throw new Error(`Unknow log level '${level}'`);
105
105
  }
106
-
107
106
  if (prefix === '*') {
108
107
  DEFAULT_LOG_LEVEL = level;
109
108
  }
@@ -9,7 +9,7 @@
9
9
  * file, You can obtain one at http://mozilla.org/MPL/2.0
10
10
  */
11
11
 
12
- import MapCache from './fixed-size-cache';
12
+ import MapCache from './fixed-size-cache.js';
13
13
 
14
14
  /**
15
15
  * Largely based on js-md5 (https://github.com/emn178/js-md5)
@@ -9,7 +9,7 @@
9
9
  * file, You can obtain one at http://mozilla.org/MPL/2.0
10
10
  */
11
11
 
12
- import logger from './logger';
12
+ import logger from './logger.js';
13
13
 
14
14
  const SECOND = 1000;
15
15
  const MINUTE = 60 * SECOND;
@@ -975,6 +975,10 @@ export default class Pages {
975
975
  windowId,
976
976
  lastUpdatedAt: now,
977
977
  };
978
+ if (!entry.pageId || entry.url !== oldTabEntry.url) {
979
+ entry.pageId = ++this._pageIdGenerator;
980
+ }
981
+
978
982
  this._initAllOptionalFields(tabId, entry, now);
979
983
  this.openTabs.set(tabId, entry);
980
984
  return;
@@ -1035,6 +1039,19 @@ export default class Pages {
1035
1039
  }
1036
1040
  }
1037
1041
 
1042
+ // Note that 'redirecting' did not originate from the browser API; it is
1043
+ // a meta state that represents the transition of an old to a new page.
1044
+ // If a link opened in a new tab, we need to merge the opener.
1045
+ if (
1046
+ entry.openedFrom?.status === 'redirecting' &&
1047
+ entry.openedFrom.openerTab
1048
+ ) {
1049
+ entry.openedFrom = {
1050
+ ...entry.openedFrom.openerTab,
1051
+ ...entry.openedFrom,
1052
+ };
1053
+ }
1054
+
1038
1055
  const previousUrl = entry.openedFrom?.url;
1039
1056
  if (isRealPage(previousUrl)) {
1040
1057
  entry.previousUrl = previousUrl;
@@ -1233,6 +1250,7 @@ export default class Pages {
1233
1250
  const entry = {
1234
1251
  status: 'created',
1235
1252
  ...oldEntry,
1253
+ pageId: ++this._pageIdGenerator,
1236
1254
  windowId,
1237
1255
  lastUpdatedAt: Date.now(),
1238
1256
  openerTab: { ...openerTab },
@@ -1241,9 +1259,8 @@ export default class Pages {
1241
1259
  }
1242
1260
 
1243
1261
  chrome_webNavigation_onBeforeNavigate(details) {
1244
- if (details.frameId !== 0) {
1245
- return;
1246
- }
1262
+ if (details.frameId !== 0) return; // not top-level frame (of the active page)
1263
+
1247
1264
  const { tabId, url } = details;
1248
1265
  const oldEntry = this.openTabs.get(tabId);
1249
1266
  if (oldEntry && oldEntry.url !== url) {
@@ -1265,9 +1282,8 @@ export default class Pages {
1265
1282
  // Safari quirks:
1266
1283
  // * The API exists, but "transitionType" is not supported
1267
1284
  chrome_webNavigation_onCommitted(details) {
1268
- if (details.frameId !== 0) {
1269
- return;
1270
- }
1285
+ if (details.frameId !== 0) return; // not top-level frame (of the active page)
1286
+
1271
1287
  const isBackOrForward =
1272
1288
  details.transitionQualifiers?.includes('forward_back');
1273
1289
 
@@ -1294,12 +1310,17 @@ export default class Pages {
1294
1310
  }
1295
1311
  }
1296
1312
 
1297
- // TODO: this needs to be thought through (the timing between chrome.tab and webNavigation might be subtle)
1298
- //
1299
1313
  // Safari quirks:
1300
1314
  // * This API is not available
1315
+ //
1316
+ // Firefox quirks (https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/webNavigation/TransitionQualifier):
1317
+ // * 'server_redirect' is limited to top-level frames
1318
+ // * 'client_redirect' is not supplied when redirections are created by JavaScript.
1301
1319
  chrome_webNavigation_onHistoryStateUpdated(details) {
1302
- const { tabId } = details;
1320
+ const { tabId, frameId, parentFrameId } = details;
1321
+ if (frameId !== 0) return; // not top-level frame (of the active page)
1322
+ if (parentFrameId !== -1) return; // not main frame
1323
+
1303
1324
  const entry = this.openTabs.get(tabId);
1304
1325
  if (!entry) {
1305
1326
  logger.warn('Navigation event in a non-existing tab detected!');
@@ -1360,25 +1381,22 @@ export default class Pages {
1360
1381
  }
1361
1382
  }
1362
1383
 
1363
- _initVisibility(tabId, entry) {
1384
+ _initVisibility(tabId, entry, now) {
1364
1385
  if (!entry.visibility) {
1365
1386
  const { visibility, search } = this._checkPageVisibility(entry.url);
1366
1387
  entry.visibility = visibility;
1367
- if (visibility !== 'private') {
1368
- if (search) {
1369
- entry.search = {
1370
- category: search.category,
1371
- query: search.query,
1372
- depth: 0,
1373
- lastUpdatedAt: Date.now(),
1374
- };
1375
- }
1388
+ if (visibility !== 'private' && search) {
1389
+ entry.search = {
1390
+ category: search.category,
1391
+ query: search.query,
1392
+ depth: 0,
1393
+ lastUpdatedAt: now,
1394
+ };
1376
1395
  }
1377
1396
  }
1378
1397
  }
1379
1398
 
1380
- _initAllOptionalFields(tabId, entry) {
1381
- const now = Date.now();
1399
+ _initAllOptionalFields(tabId, entry, now) {
1382
1400
  const { pageId } = entry;
1383
1401
  this._initVisibility(tabId, entry, now);
1384
1402
  this._tryAnalyzePageStructure(tabId, entry, now);
@@ -1791,6 +1809,51 @@ export default class Pages {
1791
1809
  if (pageIdClashes.length > 0) {
1792
1810
  check.warn('Found a pageId clash', Object.fromEntries(pageIdClashes));
1793
1811
  }
1812
+
1813
+ // checks for the active tab
1814
+ if (this.activeTab.tabId !== TAB_ID_NONE && this.activeTab.windowId) {
1815
+ const entry = this.openTabs.get(this.activeTab.tabId);
1816
+ if (entry?.windowId !== this.activeTab.windowId) {
1817
+ check.fail('mismatch between the activeTab and the openTabs', {
1818
+ activeTab: {
1819
+ tabId: this.activeTab.tabId,
1820
+ windowId: this.activeTab.windowId,
1821
+ },
1822
+ entry: entry ? { ...entry } : `<tab not found>`,
1823
+ });
1824
+ }
1825
+ }
1826
+
1827
+ // checks for the "search" attribute
1828
+ for (const [tabId, entry] of this.openTabs.entries()) {
1829
+ if (isNil(entry.search)) {
1830
+ continue;
1831
+ }
1832
+ const fail = (msg) => {
1833
+ check.fail(`inconsistency: ${msg}`, { tabId, entry: { ...entry } });
1834
+ };
1835
+
1836
+ if (isRealPage(entry.ref) && isRealPage(entry.url)) {
1837
+ if (
1838
+ entry.search.depth === 1 &&
1839
+ this.urlAnalyzer.parseSearchLinks(entry.ref).category !==
1840
+ entry.search.category &&
1841
+ sameHostname(entry.ref, entry.url)
1842
+ ) {
1843
+ fail(
1844
+ 'depth=1 search landing must not include internal page navigation',
1845
+ );
1846
+ } else if (
1847
+ entry.search.depth === 2 &&
1848
+ !sameHostname(entry.ref, entry.url)
1849
+ ) {
1850
+ fail('depth=2 search landings must stay on the same domains');
1851
+ }
1852
+ }
1853
+ if (![0, 1, 2].includes(entry.search.depth)) {
1854
+ fail('depth must be in { 0, 1, 2 }');
1855
+ }
1856
+ }
1794
1857
  })();
1795
1858
  await Promise.all([
1796
1859
  myChecks,
@@ -9,8 +9,8 @@
9
9
  * file, You can obtain one at http://mozilla.org/MPL/2.0
10
10
  */
11
11
 
12
- import logger from './logger';
13
- import SelfCheck from './self-check';
12
+ import logger from './logger.js';
13
+ import SelfCheck from './self-check.js';
14
14
 
15
15
  const SECOND = 1000;
16
16
 
@@ -9,8 +9,8 @@
9
9
  * file, You can obtain one at http://mozilla.org/MPL/2.0
10
10
  */
11
11
 
12
- import pacemaker from '../utils/pacemaker';
13
- import logger from '../logger';
12
+ import pacemaker from '../utils/pacemaker.js';
13
+ import logger from '../logger.js';
14
14
 
15
15
  const RETRY_TIMEOUT = 30 * 1000;
16
16
 
@@ -11,8 +11,8 @@
11
11
 
12
12
  /* eslint no-param-reassign: 'off' */
13
13
 
14
- import { isIpv4Address } from '../utils/url';
15
- import prob from './resources/prob';
14
+ import { isIpv4Address } from '../utils/url.js';
15
+ import prob from './resources/prob.js';
16
16
 
17
17
  export class HashProb {
18
18
  constructor() {
@@ -10,36 +10,36 @@
10
10
  */
11
11
 
12
12
  /* eslint-disable no-param-reassign */
13
- import Pipeline from '../webrequest-pipeline/pipeline';
14
- import { isPrivateIP } from '../utils/url';
15
- import pacemaker from '../utils/pacemaker';
16
-
17
- import { truncatedHash } from '../md5';
18
- import logger from '../logger';
19
-
20
- import * as datetime from './time';
21
- import QSWhitelist2 from './qs-whitelist2';
22
- import TempSet from './utils/temp-set';
23
- import { HashProb, shouldCheckToken } from './hash';
24
- import { VERSION, COOKIE_MODE } from './config';
25
- import { shuffle } from './utils';
26
- import buildPageLoadObject from './page-telemetry';
27
- import getTrackingStatus from './dnt';
28
- import random from '../random';
29
-
30
- import BlockRules from './steps/block-rules';
31
- import CookieContext from './steps/cookie-context';
32
- import PageLogger from './steps/page-logger';
33
- import RedirectTagger from './steps/redirect-tagger';
34
- import TokenChecker from './steps/token-checker/index';
35
- import TokenExaminer from './steps/token-examiner';
36
- import TokenTelemetry from './steps/token-telemetry/index';
37
- import OAuthDetector from './steps/oauth-detector';
13
+ import Pipeline from '../webrequest-pipeline/pipeline.js';
14
+ import { isLocalIP } from '../network.js';
15
+ import pacemaker from '../utils/pacemaker.js';
16
+
17
+ import { truncatedHash } from '../md5.js';
18
+ import logger from '../logger.js';
19
+
20
+ import * as datetime from './time.js';
21
+ import QSWhitelist2 from './qs-whitelist2.js';
22
+ import TempSet from './utils/temp-set.js';
23
+ import { HashProb, shouldCheckToken } from './hash.js';
24
+ import { VERSION, COOKIE_MODE } from './config.js';
25
+ import { shuffle } from './utils.js';
26
+ import buildPageLoadObject from './page-telemetry.js';
27
+ import getTrackingStatus from './dnt.js';
28
+ import random from '../random.js';
29
+
30
+ import BlockRules from './steps/block-rules.js';
31
+ import CookieContext from './steps/cookie-context.js';
32
+ import PageLogger from './steps/page-logger.js';
33
+ import RedirectTagger from './steps/redirect-tagger.js';
34
+ import TokenChecker from './steps/token-checker/index.js';
35
+ import TokenExaminer from './steps/token-examiner.js';
36
+ import TokenTelemetry from './steps/token-telemetry/index.js';
37
+ import OAuthDetector from './steps/oauth-detector.js';
38
38
 
39
39
  import {
40
40
  checkValidContext,
41
41
  checkSameGeneralDomain,
42
- } from './steps/check-context';
42
+ } from './steps/check-context.js';
43
43
 
44
44
  const DAY_CHANGE_INTERVAL = 20 * 1000;
45
45
  const RECENTLY_MODIFIED_TTL = 30 * 1000;
@@ -55,7 +55,7 @@ export default class RequestMonitor {
55
55
  communication,
56
56
  getBrowserInfo,
57
57
  onTrackerInteraction = (event, state) => {
58
- logger.log(`Tracker '${event}' with url: ${state.url}`);
58
+ logger.info('Tracker', event, 'with url:', state.url);
59
59
  },
60
60
  isRequestAllowed = () => false,
61
61
  },
@@ -640,7 +640,7 @@ export default class RequestMonitor {
640
640
  spec: 'break',
641
641
  fn: (state) => {
642
642
  if (state.isMainFrame && state.ip) {
643
- if (isPrivateIP(state.ip)) {
643
+ if (isLocalIP(state.ip)) {
644
644
  state.page.isPrivateServer = true;
645
645
  }
646
646
  return false;
@@ -9,8 +9,8 @@
9
9
  * file, You can obtain one at http://mozilla.org/MPL/2.0
10
10
  */
11
11
 
12
- import { truncatedHash } from '../md5';
13
- import { parse } from '../utils/url';
12
+ import { truncatedHash } from '../md5.js';
13
+ import { parse } from '../utils/url.js';
14
14
 
15
15
  function truncatePath(path) {
16
16
  // extract the first part of the page path
@@ -11,9 +11,9 @@
11
11
 
12
12
  import { differenceInDays, parseISO, getUnixTime, sub } from 'date-fns';
13
13
 
14
- import PackedBloomFilter from './utils/bloom-filter-packed';
15
- import pacemaker from '../utils/pacemaker';
16
- import logger from '../logger';
14
+ import PackedBloomFilter from './utils/bloom-filter-packed.js';
15
+ import pacemaker from '../utils/pacemaker.js';
16
+ import logger from '../logger.js';
17
17
 
18
18
  const STORAGE_CONFIG_KEY = 'qs_config';
19
19
  const STORAGE_BLOOM_FILTER_KEY = 'qs_bloom_filter';
@@ -9,12 +9,12 @@
9
9
  * file, You can obtain one at http://mozilla.org/MPL/2.0
10
10
  */
11
11
 
12
- import { truncatedHash } from '../../md5';
13
- import pacemaker from '../../utils/pacemaker';
14
- import { parse } from '../../utils/url';
15
- import { sameGeneralDomain, getGeneralDomain } from '../utils/tlds';
16
- import logger from '../../logger';
17
- import ChromeStorageMap from '../utils/chrome-storage-map';
12
+ import { truncatedHash } from '../../md5.js';
13
+ import pacemaker from '../../utils/pacemaker.js';
14
+ import { parse } from '../../utils/url.js';
15
+ import { sameGeneralDomain, getGeneralDomain } from '../utils/tlds.js';
16
+ import logger from '../../logger.js';
17
+ import ChromeStorageMap from '../utils/chrome-storage-map.js';
18
18
 
19
19
  const TIME_AFTER_LINK = 5 * 1000;
20
20
  const TIME_CLEANING_CACHE = 3 * 60 * 1000; // 3 minutes
@@ -9,9 +9,9 @@
9
9
  * file, You can obtain one at http://mozilla.org/MPL/2.0
10
10
  */
11
11
 
12
- import { parse } from '../../utils/url';
13
- import Subject from '../utils/subject';
14
- import ChromeStorageMap from '../utils/chrome-storage-map';
12
+ import { parse } from '../../utils/url.js';
13
+ import Subject from '../utils/subject.js';
14
+ import ChromeStorageMap from '../utils/chrome-storage-map.js';
15
15
 
16
16
  const DEFAULT_OPTIONS = {
17
17
  CLICK_TIMEOUT: 5 * 60 * 1000,
@@ -10,7 +10,8 @@
10
10
  */
11
11
 
12
12
  /* eslint no-param-reassign: 'off' */
13
- import { truncateDomain } from '../utils';
13
+
14
+ import { truncateDomain } from '../utils.js';
14
15
  import { getStatsForDomain } from '../../webrequest-pipeline/page.js';
15
16
 
16
17
  // maps string (web-ext) to int (FF cpt). Anti-tracking still uses these legacy types.
@@ -9,7 +9,7 @@
9
9
  * file, You can obtain one at http://mozilla.org/MPL/2.0
10
10
  */
11
11
 
12
- import TempSet from '../utils/temp-set';
12
+ import TempSet from '../utils/temp-set.js';
13
13
 
14
14
  const CACHE_TIMEOUT = 10 * 1000;
15
15
 
@@ -11,9 +11,9 @@
11
11
 
12
12
  /* eslint no-param-reassign: 'off' */
13
13
 
14
- import md5, { truncatedHash } from '../../../md5';
15
- import { tryDecodeURIComponent } from '../../../utils/url';
16
- import TokenDomain from './token-domain';
14
+ import md5, { truncatedHash } from '../../../md5.js';
15
+ import { tryDecodeURIComponent } from '../../../utils/url.js';
16
+ import TokenDomain from './token-domain.js';
17
17
 
18
18
  function decodeToken(token) {
19
19
  let decodedToken = tryDecodeURIComponent(token);
@@ -9,9 +9,9 @@
9
9
  * file, You can obtain one at http://mozilla.org/MPL/2.0
10
10
  */
11
11
 
12
- import * as datetime from '../../time';
13
- import logger from '../../../logger';
14
- import ChromeStorageMap from '../../utils/chrome-storage-map';
12
+ import * as datetime from '../../time.js';
13
+ import logger from '../../../logger.js';
14
+ import ChromeStorageMap from '../../utils/chrome-storage-map.js';
15
15
 
16
16
  const DAYS_EXPIRE = 7;
17
17
  const STAGED_TOKEN_EXPIRY = 1000 * 60 * 60 * 24 * 2; // 2 days
@@ -11,11 +11,11 @@
11
11
 
12
12
  /* eslint no-param-reassign: 'off' */
13
13
 
14
- import * as datetime from '../time';
15
- import md5, { truncatedHash } from '../../md5';
16
- import pacemaker from '../../utils/pacemaker';
17
- import ChromeStorageMap from '../utils/chrome-storage-map';
18
- import logger from '../../logger';
14
+ import * as datetime from '../time.js';
15
+ import md5, { truncatedHash } from '../../md5.js';
16
+ import pacemaker from '../../utils/pacemaker.js';
17
+ import ChromeStorageMap from '../utils/chrome-storage-map.js';
18
+ import logger from '../../logger.js';
19
19
 
20
20
  const SYNC_DB_INTERVAL = 20 * 1000;
21
21
 
@@ -9,9 +9,9 @@
9
9
  * file, You can obtain one at http://mozilla.org/MPL/2.0
10
10
  */
11
11
 
12
- import logger from '../../../logger';
13
- import Subject from '../../utils/subject';
14
- import ChromeStorageMap from '../../utils/chrome-storage-map';
12
+ import logger from '../../../logger.js';
13
+ import Subject from '../../utils/subject.js';
14
+ import ChromeStorageMap from '../../utils/chrome-storage-map.js';
15
15
 
16
16
  const CACHE_TTL = 2 * 24 * 60 * 60 * 1000; // 2 days
17
17
 
@@ -9,10 +9,10 @@
9
9
  * file, You can obtain one at http://mozilla.org/MPL/2.0
10
10
  */
11
11
 
12
- import md5, { truncatedHash } from '../../../md5';
13
- import Subject from '../../utils/subject';
14
- import KeyPipeline, { getSiteTokensMap } from './key-pipeline';
15
- import TokenPipeline from './token-pipeline';
12
+ import md5, { truncatedHash } from '../../../md5.js';
13
+ import Subject from '../../utils/subject.js';
14
+ import KeyPipeline, { getSiteTokensMap } from './key-pipeline.js';
15
+ import TokenPipeline from './token-pipeline.js';
16
16
 
17
17
  const DEFAULT_CONFIG = {
18
18
  // token batchs, max 720 messages/hour
@@ -9,7 +9,7 @@
9
9
  * file, You can obtain one at http://mozilla.org/MPL/2.0
10
10
  */
11
11
 
12
- import CachedEntryPipeline from './cached-entry-pipeline';
12
+ import CachedEntryPipeline from './cached-entry-pipeline.js';
13
13
 
14
14
  export function getSiteTokensMap(siteTokens, key) {
15
15
  let siteTokensMap = siteTokens[key];
@@ -9,7 +9,7 @@
9
9
  * file, You can obtain one at http://mozilla.org/MPL/2.0
10
10
  */
11
11
 
12
- import CachedEntryPipeline from './cached-entry-pipeline';
12
+ import CachedEntryPipeline from './cached-entry-pipeline.js';
13
13
 
14
14
  export default class TokenPipeline extends CachedEntryPipeline {
15
15
  constructor({ db, trustedClock, options, name }) {
@@ -10,7 +10,7 @@
10
10
  */
11
11
 
12
12
  /* eslint no-bitwise: 'off' */
13
- import md5 from '../../md5';
13
+ import md5 from '../../md5.js';
14
14
 
15
15
  /**
16
16
  * Re-implementation of core/bloom-filter using a packed ArrayBuffer to hold
@@ -109,6 +109,12 @@ export default class ChromeStorageMap {
109
109
  return this._inMemoryMap.entries();
110
110
  }
111
111
 
112
+ keys() {
113
+ this._warnIfOutOfSync();
114
+ this._expireOldEntries();
115
+ return this._inMemoryMap.keys();
116
+ }
117
+
112
118
  values() {
113
119
  this._warnIfOutOfSync();
114
120
  this._expireOldEntries();
@@ -9,7 +9,7 @@
9
9
  * file, You can obtain one at http://mozilla.org/MPL/2.0
10
10
  */
11
11
 
12
- import logger from '../../logger';
12
+ import logger from '../../logger.js';
13
13
 
14
14
  export default class Subject {
15
15
  constructor() {
@@ -12,7 +12,7 @@
12
12
  /* eslint func-names: 'off' */
13
13
  /* eslint prefer-arrow-callback: 'off' */
14
14
 
15
- import pacemaker from '../../utils/pacemaker';
15
+ import pacemaker from '../../utils/pacemaker.js';
16
16
 
17
17
  /** Set like class whose members are removed after a specific amount of time
18
18
  */