From 886514aa52ad3cdadbdec0854fad30c4d03c5e9f Mon Sep 17 00:00:00 2001 From: Val Packett Date: Fri, 26 Jul 2024 04:54:02 -0300 Subject: [PATCH] bootprefix: Tighten browser check to include the document global (#8423) Deno's node emulation can run TiddlyWiki now that it supports the VM isolates API, but the window global exists in that environment, so both browser and node were being detected, causing the autoboot to trip up on nonexistent argv, as the boot was happening in the constructor right before argv was set. Ref: https://github.com/denoland/deno/issues/19286 Ref: https://github.com/flexdinesh/browser-or-node --- boot/bootprefix.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boot/bootprefix.js b/boot/bootprefix.js index 0ae236c21..4dae1b28f 100644 --- a/boot/bootprefix.js +++ b/boot/bootprefix.js @@ -21,7 +21,7 @@ $tw.boot = $tw.boot || Object.create(null); // Detect platforms if(!("browser" in $tw)) { - $tw.browser = typeof(window) !== "undefined" ? {} : null; + $tw.browser = typeof(window) !== "undefined" && typeof(document) !== "undefined" ? {} : null; } if(!("node" in $tw)) { $tw.node = typeof(process) === "object" ? {} : null;