From 3981e40deb610f23bd54526592f8a61ffc6046b3 Mon Sep 17 00:00:00 2001 From: Percs <83934299+Percslol@users.noreply.github.com> Date: Sat, 2 Nov 2024 21:10:58 -0500 Subject: [PATCH] fix: syncxhr and dynamic import function --- src/client/shared/import.ts | 2 +- src/client/shared/requests/xmlhttprequest.ts | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/client/shared/import.ts b/src/client/shared/import.ts index 6f1811e..8b23bf8 100644 --- a/src/client/shared/import.ts +++ b/src/client/shared/import.ts @@ -3,7 +3,7 @@ import { config } from "../../shared"; import { rewriteUrl } from "../../shared/rewriters/url"; export default function (client: ScramjetClient, self: Self) { - const Function = client.natives.Function; + const Function = client.natives["Function"]; self[config.globals.importfn] = function (base: string) { return function (url: string) { diff --git a/src/client/shared/requests/xmlhttprequest.ts b/src/client/shared/requests/xmlhttprequest.ts index ca6fc01..2fc0c4f 100644 --- a/src/client/shared/requests/xmlhttprequest.ts +++ b/src/client/shared/requests/xmlhttprequest.ts @@ -5,7 +5,9 @@ import { ScramjetClient } from "../../client"; export default function (client: ScramjetClient, self: Self) { let worker; if (self.Worker && flagEnabled("syncxhr", client.url)) { - worker = new client.natives["Worker"](config.files.sync); + worker = new (client.natives["Worker"] ? client.natives["Worker"] : Worker)( + config.files.sync + ); } const ARGS = Symbol("xhr original args"); const HEADERS = Symbol("xhr headers");