@whotracksme/reporting 5.1.26 → 5.1.28

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,33 @@
1
+ # v5.1.28 (Tue Oct 29 2024)
2
+
3
+ #### 🐛 Bug Fix
4
+
5
+ - Fix: page store tab active listener [#110](https://github.com/whotracksme/webextension-packages/pull/110) ([@chrmod](https://github.com/chrmod))
6
+
7
+ #### Authors: 1
8
+
9
+ - Krzysztof Modras ([@chrmod](https://github.com/chrmod))
10
+
11
+ ---
12
+
13
+ # v5.1.27 (Wed Oct 23 2024)
14
+
15
+ #### 🐛 Bug Fix
16
+
17
+ - Remove main_frame redirect detection [#108](https://github.com/whotracksme/webextension-packages/pull/108) ([@chrmod](https://github.com/chrmod))
18
+
19
+ #### 🏠 Internal
20
+
21
+ - webrequest-pipeline cleanup [#106](https://github.com/whotracksme/webextension-packages/pull/106) ([@chrmod](https://github.com/chrmod))
22
+ - PageStore cleanup [#105](https://github.com/whotracksme/webextension-packages/pull/105) ([@chrmod](https://github.com/chrmod))
23
+ - PageStore cleanup [#104](https://github.com/whotracksme/webextension-packages/pull/104) ([@chrmod](https://github.com/chrmod))
24
+
25
+ #### Authors: 1
26
+
27
+ - Krzysztof Modras ([@chrmod](https://github.com/chrmod))
28
+
29
+ ---
30
+
1
31
  # v5.1.26 (Wed Oct 02 2024)
2
32
 
3
33
  #### 🐛 Bug Fix
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whotracksme/reporting",
3
- "version": "5.1.26",
3
+ "version": "5.1.28",
4
4
  "type": "module",
5
5
  "description": "",
6
6
  "scripts": {
@@ -112,9 +112,20 @@ chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
112
112
  sender,
113
113
  );
114
114
  } else if (request.action === 'debug') {
115
- sendResponse({
116
- tabs: [...webRequestPipeline.pageStore.tabs._inMemoryMap.values()],
117
- });
115
+ (async () => {
116
+ const tabs = await chrome.tabs.query({});
117
+
118
+ sendResponse({
119
+ tabs: tabs.map((tab) =>
120
+ webRequestPipeline.pageStore.getPageForRequest({
121
+ tabId: tab.id,
122
+ frameId: 0,
123
+ }),
124
+ ),
125
+ });
126
+ })();
127
+
128
+ return true;
118
129
  }
119
130
  });
120
131
 
@@ -11,8 +11,7 @@
11
11
  "webRequest",
12
12
  "tabs",
13
13
  "storage",
14
- "scripting",
15
- "windows"
14
+ "scripting"
16
15
  ],
17
16
  "action": {
18
17
  "default_title": "WTM/Reporting Inspector"
@@ -24,7 +24,6 @@ import { HashProb, shouldCheckToken } from './hash.js';
24
24
  import { VERSION, COOKIE_MODE } from './config.js';
25
25
  import { shuffle } from './utils.js';
26
26
  import buildPageLoadObject from './page-telemetry.js';
27
- import getTrackingStatus from './dnt.js';
28
27
  import random from '../random.js';
29
28
 
30
29
  import BlockRules from './steps/block-rules.js';
@@ -254,9 +253,9 @@ export default class RequestMonitor {
254
253
  fn: (state) => steps.oAuthDetector.checkMainFrames(state),
255
254
  },
256
255
  {
257
- name: 'redirectTagger.checkRedirect',
256
+ name: 'checkIsMainDocument',
258
257
  spec: 'break',
259
- fn: (state) => steps.redirectTagger.checkRedirect(state),
258
+ fn: (state) => !state.isMainFrame,
260
259
  },
261
260
  {
262
261
  name: 'checkSameGeneralDomain',
@@ -381,11 +380,6 @@ export default class RequestMonitor {
381
380
  spec: 'collect', // TODO - global state
382
381
  fn: (state) => steps.cookieContext.assignCookieTrust(state),
383
382
  },
384
- {
385
- name: 'redirectTagger.confirmRedirect',
386
- spec: 'break',
387
- fn: (state) => steps.redirectTagger.confirmRedirect(state),
388
- },
389
383
  {
390
384
  name: 'checkIsMainDocument',
391
385
  spec: 'break',
@@ -517,20 +511,9 @@ export default class RequestMonitor {
517
511
  fn: checkValidContext,
518
512
  },
519
513
  {
520
- name: 'checkMainDocumentRedirects',
514
+ name: 'checkIsMainDocument',
521
515
  spec: 'break',
522
- fn: (state) => {
523
- if (state.isMainFrame) {
524
- // check for tracking status headers for first party
525
- const trackingStatus = getTrackingStatus(state);
526
- if (trackingStatus) {
527
- state.page.tsv = trackingStatus.value;
528
- state.page.tsvId = trackingStatus.statusId;
529
- }
530
- return false;
531
- }
532
- return true;
533
- },
516
+ fn: (state) => !state.isMainFrame,
534
517
  },
535
518
  {
536
519
  name: 'checkSameGeneralDomain',
@@ -547,28 +530,6 @@ export default class RequestMonitor {
547
530
  spec: 'annotate',
548
531
  fn: (state) => steps.pageLogger.onHeadersReceived(state),
549
532
  },
550
- {
551
- name: 'logResponseStats',
552
- spec: 'collect',
553
- fn: (state) => {
554
- if (state.incrementStat) {
555
- // TSV stats
556
- if (
557
- this.qs_whitelist.isTrackerDomain(
558
- truncatedHash(state.urlParts.generalDomain),
559
- )
560
- ) {
561
- const trackingStatus = getTrackingStatus(state);
562
- if (trackingStatus) {
563
- state.incrementStat(`tsv_${trackingStatus.value}`);
564
- if (trackingStatus.statusId) {
565
- state.incrementStat('tsv_status');
566
- }
567
- }
568
- }
569
- }
570
- },
571
- },
572
533
  {
573
534
  name: 'checkSetCookie',
574
535
  spec: 'break',
@@ -35,8 +35,8 @@ export default function buildPageLoadObject(page) {
35
35
  redirects: [],
36
36
  redirectsPlaceHolder: [],
37
37
  triggeringTree: {},
38
- tsv: page.tsv,
39
- tsv_id: page.tsvId !== undefined,
38
+ tsv: '',
39
+ tsv_id: false,
40
40
  frames: {},
41
41
  };
42
42
  }
@@ -12,7 +12,6 @@
12
12
  /* eslint no-param-reassign: 'off' */
13
13
 
14
14
  import { truncateDomain } from '../utils.js';
15
- import { getStatsForDomain } from '../../webrequest-pipeline/page.js';
16
15
 
17
16
  // maps string (web-ext) to int (FF cpt). Anti-tracking still uses these legacy types.
18
17
  const TYPE_LOOKUP = {
@@ -46,8 +45,7 @@ export default class PageLogger {
46
45
  }
47
46
 
48
47
  _attachCounters(state) {
49
- const stats = getStatsForDomain(
50
- state.page,
48
+ const stats = state.page.getStatsForDomain(
51
49
  truncateDomain(state.urlParts.domainInfo, 2),
52
50
  );
53
51
  state.reqLog = stats;
@@ -100,9 +98,6 @@ export default class PageLogger {
100
98
  const scheme = isHTTP(urlParts.protocol) ? urlParts.scheme : 'other';
101
99
  incrementStat(`scheme_${scheme}`);
102
100
 
103
- // find frame depth
104
- incrementStat(`window_depth_${Math.min(state.frameAncestors.length, 2)}`);
105
-
106
101
  if (state.url.indexOf(this.config.placeHolder) > -1) {
107
102
  incrementStat('hasPlaceHolder');
108
103
  }
@@ -20,7 +20,6 @@ const CACHE_TIMEOUT = 10 * 1000;
20
20
  export default class RedirectTagger {
21
21
  constructor() {
22
22
  this.redirectCache = new TempSet();
23
- this.redirectTaggerCache = new TempSet();
24
23
  }
25
24
 
26
25
  isFromRedirect(url) {
@@ -49,27 +48,4 @@ export default class RedirectTagger {
49
48
  }
50
49
  return true;
51
50
  }
52
-
53
- checkRedirect(details) {
54
- if (details.isRedirect && details.requestId !== undefined) {
55
- this.redirectTaggerCache.add(details.requestId, CACHE_TIMEOUT);
56
- return false;
57
- }
58
- return true;
59
- }
60
-
61
- confirmRedirect(details) {
62
- if (
63
- details.requestId !== undefined &&
64
- this.redirectTaggerCache.has(details.requestId)
65
- ) {
66
- return false;
67
- }
68
-
69
- if (details.isMainFrame && details.isRedirect) {
70
- return false;
71
- }
72
-
73
- return true;
74
- }
75
51
  }