Move getMemory where it belongs

This commit is contained in:
Kuba Orlik 2021-11-07 17:23:48 +01:00
parent 2bd4e8b9da
commit 729a60a998
7 changed files with 15 additions and 10 deletions

View File

@ -69,3 +69,7 @@ export function init() {
(window as any).memory = memory; (window as any).memory = memory;
} }
export function getMemory(): Memory {
return (browser.extension.getBackgroundPage().window as any).memory as Memory;
}

View File

@ -1,6 +1,6 @@
import React from "react"; import React from "react";
import ReactDOM from "react-dom"; import ReactDOM from "react-dom";
import { getMemory } from "../util"; import { getMemory } from "../memory";
function Report() { function Report() {
const origin = new URL(document.location.toString()).searchParams.get( const origin = new URL(document.location.toString()).searchParams.get(

View File

@ -2,7 +2,8 @@ import React, { useEffect, useState } from "react";
import ReactDOM from "react-dom"; import ReactDOM from "react-dom";
import Options from "../options"; import Options from "../options";
import { StolenData } from "./stolen-data"; import { StolenData } from "./stolen-data";
import { getMemory, useEmitter } from "../util"; import { useEmitter } from "../util";
import { getMemory } from "../memory";
async function getCurrentTab() { async function getCurrentTab() {
const [tab] = await browser.tabs.query({ const [tab] = await browser.tabs.query({

View File

@ -1,7 +1,8 @@
import React from "react"; import React from "react";
import { getMemory } from "../memory";
import { MergedStolenDataEntry, Sources } from "../stolen-data-entry";
import { MergedStolenDataEntry, Sources } from "../request-cluster"; import { hyphenate } from "../util";
import { getMemory, hyphenate } from "../util";
function StolenDataValueTable({ function StolenDataValueTable({
entry, entry,

View File

@ -1,7 +1,9 @@
import React from "react"; import React from "react";
import { RequestCluster } from "../request-cluster"; import { RequestCluster } from "../request-cluster";
import StolenDataCluster from "./stolen-data-cluster"; import StolenDataCluster from "./stolen-data-cluster";
import { getMemory, getshorthost } from "../util"; import { getshorthost } from "../util";
import { getMemory } from "../memory";
export function StolenData({ export function StolenData({
origin, origin,

View File

@ -1,6 +1,7 @@
import { TCModel } from "@iabtcf/core"; import { TCModel } from "@iabtcf/core";
import ExtendedRequest from "./extended-request"; import ExtendedRequest from "./extended-request";
import { getMemory, isJSONObject, isURL, parseToObject } from "./util"; import { getMemory } from "./memory";
import { isJSONObject, isURL, parseToObject } from "./util";
export type Sources = "cookie" | "pathname" | "queryparams" | "header"; export type Sources = "cookie" | "pathname" | "queryparams" | "header";

View File

@ -83,10 +83,6 @@ export function hyphenate(str: string): string {
return str.replace(/[_\[A-Z]/g, `${String.fromCharCode(173)}$&`); return str.replace(/[_\[A-Z]/g, `${String.fromCharCode(173)}$&`);
} }
export function getMemory(): Memory {
return (browser.extension.getBackgroundPage().window as any).memory as Memory;
}
export function unique(array: string[]) { export function unique(array: string[]) {
return Array.from(new Set(array)); return Array.from(new Set(array));
} }