File tree Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,9 @@ import { getGlobal } from './utils.js';
4
4
* Check if the current document origin is on the tracker list, using the provided lookup trie.
5
5
* @param {object } trackerLookup Trie lookup of tracker domains
6
6
* @returns {boolean } True iff the origin is a tracker.
7
+ *
8
+ * Note: getGlobal() is in testing to get the global object,
9
+ * it's a work around for ESM modules are essentially singletons preventing overriding of global variables.
7
10
*/
8
11
export function isTrackerOrigin ( trackerLookup , originHostname = getGlobal ( ) . document . location . hostname ) {
9
12
const parts = originHostname . split ( '.' ) . reverse ( ) ;
Original file line number Diff line number Diff line change @@ -49,6 +49,10 @@ export function setGlobal(globalObjIn) {
49
49
Error = globalObj . Error ;
50
50
}
51
51
52
+ /**
53
+ * Used for testing to allow other files to override the globals used within this file.
54
+ * @returns {globalThis } the global object
55
+ */
52
56
export function getGlobal ( ) {
53
57
return globalObj ;
54
58
}
You can’t perform that action at this time.
0 commit comments