Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion scripts/build/deps/webkit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@
// -lto variants built with ThinLTO (per-module summaries for cross-language
// importing), and the Windows ICU data table filtered + per-item zstd
// compressed (lazily decompressed via bun_icu_decompress.cpp).
export const WEBKIT_VERSION = "cd821fecca0d39c8bac874c283d956868c7f0de0";
// TEMPORARY preview pin: main's WebKit cd821fec + the asyncModuleExecutionResume
// fix from oven-sh/WebKit#252 (fixes oven-sh/bun#32178), rebased onto cd821fec as
// commit 83144fc3 so it is ABI-compatible with main's bindings.
// Swap to the oven-sh/WebKit main autobuild SHA that includes #252 (the new commit
// created when #252 lands, NOT cd821fec which is its unfixed base), before merging.
// (main pin superseded by this preview: "cd821fecca0d39c8bac874c283d956868c7f0de0")
export const WEBKIT_VERSION = "autobuild-preview-pr-252-83144fc3";

Check warning on line 16 in scripts/build/deps/webkit.ts

View check run for this annotation

Claude / Claude Code Review

PR description and merge-gate thread one rebase behind (cd821fec / 83144fc3)

🟡 Nit: same documentation-drift as the (resolved) 09f04cd5/6861a738 thread, one rebase later. The diff now removes main's pin `cd821fec` and sets `WEBKIT_VERSION = "autobuild-preview-pr-252-83144fc3"` (commit 32d3d8fb, third rebase), and the in-source TEMPORARY comment is correct — but the PR description (Fix section + Rebase note 2), the latest reply on the open merge-gate thread (3424834553), and the 01:55Z status comment still reference `09f04cd5` / `autobuild-preview-pr-252-6861a738`. No cod
Comment thread
robobun marked this conversation as resolved.

/**
* WebKit (JavaScriptCore) — the JS engine.
Expand Down
67 changes: 67 additions & 0 deletions test/regression/issue/32178.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
// https://github.com/oven-sh/bun/issues/32178
Comment thread
robobun marked this conversation as resolved.
import { expect, test } from "bun:test";
import { bunEnv, bunExe, tempDir } from "harness";

test.concurrent("top-level await resumes while an AsyncLocalStorage context is active", async () => {
using dir = tempDir("issue-32178", {
"entry.ts": `
import { AsyncLocalStorage } from "node:async_hooks";
const als = new AsyncLocalStorage();
als.enterWith({ v: 42 });
await Promise.resolve(1);
console.log("after microtask await:", JSON.stringify(als.getStore()));
await new Promise(r => setImmediate(r));
console.log("after macrotask await:", JSON.stringify(als.getStore()));
`,
});

await using proc = Bun.spawn({
cmd: [bunExe(), "entry.ts"],
env: bunEnv,
cwd: String(dir),
stdout: "pipe",
stderr: "pipe",
});

const [stdout, stderr, exitCode] = await Promise.all([proc.stdout.text(), proc.stderr.text(), proc.exited]);

// The async context must also survive across the top-level awaits, like Node.
expect({ stdout, stderr, exitCode }).toEqual({
stdout: 'after microtask await: {"v":42}\nafter macrotask await: {"v":42}\n',
stderr: "",
exitCode: 0,
});
Comment thread
claude[bot] marked this conversation as resolved.
});

test.concurrent("imported top-level-await module entering an AsyncLocalStorage context", async () => {
using dir = tempDir("issue-32178-import", {
"main.ts": `
import { store } from "./tla.ts";
console.log("imported:", JSON.stringify(store));
`,
"tla.ts": `
import { AsyncLocalStorage } from "node:async_hooks";
const als = new AsyncLocalStorage();
als.enterWith({ id: 7 });
await Promise.resolve();
await Promise.resolve();
export const store = als.getStore();
`,
});

await using proc = Bun.spawn({
cmd: [bunExe(), "main.ts"],
env: bunEnv,
cwd: String(dir),
stdout: "pipe",
stderr: "pipe",
});

const [stdout, stderr, exitCode] = await Promise.all([proc.stdout.text(), proc.stderr.text(), proc.exited]);

expect({ stdout, stderr, exitCode }).toEqual({
stdout: 'imported: {"id":7}\n',
stderr: "",
exitCode: 0,
});
});
Loading