From 8538f1f3e56d36d6763b2166056aa9901050144d Mon Sep 17 00:00:00 2001 From: Camillo Bruni Date: Thu, 31 Jul 2025 14:17:24 +0200 Subject: [PATCH 1/7] cleanup --- JetStreamDriver.js | 262 +++++++++++++++++++++++++-------------------- 1 file changed, 148 insertions(+), 114 deletions(-) diff --git a/JetStreamDriver.js b/JetStreamDriver.js index 21b16394..2364032c 100644 --- a/JetStreamDriver.js +++ b/JetStreamDriver.js @@ -310,51 +310,8 @@ class Driver { runCode(string) { if (!isInBrowser) { - const scripts = string; - let globalObject; - let realm; - if (isD8) { - realm = Realm.createAllowCrossRealmAccess(); - globalObject = Realm.global(realm); - globalObject.loadString = function(s) { - return Realm.eval(realm, s); - }; - globalObject.readFile = read; - } else if (isSpiderMonkey) { - globalObject = newGlobal(); - globalObject.loadString = globalObject.evaluate; - globalObject.readFile = globalObject.readRelativeToScript; - } else - globalObject = runString(""); - - globalObject.console = { - log: globalObject.print, - warn: (e) => { print("Warn: " + e); }, - error: (e) => { print("Error: " + e); }, - debug: (e) => { print("Debug: " + e); }, - }; - - globalObject.self = globalObject; - globalObject.top = { - currentResolve, - currentReject - }; - - globalObject.performance ??= performance; - for (const script of scripts) - globalObject.loadString(script); - return isD8 ? realm : globalObject; } - - const magic = document.getElementById("magic"); - magic.contentDocument.body.textContent = ""; - magic.contentDocument.body.innerHTML = "