Skip to content

Commit ca54507

Browse files
Setting of document for tracker analysis
1 parent f996039 commit ca54507

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

injected/src/trackers.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
import { getGlobal } from './utils.js';
2+
13
/**
24
* Check if the current document origin is on the tracker list, using the provided lookup trie.
35
* @param {object} trackerLookup Trie lookup of tracker domains
46
* @returns {boolean} True iff the origin is a tracker.
57
*/
6-
export function isTrackerOrigin(trackerLookup, originHostname = document.location.hostname) {
8+
export function isTrackerOrigin(trackerLookup, originHostname = getGlobal().document.location.hostname) {
79
const parts = originHostname.split('.').reverse();
810
let node = trackerLookup;
911
for (const sub of parts) {

injected/src/utils.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ export function setGlobal(globalObjIn) {
4949
Error = globalObj.Error;
5050
}
5151

52+
export function getGlobal() {
53+
return globalObj;
54+
}
55+
5256
// linear feedback shift register to find a random approximation
5357
export function nextRandom(v) {
5458
return Math.abs((v >> 1) | (((v << 62) ^ (v << 61)) & (~(~0 << 63) << 62)));

0 commit comments

Comments
 (0)