bugsbug fix - global is readonly
Some checks are pending
ci / Linux (Ubuntu) (push) Waiting to run
ci / linux-asan (push) Waiting to run
ci / linux-msan (push) Waiting to run
ci / linux-ubsan (push) Waiting to run
ci / macOS (push) Waiting to run
ci / macos-asan (push) Waiting to run
ci / macos-ubsan (push) Waiting to run
ci / freebsd (push) Waiting to run
ci / qemu-alpine (arm32v6) (push) Waiting to run
ci / qemu-alpine (arm32v7) (push) Waiting to run
ci / qemu-alpine (arm64v8) (push) Waiting to run
ci / qemu-alpine (i386) (push) Waiting to run
ci / qemu-alpine (s390x) (push) Waiting to run

This commit is contained in:
The Ghost of FOSS' Past 2024-10-24 15:46:45 -05:00
parent 4fb5334ebc
commit 8f39c02ea6

14
qjs.c
View file

@ -508,15 +508,15 @@ int main(int argc, char **argv)
eval_buf(ctx, reqPF, strlen(reqPF), "<input>", JS_EVAL_TYPE_MODULE); eval_buf(ctx, reqPF, strlen(reqPF), "<input>", JS_EVAL_TYPE_MODULE);
const char *timeoutPF = "global.setTimeout = os.setTimeout\n" const char *timeoutPF = "globalThis.setTimeout = os.setTimeout\n"
"global.sleep = os.sleep"; "globalThis.sleep = os.sleep";
eval_buf(ctx, timeoutPF, strlen(timeoutPF), "<input>", JS_EVAL_TYPE_MODULE); eval_buf(ctx, timeoutPF, strlen(timeoutPF), "<input>", JS_EVAL_TYPE_MODULE);
const char *stdGlobals = "global.urlGet = std.urlGet\n" const char *stdGlobals = "globalThis.urlGet = std.urlGet\n"
"global.loadFile = std.loadFile\n" "globalThis.loadFile = std.loadFile\n"
"global.printf = std.printf\n" "globalThis.printf = std.printf\n"
"global.evalFile = std.loadScript\n" "globalThis.evalFile = std.loadScript\n"
"global.getURL = std.urlGet"; "globalThis.getURL = std.urlGet";
eval_buf(ctx, stdGlobals, strlen(stdGlobals), "<input>", JS_EVAL_TYPE_MODULE); eval_buf(ctx, stdGlobals, strlen(stdGlobals), "<input>", JS_EVAL_TYPE_MODULE);