[Git][ghc/ghc][master] wasm: ensure post-linker output is synchronous ESM
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC Commits: cccf45da by Cheng Shao at 2026-05-25T16:32:13-04:00 wasm: ensure post-linker output is synchronous ESM This patch fixes wasm backend's post-linker output script to ensure it's synchronous ESM and doesn't use top-level await, which doesn't work in ServiceWorkers. Fixes #27257. - - - - - 2 changed files: - + changelog.d/wasm-fix-serviceworker - utils/jsffi/prelude.mjs Changes: ===================================== changelog.d/wasm-fix-serviceworker ===================================== @@ -0,0 +1,4 @@ +section: wasm-backend +synopsis: Ensure post-linker output is synchronous ESM and fix loading in ServiceWorker +issues: #27257 +mrs: !16093 ===================================== utils/jsffi/prelude.mjs ===================================== @@ -39,19 +39,13 @@ export class JSValManager { // To benchmark different setImmediate() implementations in the // browser, use https://github.com/jphpsf/setImmediate-shim-demo as a // starting point. -export const setImmediate = await (async () => { - // node, bun, or other scripts might have set this up in the browser +export const setImmediate = (() => { + // node, deno, bun, or other scripts might have set this up in the + // browser if (globalThis.setImmediate) { return globalThis.setImmediate; } - // deno - if (globalThis.Deno) { - try { - return (await import("node:timers")).setImmediate; - } catch {} - } - // https://developer.mozilla.org/en-US/docs/Web/API/Scheduler/postTask if (globalThis.scheduler) { return (cb, ...args) => scheduler.postTask(() => cb(...args)); View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/cccf45da01988801b0c97f7e7ed01601... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/cccf45da01988801b0c97f7e7ed01601... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Marge Bot (@marge-bot)