@whotracksme/reporting 12.1.15 → 12.1.17
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 +24 -0
- package/package.json +1 -1
- package/reporting/src/pagedb.js +3 -1
- package/reporting/src/pages.js +1 -1
- package/reporting/test/pagedb.spec.js +15 -0
- package/reporting/test/pages.spec.js +102 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,27 @@
|
|
|
1
|
+
# v12.1.17 (Thu Nov 19 2026)
|
|
2
|
+
|
|
3
|
+
#### 🐛 Bug Fix
|
|
4
|
+
|
|
5
|
+
- fixed: activity detection missed URLs with fragments [#259](https://github.com/whotracksme/webextension-packages/pull/259) ([@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.16 (Thu Nov 19 2026)
|
|
14
|
+
|
|
15
|
+
#### 🐛 Bug Fix
|
|
16
|
+
|
|
17
|
+
- Fixed: After a restart of the service worker, the state of all tabs is lost [#258](https://github.com/whotracksme/webextension-packages/pull/258) ([@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.15 (Thu Nov 19 2026)
|
|
2
26
|
|
|
3
27
|
#### 🐛 Bug Fix
|
package/package.json
CHANGED
package/reporting/src/pagedb.js
CHANGED
|
@@ -308,7 +308,9 @@ export default class PageDB {
|
|
|
308
308
|
const url = normalizeUrl(url_);
|
|
309
309
|
const persistedKey = this.urlsToPersistedKeys.get(url);
|
|
310
310
|
if (persistedKey) {
|
|
311
|
-
|
|
311
|
+
// The estimator knows the page by the URL of the tab
|
|
312
|
+
// (it can have a fragment), not by the normalized URL.
|
|
313
|
+
const score = activityEstimator.estimate(url_, now);
|
|
312
314
|
if (score > 0.0) {
|
|
313
315
|
const updateScore = (entry) => {
|
|
314
316
|
if (score > entry.aggregator.activity) {
|
package/reporting/src/pages.js
CHANGED
|
@@ -599,7 +599,7 @@ export default class Pages {
|
|
|
599
599
|
if (openTabs) {
|
|
600
600
|
const deserializedTabs = Object.entries(openTabs).map(
|
|
601
601
|
([tabId, tabContent]) => [
|
|
602
|
-
tabId,
|
|
602
|
+
Number(tabId), // tab ids are numbers, but object keys are strings
|
|
603
603
|
this._deserializeTabContent(tabContent),
|
|
604
604
|
],
|
|
605
605
|
);
|
|
@@ -267,6 +267,21 @@ describe('#PageDB', function () {
|
|
|
267
267
|
await expectUrlsInDb([simplUrl]);
|
|
268
268
|
await passesSelfChecks();
|
|
269
269
|
});
|
|
270
|
+
|
|
271
|
+
it('should update the activity of a page that has a URL fragment', async function () {
|
|
272
|
+
const simpleUrl = 'https://de.wikipedia.test/wiki/Elefanten';
|
|
273
|
+
const urlInTab = `${simpleUrl}#Verbreitung`;
|
|
274
|
+
await uut.updatePages([somePage({ url: urlInTab })], undefined);
|
|
275
|
+
|
|
276
|
+
// the activity estimator knows only the URL of the tab
|
|
277
|
+
const activityEstimator = {
|
|
278
|
+
estimate: (url) => (url === urlInTab ? 0.5 : 0.0),
|
|
279
|
+
};
|
|
280
|
+
await uut.updateActivity([urlInTab], activityEstimator);
|
|
281
|
+
|
|
282
|
+
const { memory } = await uut.describeState({ inMemoryOnly: true });
|
|
283
|
+
expect(memory[simpleUrl].aggregator.activity).to.eql(0.5);
|
|
284
|
+
});
|
|
270
285
|
});
|
|
271
286
|
|
|
272
287
|
describe('emergency cleanup', function () {
|
|
@@ -15,6 +15,7 @@ import Pages, { stripLazyVars, CANCEL_LAZY_VAR } from '../src/pages.js';
|
|
|
15
15
|
import UrlAnalyzer from '../src/url-analyzer.js';
|
|
16
16
|
import SessionStorageWrapper from '../src/session-storage.js';
|
|
17
17
|
import Patterns from '../src/patterns.js';
|
|
18
|
+
import FakeSessionApi from './helpers/fake-session-storage.js';
|
|
18
19
|
|
|
19
20
|
function waitForPendingMicrotasks() {
|
|
20
21
|
return new Promise((resolve) => {
|
|
@@ -860,6 +861,107 @@ ${total} tests run: ${passed} passed, ${failed} failed (${ratio}% passed)
|
|
|
860
861
|
});
|
|
861
862
|
}
|
|
862
863
|
});
|
|
864
|
+
|
|
865
|
+
describe('after a restart of the service worker', function () {
|
|
866
|
+
const TAB_ID = 7;
|
|
867
|
+
const WINDOW_ID = 1;
|
|
868
|
+
const URL_A = 'https://www.example.com/start';
|
|
869
|
+
const URL_B = 'https://www.example.com/article';
|
|
870
|
+
let sessionApi;
|
|
871
|
+
|
|
872
|
+
function tab(url, status) {
|
|
873
|
+
return {
|
|
874
|
+
id: TAB_ID,
|
|
875
|
+
windowId: WINDOW_ID,
|
|
876
|
+
incognito: false,
|
|
877
|
+
active: true,
|
|
878
|
+
status,
|
|
879
|
+
title: `Title of ${url}`,
|
|
880
|
+
url,
|
|
881
|
+
};
|
|
882
|
+
}
|
|
883
|
+
|
|
884
|
+
function navigate(url, transitionType) {
|
|
885
|
+
chromeApiMock.tabs.onUpdated.dispatch(
|
|
886
|
+
TAB_ID,
|
|
887
|
+
{ status: 'loading', url },
|
|
888
|
+
tab(url, 'loading'),
|
|
889
|
+
);
|
|
890
|
+
chromeApiMock.webNavigation.onCommitted.dispatch({
|
|
891
|
+
tabId: TAB_ID,
|
|
892
|
+
frameId: 0,
|
|
893
|
+
parentFrameId: -1,
|
|
894
|
+
url,
|
|
895
|
+
transitionType,
|
|
896
|
+
});
|
|
897
|
+
chromeApiMock.tabs.onUpdated.dispatch(
|
|
898
|
+
TAB_ID,
|
|
899
|
+
{ status: 'complete' },
|
|
900
|
+
tab(url, 'complete'),
|
|
901
|
+
);
|
|
902
|
+
}
|
|
903
|
+
|
|
904
|
+
// like "initMocks", but the state is kept in the (fake) session storage
|
|
905
|
+
async function startPages({ openTabs }) {
|
|
906
|
+
chromeApiMock.tabs.query = async () => openTabs;
|
|
907
|
+
uut = new Pages({
|
|
908
|
+
config: { pages: { chrome: chromeApiMock } },
|
|
909
|
+
urlAnalyzer,
|
|
910
|
+
newPageApprover: stubNewPageApprover(),
|
|
911
|
+
pageSessionStore: new SessionStorageWrapper({
|
|
912
|
+
sessionApi,
|
|
913
|
+
namespace: 'test',
|
|
914
|
+
}),
|
|
915
|
+
});
|
|
916
|
+
await uut.init();
|
|
917
|
+
await uut.blockUntilFullInit();
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
async function restart({ openTabs }) {
|
|
921
|
+
await uut.sessionStore.flush();
|
|
922
|
+
uut.unload();
|
|
923
|
+
await startPages({ openTabs });
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
beforeEach(async function () {
|
|
927
|
+
sessionApi = new FakeSessionApi();
|
|
928
|
+
await startPages({ openTabs: [] });
|
|
929
|
+
|
|
930
|
+
// the user opens a page, and then follows a link to another page
|
|
931
|
+
chromeApiMock.tabs.onActivated.dispatch({
|
|
932
|
+
tabId: TAB_ID,
|
|
933
|
+
windowId: WINDOW_ID,
|
|
934
|
+
});
|
|
935
|
+
navigate(URL_A, 'typed');
|
|
936
|
+
navigate(URL_B, 'link');
|
|
937
|
+
expect(uut.describeTab(TAB_ID)).to.include({ url: URL_B, ref: URL_A });
|
|
938
|
+
});
|
|
939
|
+
|
|
940
|
+
it('should keep the information about a tab that is still open', async function () {
|
|
941
|
+
await restart({ openTabs: [tab(URL_B, 'complete')] });
|
|
942
|
+
|
|
943
|
+
expect([...uut.openTabs.keys()]).to.eql([TAB_ID]);
|
|
944
|
+
expect(uut.describeTab(TAB_ID)).to.include({
|
|
945
|
+
url: URL_B,
|
|
946
|
+
ref: URL_A,
|
|
947
|
+
pageLoadMethod: 'full-page-load',
|
|
948
|
+
});
|
|
949
|
+
});
|
|
950
|
+
|
|
951
|
+
it('should drop the information if the tab shows another page now', async function () {
|
|
952
|
+
await restart({ openTabs: [tab(URL_A, 'complete')] });
|
|
953
|
+
|
|
954
|
+
expect([...uut.openTabs.keys()]).to.eql([TAB_ID]);
|
|
955
|
+
expect(uut.describeTab(TAB_ID).url).to.eql(URL_A);
|
|
956
|
+
expect(uut.describeTab(TAB_ID).ref).to.be.undefined;
|
|
957
|
+
});
|
|
958
|
+
|
|
959
|
+
it('should drop a tab that was closed', async function () {
|
|
960
|
+
await restart({ openTabs: [] });
|
|
961
|
+
|
|
962
|
+
expect([...uut.openTabs.keys()]).to.eql([]);
|
|
963
|
+
});
|
|
964
|
+
});
|
|
863
965
|
});
|
|
864
966
|
});
|
|
865
967
|
|