Skip to content

Upgrade WebKit to 2e37adcc23b7 - #36267

Open
robobun wants to merge 10 commits into
mainfrom
claude/webkit-upgrade-2e37adcc23b7
Open

Upgrade WebKit to 2e37adcc23b7#36267
robobun wants to merge 10 commits into
mainfrom
claude/webkit-upgrade-2e37adcc23b7

Conversation

@robobun

@robobun robobun commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

Bumps vendor/WebKit to upstream WebKit/WebKit@2e37adcc23b7 (2026-07-28). 163 upstream commits since the last sync point (01aaa3e0be0c); 17 touch Source/JavaScriptCore, 16 touch Source/WTF, 3 touch Source/bmalloc.

The fork-side merge is in oven-sh/WebKit#370. Supersedes #35910, whose branch this one is built on.

Note

WEBKIT_VERSION currently points at the preview build autobuild-preview-pr-370-06ee8632. Once oven-sh/WebKit#370 merges to main, bump it to the resulting autobuild-<sha> before merging this PR. The first CI run here will fail its WebKit fetch until that preview build publishes (~45 min after the WebKit PR opened).

Bun changes required by this upgrade

None on top of #35910. All runtime/, heap/, API/ and WTF/ header changes in the 163 new commits are additive; Bun's bindings build and link unchanged against the merged tree. The JSModuleRecord/JSAsyncFromSyncIterator/ApproximateTime/IntlCache/hostResolveImportedModule adaptations carried over from #35910 remain sufficient.

Dead-in-effect producer chain (follow-up, not removed here)

The JSModuleRecord adaptation (#35910, from https://bugs.webkit.org/show_bug.cgi?id=320151) makes zig__ModuleInfoDeserialized__toJSModuleRecord ignore RecordKind::DeclaredVariable/LexicalVariable records. The producer side still writes them: add_var/add_declared_variable/add_lexical_variable in src/js_printer/lib.rs (~16 call sites) and src/bundler/linker_context/postProcessJSChunk.rs (6 call sites) serialize every top-level binding into module_info bytes that are now read and discarded. Removing that chain touches the printer/bundler and the serialized cache format, which is out of scope for a WebKit sync; it is left for a follow-up and is kept so on-disk transpiler caches written by older builds continue to deserialize.

Notable upstream changes

  • Yarr correctness fixes: sticky /^.*EXPR.*$/y no longer drops the leading .* (https://bugs.webkit.org/show_bug.cgi?id=320348); ^ inside an empty-matching parenthesis no longer anchors the whole pattern (https://bugs.webkit.org/show_bug.cgi?id=320347). New regression tests cover both in test/js/bun/jsc/webkit-upgrade.test.ts.
  • JSON.stringify 8-byte SWAR fast path for short strings (bugs 320393 and 320419) and a non-enumerable-own-toJSON fix (320437).
  • Structure::defaultToPrimitiveFastAndNonObservable() cache (320343).
  • RegExp::firstCharacterBitmap() (merged first-char filter computation; 320258).
  • Wasm Memory64 Table64 support in BBQ/OMG (319924, 320014).
  • DFG BasicBlock::intersectionOfPastValuesAtHead allocated only for OSR-entry targets (320177).
  • Iterator.zip null-prototype options/underlying-iterator objects (320312).
  • WTF::RobinHoodHashTable::removeIf (320337); SIMD makeStringByReplacingAll (320155).
  • Windows build fixes (SegmentedVector offsetof assert, Heap.h friend JS_EXPORT_PRIVATE; 320179). The fork's narrower #if !OS(WINDOWS) in SegmentedVector.h is replaced by upstream's version.
  • bmalloc MADV_ZERO latch fix (320384); libpas MTE override fix (319668).

Verification

Built debug+ASAN with --webkit=local against the oven-sh/WebKit#370 branch. bun-debug links and passes test/js/bun/jsc/webkit-upgrade.test.ts (7/7) and test/js/bun/jsc/bun-jsc.test.ts (36/36). The two new Yarr tests fail on the pre-sync WebKit and pass after.


[decide:webkit] gate passed · iteration 1 · 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.test.ts
ninja: Entering directory `/workspace/bun/build/debug'
[1/11] gen cpp.rs (cppbind)
[1/11] 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)

[4/11] 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 -fno-delete-null-pointer-checks -fdiagnostics-color=always -ferror-limit=100 -std=gnu++23 -fsanitize=null -fno-sanitize-recover=all -fsanitize=bounds -fsanitize=return -fsanitize=nullability-
... (truncated)

release without fix: 3 FAILED
bun test v1.4.0-canary.1 (1498d7b77)

test/js/bun/jsc/webkit-upgrade.test.ts:
(pass) WebKit 01aaa3e0be0c upgrade > import with a HostDefined type attribute links without crashing [53.06ms]
(pass) WebKit 01aaa3e0be0c upgrade > AsyncLocalStorage context survives for-await over an async generator [44.44ms]
101 |       ],
102 |       env: bunEnv,
103 |       stderr: "pipe",
104 |     });
105 |     const [stdout, stderr, exitCode] = await Promise.all([proc.stdout.text(), proc.stderr.text(), proc.exited]);
106 |     expect(stderr).toBe("");
                         ^
error: expect(received).toBe(expected)

- ""
+ "1 | 
+ 2 |           const rs = ReadableStream.from([10, 20, 30]);
+                                         ^
+ TypeError: ReadableStream.from is not a function. (In 'ReadableStream.from([10, 20, 30])', 'ReadableStream.from' is undefined)
+       at /workspace/bun/[eval]:2:37
+ 
+ Bun v1.4.0-canary.1+1498d7b77 (Linux x64)
+ "

- Expected  - 1
+ Received  + 8

      at <anonymous> (/workspace/bun/test/js/bun/jsc/webkit-upgrade.test.ts:106:20)
(fail) WebKit 01aaa3e0be0c upgrade > ReadableStream.from wraps a sync iterable [44.66ms]
(pass) WebKit 01aaa3e0be0c upgra
... (truncated)
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.test.ts
bun test v1.4.0 (11a3597a9)

test/js/bun/jsc/webkit-upgrade.test.ts:
(pass) WebKit 01aaa3e0be0c upgrade > import with a HostDefined type attribute links without crashing [1853.65ms]
(pass) WebKit 01aaa3e0be0c upgrade > ReadableStream.from wraps a sync iterable [1820.60ms]
(pass) WebKit 01aaa3e0be0c upgrade > process.env.TZ invalidates the Intl.DateTimeFormat cache [2164.13ms]
(pass) WebKit 01aaa3e0be0c upgrade > AsyncLocalStorage context survives for-await over an async generator [2435.80ms]
(pass) WebKit 01aaa3e0be0c upgrade > module linking initialises var bindings without JSModuleRecord VariableEnvironments [2592.76ms]
(pass) WebKit 2e37adcc23b7 upgrade > sticky dot-star-wrapped expression does not skip the leading .* [6.03ms]
(pass) WebKit 2e37adcc23b7 upgrade > ^ inside an empty-matching parenthesis does not anchor the whole pattern [4.74ms]

 7 pass
 0 fail
 19 expect() calls
Ran 7 tests across 1 file. [6.06s]
__F:0:S:0

release with fix: all passed
$ bun scripts/build.ts --profile=release
[configured] bun-profile → bun (stripped) in 1058ms (unchanged)
ninja: Entering directory `/workspace/bun/build/release'
[1/111] cxx obj/unified/UnifiedSource-src_jsc_bindings-2.cpp.o
[2/111] cxx obj/unified/UnifiedSource-src_jsc_bindings-0.cpp.o
[3/111] cxx obj/unified/UnifiedSource-src_jsc_bindings-1.cpp.o
[4/111] cxx obj/unified/UnifiedSource-src_jsc_bindings-3.cpp.o
[5/111] gen cpp.rs (cppbind)
[5/111] 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_react_compiler v0.0.0 (/workspace/bun/src/react_compiler)
�[1m�[92m   Compiling�[0m bun_css v0.0.0 (/workspace/bun/src/css)
�[1m�[92m   Compiling�[0m bun_js_parser v0.0.0 (/workspace/bun/src/js_parser)
�[1m�[92m   Compiling�[0m bun_resolver v0.0.0 (/workspace/bun/src/resolver)
�[1m�[92m   Compiling�[0m bun_ini v0.0.0 (/workspace/bun/src/ini)
�[1m�[92m   Compiling�[0m bun_router v0.0.0 (/workspace/bun/src/router)
�[1m�[92m   Compiling�[0m bun_bundler v0.0.0 (/workspace/bun/src/bundler)
�[1m�[92m   Compiling�[0m bun_standalon
... (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.test.ts             | 164 +++++++++++++++++++++
 10 files changed, 179 insertions(+), 90 deletions(-)

gate history · 1 passed · 1 rejected · iteration 1

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

robobun and others added 9 commits July 26, 2026 08:52
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).
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.
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.
… 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.
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.
[skip size check]
Bumps WEBKIT_VERSION to the oven-sh/WebKit#370 preview build and adds
regression coverage for the Yarr correctness fixes delivered by this
sync (bugs 320348 and 320347). No Bun-side API adaptation is needed on
top of the 01aaa3e0be0c changes: all JSC/WTF/bmalloc header changes in
the 163 new upstream commits are additive.
@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@robobun, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 17 seconds

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 480e00c1-7401-4d53-a005-08f503f35e7c

📥 Commits

Reviewing files that changed from the base of the PR and between e532ad9 and 11a3597.

📒 Files selected for processing (10)
  • scripts/build/deps/webkit.ts
  • src/bundler_jsc/analyze_jsc.rs
  • src/jsc/bindings/BunAnalyzeTranspiledModule.cpp
  • src/jsc/bindings/JSEnvironmentVariableMap.cpp
  • src/jsc/bindings/NodeVMSourceTextModule.cpp
  • src/jsc/bindings/ZigGlobalObject.cpp
  • src/jsc/bindings/bindings.cpp
  • src/jsc/bindings/webcore/streams/ReadableStreamOperations.cpp
  • src/jsc/modules/BunJSCModule.h
  • test/js/bun/jsc/webkit-upgrade.test.ts

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

@github-actions

Copy link
Copy Markdown
Contributor

Found 1 issue this PR may fix:

  1. delete process.env.TZ permanently freezes the Intl timezone; all later TZ assignments are ignored #36160 - PR fixes process.env.TZ cache invalidation for Intl.DateTimeFormat, directly addressing the bug where deleting process.env.TZ permanently freezes the Intl timezone

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

Fixes #36160

🤖 Generated with Claude Code

@github-actions

Copy link
Copy Markdown
Contributor

This PR may be a duplicate of:

  1. Upgrade WebKit to 01aaa3e0be0c #35910 - Also upgrades WebKit (to 01aaa3e0be0c); explicitly superseded by this PR
  2. Upgrade WebKit to 0e86b49069a5 #33956 - Also upgrades WebKit (to 0e86b49069a5); older target commit
  3. Bump WebKit to 6d586e293f #31706 - Also bumps WebKit (to 6d586e293f); older target commit
  4. [RETEST] WebKit a497d59689e4 full upgrade (verify original failure was real) #29625 - WebKit full upgrade retest (a497d59689e4); older target commit
  5. build: test WebKit preview autobuild-preview-pr-187-0c3c8e5a #29580 - WebKit preview test (autobuild-preview-pr-187-0c3c8e5a); older target commit
  6. Bump WebKit to autobuild-preview-pr-185-309b1951 #29421 - WebKit preview bump (autobuild-preview-pr-185-309b1951); older target commit

🤖 Generated with Claude Code

@robobun

robobun commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator Author
Updated 8:45 PM PT - Jul 28th, 2026

@robobun, your commit 11a3597 has 3 failures in Build #84457 (All Failures):


🧪   To try this PR locally:

bunx bun-pr 36267

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

bun-36267 --bun

Comment thread src/bundler_jsc/analyze_jsc.rs

@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.

I didn't find bugs in the Bun-side adaptations, but this is a JS-engine version bump (163 upstream commits) with WEBKIT_VERSION still pointing at a preview tag the description says must change before merge — needs a human to gate on full CI and the oven-sh/WebKit#370 merge.

What was reviewed:

  • asObject(syncRecord.iterator) in ReadableStreamOperations — safe, isObject() is checked 6 lines above.
  • vm.clearForTimeZoneChange() — all three former dateCache.clearForTimeZoneChange() sites (env-var setter, JSGlobalObject__setTimeZone, bun:jsc setTimeZone) updated consistently.
  • Rust↔C++ zig__ModuleInfoDeserialized__toJSModuleRecord / JSC_JSModuleRecord__create signatures match after the VariableEnvironment removal; record-kind loops still advance i correctly for the now-ignored kinds.
Extended reasoning...

Overview

This PR bumps vendor/WebKit to upstream 2e37adcc23b7 (163 commits; 17 in JSC, 16 in WTF, 3 in bmalloc), superseding #35910. Bun-side changes are mechanical adaptations to upstream API signature changes: JSModuleRecord::create/ModuleAnalyzer dropped their VariableEnvironment params (bug 320151), VM gained clearForTimeZoneChange() subsuming dateCache.clearForTimeZoneChange(), performOpportunisticallyScheduledTasks now takes ApproximateTime, and JSAsyncFromSyncIterator::create gained JSObject*/IterationMode params. A new test file covers each adaptation plus two Yarr regressions delivered by the sync.

Security risks

None introduced by the Bun-side diff itself — the changes are signature adaptations with no new parsing of untrusted input, no new allocation logic, and no auth/crypto paths. The upstream WebKit changes themselves (Yarr, JSON.stringify SWAR, Wasm Memory64, etc.) are outside what can be reviewed here and are the reason full-suite CI is the real gate.

Level of scrutiny

High. A JavaScriptCore version bump has the largest possible blast radius in this repo — every JS execution path runs through it. The Bun-side hunks are individually small and forced by compile errors, but correctness depends on (a) the fork-side merge in oven-sh/WebKit#370 being clean and (b) the full test matrix passing on all platforms. Neither is verifiable from this diff alone. Additionally, WEBKIT_VERSION currently points at autobuild-preview-pr-370-06ee8632, which the PR description explicitly flags as needing replacement with the post-merge autobuild-<sha> tag before this lands.

Other factors

  • CI build #84457 is still in progress; WebKit upgrades routinely surface platform-specific failures that only show in the full matrix.
  • The JSModuleRecord VariableEnvironment removal touches the fast-path module-record construction used on every ES module load; the new test exercises node:vm and one with { type: "text" } import, but the debug-only fallbackParse diff-check in BunAnalyzeTranspiledModule.cpp and the broader test suite are the real coverage.
  • My earlier inline note about the dead-in-effect add_var/RecordKind::{Declared,Lexical}Variable producer chain was addressed by the author (named in the PR description with a stated follow-up rationale) and the thread is resolved.
  • The ReadableStream.from sync-iterable test covers the JSAsyncFromSyncIterator::create adaptation; IterationMode::Generic is the correct value for CreateAsyncFromSyncIterator per spec.

@robobun

robobun commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator Author

Build #84457: 185+ passed; three tests marked [new] that don't look like regressions from this sync.

test lane failure local repro (this branch)
test/js/bun/http/bun-serve-html.test.ts windows 11 aarch64 segfault at 0x48, no symbolicated trace 0/25 on a fresh windows-aarch64 release build of 11a3597a9
test/js/bun/http/proxy-stress-protocol.test.ts debian 13 x64-asan ECONNRESET in "https-proxy → http-origin, 500 after 1KB" (1/102 subtests) network stress, not retried
test/js/node/worker_threads/worker-transfer-terminate-stress.test.ts debian 13 x64-asan ASSERTION FAILED: !exception() at ExceptionScope.h:61 0/5 on debug+ASAN here; the test's own header says it targets a pre-existing race that "does not reproduce locally (0/115 loaded runs)"

worker-transfer-terminate-stress is the only one that reads as JSC, and it exists specifically to surface an intermittent terminate()-during-serialize race that predates both this sync and #35910; the assertion site moved from JSObject.cpp:3936 to ExceptionScope.h:61, consistent with the same race tripping at a different inlined call site after the version bump rather than a new bug.

webkit-upgrade.test.ts and the rest of the suite are green across the matrix. First build #84432 couldn't run at all (WebKit preview 404 before autobuild-preview-pr-370-06ee8632 published), so this is the first real pass.

Build completed (191 passed / 196). The three darwin-14 lanes finished as CI infra, not test failures: two :darwin: 14 aarch64 - test-bun shards expired (never ran), one :darwin: 14 x64 - test-bun timed_out. The [new] set above is unchanged.

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