@whotracksme/reporting 12.1.9 → 12.1.11

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,27 @@
1
+ # v12.1.11 (Wed Nov 18 2026)
2
+
3
+ #### 🐛 Bug Fix
4
+
5
+ - fix: PageAggregator listens for an event name that does not exist [#253](https://github.com/whotracksme/webextension-packages/pull/253) ([@philipp-classen](https://github.com/philipp-classen))
6
+
7
+ #### Authors: 1
8
+
9
+ - Philipp Claßen ([@philipp-classen](https://github.com/philipp-classen))
10
+
11
+ ---
12
+
13
+ # v12.1.10 (Wed Nov 18 2026)
14
+
15
+ #### 🐛 Bug Fix
16
+
17
+ - fix: PageDB does not update pages in tabs that are not active [#252](https://github.com/whotracksme/webextension-packages/pull/252) ([@philipp-classen](https://github.com/philipp-classen))
18
+
19
+ #### Authors: 1
20
+
21
+ - Philipp Claßen ([@philipp-classen](https://github.com/philipp-classen))
22
+
23
+ ---
24
+
1
25
  # v12.1.9 (Wed Nov 18 2026)
2
26
 
3
27
  #### 🐛 Bug Fix
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whotracksme/reporting",
3
- "version": "12.1.9",
3
+ "version": "12.1.11",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  "./sanitizer": "./reporting/src/sanitizer.js",
@@ -53,7 +53,7 @@ export default class PageAggregator {
53
53
  } else {
54
54
  this.syncTab(event.tabId);
55
55
  }
56
- } else if (event.type === 'search-landing') {
56
+ } else if (event.type === 'safe-search-landing') {
57
57
  this.syncTab(event.tabId);
58
58
  } else if (event.type === 'activity-updated') {
59
59
  const { urls, activityEstimator } = event;
@@ -263,7 +263,7 @@ export default class PageDB {
263
263
  const shouldUpdate =
264
264
  url == activeUrl ||
265
265
  (inMemoryEntry !== null &&
266
- pages.some((x) => x.lastUpdatedAt) > inMemoryEntry.lastUpdatedAt);
266
+ pages.some((x) => x.lastUpdatedAt > inMemoryEntry.lastUpdatedAt));
267
267
  if (shouldUpdate) {
268
268
  const updateDB = (oldEntry) => {
269
269
  const page = mergePages([oldEntry, ...pages]);
@@ -103,5 +103,44 @@ describe('#PageAggregator', function () {
103
103
  uut.fullSync();
104
104
  await clock.runAllAsync();
105
105
  });
106
+
107
+ describe('#onPageEvent', function () {
108
+ const tabId = 42;
109
+ const landingPage = {
110
+ status: 'complete',
111
+ title: 'Some landing page',
112
+ url: 'https://www.example.test/landing',
113
+ search: { category: 'go', query: 'some query', depth: 1 },
114
+ lastUpdatedAt: 1577836800000,
115
+ };
116
+
117
+ async function pagesInDb() {
118
+ await clock.runAllAsync();
119
+ const { memory } = await pagedb.describeState({ inMemoryOnly: true });
120
+ return memory;
121
+ }
122
+
123
+ beforeEach(function () {
124
+ pages.describeTab = (id) => (id === tabId ? landingPage : null);
125
+ });
126
+
127
+ it('should sync the tab when the user lands on a search result', async function () {
128
+ uut.onPageEvent({ type: 'safe-search-landing', tabId, details: {} });
129
+
130
+ const memory = await pagesInDb();
131
+ expect(Object.keys(memory)).to.eql([landingPage.url]);
132
+ expect(memory[landingPage.url].search).to.eql(landingPage.search);
133
+ });
134
+
135
+ it('should ignore other navigation events', async function () {
136
+ uut.onPageEvent({
137
+ type: 'safe-page-navigation',
138
+ tabId,
139
+ url: landingPage.url,
140
+ });
141
+
142
+ expect(await pagesInDb()).to.eql({});
143
+ });
144
+ });
106
145
  });
107
146
  });
@@ -172,6 +172,49 @@ describe('#PageDB', function () {
172
172
  await expectUrlsInMemory([page.url]);
173
173
  await expectUrlsInDb([page.url]);
174
174
  });
175
+
176
+ describe('for a page in a non-active tab that is already known', function () {
177
+ function loadingPage() {
178
+ const page = { ...somePage(), status: 'loading' };
179
+ delete page.preDoublefetch;
180
+ return page;
181
+ }
182
+
183
+ async function pageInMemory(url) {
184
+ const { memory } = await uut.describeState({ inMemoryOnly: true });
185
+ return memory[url];
186
+ }
187
+
188
+ it('should take over newer information', async function () {
189
+ const before = loadingPage();
190
+ await uut.updatePages([before], undefined);
191
+
192
+ const after = {
193
+ ...somePage(),
194
+ lastUpdatedAt: before.lastUpdatedAt + 1,
195
+ };
196
+ await uut.updatePages([after], undefined);
197
+
198
+ const page = await pageInMemory(after.url);
199
+ expect(page.status).to.eql('complete');
200
+ expect(page.preDoublefetch).to.eql(after.preDoublefetch);
201
+ });
202
+
203
+ it('should ignore older information', async function () {
204
+ const before = somePage();
205
+ await uut.updatePages([before], undefined);
206
+
207
+ const after = {
208
+ ...loadingPage(),
209
+ lastUpdatedAt: before.lastUpdatedAt - 1,
210
+ };
211
+ await uut.updatePages([after], undefined);
212
+
213
+ const page = await pageInMemory(before.url);
214
+ expect(page.status).to.eql('complete');
215
+ expect(page.preDoublefetch).to.eql(before.preDoublefetch);
216
+ });
217
+ });
175
218
  });
176
219
 
177
220
  describe('#acquireExpiredPages', function () {