Skip to content

Commit 3593689

Browse files
committed
[scramjet] move cookie dump to $scramjetLoadClient to avoid polluting globals
1 parent d8fcb33 commit 3593689

File tree

3 files changed

+3
-5
lines changed

3 files changed

+3
-5
lines changed

packages/scramjet/src/client/entry.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export type ScramjetClientEntryInit = {
3030
config: ScramjetConfig;
3131
interface: ScramjetInterface;
3232
transport: BareTransport;
33+
cookies: string;
3334
};
3435
export function loadAndHook(init: ScramjetClientEntryInit) {
3536
setConfig(init.config);
@@ -49,7 +50,7 @@ export function loadAndHook(init: ScramjetClientEntryInit) {
4950
frame.name = createFrameId();
5051
}
5152

52-
if (globalThis.COOKIE) client.loadcookies(globalThis.COOKIE);
53+
client.loadcookies(init.cookies);
5354

5455
client.hook();
5556

@@ -60,5 +61,4 @@ export function loadAndHook(init: ScramjetClientEntryInit) {
6061
}
6162

6263
Reflect.deleteProperty(globalThis, "WASM");
63-
Reflect.deleteProperty(globalThis, "COOKIE");
6464
}

packages/scramjet/src/client/shared/chrome.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ export default function (client: ScramjetClient, self: any) {
1717
}
1818
};
1919

20-
Reflect.deleteProperty(Navigator.prototype, "serviceWorker");
21-
2220
// obviously
2321
// del("chrome");
2422

@@ -46,6 +44,7 @@ export default function (client: ScramjetClient, self: any) {
4644
if (!iswindow) return;
4745
// DOM specific ones below here
4846

47+
Reflect.deleteProperty(Navigator.prototype, "serviceWorker");
4948
del("MediaDevices.prototype.setCaptureHandleConfig");
5049

5150
// web bluetooth api

packages/scramjet/src/types.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ declare global {
8181
var $scramjetLoadWorker: () => typeof worker;
8282
var $scramjetVersion: ScramjetVersionInfo;
8383
interface Window {
84-
COOKIE: string;
8584
WASM: string;
8685
REAL_WASM: Uint8Array;
8786

0 commit comments

Comments
 (0)