Skip to content

Upgrade WebKit to 01aaa3e0be0c - #35910

Closed
robobun wants to merge 7 commits into
mainfrom
claude/webkit-upgrade-01aaa3e0be0c
Closed

robobun wants to merge 7 commits into
mainfrom
claude/webkit-upgrade-01aaa3e0be0c

Conversation

@robobun

@robobun robobun commented Jul 26, 2026 •

Copy link
Copy Markdown
Collaborator

Bumps vendor/WebKit to upstream WebKit/WebKit@01aaa3e0be0c (2026-07-25). 538 upstream commits since the last sync point (2603e9eb41f0); 76 touch Source/JavaScriptCore, 41 touch Source/WTF, 6 touch Source/bmalloc (117 combined).

The fork-side merge is in oven-sh/WebKit#352.

Note

WEBKIT_VERSION currently points at the preview build autobuild-preview-pr-352-f8c38e23. Once oven-sh/WebKit#352 merges to main, bump it to the resulting autobuild-<sha> before merging this PR.

Bun changes required by this upgrade

JSModuleRecord no longer stores VariableEnvironments (https://bugs.webkit.org/show_bug.cgi?id=320151)

JSModuleRecord::create and ModuleAnalyzer dropped their declared/lexical VariableEnvironment parameters; var-binding initialisation now reads UnlinkedModuleProgramCodeBlock::variableDeclarations() populated at bytecode-generation time.

  • src/jsc/bindings/BunAnalyzeTranspiledModule.cpp, src/bundler_jsc/analyze_jsc.rs: drop the VariableEnvironment plumbing from the fast-path JSModuleRecord construction (zig__ModuleInfoDeserialized__toJSModuleRecord, JSC_JSModuleRecord__create). The serialized DeclaredVariable/LexicalVariable records are kept for on-disk cache format compatibility but are now skipped when reconstructing the record. dumpRecordInfo no longer prints the two environments, and the unused JSC_JSModuleRecord__declaredVariables/lexicalVariables/JSC__VariableEnvironment__add FFI shims are removed.
  • src/jsc/bindings/NodeVMSourceTextModule.cpp: ModuleAnalyzer ctor ported to the new 4-argument form.

JSAsyncFromSyncIterator::create takes IterationMode (https://bugs.webkit.org/show_bug.cgi?id=319435)

  • src/jsc/bindings/webcore/streams/ReadableStreamOperations.cpp: pass IterationMode::Generic and cast the sync iterator to JSObject* (the wrapper already fetched next).

VM::performOpportunisticallyScheduledTasks takes ApproximateTime (https://bugs.webkit.org/show_bug.cgi?id=319662)

  • src/jsc/bindings/bindings.cpp: MonotonicTime::now() becomes ApproximateTime::now().

Cached Intl.DateTimeFormat instances (https://bugs.webkit.org/show_bug.cgi?id=314337)

Upstream now caches Intl.DateTimeFormat instances in VM::intlCache() and clears the cache on VM entry when hasTimeZoneChange() trips. Bun flips the zone mid-execution via process.env.TZ / setTimeZone(), so the setter sites now call vm.intlCache().clearForTimeZoneChange() alongside vm.dateCache.clearForTimeZoneChange().

  • src/jsc/bindings/ZigGlobalObject.cpp, src/jsc/bindings/JSEnvironmentVariableMap.cpp, src/jsc/modules/BunJSCModule.h

hostResolveImportedModule typed-lookup probe (https://bugs.webkit.org/show_bug.cgi?id=320144)

The removal of AbstractModuleRecord::m_dependencies rewrote hostResolveImportedModule as a hardcoded loop over the four upstream ScriptFetchParameters::Type values. The fork adds a fifth, HostDefined, for with { type: "text" } / "sqlite" / "toml" etc.; requests keyed with it were no longer found, so the caller dereferenced null during link and segfaulted. The probe list now includes HostDefined under USE(BUN_JSC_ADDITIONS) (fork-side, in oven-sh/WebKit#352).

Notes

Upstream now defaults Explicit Resource Management on (https://bugs.webkit.org/show_bug.cgi?id=248707). Bun already pinned useExplicitResourceManagement=true in ZigGlobalObject.cpp, so this is a no-op for Bun users; the pin is kept as a defensive option alongside the other forced JSC options.

Upstream changelog

Memory safety and security
  • Fix DFG Object.defineProperty descriptor cell-type confusion causing invalid cell dereference in JIT code (bug 318139)
  • Fix instanceof prototype-chain IC condition mismatch triggering release assertion (bug 318144)
  • Fix out-of-bounds buffer index in WTF userVisibleURL when probing for xn-- (bug 319161)
Correctness
  • YARR: tryReadUnicodeChar reads first code unit before testing whether a second is needed (bug 320088)
  • YARR: fix interpreter ignore-case handling across ASCII/Unicode case folds (bug 320153)
  • YARR: InputStream::reread() checks the code unit before a trail surrogate, not after (bug 319932)
  • YARR: correct surrogateTagMask to 0xfc00 (was 0xdc00) (bug 319651)
  • Materialize .length/.name correctly for doubly-bound (bind().bind()) functions (bug 320017)
  • Iterator.prototype.includes now propagates errors thrown during IteratorClose on match (bug 319569)
  • WTF: charactersToFloat() now reports failure when value fits double but overflows float (bug 320069)
  • WTF: fix saturatingSum variadic overload truncating 3+ argument sums to uint32_t (bug 319524)
  • Revert "Use InstanceOf DFG node for Object#isPrototypeOf", which tripped a RELEASE_ASSERT (bug 320022)
Language features and spec alignment
  • Enable Explicit Resource Management (using / await using) by default (bug 248707)
  • Implement Joint Iteration proposal (Iterator.zip / Iterator.zipKeyed) (bug 319921)
  • Temporal: resolve Chinese and Dangi calendar field resolution (bug 319814)
  • Temporal: japanese calendar accepts ISO year/day/month/monthCode (bug 319964)
  • Temporal: fix Japanese, ROC, and Buddhist calendar field handling (bug 319663)
  • Temporal: fix fixed-solar non-ISO calendar arithmetic (Coptic/Ethiopic/Indian/Persian) (bug 319804)
  • Temporal: fix Ethiopic AA era mapping (bug 319787)
  • Temporal: fix Ethioaa arithmetic year to use UCAL_YEAR (bug 319785)
  • Temporal: fix PlainMonthDay reference-year drop for Chinese leap months (bug 319656)
  • Temporal: clean up getNamedTimeZoneEpochNanoseconds (bug 319296)
Performance
  • JSModuleRecord no longer retains the parser's VariableEnvironments after linking (bug 320151)
  • Remove AbstractModuleRecord::m_dependencies to shrink module memory (bug 320144)
  • Drop shared Baseline JIT code eagerly in Heap::deleteAllUnlinkedCodeBlocks (bug 320071)
  • Generate Data IC code as fall-through (bug 318125)
  • DFG/FTL: fast-fail filter for RegExp patterns with BOL anchors (bug 320128)
  • YARR: enable Boyer-Moore lookahead optimization for Unicode patterns (bug 307635)
  • YARR: tryReadUnicodeChar takes BMP fast path for any non-surrogate character (bug 319943)
  • DFG/FTL: inline ArrayBuffer.isView via IsCellWithType JSType-range check (bug 319796)
  • DFG: use ArrayIndexOf/ArrayIncludes intrinsic for RegExp match arrays (bug 319351)
  • Array#indexOf/includes skip slow path for rope elements with mismatched length (bug 319237)
  • Add JIT support for BigInt64Array/BigUint64Array allocation (bug 319872)
  • Use vectorLengthHint from ArrayAllocationProfile for NewArrayWithSize (bug 317466)
  • Avoid zero-fill + gcSafeMemcpy in tryCreateObjectViaCloning (bug 319850)
  • JSON.parse creates 8-bit strings for Latin-1 values found in 16-bit input (bug 319782)
  • Symbol.keyFor reuses the symbol's cached description string (bug 319843)
  • Cache Intl.DateTimeFormat instances (bug 314337)
  • Cooperative driving for top-level-await modules (bug 319867)
  • Use cached iterator-result object for async-generator cooperative driving (bug 319817)
  • Handle AsyncFromSyncIterator directly in async_iterator_open/next bytecodes (bug 319435)
  • Use op_async_iterator_open/op_async_iterator_next for yield* (bug 319946)
  • FTL: use select for more arithmetic ops (bug 319951)
  • B3: VectorZipX(a, all-zeros) strength reduction (bug 319991)
  • B3: match non-canonical SBFX form in B3LowerToAir (ARM64) (bug 271412)
  • Wire ARM64 Math.min/Math.max specialized thunks into thunkGeneratorForIntrinsic (bug 319795)
  • Fold String.prototype.at negative-index adjustment to branchless csel (bug 319789)
  • Double to Bool conversion is now branchless (bug 319790)
  • Use moveConditionally32 in prepareForTailCallSlow (bug 319845)
  • Put emitWriteBarrier slow path in m_slowPaths (bug 319688)
  • Use ApproximateTime for deadlines in Opportunistic Task Scheduler and Incremental Sweeper (bug 319662)
Wasm
  • Enable Wasm multi-memory by default (bug 319389)
  • Enable Wasm relaxed SIMD by default (bug 319518)
  • Implement Table64 in the parser and IPInt tier (bug 316710)
  • Memory64: allow modules with oversized initial table size to compile (bug 320132)
  • Evaluate element-segment expressions exactly once per instance (bug 320129)
  • Zero-extend memory32 data-segment offsets (bug 314444)
  • Wasm-backed resizable ArrayBuffers now throw for all invalid resize sizes (bug 319705)
  • Fix OMG inlined stack-origin lookup skipping deeper frames (bug 270832)
  • Make releaseBBQCallee tolerate a missing BBQ callee (bug 290296)
  • Skew small-function OMG tier-up call counts (bug 320046)
  • Shrink Wasm::Type to a pointer-sized payload on 64-bit (bug 247454)
WTF / bmalloc / build system
  • libpas: rework per-heap MTE tagging policy logic (bug 316145)
  • Fix PAS_ENABLE_MTE breaking preprocessed distributed builds (bug 319895)
  • TSan/Xcode: disable USE(LIBPAS)/USE(TZONE_MALLOC) when bmalloc falls back to system allocator (bug 319644)
  • RecursiveLockAdapter::unlock() asserts against underflow / wrong-owner unlock (bug 320067)
  • Mark crash-on-overflow functions in OverflowHandler.h as NODELETE (bug 318384)
  • Clean up ParkingLot::ensureHashtable() dead check and variable shadowing (bug 320050)
  • Linux: detect main thread and ensure its thread id is always 1 (bug 319887)
  • Vector::reverse() now uses std::ranges::reverse() (bug 319857)
  • Remove dead deleteReleasedWeakBuckets()/isReleasedWeakBucket() from HashTable (bug 319825)
  • CrossThreadCopierBase<HashSet<ObjectIdentifierGeneric>> gains IsNeeded and move-copy overload (bug 319797)
  • Rename WeakPtr::is()/UniqueRef::is() variadic overloads to isAnyOf (bug 319815)
  • CMake: derive generator feature defines from Platform.h on Mac (bug 312033)
  • CMake: make JavaScriptCore a real Clang module for the Mac Swift importer (bug 319625)
  • CMake: centralize code signing and add missing entitlements (bug 319641)

[decide:webkit] gate passed · iteration 4 · 10 files touched

fails on main (without fix)
ASAN without fix: BUILD FAILED (no junit output)
$ BUN_DEBUG_QUIET_LOGS=1 bun scripts/build.ts --profile=debug --quiet test "--reporter=junit" "--reporter-outfile=/tmp/mechgate.xml" "test/js/bun/jsc/webkit-upgrade-01aaa3e0.test.ts"
ninja: Entering directory `/workspace/bun/build/debug'
[1/12] cxx obj/unified/UnifiedSource-src_jsc_bindings-7.cpp.o
[2/12] cxx obj/src/jsc/bindings/ZigGlobalObject.cpp.o
[3/12] cxx obj/unified/UnifiedSource-src_jsc_bindings-9.cpp.o
[4/12] gen cpp.rs (cppbind)
[4/12] cargo bun_bin → libbun_rust.a (--target x86_64-unknown-linux-gnu)

  nightly-2026-07-20-x86_64-unknown-linux-gnu unchanged - rustc 1.99.0-nightly (9f36de775 2026-07-19)

[5/12] cxx obj/src/jsc/bindings/webcore/streams/ReadableStreamOperations.cpp.o
FAILED: obj/src/jsc/bindings/webcore/streams/ReadableStreamOperations.cpp.o 
/usr/bin/ccache /usr/lib/llvm-21/bin/clang++ -march=nehalem -O0 -g3 -gz=zstd -glldb -fsanitize=address -fno-exceptions -fno-c++-static-destructors -fno-rtti -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fvisibility=hidden -fvisibility-inlines-hidden -fno-unwind-tables -fno-asynchronous-unwind-tables -Wno-c23-extensions -ffunction-sections -fdata-sections -faddrsig -fno-semantic-interposition -f
... (truncated)

release without fix: all passed
bun test v1.4.0-canary.1 (340781e06)

test/js/bun/jsc/webkit-upgrade-01aaa3e0.test.ts:
(pass) WebKit 01aaa3e0be0c upgrade > import with a HostDefined type attribute links without crashing [27.52ms]
(pass) WebKit 01aaa3e0be0c upgrade > AsyncLocalStorage context survives for-await over an async generator [25.82ms]
(pass) WebKit 01aaa3e0be0c upgrade > ReadableStream.from wraps a sync iterable [24.99ms]
(pass) WebKit 01aaa3e0be0c upgrade > module linking initialises var bindings without JSModuleRecord VariableEnvironments [25.52ms]
(pass) WebKit 01aaa3e0be0c upgrade > process.env.TZ invalidates the Intl.DateTimeFormat cache [55.76ms]

 5 pass
 0 fail
 15 expect() calls
Ran 5 tests across 1 file. [225.00ms]
__F:0:S:0
passes on PR (with fix)
ASAN with fix: all passed
$ BUN_DEBUG_QUIET_LOGS=1 bun scripts/build.ts --profile=debug --quiet test "--reporter=junit" "--reporter-outfile=/tmp/mechgate.xml" "test/js/bun/jsc/webkit-upgrade-01aaa3e0.test.ts"
bun test v1.4.0 (5e818852a)

test/js/bun/jsc/webkit-upgrade-01aaa3e0.test.ts:
(pass) WebKit 01aaa3e0be0c upgrade > import with a HostDefined type attribute links without crashing [1127.98ms]
(pass) WebKit 01aaa3e0be0c upgrade > ReadableStream.from wraps a sync iterable [1117.41ms]
(pass) WebKit 01aaa3e0be0c upgrade > process.env.TZ invalidates the Intl.DateTimeFormat cache [1302.51ms]
(pass) WebKit 01aaa3e0be0c upgrade > AsyncLocalStorage context survives for-await over an async generator [1489.10ms]
(pass) WebKit 01aaa3e0be0c upgrade > module linking initialises var bindings without JSModuleRecord VariableEnvironments [1522.17ms]

 5 pass
 0 fail
 15 expect() calls
Ran 5 tests across 1 file. [3.91s]
__F:0:S:0

release with fix: all passed
$ bun scripts/build.ts --profile=release
[configured] bun-profile → bun (stripped) in 725ms (unchanged)
ninja: Entering directory `/workspace/bun/build/release'
[1/13] cxx obj/src/jsc/bindings/webcore/streams/ReadableStreamOperations.cpp.o
[2/13] cxx obj/unified/UnifiedSource-src_jsc_bindings-1.cpp.o
[3/13] cxx obj/unified/UnifiedSource-src_jsc_bindings-3.cpp.o
[4/13] cxx obj/src/jsc/bindings/ZigGlobalObject.cpp.o
[5/13] cxx obj/unified/UnifiedSource-src_jsc_bindings-0.cpp.o
[6/13] cxx obj/unified/UnifiedSource-src_jsc_bindings-2.cpp.o
[7/13] cxx obj/src/jsc/bindings/bindings.cpp.o
[8/13] gen cpp.rs (cppbind)
[8/13] cargo bun_bin → libbun_rust.a (--target x86_64-unknown-linux-gnu)

  nightly-2026-07-20-x86_64-unknown-linux-gnu unchanged - rustc 1.99.0-nightly (9f36de775 2026-07-19)

�[1m�[92m   Compiling�[0m bun_core v0.0.0 (/workspace/bun/src/bun_core)
�[1m�[92m   Compiling�[0m bun_errno v0.0.0 (/workspace/bun/src/errno)
�[1m�[92m   Compiling�[0m bun_ptr v0.0.0 (/workspace/bun/src/ptr)
�[1m�[92m   Compiling�[0m bun_boringssl_sys v0.0.0 (/workspace/bun/src/boringssl_sys)
�[1m�[92m   Compiling�[0m bun_safety v0.0.0 (/workspace/bun/src/safety)
�[1m�[92m   Compilin
... (truncated)
diff hotspot
scripts/build/deps/webkit.ts                       |   2 +-
 src/bundler_jsc/analyze_jsc.rs                     |  40 +-----
 src/jsc/bindings/BunAnalyzeTranspiledModule.cpp    |  51 +-------
 src/jsc/bindings/JSEnvironmentVariableMap.cpp      |   2 +-
 src/jsc/bindings/NodeVMSourceTextModule.cpp        |   2 +-
 src/jsc/bindings/ZigGlobalObject.cpp               |   2 +-
 src/jsc/bindings/bindings.cpp                      |   2 +-
 .../webcore/streams/ReadableStreamOperations.cpp   |   2 +-
 src/jsc/modules/BunJSCModule.h                     |   2 +-
 test/js/bun/jsc/webkit-upgrade-01aaa3e0.test.ts    | 142 +++++++++++++++++++++
 10 files changed, 157 insertions(+), 90 deletions(-)

gate history · 2 passed · 1 rejected · iteration 4

evidence per changed file
file                                                      reads  edits  tests
scripts/build/deps/webkit.ts                                  1      6      0
src/bundler_jsc/analyze_jsc.rs                                3      6      0
src/jsc/bindings/BunAnalyzeTranspiledModule.cpp               1      5      0
src/jsc/bindings/JSEnvironmentVariableMap.cpp                 5      7      0
src/jsc/bindings/NodeVMSourceTextModule.cpp                   1      1      0
src/jsc/bindings/ZigGlobalObject.cpp                          4      5      0
src/jsc/bindings/bindings.cpp                                 1      1      0
…c/bindings/webcore/streams/ReadableStreamOperations.cpp      1      2      0
src/jsc/modules/BunJSCModule.h                                5      7      0
test/js/bun/jsc/webkit-upgrade-01aaa3e0.test.ts               2      4      0

Bumps vendor/WebKit to upstream WebKit/WebKit@01aaa3e0be0c via
oven-sh/WebKit#352.

Bun-side adaptations:
- JSModuleRecord no longer stores VariableEnvironments (bug 320151): drop the
  declared/lexical-env plumbing from the fast-path JSModuleRecord construction
  and from the node:vm ModuleAnalyzer call.
- JSAsyncFromSyncIterator::create takes IterationMode (bug 319435): pass
  Generic from ReadableStream.from's sync-iterable path.
- VM::performOpportunisticallyScheduledTasks takes ApproximateTime (bug 319662).
@coderabbitai

coderabbitai Bot commented Jul 26, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

Changes

The PR updates the WebKit preview version, removes module variable-environment plumbing across Rust and C++ bindings, adjusts JavaScriptCore iterator and scheduling calls, and adds regression tests for async iteration, streams, and module linking.

WebKit upgrade compatibility

Layer / File(s) Summary
Module record environment removal
src/bundler_jsc/analyze_jsc.rs, src/jsc/bindings/BunAnalyzeTranspiledModule.cpp, src/jsc/bindings/NodeVMSourceTextModule.cpp
Module-record construction no longer accepts or forwards declared and lexical variable environments; analyzer inputs and debug output are updated accordingly.
JavaScriptCore runtime binding updates
src/jsc/bindings/webcore/streams/ReadableStreamOperations.cpp, src/jsc/bindings/bindings.cpp
Sync iterator fallback construction uses the updated async-iterator API, and opportunistic task scheduling uses ApproximateTime::now().
Preview version and regression coverage
scripts/build/deps/webkit.ts, test/js/bun/jsc/webkit-upgrade-01aaa3e0.test.ts
The WebKit version changes to an autobuild preview tag, with subprocess tests covering async context preservation, synchronous stream iteration, and module linking.

Suggested reviewers: jarred-sumner, sosukesuzuki

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title accurately and concisely summarizes the main change: upgrading WebKit to commit 01aaa3e0be0c.
Description check ✅ Passed It explains the WebKit upgrade, Bun-side changes, and verification evidence, even though it doesn't use the template headings.

Comment @coderabbitai help to get the list of available commands.

@robobun

robobun commented Jul 26, 2026 •

Copy link
Copy Markdown
Collaborator Author
Updated 10:39 PM PT - Jul 26th, 2026

✅ @robobun, your commit 5e818852a7d279d6d3032cf924a6ea4f007e8055 passed in Build #83086! 🎉


🧪   To try this PR locally:

bunx bun-pr 35910

That installs a local version of the PR into your bun-35910 executable, so you can run:

bun-35910 --bun

Comment thread src/bundler_jsc/analyze_jsc.rs Resolved
The first pass over record_kinds is now purely structural validation (kind is
known + buffer bounds) since JSModuleRecord no longer takes VariableEnvironments
at construction. Fold the no-op arms together.
@github-actions

Copy link
Copy Markdown
Contributor

Found 3 issues this PR may fix:

  1. Async generator returns Promise object instead of awaited value #33185 - Async generator returns Promise object instead of awaited value; the upstream async generator iteration rework (WebKit bugs 319817, 319435, 319946) directly addresses this
  2. Character set intersection of complement classes in v-mode regular expressions not considered #30183 - Character set intersection of complement classes in v-mode regex; multiple YARR correctness fixes (WebKit bugs 320088, 320153, 319932, 319651) target Unicode property class intersection behavior
  3. Bun doesnt print info about SuppressedError #10336 - Bun doesn't print info about SuppressedError; enabling Explicit Resource Management by default (WebKit bug 248707) makes SuppressedError a first-class runtime type

If this is helpful, copy the block below into the PR description to auto-close these issues on merge.

Fixes #33185
Fixes #30183
Fixes #10336

🤖 Generated with Claude Code

Bun already pins useExplicitResourceManagement=true in ZigGlobalObject.cpp, so
the 'using enabled by default' test passed on the pre-upgrade release too and
proved nothing about this sync. The remaining three cases each spawn an
independent bun -e subprocess; run them concurrently.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/jsc/bindings/NodeVMSourceTextModule.cpp`:
- Line 186: Update the ModuleAnalyzer construction in NodeVMSourceTextModule to
pass the parsed feature mask from node->features() instead of AllFeatures,
matching the fallback path and preserving accurate import.meta and
top-level-await detection.

In `@test/js/bun/jsc/webkit-upgrade-01aaa3e0.test.ts`:
- Around line 4-5: Remove the suite-level regression narration in
test/js/bun/jsc/webkit-upgrade-01aaa3e0.test.ts at lines 4-5. At lines 9-11,
38-39, and 68-71, replace each explanatory regression comment with only its
relevant issue URL, or remove it when no URL applies; each retained comment must
contain exactly the issue URL.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: a4c10704-43a7-4b20-a7d9-40732ef26c4d

📥 Commits

Reviewing files that changed from the base of the PR and between 44f6469 and bb72bb4.

📒 Files selected for processing (7)
  • scripts/build/deps/webkit.ts
  • src/bundler_jsc/analyze_jsc.rs
  • src/jsc/bindings/BunAnalyzeTranspiledModule.cpp
  • src/jsc/bindings/NodeVMSourceTextModule.cpp
  • src/jsc/bindings/bindings.cpp
  • src/jsc/bindings/webcore/streams/ReadableStreamOperations.cpp
  • test/js/bun/jsc/webkit-upgrade-01aaa3e0.test.ts

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Bun-side adaptations look correct and the earlier review nits are addressed, but a WebKit/JSC engine bump of this size should get a human sign-off — and WEBKIT_VERSION still points at the preview tag that the description says must be replaced before merge.

What was reviewed:

  • JSModuleRecord::create / ModuleAnalyzer signature updates and the matching Rust FFI removals — no orphaned VariableEnvironment references remain.
  • asObject(syncRecord.iterator) in ReadableStreamOperations.cpp is guarded by the isObject() check a few lines earlier.
  • ApproximateTime::now() + Seconds(until) — ApproximateTime supports + Seconds like MonotonicTime did.
  • Test file: prior nits applied (vacuous ERM case dropped, describe.concurrent).
Extended reasoning...

Overview

This PR bumps the vendored WebKit/JavaScriptCore to 01aaa3e0be0c (538 upstream commits, 117 touching JSC/WTF/bmalloc) and applies the mechanical Bun-side adaptations required by three upstream API changes: JSModuleRecord/ModuleAnalyzer dropping their VariableEnvironment parameters (bug 320151), JSAsyncFromSyncIterator::create gaining an IterationMode parameter (bug 319435), and VM::performOpportunisticallyScheduledTasks switching to ApproximateTime (bug 319662). Files touched: scripts/build/deps/webkit.ts (version pin), src/bundler_jsc/analyze_jsc.rs + src/jsc/bindings/BunAnalyzeTranspiledModule.cpp (drop VariableEnvironment plumbing and dead FFI shims), src/jsc/bindings/NodeVMSourceTextModule.cpp (4-arg ModuleAnalyzer), src/jsc/bindings/bindings.cpp (ApproximateTime), src/jsc/bindings/webcore/streams/ReadableStreamOperations.cpp (IterationMode::Generic + asObject cast), plus a new 3-case regression test file.

Security risks

The Bun-side diff itself is signature plumbing with no new parsing of untrusted input, no new allocations, and no new user-reachable code paths. The one new unchecked cast, asObject(syncRecord.iterator), is safe: syncIterator is checked with isObject() before iteratorDirect builds syncRecord. The real security surface is the 538 upstream commits — the changelog lists JIT correctness and OOB fixes (bugs 318139, 318144, 319161) plus new-by-default features (Wasm multi-memory, relaxed SIMD, Iterator.zip). That surface is not reviewable from this diff and is exactly why an engine bump needs a maintainer's judgement and a green CI across all lanes.

Level of scrutiny

High. This is a JS engine upgrade — the most production-critical dependency in the repo — and WEBKIT_VERSION currently points at autobuild-preview-pr-352-39744305, which the PR description itself flags as needing to be replaced with the post-merge autobuild-<sha> before this lands. The Bun-side adaptations are individually simple and I found no issues with them, but the aggregate change (fork-side merge in oven-sh/WebKit#352 plus behavioural shifts like cooperative TLA driving, async-iterator bytecode changes, and Explicit Resource Management defaulting on) is well outside auto-approve territory.

Other factors

The three review threads from the previous run are all resolved: the vacuous ERM test case was dropped and the PR description's "User-visible" claim replaced with a "Notes" section acknowledging Bun already pinned the option; describe.concurrent was applied; and the comment-cop-flagged justification comment in analyze_jsc.rs was removed by collapsing the record-kind validation pass. No new bugs were surfaced by the bug-hunting system this run. The remaining gate is human sign-off on the engine bump and swapping the preview WebKit tag for the final one.

Comment thread scripts/build/deps/webkit.ts Resolved
… tests

Upstream caches Intl.DateTimeFormat instances (bug 314337) and clears the cache
on VM entry when hasTimeZoneChange() trips. Bun flips the zone mid-execution
via process.env.TZ / setTimeZone(), so clear vm.intlCache() alongside
vm.dateCache at the three setter sites.

Also bump WEBKIT_VERSION to preview-pr-352-642e4852 for the fork-side
hostResolveImportedModule HostDefined probe and the Linux main-thread uid
pinning opt-out, and add regression tests for the TZ cache and the HostDefined
import path.

[skip size check] WebKit sync adds ~600KB of upstream JSC/WTF code.

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The two issues I flagged earlier (stale Intl.DateTimeFormat cache after TZ change; HostDefined import-attribute crash on the module-loader path) both look addressed in c947998 — vm.intlCache().clearForTimeZoneChange() is now called at all three TZ-change sites, and the fork bump to 642e4852 picks up the hostResolveImportedModule probe fix. No new findings this pass, but a WebKit sync of this size (76 JSC commits, fork-side loader/main-thread changes, WEBKIT_VERSION still on a preview tag pending oven-sh/WebKit#352) needs a human sign-off and a green #82460.

What was reviewed:

  • intlCache().clearForTimeZoneChange() added at all three TZ setters (ZigGlobalObject, JSEnvironmentVariableMap, BunJSCModule) with a subprocess regression test.
  • VariableEnvironment FFI plumbing removed cleanly on both Rust and C++ sides; the RecordKind::{Declared,Lexical}Variable cases are now no-ops but still length-validated so cached buffers stay compatible.
  • asObject(syncRecord.iterator) in ReadableStreamOperations.cpp is guarded by the isObject() check just above, and IterationMode::Generic matches the spec's CreateAsyncFromSyncIterator path.
Extended reasoning...

Overview

This PR syncs Bun's WebKit fork to upstream 01aaa3e0be0c (538 commits, 76 in JSC) and adapts Bun's bindings to five upstream API changes: JSModuleRecord::create/ModuleAnalyzer dropping VariableEnvironment params, JSAsyncFromSyncIterator::create gaining IterationMode, performOpportunisticallyScheduledTasks moving to ApproximateTime, the new per-VM IntlCache, and the hostResolveImportedModule typed-probe rewrite. It touches analyze_jsc.rs, BunAnalyzeTranspiledModule.cpp, NodeVMSourceTextModule.cpp, ReadableStreamOperations.cpp, ZigGlobalObject.cpp, JSEnvironmentVariableMap.cpp, BunJSCModule.h, bindings.cpp, the WebKit version pin, and adds a five-case regression test file.

Security risks

None introduced by the Bun-side adaptations, which are mechanical signature updates plus one new cache-invalidation call. The upstream changelog itself contains three memory-safety fixes (bugs 318139, 318144, 319161) and several YARR/Wasm bounds-handling changes; those are pulled in, not authored here, and are covered by the fork-side merge review in oven-sh/WebKit#352.

Level of scrutiny

High. A WebKit upgrade replaces the JS engine under every Bun user; the Bun-side diff is small and each hunk is a targeted API adaptation, but correctness depends on the fork-side merge (two Bun-specific patches: the HostDefined probe entry and the Linux main-thread uid-1 relaxation) and on full CI across all platforms. WEBKIT_VERSION is currently pinned to a preview autobuild tag that the PR description explicitly says must be swapped for the post-merge autobuild-<sha> before this lands.

Other factors

My two earlier findings on this PR (IntlCache staleness on process.env.TZ/setTimeZone, and the type: "macro"/type: "text" link-time crash from the missing HostDefined probe entry) were both root-caused by the author and fixed in the latest push; the new test file covers both. All prior review threads are resolved. Build #82460 for c947998 was still in progress at review time. Given the coupled fork PR, the preview-tag placeholder, and the breadth of the engine change, this should be signed off by a maintainer once CI is green and the fork PR has merged.

IntlCache.h transitively includes <unicode/udat.h> which is not available to
Bun's own C++ on macOS (the prebuilt WebKit tarball drops include/unicode/
there and Bun does not add system ICU to its include path). Use the new
fork-side JS_EXPORT_PRIVATE VM::clearForTimeZoneChange() helper instead so the
three setter sites (ZigGlobalObject, JSEnvironmentVariableMap, BunJSCModule)
clear both dateCache and the new Intl.DateTimeFormat instance cache without
needing IntlCache.h.

Bump WEBKIT_VERSION to preview-pr-352-f8c38e23 for the helper.

[skip size check] WebKit sync adds ~600KB of upstream JSC/WTF code.

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Bun-side adaptations look correct and my earlier findings (Intl cache invalidation, HostDefined probe, vacuous ERM test, describe.concurrent) have all been addressed. Deferring to a human for the merge decision though — this is a 538-commit JSC/WTF sync with fork-side fixes in oven-sh/WebKit#352, and WEBKIT_VERSION still points at the preview build (autobuild-preview-pr-352-f8c38e23) which the description says must be bumped to the final autobuild-<sha> before merge.

What was reviewed:

  • VariableEnvironment plumbing removal across analyze_jsc.rs/BunAnalyzeTranspiledModule.cpp — FFI signatures match on both sides, record-kind validation still covers DeclaredVariable/LexicalVariable.
  • All three TZ-change sites now call vm.clearForTimeZoneChange() (ZigGlobalObject, JSEnvironmentVariableMap, BunJSCModule) — no straggler dateCache.clearForTimeZoneChange() remains.
  • asObject(syncRecord.iterator) in ReadableStreamOperations.cpp is guarded by the syncIterator.isObject() check just above.
  • New test file: five subprocess cases, concurrent, pipes drained via Promise.all, {...bunEnv} spread for the TZ override.
Extended reasoning...

Overview

This PR bumps vendor/WebKit to upstream 01aaa3e0be0c (538 commits, 76 in JSC / 41 in WTF / 6 in bmalloc). The Bun-side diff is the set of mechanical adaptations forced by upstream API changes: JSModuleRecord::create/ModuleAnalyzer dropping VariableEnvironment params (bug 320151), JSAsyncFromSyncIterator::create gaining IterationMode (bug 319435), performOpportunisticallyScheduledTasks moving to ApproximateTime (bug 319662), and clearing the new IntlCache on runtime TZ change (bug 314337). A new test file covers each adaptation plus the fork-side HostDefined typed-probe fix.

Security risks

None specific to the Bun-side diff — no auth/crypto/permission code touched, no new user-input parsing. The upstream changelog does contain memory-safety fixes (DFG cell-type confusion, YARR OOB, instanceof IC assertion), but those are inbound fixes rather than new attack surface.

Level of scrutiny

High. A JavaScriptCore engine sync is production-critical by definition: it changes JIT tiers, YARR, module linking, Wasm defaults (multi-memory and relaxed SIMD now on), Temporal, and Intl caching underneath every Bun user. The Bun-side edits are small and look correct, but the real change is the 117 upstream JSC/WTF/bmalloc commits plus two fork-side fixes in oven-sh/WebKit#352 (the HostDefined probe and the Linux main-thread uid pin) that aren't visible in this diff. This class of PR should be signed off by a maintainer with green CI across all lanes.

Other factors

  • WEBKIT_VERSION is pinned to autobuild-preview-pr-352-f8c38e23; the PR's own NOTE says to bump it to the final autobuild-<sha> once oven-sh/WebKit#352 merges. That's an explicit pre-merge TODO.
  • The last robobun status shows build #83032 for HEAD 340781e0 still building — CI outcome for the current head isn't confirmed in the thread.
  • All prior review threads (my Intl-cache and macro-crash findings, the describe.concurrent nit, the vacuous ERM test, both CodeRabbit findings) are resolved by commits bb72bb4d, c947998f, and 340781e0.
  • The asObject() cast in getIteratorAsync is safe: syncIterator.isObject() is checked and returns early on line 833 before iteratorDirect populates syncRecord.iterator.

[skip size check]

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both earlier blockers are now addressed in the current diff — the three TZ-change sites (ZigGlobalObject.cpp, JSEnvironmentVariableMap.cpp, BunJSCModule.h) route through vm.clearForTimeZoneChange() with a covering test, and the type: "macro" / HostDefined-attribute crashes are root-caused to fork-side fixes in oven-sh/WebKit#352 with a with { type: "text" } regression test here. Deferring to a human for the engine upgrade itself.

What was reviewed:

  • All three TZ setters now call vm.clearForTimeZoneChange(); no remaining dateCache.clearForTimeZoneChange()-only sites in src/jsc.
  • asObject(syncRecord.iterator) in ReadableStreamOperations.cpp is safe — syncIterator is isObject()-checked before iteratorDirect.
  • analyze_jsc.rs record-kind validation loop still bounds-checks and rejects unknown kinds after folding DeclaredVariable/LexicalVariable into the no-op arm.
  • fallbackParse and NodeVMSourceTextModule ModuleAnalyzer calls match the new 4-arg signature; AllFeatures preserved as pre-upgrade behaviour.
Extended reasoning...

Overview

This PR syncs Bun's WebKit fork to upstream 01aaa3e0be0c (538 commits, 76 in JSC, 41 in WTF). The Bun-side changes are adaptations to upstream API breaks: JSModuleRecord::create/ModuleAnalyzer dropped their VariableEnvironment parameters (BunAnalyzeTranspiledModule.cpp, analyze_jsc.rs, NodeVMSourceTextModule.cpp), JSAsyncFromSyncIterator::create gained an IterationMode parameter (ReadableStreamOperations.cpp), performOpportunisticallyScheduledTasks moved to ApproximateTime (bindings.cpp), and the new Intl.DateTimeFormat instance cache required TZ-change invalidation to go through a new VM::clearForTimeZoneChange() helper at all three setter sites. A five-case regression test file covers each adaptation.

Prior findings resolved

I previously flagged two 🔴 issues on the earlier revision (bb72bb4): (1) the Intl.DateTimeFormat cache was not invalidated on runtime TZ change, and (2) bun build with type: "macro" imports segfaulted across multiple CI lanes. Both are now addressed — commit 340781e routes all three TZ setters through vm.clearForTimeZoneChange() (verified by grep; no stragglers), and the macro crashes were root-caused to two fork-side issues (missing HostDefined in the hostResolveImportedModule typed probe, and the Linux main-thread uid-1 RELEASE_ASSERT from bug 319887) fixed in oven-sh/WebKit#352. The new test file adds direct coverage for both.

Security risks

None introduced by the Bun-side adaptations themselves — they are signature updates and dead-plumbing removal. The upstream changelog does include three memory-safety fixes (bugs 318139, 318144, 319161) which are net-positive.

Level of scrutiny

High, and inherently beyond bot approval. This swaps the JS engine under 538 upstream commits, with fork-side patches (the HostDefined probe, the main-thread uid assert relaxation, the AsyncContextSwapScope re-plumbing through settleDriverWithIteratorResult) that live in oven-sh/WebKit#352 and are not reviewable from this diff. The PR description also explicitly notes WEBKIT_VERSION is still on a preview tag pending the fork PR merging.

Other factors

The Bun-side changes look correct and minimal for what they are. describe.concurrent was applied per the earlier nit. CI on the latest push (#83086) was still building when the timeline was fetched, so full-suite results across all lanes should be confirmed before merge.

@robobun

robobun commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator Author

Superseded by #36267, which carries these changes forward on top of a fresh upstream sync (oven-sh/WebKit#370, WebKit/WebKit@2e37adcc23b7).

@robobun

robobun commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator Author

Closing as superseded. oven-sh/WebKit#352 merged on 2026-07-28 (6886cd28), and main picked it up through the 3722912ff800 upgrade (#36794); the current pin, 7b763944 (#37525), contains both 01aaa3e0be0c and 6886cd28. #36267 also listed itself as superseding this PR.

The Bun-side adaptations are on main: the JSModuleRecord / ModuleAnalyzer changes and the related analyze_jsc.rs cleanup via #36794, IterationMode::Generic in ReadableStreamOperations.cpp, ApproximateTime in bindings.cpp. The TZ setters now go through Bun::resetDateCachesAfterTimeZoneChange (#31831); since the Intl.DateTimeFormat cache key includes WTF::lastTimeZoneID(), which that path bumps, the explicit intlCache() clear is not needed, and the #36160 repro passes on current main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants