Repository navigation
Upgrade WebKit to fc9f2fa7272fec64905df6a9c78e15d7912f14ca - #28371
Conversation
|
Updated 5:31 AM PT - Mar 22nd, 2026
❌ @sosukesuzuki, your commit cabf10d has 2 failures in
🧪 To try this PR locally: bunx bun-pr 28371That installs a local version of the PR into your bun-28371 --bun |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughUpdated default WebKit commit; removed event-loop queue helpers from several global method tables; migrated many GC visitor hooks to GC-thread variants; added explicit VM argument to numerous promise resolve calls; adjusted WebAssembly streaming APIs, generated static-global emission, wasm memory clone behavior, tests, and an allowlist. Changes
Suggested reviewers
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/bun.js/bindings/JSBundlerPlugin.cpp (1)
161-216:⚠️ Potential issue | 🔴 CriticalAdd the missing
DEFINE_VISIT_ADDITIONAL_CHILDREN_IN_GC_THREAD(JSBundlerPlugin)macro.This file renames the helper function and updates call sites but omits the macro registration present in all other migrated bindings. Without it, the
visitAdditionalChildrenInGCThreadhook may not be properly wired into JSC's garbage collection system.🔧 Suggested fix
DEFINE_VISIT_CHILDREN(JSBundlerPlugin); +DEFINE_VISIT_ADDITIONAL_CHILDREN_IN_GC_THREAD(JSBundlerPlugin); template<typename Visitor> void JSBundlerPlugin::visitOutputConstraintsImpl(JSCell* cell, Visitor& visitor)🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/bun.js/bindings/JSBundlerPlugin.cpp` around lines 161 - 216, The file defines JSBundlerPlugin::visitAdditionalChildrenInGCThread but forgot to register it with the JSC GC macros; add the macro invocation DEFINE_VISIT_ADDITIONAL_CHILDREN_IN_GC_THREAD(JSBundlerPlugin) alongside the existing DEFINE_VISIT_CHILDREN(JSBundlerPlugin) and DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSBundlerPlugin) so the visitAdditionalChildrenInGCThread hook is properly wired into JSC's garbage collector for the JSBundlerPlugin class.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@cmake/tools/SetupWebKit.cmake`:
- Around line 8-10: The change sets WEBKIT_VERSION to a commit SHA that has no
matching release tag in oven-sh/WebKit, which will break downloading prebuilt
artifacts; revert or remove the hardcoded default in SetupWebKit.cmake (the
set(WEBKIT_VERSION de176b300e6545e3dbb2049e38ef1e22d943b3e0) line) and instead
leave WEBKIT_VERSION unset or set it to a known-good release tag, then verify
the release tag named autobuild-<sha> exists in the oven-sh/WebKit repository
(or that prebuilt artifacts are published) before reintroducing this specific
value. Ensure references to WEBKIT_VERSION in the rest of the script continue to
work when it is unset and update any documentation or CI that relies on a
default.
In `@src/bun.js/bindings/ZigGlobalObject.cpp`:
- Line 3432: The compileStreaming and instantiateStreaming functions currently
accept an unnamed std::optional<JSC::WebAssemblyCompileOptions>&& but never
forward it to handleResponseOnStreamingAction, causing StreamingCompiler::create
to be called with std::nullopt; fix this by naming the parameter (e.g.,
compileOptions) in compileStreaming/instantiateStreaming, thread that
compileOptions through to handleResponseOnStreamingAction, and ensure
handleResponseOnStreamingAction forwards the optional to
StreamingCompiler::create (replace the std::nullopt argument at the
StreamingCompiler::create call with the forwarded compileOptions) so callers'
WebAssemblyCompileOptions are respected.
---
Outside diff comments:
In `@src/bun.js/bindings/JSBundlerPlugin.cpp`:
- Around line 161-216: The file defines
JSBundlerPlugin::visitAdditionalChildrenInGCThread but forgot to register it
with the JSC GC macros; add the macro invocation
DEFINE_VISIT_ADDITIONAL_CHILDREN_IN_GC_THREAD(JSBundlerPlugin) alongside the
existing DEFINE_VISIT_CHILDREN(JSBundlerPlugin) and
DEFINE_VISIT_OUTPUT_CONSTRAINTS(JSBundlerPlugin) so the
visitAdditionalChildrenInGCThread hook is properly wired into JSC's garbage
collector for the JSBundlerPlugin class.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 9fa81b51-48ed-4514-92b7-2bd7a9f0e94e
📒 Files selected for processing (48)
cmake/tools/SetupWebKit.cmakesrc/bake/BakeGlobalObject.cppsrc/bun.js/bindings/BunAnalyzeTranspiledModule.cppsrc/bun.js/bindings/BunGCOutputConstraint.cppsrc/bun.js/bindings/JSBundlerPlugin.cppsrc/bun.js/bindings/JSMockFunction.cppsrc/bun.js/bindings/JSSecrets.cppsrc/bun.js/bindings/ModuleLoader.cppsrc/bun.js/bindings/NodeTimerObject.cppsrc/bun.js/bindings/NodeVM.cppsrc/bun.js/bindings/ZigGlobalObject.cppsrc/bun.js/bindings/ZigGlobalObject.hsrc/bun.js/bindings/bindings.cppsrc/bun.js/bindings/sqlite/JSSQLStatement.cppsrc/bun.js/bindings/webcore/CustomEventCustom.cppsrc/bun.js/bindings/webcore/JSAbortSignal.cppsrc/bun.js/bindings/webcore/JSAbortSignal.hsrc/bun.js/bindings/webcore/JSAbortSignalCustom.cppsrc/bun.js/bindings/webcore/JSCustomEvent.cppsrc/bun.js/bindings/webcore/JSCustomEvent.hsrc/bun.js/bindings/webcore/JSDOMPromiseDeferred.cppsrc/bun.js/bindings/webcore/JSErrorEvent.cppsrc/bun.js/bindings/webcore/JSErrorEvent.hsrc/bun.js/bindings/webcore/JSErrorEventCustom.cppsrc/bun.js/bindings/webcore/JSEventEmitter.cppsrc/bun.js/bindings/webcore/JSEventEmitter.hsrc/bun.js/bindings/webcore/JSEventEmitterCustom.cppsrc/bun.js/bindings/webcore/JSEventTarget.cppsrc/bun.js/bindings/webcore/JSEventTarget.hsrc/bun.js/bindings/webcore/JSEventTargetCustom.cppsrc/bun.js/bindings/webcore/JSMessageChannel.cppsrc/bun.js/bindings/webcore/JSMessageChannel.hsrc/bun.js/bindings/webcore/JSMessageChannelCustom.cppsrc/bun.js/bindings/webcore/JSMessageEvent.cppsrc/bun.js/bindings/webcore/JSMessageEvent.hsrc/bun.js/bindings/webcore/JSMessageEventCustom.cppsrc/bun.js/bindings/webcore/JSMessagePort.cppsrc/bun.js/bindings/webcore/JSMessagePort.hsrc/bun.js/bindings/webcore/JSMessagePortCustom.cppsrc/bun.js/bindings/webcore/JSPerformanceObserver.cppsrc/bun.js/bindings/webcore/JSPerformanceObserver.hsrc/bun.js/bindings/webcore/JSPerformanceObserverCustom.cppsrc/bun.js/bindings/webcore/JSWorker.cppsrc/bun.js/bindings/webcore/SerializedScriptValue.cppsrc/bun.js/webview/JSWebView.cppsrc/codegen/bundle-functions.tssrc/codegen/generate-classes.tstest/js/bun/s3/s3-fd-validation.test.ts
💤 Files with no reviewable changes (2)
- src/bun.js/bindings/NodeVM.cpp
- src/bake/BakeGlobalObject.cpp
There was a problem hiding this comment.
This large WebKit upgrade touching 47 files with breaking API changes across core JSC integration points warrants a human review.
Extended reasoning...
Overview
This PR upgrades WebKit from commit b55703a to de176b3 (1650 upstream commits), modifying 47 files across cmake, codegen templates, and C++ bindings throughout src/bun.js/bindings/ and src/bake/.
Security Risks
No direct security vulnerabilities introduced. The WebKit upgrade brings GC hardening (writeBarrier validation, UAF crash distinguishing, weak-pointer lookup hardening) which may reduce attack surface.
Level of Scrutiny
High scrutiny appropriate. Changes span critical subsystems:
- Promise resolution: every promise->resolve() updated to add vm parameter (15+ call sites)
- Microtask queue: removal of queueMicrotaskToEventLoop hook is an architectural change affecting how Bun integrates with JSCs microtask scheduling
- GC visitors: mechanical rename of visitAdditionalChildren to visitAdditionalChildrenInGCThread across many DOM-binding objects
- WebAssembly: Memory::create and streaming compiler signatures changed
Other Factors
Bug hunting found no issues. CI build triggered. Changes follow established WebKit upgrade patterns and appear mechanically correct. However, the scope (47 files) plus the microtask scheduling architectural change justify human validation before merge.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@cmake/tools/SetupWebKit.cmake`:
- Around line 8-10: The WEBKIT_VERSION variable was bumped to
fc9f2fa7272fec64905df6a9c78e15d7912f14ca but the corresponding release tag
autobuild-fc9f2fa7272fec64905df6a9c78e15d7912f14ca is not published yet; revert
the WEBKIT_VERSION change in SetupWebKit.cmake (restore the prior commit hash)
or gate this change until the prebuilts are published by removing the new hash
from the set(WEBKIT_VERSION ...) assignment and/or adding a pre-check that
validates the existence of the release tag before attempting to download
prebuilts (use the WEBKIT_VERSION symbol and the expected
autobuild-<WEBKIT_VERSION> tag name in the check).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: ed440143-3290-47f4-bd73-3df0198e2cde
📒 Files selected for processing (1)
cmake/tools/SetupWebKit.cmake
| if(NOT WEBKIT_VERSION) | ||
| set(WEBKIT_VERSION b55703a58c8e57ac3479b9ba5cd434386a298965) | ||
| set(WEBKIT_VERSION fc9f2fa7272fec64905df6a9c78e15d7912f14ca) | ||
| endif() |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
TAG="autobuild-fc9f2fa7272fec64905df6a9c78e15d7912f14ca"
REPO="oven-sh/WebKit"
echo "== Checking if release tag ${TAG} exists =="
if gh release view "$TAG" --repo "$REPO" >/dev/null 2>&1; then
echo "OK: Release tag exists"
else
echo "FAIL: Release tag ${TAG} not found in ${REPO}"
exit 1
fi
echo
echo "== Listing release assets =="
gh release view "$TAG" --repo "$REPO" --json assets --jq '.assets[].name' | sort
echo
echo "== Checking for expected platform artifacts =="
expected_assets=(
"bun-webkit-linux-amd64-lto.tar.gz"
"bun-webkit-linux-arm64-lto.tar.gz"
"bun-webkit-macos-amd64-lto.tar.gz"
"bun-webkit-macos-arm64-lto.tar.gz"
"bun-webkit-windows-amd64-lto.tar.gz"
)
ASSETS_JSON="$(gh release view "$TAG" --repo "$REPO" --json assets)"
missing=0
for name in "${expected_assets[@]}"; do
if echo "$ASSETS_JSON" | jq -e --arg n "$name" '.assets[] | select(.name == $n)' >/dev/null; then
echo "OK $name"
else
echo "MISS $name"
missing=1
fi
done
if [[ "$missing" -ne 0 ]]; then
echo
echo "WARN: Some expected artifacts may be missing"
fiRepository: oven-sh/bun
Length of output: 239
Do not merge until the WebKit release is published.
The WEBKIT_VERSION is updated to fc9f2fa7272fec64905df6a9c78e15d7912f14ca, but the corresponding release tag autobuild-fc9f2fa7272fec64905df6a9c78e15d7912f14ca does not exist in oven-sh/WebKit. The build will fail when attempting to download prebuilt artifacts. The WebKit prebuilts must be built and published to the release page before this change can merge.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@cmake/tools/SetupWebKit.cmake` around lines 8 - 10, The WEBKIT_VERSION
variable was bumped to fc9f2fa7272fec64905df6a9c78e15d7912f14ca but the
corresponding release tag autobuild-fc9f2fa7272fec64905df6a9c78e15d7912f14ca is
not published yet; revert the WEBKIT_VERSION change in SetupWebKit.cmake
(restore the prior commit hash) or gate this change until the prebuilts are
published by removing the new hash from the set(WEBKIT_VERSION ...) assignment
and/or adding a pre-check that validates the existence of the release tag before
attempting to download prebuilts (use the WEBKIT_VERSION symbol and the expected
autobuild-<WEBKIT_VERSION> tag name in the check).
JSBigInt.cpp now uses std::min({initializer_list}) which pulls in
MSVC STL's __std_minmax implementation with AVX/AVX-512 instructions.
These are runtime-gated by __isa_available.
This ensures spawned subprocesses are killed when they hang, preventing zombie processes from starving concurrent tests.
WebKit's CRASH() macro now uses WTFBreakpointTrap() on Linux release builds (int3 on x64, brk on arm64), which raises SIGTRAP instead of the previous SIGSEGV at 0xbbadbeef from WTFCrash(). Without a SIGTRAP handler, a failed RELEASE_ASSERT would cause undefined behavior as execution falls through to __builtin_unreachable() after the trap signal is handled without re-raising.
The bytecode compile tests hang consistently on Linux CI. These changes add a granular diagnostic test that separately exercises each phase (plain build, bytecode only, compile only, both, run compiled) so we can see exactly which step hangs. Also adds signalCode reporting when build/run subprocesses are killed by timeout.
The SIGTRAP handler addition broke child_process.test.ts which expects SIGTRAP signal to be reported as-is. The crash handler was catching it and converting the exit to SIGILL. Since default SIGTRAP disposition is terminate (not ignore), WebKit RELEASE_ASSERT failures would still terminate the process correctly without Bun's handler. The prefix variable in expectBundled.ts was out of scope in the build signalCode check, preventing us from seeing the subprocess output. Added 10 concurrent compile tests to the diagnostic - if these hang but the sequential ones pass, the issue is concurrency-related.
The Linux bundler_compile.test.ts hang is a pre-existing issue from PR #26923 (ELF section for standalone binaries), not from the WebKit upgrade. That PR added describe.concurrent to bundler_compile.test.ts and changed the Linux inject path from a simple append to reading and rewriting the entire executable. With 20 concurrent compiles of a ~500MB profile binary, this causes resource exhaustion. The ELF PR's own CI (build #40193) shows the same failures.
The test was hanging on Windows waiting for FinalizationRegistry callbacks that never fired after a single Bun.gc(true). GC doesn't guarantee immediate finalization, especially across event loop ticks. Replace the single await with a bounded loop that repeatedly invokes GC and yields to the event loop, giving DeferredWorkTimer callbacks a chance to run.
PR #26923 changed this to describe.concurrent and also changed the Linux ELF inject path from a simple append to reading + rewriting the entire executable. With profile builds at ~500MB, running 20 concurrent compiles exhausts CI resources. Sequential execution avoids this resource contention. The ELF PR's own CI (build #40193) shows identical timeouts on all Linux x64 targets.
| if (opts->error.type == Secrets::ErrorType::NotFound) { | ||
| if (opts->op == SecretsJobOptions::GET) { | ||
| // For GET operations, NotFound resolves with null | ||
| RELEASE_AND_RETURN(scope, promise->resolve(global, jsNull())); | ||
| RELEASE_AND_RETURN(scope, promise->resolve(global, vm, jsNull())); | ||
| } else if (opts->op == SecretsJobOptions::DELETE_OP) { | ||
| // For DELETE_OP operations, NotFound means we return false | ||
| RELEASE_AND_RETURN(scope, promise->resolve(global, jsBoolean(false))); | ||
| RELEASE_AND_RETURN(scope, promise->resolve(global, vm, jsBoolean(false))); | ||
| } | ||
| } | ||
| JSValue error = opts->error.toJS(vm, global); |
There was a problem hiding this comment.
🟣 Pre-existing bug: Bun.secrets.delete(service, name) fails silently when called with two positional string arguments because case DELETE_OP: falls through to case SET: which requires 3 positional args instead of 2. This is a pre-existing issue unrelated to this PR's WebKit upgrade changes.
Extended reasoning...
What the bug is
In SecretsJobOptions::fromJS() (JSSecrets.cpp), the case DELETE_OP: label has no body and falls through to case SET:. The shared positional-argument path inside that combined block checks args.size() > 2, requiring three string arguments (service, name, value). But DELETE_OP only needs two arguments (service + name) — there is no value to delete. So any call like Bun.secrets.delete("myService", "myKey") with two positional strings skips the fast path entirely and falls into fromOptionsObject(), which throws "Expected options to be an object" because the second argument is a string, not an options object.
The specific code path
0 ""
0 ""
0 ""
1 "/usr/include/stdc-predef.h" 1 3 4
0 "" 2
1 ""
By contrast, case GET: correctly uses args.size() > 1 in its own branch, requiring only 2 string args.
Why existing code does not prevent it
The fall-through is intentional for the options-object form (both SET and DELETE can accept {service, name, value} / {service, name} objects), but the positional-argument guard was written with only SET in mind (which genuinely needs 3 args: service, name, value). Nobody added a separate positional check for DELETE_OP that needs only 2.
Impact
Any caller using the convenient Bun.secrets.delete('service', 'name') positional form receives a runtime error instead of a successful deletion. The options-object form Bun.secrets.delete({ service: 'x', name: 'y' }) works correctly. This is a silent behavioral regression for users who follow the documented positional API.
Step-by-step proof
- User calls: await Bun.secrets.delete('com.example', 'API_KEY')
- JS glue marshals this as callWithThisValueAndArguments -> fromJS(globalObject, args) where args = ['com.example', 'API_KEY'], args.size() == 2, op == DELETE_OP
- Switch hits case DELETE_OP: — no body — falls to case SET:
- Guard args.size() > 2 -> 2 > 2 -> false — positional path skipped
- fromOptionsObject() is called; it looks at args.at(0) expecting an object, finds a string -> throws "Expected options to be an object"
- Promise rejects with that error instead of deleting the secret
How to fix it
Give DELETE_OP its own case block before SET:, mirroring the GET: pattern but checking args.size() > 1:
0 ""
0 ""
0 ""
1 "/usr/include/stdc-predef.h" 1 3 4
0 "" 2
1 ""
Pre-existing classification
This PR's only change to JSSecrets.cpp is updating promise->resolve(global, value) to promise->resolve(global, vm, value) to match the new WebKit JSPromise API. The argument-parsing logic in fromJS() was not touched by this PR.
After reverting to sequential describe, the test passes 39 tests in 3 minutes on ASAN before hitting the file-level timeout. With 54 total compile tests each needing ~4.6s sequentially on ASAN (due to the ELF inject path reading + rewriting the entire ~800MB binary), the total needed is ~250s which exceeds the default 3-minute testTimeout but fits within the 5-minute integrationTimeout.
…pe read - Forward WebAssemblyCompileOptions through compileStreaming/instantiateStreaming to StreamingCompiler::create instead of dropping it. The new JSC API accepts compile options (e.g. JS string builtins) and we were silently ignoring them. - Replace result->memory().addressType() with explicit Wasm::AddressType::I32 in SerializedScriptValue WasmMemoryTag deserialization. The call was reading from an uninitialized stub before result->adopt() is called. Memory64 isn't serialized in WasmMemoryTag anyway, so I32 is the only correct value. (Upstream WebKit has the same latent bug.) - Add missing DEFINE_VISIT_ADDITIONAL_CHILDREN_IN_GC_THREAD(JSBundlerPlugin) for consistency with other classes (was pre-existing, but harmless to add).
There was a problem hiding this comment.
The addressType and WebAssemblyCompileOptions bugs raised in earlier inline comments were fixed in cabf10d — LGTM.
Extended reasoning...
Overview
This PR upgrades WebKit from b55703a to fc9f2fa (1650 upstream commits, 301 touching JSC/WTF/bmalloc), adapting Bun's bindings to API changes in the new JSC. Changed files span 54 files across C++ bindings, codegen, and tests. The code changes are largely mechanical: method renames (visitAdditionalChildren → visitAdditionalChildrenInGCThread), macro renames, adding a vm parameter to JSPromise::resolve, forwarding a new WebAssemblyCompileOptions&& parameter, removing the now-deleted queueMicrotaskToEventLoop hook, and switching addStaticGlobals to the new std::span overload.
Security Risks
No security-sensitive changes are present. The promise/GC/Wasm API changes are adapting to upstream JSC behavior, not introducing new attack surface. The SerializedScriptValue.cpp fix explicitly documents the Memory64 limitation rather than silently passing wrong data.
Level of Scrutiny
Although the PR is large in scope, the changes are faithful mechanical adaptations to upstream API breakage — the kind that accumulate across a WebKit bump. Two substantive bugs were found and fixed by cabf10d: (1) WebAssemblyCompileOptions being unnamed/unforwarded, and (2) result->memory().addressType() being called on an uninitialized stub before result->adopt(). Both are now correctly resolved. The remaining flagged items (JSSQLStatement missing macro, JSSecrets DELETE_OP fallthrough) are pre-existing bugs not introduced by this PR.
Other Factors
CI failures mentioned in the robobun comment (v8-heap-snapshot.test.ts illegal instruction on Windows aarch64, bake/dev/stress.test.ts on Windows 2019 x64) appear to be pre-existing issues unrelated to this WebKit upgrade, consistent with the PR description noting known pre-existing failures. The test improvements (sequential bundler describe, robust FinalizationRegistry loop, await using spawn with timeout) are defensive and appropriate.
| DEFINE_VISIT_CHILDREN(JSSQLStatement); | ||
|
|
||
| template<typename Visitor> | ||
| void JSSQLStatement::visitAdditionalChildren(Visitor& visitor) | ||
| void JSSQLStatement::visitAdditionalChildrenInGCThread(Visitor& visitor) | ||
| { | ||
| JSSQLStatement* thisObject = this; | ||
| ASSERT_GC_OBJECT_INHERITS(thisObject, info()); |
There was a problem hiding this comment.
🟣 JSSQLStatement.cpp is missing the DEFINE_VISIT_ADDITIONAL_CHILDREN_IN_GC_THREAD(JSSQLStatement) macro — this is a pre-existing omission (the old code also lacked DEFINE_VISIT_ADDITIONAL_CHILDREN(JSSQLStatement)), perpetuated by this PR which renamed the method without adding the newly-required macro. To fix, add DEFINE_VISIT_ADDITIONAL_CHILDREN_IN_GC_THREAD(JSSQLStatement); on the line after DEFINE_VISIT_CHILDREN(JSSQLStatement), consistent with every other class implementing this method.
Extended reasoning...
This PR renames visitAdditionalChildren to visitAdditionalChildrenInGCThread across all affected files. For every class implementing this method — GlobalObject, JSBundlerPlugin, JSMockFunction, and all the webcore classes — the corresponding DEFINE_VISIT_ADDITIONAL_CHILDREN_IN_GC_THREAD(ClassName) macro is either added (new classes) or updated (existing classes). JSSQLStatement is the sole exception: the diff shows no removal of an old DEFINE_VISIT_ADDITIONAL_CHILDREN(JSSQLStatement) macro, which means the class never had the old macro either, and consequently the new one was never added. This is confirmed by running grep for DEFINE_VISIT_ADDITIONAL_CHILDREN in JSSQLStatement.cpp, which returns zero matches.
By contrast, JSMockFunction shows -DEFINE_VISIT_ADDITIONAL_CHILDREN(JSMockFunction) / +DEFINE_VISIT_ADDITIONAL_CHILDREN_IN_GC_THREAD(JSMockFunction) in the diff, and GlobalObject similarly shows the old macro being renamed to the new one. JSSQLStatement fell through both the old and new macro registrations. The omission predates this PR, making this a pre-existing issue that the PR perpetuated when it touched the file.
The DEFINE_VISIT_ADDITIONAL_CHILDREN_IN_GC_THREAD macro registers the visitAdditionalChildrenInGCThread function so that GC worker threads can invoke it during concurrent/incremental GC cycles. Without the macro, the GC framework has no registered hook for JSSQLStatement's additional marking from worker threads. The method itself marks _structure, _prototype, and userPrototype fields.
The practical risk from this omission is partially mitigated: JSSQLStatement's visitChildrenImpl already visits the same three fields (_structure, _prototype, userPrototype) directly, so the main-thread GC marking path remains correct. However, the missing registration removes the GC infrastructure the WebKit upgrade specifically introduced, and as JSC grows more reliant on concurrent worker-thread marking, the absent hook could become a real correctness hazard.
Step-by-step proof: (1) In the PR diff, search for DEFINE_VISIT_ADDITIONAL_CHILDREN changes in JSSQLStatement.cpp — there are none. (2) Search JSBundlerPlugin.cpp diff — shows +DEFINE_VISIT_ADDITIONAL_CHILDREN_IN_GC_THREAD(JSBundlerPlugin) was added. (3) Search JSMockFunction.cpp diff — shows the macro was renamed from old to new. (4) JSSQLStatement had neither the old macro before the PR nor the new macro after. The one-line fix is: add DEFINE_VISIT_ADDITIONAL_CHILDREN_IN_GC_THREAD(JSSQLStatement); immediately after DEFINE_VISIT_CHILDREN(JSSQLStatement); at line 2789.
The underlying JSC bug — GetDisposeMethod wrapped [Symbol.asyncDispose] in a closure that discarded the returned promise — was fixed upstream in WebKit and picked up in Bun 1.3.12 via the bump to fc9f2fa7 (#28371). This adds a regression test so a future WebKit update can't silently reintroduce the behavior. Covers use(), adopt(), and defer(); asserts LIFO ordering, that each disposer is fully awaited before the next begins, and that disposeAsync() does not resolve until all resources have finished disposing.
The underlying JSC bug — GetDisposeMethod wrapped [Symbol.asyncDispose] in a closure that discarded the returned promise — was fixed upstream in WebKit and picked up in Bun 1.3.12 via the bump to fc9f2fa7 (#28371). This adds a regression test so a future WebKit update can't silently reintroduce the behavior. Covers use(), adopt(), and defer(); asserts LIFO ordering, that each disposer is fully awaited before the next begins, and that disposeAsync() does not resolve until all resources have finished disposing.
WebKit Upgrade Changes
Summary
Upgraded from WebKit commit
a30d85fto57cc442(1650 commits total, 301 touching JSC/WTF/bmalloc).Key Changes Affecting Bun
Microtask & Promise (⚠️ Breaking API Changes)
The MicrotaskQueue implementation moved entirely from WebCore into JSC. This changes several APIs Bun overrides/calls:
GlobalObjectMethodTable::queueMicrotaskToEventLoophook removed — microtasks are now enqueued directly into a per-JSGlobalObjectRef<MicrotaskQueue> m_microtaskQueue.JSGlobalObject::queueMicrotasksignature changed — now takesVM&as first parameter:void queueMicrotask(VM&, QueuedTask&&)void queueMicrotask(VM&, InternalMicrotask, uint8_t, JSValue, JSValue, JSValue)JSGlobalObject::setMicrotaskQueue(Ref<MicrotaskQueue>&&)— hosts set a custom queue instead of implementing a method-table hook. Queue hasscheduleToRunIfNeededvirtual.MicrotaskCall— aCachedCall-like fast-path for microtask invocation that cachesFunctionExecutable*/CodeBlock*.callMicrotasknow takes this parameter internally.JSC::runMicrotaskno longer exported — draining is done inside JSC viaMicrotaskQueue::performMicrotaskCheckpoint.CrossTaskToken—VMnow holdsRefPtr<CrossTaskToken>carried between tasks (base class for WebCore'sUserGestureToken).Promise.resolvespec fix — subclass constructor no longer returns basePromise(cross-realm constructor check).triggerPromiseReactions,JSPromiseC++ code, andMicrotaskQueuedrain path.PerformPromiseThenDFG/FTL node.Relevant commits:
113e989f0ab0,fa403f3bda25,3692b888d679,cef91b6c3f11,6309e93f8193,b6d94e4de12f,c1df92d228fc,7a597ba1b58e,40f8432a95e2GlobalObjectMethodTable Changes
queueMicrotaskToEventLoopremoved (see above).compileStreaming/instantiateStreamingsignature changed — now takestd::optional<WebAssemblyCompileOptions>&&. Wrapped in#if ENABLE(WEBASSEMBLY)withvoid*placeholders when disabled.JSGlobalObject::addStaticGlobalssignature changed — now takesstd::span<GlobalPropertyInfo>instead of(GlobalPropertyInfo*, int).Header / Include Changes
MarkedVectorbroken out ofArgList.hinto its own header (f7c81e42deb4).JSPIContextmoved out ofVM.h(fcf736d4f9e9).LIFETIME_BOUNDannotations added to many getters in JSC and WTF (75c21debe092,418eb5cfca82,7d6d7706aac8).StringHasherstreaming interface removed (756399f1473c).RegisterSetBuildermerged intoRegisterSet(b23dfb2b0212).StructureStubInforenamed toPropertyInlineCache(ffb03436fd34).Parser & Language Features
using(4ca75592d165) andawait using(92e52221d299) syntax implemented, plus several follow-up bytecode/spec fixes (6c959cf9637e,57a48c393902,138963318c87,064f2d4d90ab,9a3b8c612a49).dc352eb56d2c), fast'0'lexing (46eeb62ea27a).VariableEnvironmentmap perf (577296de6a91),ScopeRefretired (c1a4f50e71dc),RestParameterNodedirect binding (e89865c7f8c3).emitBytecodeInConditionContextforConditionalNode(ee963cf3db75), removed redundantto_stringin single-expr template literals (c89babbf6441).JIT / Optimization
9af814208502), recovery after reinstall (f92b82d07c51), threshold tuning (87d8e03a1a4b), jettison-during-finalization fix (66f509e2dccd), premature jettison fix (90a5bb45b586).StructureStubInfo→PropertyInlineCacherename, split into subclasses (d042d9b75315), combined Handler+Data IC (365ecfc0a511), megamorphic GetById handles String (65d02142320f).RegExp#lastIndexIC (d2c63be26cd6).f8b9ab1a0bfa).c03651a49eb9).CompareStrictEq(Untyped)bit-trick fast path (089c67d2ead9).ArrayIsArrayintrinsic forArray.isArray(b7c903516b25).Modoptimization in DFG/FTL (899d00c4aa72).HeapBigIntUsespeculation (38c024bb251e).32de67469bf0).s_maxTransitionLengthbumped 64 → 128 (f6414a9cee54).Runtime / GC
80d2d35df693),Heap::writeBarrierGC-validation (682cd16441c4).JSNativeStdFunctioncan safely capture (8ed6b76ec394).SymbolTablecached perJSGlobalObject(5980a4242cc7).ArrayBuffer: page-based zero-fill for large zero-clear (bee72f6e2750).JSBigInt: shrink size (d2f75e3929bb), tighten hot path (22fb65b6b34b), cached remainder (559de0581a46), multiply uses result buffer (e4e7aafcdfd8).313be2bb1cf5).String#includesusestryFindOneChar(dbe0b0a08f9a).containsHoleusesWTF::find64for double arrays (26af206baebb).OrderedHashTableHelperstorage mutation usesDeferTerminationForAWhile(f45f20af9c44).std::unique_ptrfor ICU resources, fixesUEnumerationleak (1566af375f80).WebAssembly
WebAssembly.compileStreaming/.instantiateStreamingacceptcompileOptions(4f51c89e3c77,e075761ea48f).addressfield added to memory descriptor (c7a099ccc935).653249798501,d8a913bd3feb).8eb745ff86d0), B3 SIMD shuffle optimization (99bafdf6e24a,72cb0c48cb44), x64 SIMD optimizations (8528edac562f), ARM64 simple shl/ushr/sshr (b349f3567217), more SIMD lowering (dbf8cb7e3ecc).select(6708616ef5ef).8b75d8f65733), tail-call scratch clobber (4572dd488e4e), F32 float storage (a73d24da9011).3e5413522e4c).Rareannotation (9d8c6b94fcc4).RegExp / YARR
12ef604ef990).0bebf49082ee,fbd2a11004f4,2fb117dc7dcd).String#replacesurrogate-advancement fix for non-unicode regexps (13f7de0a8f94).lastIndexclobber fix (a3789656ce60).RegExpMatchFastGlobalmust-generate to prevent FTL DCE (e8f0cb20dfb0).Bug Fixes (Spec / Correctness)
TypedArray#sortwhen comparator accesses.buffer(b9c004b3c5be).Array#includes(undefined, fromIndex)hole handling (b2cf11dd2959).Array#flatdepth-0 / DerivedArray bailout (58336b9e2fcd).Array.p.concatchecks all indexed accessors (131349b225e3).Array.prototype.copyWithinreturn value (685247318fa2).Setmethods throw on non-object iteratornext()result (4d96716c8dc8).RegExp#@@matchAlllastIndex clamping (8cfdd1d58057).Temporal.PlainDate.fromSIGSEGV fix (ce0c3918570d).AsyncDisposableStack#disposeAsyncstack overflow fix (9a3b8c612a49).672cdd38781c).ToNumberside-effect forMath.pow(x)(dfddac02cb48),iterator_next/openPhantom emission (d9b3841d9b3f),ShadowChickencannot-exit (9d596abdce46),PhantomNewArrayWithButterflyexception handling (0dbabc018f3f),MapIterationEntryKeyresult type (3f6f7836068a),MultiGetByOffsetMethoddouble conversion (f2c5bf80637a).dc46995eb9ed).2a07f263519f).ReduceStrengthInt52→Int32 unsound optimization (1c537b0aea64).libpas / bmalloc
bdbe48f72fba), page-based zeroing threshold 64MB→1MB (b245c6393674), unconditional tag-on-alloc (b754353fb35e), bitfit heaps used quickly (dee9781145cf),PAS_ASSERTunified (7b43a563bdda), futex lock on PlayStation (15957d955111).BASSERTrerouted to libpas asserts when available (736a08b1bbf5).WTF
Dequemade branchless (f3b792ece3b9).HashTable: removeIf early-return when null (519967f72252), skip destructor for trivially-destructible (93262de2b325), batch count updates in weak cleanup (69aae74416c4), weak-pointer lookup hardening (2ace7bf41640).cf507455abeb).Stringfrom nullASCIILiteral→ nullString(30479f7ed01f).CheckedPtr/CheckedRefconstructible fromWeakPtr/WeakRef(687172c1a2f2).IntegralOrEnumconcept (0090c1577f59).CI Status
Known pre-existing failures (not caused by this PR)
Linux
bundler_compile.test.tstimeouts — These are caused by PR #26923 (ELF section for standalone binaries), which was merged to main on Mar 19. That PR:describe("bundler", ...)→describe.concurrent("bundler", ...)in bundler_compile.test.tsinjectpath from a simple append (~2KB write) to reading the entire executable into memory, modifying the ELF, and rewriting everything (~120MB I/O per compile)With 20 concurrent compile tests each doing ~1.5GB of I/O (copy + read + write of a ~500MB profile binary), Linux CI machines exhaust resources. The ELF PR's own CI (build #40193) shows identical failures on all Linux x64 targets.
Fixed in this PR by reverting the describe.concurrent back to sequential describe.
Fixed in this PR
bundler_defer.test.ts— Made the FinalizationRegistry test more robust by using a bounded gc+sleep loop instead of a singleBun.gc(true)+ await.darwin
webview.test.ts/webview-chrome.test.tstimeouts — Pre-existing from PR #28185 (merged Mar 20). That PR's own CI (build #40403) shows identical darwin failures. The click(selector) tests rely on requestAnimationFrame which doesn't fire on CI macOS's (0,0) alpha=0 window (CVDisplayLink throttling). Not caused by this WebKit upgrade.