@whotracksme/reporting 5.2.0 β†’ 5.2.1

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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,19 @@
1
+ # v5.2.1 (Tue Dec 10 2024)
2
+
3
+ #### πŸ› Bug Fix
4
+
5
+ - Fix anti-tracking on Android [#147](https://github.com/whotracksme/webextension-packages/pull/147) ([@philipp-classen](https://github.com/philipp-classen))
6
+
7
+ #### πŸ“ Documentation
8
+
9
+ - Document sampling [#138](https://github.com/whotracksme/webextension-packages/pull/138) ([@philipp-classen](https://github.com/philipp-classen))
10
+
11
+ #### Authors: 1
12
+
13
+ - Philipp Claßen ([@philipp-classen](https://github.com/philipp-classen))
14
+
15
+ ---
16
+
1
17
  # v5.2.0 (Mon Dec 02 2024)
2
18
 
3
19
  #### πŸš€ Enhancement
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whotracksme/reporting",
3
- "version": "5.2.0",
3
+ "version": "5.2.1",
4
4
  "type": "module",
5
5
  "description": "",
6
6
  "scripts": {
@@ -77,7 +77,9 @@ export default class PageStore {
77
77
  chrome.webNavigation.onBeforeNavigate.addListener(this.#onBeforeNavigate);
78
78
  chrome.webNavigation.onCommitted.addListener(this.#onNavigationCommitted);
79
79
  chrome.webNavigation.onCompleted.addListener(this.#onNavigationCompleted);
80
- chrome.windows.onFocusChanged?.addListener(this.#onWindowFocusChanged);
80
+
81
+ // Note: not available on Firefox Android
82
+ chrome.windows?.onFocusChanged?.addListener(this.#onWindowFocusChanged);
81
83
 
82
84
  // popupate initially open tabs
83
85
  (await chrome.tabs.query({})).forEach((tab) => this.#onTabCreated(tab));
@@ -103,7 +105,7 @@ export default class PageStore {
103
105
  chrome.webNavigation.onCompleted.removeListener(
104
106
  this.#onNavigationCompleted,
105
107
  );
106
- chrome.windows.onFocusChanged?.removeListener(this.#onWindowFocusChanged);
108
+ chrome.windows?.onFocusChanged?.removeListener(this.#onWindowFocusChanged);
107
109
  }
108
110
 
109
111
  checkIfEmpty() {
@@ -182,6 +184,7 @@ export default class PageStore {
182
184
  }
183
185
  };
184
186
 
187
+ // Note: not available on Firefox Android
185
188
  #onWindowFocusChanged = async (focusedWindowId) => {
186
189
  const activeTabs = await chrome.tabs.query({ active: true });
187
190
  for (const { id, windowId } of activeTabs) {
@@ -87,6 +87,22 @@ export default class KeyPipeline extends CachedEntryPipeline {
87
87
  }
88
88
  let tokensToSend = Object.entries(tokens);
89
89
 
90
+ // In rare cases, the number of tokens may exceed the message size limit (currently 32K),
91
+ // such as when a website sends high-frequency requests with randomized IDs. To handle
92
+ // this scenario, two approaches were considered:
93
+ //
94
+ // 1. Chunking: Splitting the message into multiple smaller messages.
95
+ // 2. Sampling: Sending a random subset of token hashes.
96
+ //
97
+ // We implemented the second approach because the server-side aggregation aims to identify
98
+ // common tokens seen by enough clients. If a website sends many different values rapidly,
99
+ // they are likely random and unlikely to reach a quorum. Therefore, sending a random sample
100
+ // of token hashes should not impair the server's ability to identify common values and may
101
+ // even reduce noise.
102
+ //
103
+ // Exceeding the limit should be rare, and this measure serves as protection against edge cases.
104
+ // Currently, we are aware of only one page that triggered this issue:
105
+ // https://github.com/ghostery/broken-page-reports/issues/873#issuecomment-2450496021.
90
106
  if (tokensToSend.length > this.options.KEY_TOKENS_LIMIT) {
91
107
  logger.warn(
92
108
  '[Request keys-pipeline]',