A typescript package to execute JavaScript and TypeScript code in a webassembly quickjs sandbox
**Describe the bug** `setTimeout(f)` should behave exactly like `setTimeout(f, 0)`. A lot of code in the wild relies on this behavior. However, instead of working as expected, it throws an error (see below). This behavior changed recently. In version 2.0.1, such timeouts never fired and prevented the script from completing. ```js { ok: false, error: { name: 'TypeError', message: "Cannot read properties of undefined (reading 'owner')", stack: "TypeError: Cannot read properties of undefined (reading 'owner')\n" + ' at <anonymous> (/src/index.js:4:5)\n' + "Host: TypeError: Cannot read properties of undefined (reading 'owner')\n" + ' at QuickJSContext.unwrapResult (file:///E:/qjs/node_modules/quickjs-emscripten-core/dist/chunk-JTKJZQYV.mjs:4:24443)\n' + ' at file:///E:/qjs/node_modules/@sebastianwessel/quickjs/dist/esm/sandbox/syncVersion/createEvalCodeFunction.js:28:45\n' + ' at runSandboxed.maxTimeoutCount (file:///E:/qjs/q.mjs:8:18)\n' + ' at executeSandboxFunction (file:///E:/qjs/node_modules/@sebastianwessel/quickjs/dist/esm/sandbox/syncVersion/executeSandboxFunction.js:8:18)\n' + ' at runSandboxed (file:///E:/qjs/node_modules/@sebastianwessel/quickjs/dist/esm/loadQuickJs.js:55:34)\n' + ' at async file:///E:/qjs/q.mjs:6:16' }, isSyntaxError: false } ``` **To Reproduce** Run this code to see the issue: ```js import { loadQuickJs } from "@sebastianwessel/quickjs"; import { readFileSync } from "fs"; const { runSandboxed } = await loadQuickJs(); const result = await runSandboxed(async ({ evalCode }) => { return await evalCode(` setTimeout(() => { console.log("Hello from setTimeout"); }); `); }); console.log(result); ``` **Desktop (please complete the following information):** Node 22.7.0 on Windows 10
This issue appears to be discussing a feature request or bug report related to the repository. Based on the content, it seems to be resolved. The issue was opened by thorn0 and has received 5 comments.