Skip to content

Upgrade WebKit to d5bd162d9ab2 - #25958

Merged
Jarred-Sumner merged 15 commits into
mainfrom
jarred/webkit-upgrade-jan-10
Jan 15, 2026
Merged

Jarred-Sumner merged 15 commits into
mainfrom
jarred/webkit-upgrade-jan-10

Conversation

@Jarred-Sumner

Copy link
Copy Markdown
Collaborator

Summary

Updates WebKit from 1d0216219a3c to d5bd162d9ab2.

Key WebKit Changes

Performance Improvements:

  • Array.prototype.flat - Implemented in C++, 3.2x faster
  • Array.from fast paths for sets, maps, and arguments
  • String methods moved to C++ (padStart/padEnd, repeat, replace/replaceAll)
  • String#isWellFormed/toWellFormed - Now using simdutf, 5.2-5.4x faster
  • Promise.prototype.finally - Moved from JS to C++
  • MicrotaskQueue AsyncGenerator code moved to C++

Regular Expressions:

  • RegExp#@@matchall and RegExp.prototype[Symbol.replace] implemented in C++

Async/Generator:

  • Inline async function body when there is no await
  • AsyncGenerator now inlines first queue item
  • Optimized callMicrotask

Bun-Specific Fixes

  • Added performPromiseThenWithContext for passing extra context to promise handlers
  • Fixed PromiseReactionJob to check isEmpty() || isUndefinedOrNull() before passing context (empty JSValue ≠ undefined)
  • Added @then property to JSInternalPromisePrototype via addOwnInternalSlots
  • Restored BunPerformMicrotaskJob and BunInvokeJobWithArguments cases that were lost during merge

Test plan

  • test/js/bun/plugin/plugins.test.ts passes
  • test/js/node/test/parallel/test-readable-from.js passes
  • test/js/node/test/parallel/test-stream-duplex-from.js passes
  • test/js/web/streams/streams.test.js ReadableStream for Blob test passes
  • Various regression tests pass

🤖 Generated with Claude Code

Jarred-Sumner and others added 2 commits January 10, 2026 20:51
Updates WebKit from 1d0216219a3c to d5bd162d9ab2.

Key changes:
- Promise system refactored to use new callMicrotask variadic template
- Added performPromiseThenWithContext for Bun's context passing
- Fixed PromiseReactionJob to properly handle empty vs undefined context
- Added @then property to JSInternalPromisePrototype
- Restored BunPerformMicrotaskJob and BunInvokeJobWithArguments cases

Co-Authored-By: Claude <noreply@anthropic.com>
@robobun

robobun commented Jan 11, 2026 •

Copy link
Copy Markdown
Collaborator
Updated 6:00 AM PT - Jan 15th, 2026

❌ @sosukesuzuki, your commit b6d97cc has 3 failures in Build #34950 (All Failures):


🧪   To try this PR locally:

bunx bun-pr 25958

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

bun-25958 --bun

@coderabbitai

coderabbitai Bot commented Jan 11, 2026 •

Copy link
Copy Markdown
Contributor

Walkthrough

Updates WebKit version and upgrade docs; fixes binding macros and attributes; wires a microtask queue helper and adds an extra reserved argument to queued tasks; refactors multiple enum mappings to SortedArrayMap initializations; changes bundled-function default visibility for async functions.

Changes

Cohort / File(s) Summary
WebKit configuration & upgrade doc
/.claude/commands/upgrade-webkit.md, cmake/tools/SetupWebKit.cmake
Updated default WEBKIT_VERSION hash, reordered one JavaScriptCore include directory, removed two upgrade commands and added upgrade verification checklist items.
Binding macros & attributes
src/bun.js/bindings/BunGCOutputConstraint.h, src/bun.js/bindings/node/crypto/CryptoSignJob.h, src/bun.js/bindings/webcore/EventInit.h, src/bun.js/bindings/webcore/HTTPHeaderMap.h
Fixed deprecation-macro class name typo, corrected TZONE allocation tag to SignJobCtx, and replaced WARN_UNUSED_RETURN with [[nodiscard]] on decode() declarations.
Microtask queue wiring
src/bun.js/bindings/ZigGlobalObject.cpp, src/bun.js/bindings/bindings.cpp
Added queueMicrotaskToEventLoop helper and assigned it to GlobalObject method tables; updated JSC::QueuedTask constructions to include an extra reserved 0 argument at two call sites and related microtask call sites.
WebCore / WebCrypto enum refactors
src/bun.js/bindings/webcore/PerformanceUserTiming.cpp, src/bun.js/bindings/webcrypto/JSCryptoKey.cpp, src/bun.js/bindings/webcrypto/JSCryptoKeyUsage.cpp, src/bun.js/bindings/webcrypto/JSSubtleCrypto.cpp
Replaced static array-based mappings with SortedArrayMap initialized via std::to_array, preserving lookup semantics but changing storage/initialization.
Codegen enum handling & bundle visibility
src/codegen/bindgen.ts, src/codegen/bindgenv2/internal/enumeration.ts, src/codegen/bundle-functions.ts
Streamlined enum mapping initialization to SortedArrayMap via std::to_array; changed default bundled-function visibility to Private for async functions or when linkTimeConstant is set.
Windows build definition
cmake/targets/BuildBun.cmake
Added target_compile_definitions(${bun} PRIVATE U_STATIC_IMPLEMENTATION) under WIN32 to force static ICU implementation.

Possibly related PRs

Suggested reviewers

  • pfgithub
  • taylordotfish
🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: updating WebKit to a specific version (d5bd162d9ab2), which aligns with the PR's primary objective.
Description check ✅ Passed The description covers both required template sections: 'What does this PR do?' (with comprehensive WebKit changes and Bun-specific fixes) and 'How did you verify your code works?' (with detailed test plan checklist).

✏️ Tip: You can configure your own custom pre-merge checks in the settings.



📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between f758a5f and b6d97cc.

📒 Files selected for processing (2)
  • cmake/targets/BuildBun.cmake
  • cmake/tools/SetupWebKit.cmake
🧰 Additional context used
🧠 Learnings (10)
📓 Common learnings
Learnt from: taylordotfish
Repo: oven-sh/bun PR: 23169
File: src/bun.js/bindings/webcore/JSDOMConvertEnumeration.h:47-74
Timestamp: 2025-10-01T21:59:54.571Z
Learning: In the new bindings generator (bindgenv2) for `src/bun.js/bindings/webcore/JSDOMConvertEnumeration.h`, the context-aware enumeration conversion overloads intentionally use stricter validation (requiring `value.isString()` without ToString coercion), diverging from Web IDL semantics. This is a design decision documented in comments.
📚 Learning: 2025-11-24T18:36:59.706Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: src/bun.js/bindings/v8/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:36:59.706Z
Learning: Applies to src/bun.js/bindings/v8/V8*.h : Add BUN_EXPORT visibility attribute to all public V8 API functions to ensure proper symbol export across platforms

Applied to files:

  • cmake/targets/BuildBun.cmake
📚 Learning: 2025-10-15T20:19:37.256Z
Learnt from: markovejnovic
Repo: oven-sh/bun PR: 23680
File: cmake/targets/BuildBun.cmake:822-822
Timestamp: 2025-10-15T20:19:37.256Z
Learning: In the Bun codebase, FFI (Foreign Function Interface) code is compiled separately using TinyCC (tcc), which barely supports C99. Headers like src/bun.js/api/FFI.h and src/bun.js/api/ffi-stdbool.h are only used for FFI compilation with tcc, not with the main compiler. Therefore, C standard changes to the main Bun target do not affect FFI code compilation.

Applied to files:

  • cmake/targets/BuildBun.cmake
📚 Learning: 2025-09-20T05:35:57.318Z
Learnt from: pfgithub
Repo: oven-sh/bun PR: 22534
File: src/bun.js/bindings/headers.h:729-731
Timestamp: 2025-09-20T05:35:57.318Z
Learning: symbols.txt in the Bun codebase is specifically for V8 API mangled symbols (without leading underscore), not for general Bun host functions declared with BUN_DECLARE_HOST_FUNCTION. Host functions are handled through different build mechanisms.

Applied to files:

  • cmake/targets/BuildBun.cmake
📚 Learning: 2025-10-01T21:48:38.278Z
Learnt from: taylordotfish
Repo: oven-sh/bun PR: 23169
File: src/bun.js/bindings/Bindgen/IDLTypes.h:1-3
Timestamp: 2025-10-01T21:48:38.278Z
Learning: In the Bun codebase, for `BunIDL*` and `Bindgen*` headers (e.g., BunIDLTypes.h, Bindgen/IDLTypes.h), it's acceptable to rely on transitive includes for standard library headers like <type_traits> and <utility> rather than including them explicitly.

Applied to files:

  • cmake/targets/BuildBun.cmake
📚 Learning: 2025-11-24T18:36:59.706Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: src/bun.js/bindings/v8/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:36:59.706Z
Learning: Applies to src/bun.js/bindings/v8/V8*.h : Create V8 class headers with .h extension following the pattern V8ClassName.h that include pragma once, v8.h, V8Local.h, V8Isolate.h, and declare classes extending from Data with BUN_EXPORT static methods

Applied to files:

  • cmake/targets/BuildBun.cmake
📚 Learning: 2025-10-15T20:19:38.580Z
Learnt from: markovejnovic
Repo: oven-sh/bun PR: 23680
File: cmake/targets/BuildBun.cmake:822-822
Timestamp: 2025-10-15T20:19:38.580Z
Learning: In the Bun codebase, FFI is compiled with tcc (TinyCC), which barely supports C99. The headers `src/bun.js/api/FFI.h` and `src/bun.js/api/ffi-stdbool.h` are only used for FFI compilation with tcc, not for the main Bun target. Therefore, C23 compatibility concerns (such as bool/true/false keyword conflicts) do not apply to these FFI headers.

Applied to files:

  • cmake/targets/BuildBun.cmake
📚 Learning: 2025-11-24T18:36:59.706Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: src/bun.js/bindings/v8/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:36:59.706Z
Learning: Applies to src/bun.js/bindings/v8/src/napi/napi.zig : For each new V8 C++ method, add both GCC/Clang and MSVC mangled symbol names to the V8API struct in src/napi/napi.zig using extern fn declarations

Applied to files:

  • cmake/targets/BuildBun.cmake
📚 Learning: 2025-11-14T16:07:01.064Z
Learnt from: RiskyMH
Repo: oven-sh/bun PR: 24719
File: docs/bundler/executables.mdx:527-560
Timestamp: 2025-11-14T16:07:01.064Z
Learning: In the Bun repository, certain bundler features like compile with code splitting (--compile --splitting) are CLI-only and not supported in the Bun.build() JavaScript API. Tests for CLI-only features use backend: "cli" flag (e.g., test/bundler/bundler_compile_splitting.test.ts). The CompileBuildConfig interface correctly restricts these with splitting?: never;. When documenting CLI-only bundler features, add a note clarifying they're not available via the programmatic API.

Applied to files:

  • cmake/targets/BuildBun.cmake
📚 Learning: 2026-01-15T03:22:50.711Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-01-15T03:22:50.711Z
Learning: C++ code for JavaScriptCore bindings should be placed in `src/bun.js/bindings/*.cpp`

Applied to files:

  • cmake/tools/SetupWebKit.cmake
🔇 Additional comments (3)
cmake/tools/SetupWebKit.cmake (2)

29-38: Include directory reordering is fine.

The inspector derived sources path is now positioned after PrivateHeaders/JavaScriptCore. Both paths remain included, so this is just a reordering with no functional impact on the build.


5-5: WebKit version update to c4d4cae03ecef2791f7ad5dd795f722d8be87d41 is valid.

The commit exists in the oven-sh/WebKit repository with a corresponding autobuild release tag and is accessible.

cmake/targets/BuildBun.cmake (1)

1313-1315: Correct fix for static ICU linkage on Windows.

U_STATIC_IMPLEMENTATION is the standard define required when linking ICU statically. Without it, ICU headers default to __declspec(dllimport) which causes ABI mismatches with statically-linked ICU libraries. The detailed comment explaining the crash scenario (STATUS_STACK_BUFFER_OVERRUN) is helpful for future maintainers.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.


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

@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: 0

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/bindings.cpp (1)

3527-3545: Use normalized asyncContext in the queued microtask at line 3543.

The code normalizes asyncContext (lines 3535–3537) to convert empty JSValue to jsUndefined(), but then passes the raw un-normalized field to QueuedTask instead of the normalized variable. This defeats the normalization and is inconsistent with the same pattern correctly implemented in ZigGlobalObject.cpp:1079.

Proposed fix
-        JSC::QueuedTask task { nullptr, JSC::InternalMicrotask::BunPerformMicrotaskJob, 0, globalObject, microtaskFunction, rejectPromiseFunction, globalObject->m_asyncContextData.get()->getInternalField(0), promise, value };
+        JSC::QueuedTask task { nullptr, JSC::InternalMicrotask::BunPerformMicrotaskJob, 0, globalObject, microtaskFunction, rejectPromiseFunction, asyncContext, promise, value };
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between ebf39e9 and f758a5f.

📒 Files selected for processing (15)
  • .claude/commands/upgrade-webkit.md
  • cmake/tools/SetupWebKit.cmake
  • src/bun.js/bindings/BunGCOutputConstraint.h
  • src/bun.js/bindings/ZigGlobalObject.cpp
  • src/bun.js/bindings/bindings.cpp
  • src/bun.js/bindings/node/crypto/CryptoSignJob.h
  • src/bun.js/bindings/webcore/EventInit.h
  • src/bun.js/bindings/webcore/HTTPHeaderMap.h
  • src/bun.js/bindings/webcore/PerformanceUserTiming.cpp
  • src/bun.js/bindings/webcrypto/JSCryptoKey.cpp
  • src/bun.js/bindings/webcrypto/JSCryptoKeyUsage.cpp
  • src/bun.js/bindings/webcrypto/JSSubtleCrypto.cpp
  • src/codegen/bindgen.ts
  • src/codegen/bindgenv2/internal/enumeration.ts
  • src/codegen/bundle-functions.ts
🧰 Additional context used
📓 Path-based instructions (1)
src/bun.js/bindings/**/*.cpp

📄 CodeRabbit inference engine (CLAUDE.md)

src/bun.js/bindings/**/*.cpp: Create classes in three parts in C++ when there is a public constructor: Foo (JSDestructibleObject), FooPrototype (JSNonFinalObject), and FooConstructor (InternalFunction)
Define properties using HashTableValue arrays in C++ JavaScript class bindings
Add iso subspaces for C++ classes with fields in JavaScript class bindings
Cache structures in ZigGlobalObject for JavaScript class bindings

Files:

  • src/bun.js/bindings/webcrypto/JSCryptoKey.cpp
  • src/bun.js/bindings/webcrypto/JSSubtleCrypto.cpp
  • src/bun.js/bindings/webcore/PerformanceUserTiming.cpp
  • src/bun.js/bindings/ZigGlobalObject.cpp
  • src/bun.js/bindings/bindings.cpp
  • src/bun.js/bindings/webcrypto/JSCryptoKeyUsage.cpp
🧠 Learnings (41)
📓 Common learnings
Learnt from: taylordotfish
Repo: oven-sh/bun PR: 23169
File: src/bun.js/bindings/webcore/JSDOMConvertEnumeration.h:47-74
Timestamp: 2025-10-01T21:59:54.571Z
Learning: In the new bindings generator (bindgenv2) for `src/bun.js/bindings/webcore/JSDOMConvertEnumeration.h`, the context-aware enumeration conversion overloads intentionally use stricter validation (requiring `value.isString()` without ToString coercion), diverging from Web IDL semantics. This is a design decision documented in comments.
Learnt from: Jarred-Sumner
Repo: oven-sh/bun PR: 25429
File: src/bun.js/bindings/helpers.h:422-422
Timestamp: 2025-12-23T06:50:41.142Z
Learning: In Bun's C++ bindings (src/bun.js/bindings/helpers.h and similar files), when returning an empty JSC::Identifier and a VM is accessible, prefer using `vm.propertyNames->emptyIdentifier` over constructing with `JSC::Identifier(JSC::Identifier::EmptyIdentifierFlag::EmptyIdentifier)`. The cached identifier from the VM's property names table is more efficient and consistent with WebKit upgrade patterns.
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: src/js/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:37:11.466Z
Learning: The build process converts source TS/JS through preprocessing, bundling, and C++ header generation; assign numeric IDs in A-Z sorted order
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: src/bun.js/bindings/v8/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:36:59.706Z
Learning: Applies to src/bun.js/bindings/v8/src/napi/napi.zig : For each new V8 C++ method, add both GCC/Clang and MSVC mangled symbol names to the V8API struct in src/napi/napi.zig using extern fn declarations
📚 Learning: 2025-11-14T16:07:01.064Z
Learnt from: RiskyMH
Repo: oven-sh/bun PR: 24719
File: docs/bundler/executables.mdx:527-560
Timestamp: 2025-11-14T16:07:01.064Z
Learning: In the Bun repository, certain bundler features like compile with code splitting (--compile --splitting) are CLI-only and not supported in the Bun.build() JavaScript API. Tests for CLI-only features use backend: "cli" flag (e.g., test/bundler/bundler_compile_splitting.test.ts). The CompileBuildConfig interface correctly restricts these with splitting?: never;. When documenting CLI-only bundler features, add a note clarifying they're not available via the programmatic API.

Applied to files:

  • .claude/commands/upgrade-webkit.md
  • src/codegen/bundle-functions.ts
📚 Learning: 2025-11-24T18:37:11.466Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: src/js/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:37:11.466Z
Learning: The build process converts source TS/JS through preprocessing, bundling, and C++ header generation; assign numeric IDs in A-Z sorted order

Applied to files:

  • .claude/commands/upgrade-webkit.md
📚 Learning: 2026-01-05T23:04:01.518Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: test/CLAUDE.md:0-0
Timestamp: 2026-01-05T23:04:01.518Z
Learning: Applies to test/**/*.test.{ts,js,jsx,tsx,mjs,cjs} : Use `bun bd test <...test file>` to run tests with compiled code changes. Do not use `bun test` as it will not include your changes.

Applied to files:

  • .claude/commands/upgrade-webkit.md
📚 Learning: 2025-11-24T18:37:11.466Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: src/js/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:37:11.466Z
Learning: Write JS builtins for Bun's Node.js compatibility and APIs, and run `bun bd` after changes

Applied to files:

  • .claude/commands/upgrade-webkit.md
📚 Learning: 2025-12-16T00:21:32.179Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-16T00:21:32.179Z
Learning: Only push changes after running `bun bd test <file>` and ensuring tests pass

Applied to files:

  • .claude/commands/upgrade-webkit.md
📚 Learning: 2026-01-05T23:04:01.518Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: test/CLAUDE.md:0-0
Timestamp: 2026-01-05T23:04:01.518Z
Learning: Applies to test/**/*.test.{ts,js,jsx,tsx,mjs,cjs} : Use `bun:test` for files ending in `*.test.{ts,js,jsx,tsx,mjs,cjs}`. For test files without .test extension in test/js/node/test/{parallel,sequential}/*.js, use `bun bd <file>` instead of `bun bd test <file>` since they expect exit code 0.

Applied to files:

  • .claude/commands/upgrade-webkit.md
📚 Learning: 2025-11-24T18:36:59.706Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: src/bun.js/bindings/v8/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:36:59.706Z
Learning: Applies to src/bun.js/bindings/v8/test/v8/v8.test.ts : Add corresponding test cases to test/v8/v8.test.ts using checkSameOutput() function to compare Node.js and Bun output

Applied to files:

  • .claude/commands/upgrade-webkit.md
  • src/bun.js/bindings/BunGCOutputConstraint.h
📚 Learning: 2025-12-16T00:21:32.179Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-16T00:21:32.179Z
Learning: Run `bun run zig:check-all` to compile Zig code on all platforms when making platform-specific changes

Applied to files:

  • .claude/commands/upgrade-webkit.md
📚 Learning: 2025-12-16T00:21:32.179Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-16T00:21:32.179Z
Learning: Applies to **/*.test.ts?(x) : Never use `bun test` directly - always use `bun bd test` to run tests with debug build changes

Applied to files:

  • .claude/commands/upgrade-webkit.md
📚 Learning: 2025-10-19T02:44:46.354Z
Learnt from: theshadow27
Repo: oven-sh/bun PR: 23798
File: packages/bun-otel/context-propagation.test.ts:1-1
Timestamp: 2025-10-19T02:44:46.354Z
Learning: In the Bun repository, standalone packages under packages/ (e.g., bun-vscode, bun-inspector-protocol, bun-plugin-yaml, bun-plugin-svelte, bun-debug-adapter-protocol, bun-otel) co-locate their tests with package source code using *.test.ts files. This follows standard npm/monorepo patterns. The test/ directory hierarchy (test/js/bun/, test/cli/, test/js/node/) is reserved for testing Bun's core runtime APIs and built-in functionality, not standalone packages.

Applied to files:

  • .claude/commands/upgrade-webkit.md
📚 Learning: 2025-10-01T21:59:54.571Z
Learnt from: taylordotfish
Repo: oven-sh/bun PR: 23169
File: src/bun.js/bindings/webcore/JSDOMConvertEnumeration.h:47-74
Timestamp: 2025-10-01T21:59:54.571Z
Learning: In the new bindings generator (bindgenv2) for `src/bun.js/bindings/webcore/JSDOMConvertEnumeration.h`, the context-aware enumeration conversion overloads intentionally use stricter validation (requiring `value.isString()` without ToString coercion), diverging from Web IDL semantics. This is a design decision documented in comments.

Applied to files:

  • src/bun.js/bindings/webcore/EventInit.h
  • src/bun.js/bindings/BunGCOutputConstraint.h
  • src/bun.js/bindings/webcrypto/JSCryptoKey.cpp
  • src/bun.js/bindings/webcrypto/JSSubtleCrypto.cpp
  • src/bun.js/bindings/webcore/HTTPHeaderMap.h
  • src/codegen/bindgenv2/internal/enumeration.ts
  • src/bun.js/bindings/webcore/PerformanceUserTiming.cpp
  • src/codegen/bindgen.ts
  • src/bun.js/bindings/bindings.cpp
  • src/bun.js/bindings/webcrypto/JSCryptoKeyUsage.cpp
📚 Learning: 2025-12-23T06:50:31.577Z
Learnt from: Jarred-Sumner
Repo: oven-sh/bun PR: 25429
File: src/bun.js/bindings/helpers.h:422-422
Timestamp: 2025-12-23T06:50:31.577Z
Learning: In Bun's C++ bindings, when returning an empty JSC::Identifier and a VM is accessible, prefer using vm.propertyNames->emptyIdentifier over constructing with JSC::Identifier(JSC::Identifier::EmptyIdentifierFlag::EmptyIdentifier). The cached identifier from the VM's property names table is more efficient and consistent with WebKit upgrade patterns. Apply this guidance to src/bun.js/bindings/helpers.h and similar header files in the same bindings directory (i.e., any file that constructs an EmptyIdentifier).

Applied to files:

  • src/bun.js/bindings/webcore/EventInit.h
  • src/bun.js/bindings/BunGCOutputConstraint.h
  • src/bun.js/bindings/node/crypto/CryptoSignJob.h
  • src/bun.js/bindings/webcore/HTTPHeaderMap.h
📚 Learning: 2025-11-24T18:36:59.706Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: src/bun.js/bindings/v8/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:36:59.706Z
Learning: Applies to src/bun.js/bindings/v8/V8*.h : Add BUN_EXPORT visibility attribute to all public V8 API functions to ensure proper symbol export across platforms

Applied to files:

  • src/codegen/bundle-functions.ts
  • src/bun.js/bindings/BunGCOutputConstraint.h
  • src/bun.js/bindings/webcrypto/JSSubtleCrypto.cpp
  • src/bun.js/bindings/webcore/PerformanceUserTiming.cpp
📚 Learning: 2025-11-24T18:37:11.466Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: src/js/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:37:11.466Z
Learning: Applies to src/js/{builtins,node,bun,thirdparty,internal}/**/*.{ts,js} : Use private globals and methods with `$` prefix (e.g., `$Array`, `map.$set()`) instead of public JavaScript globals

Applied to files:

  • src/codegen/bundle-functions.ts
📚 Learning: 2025-11-24T18:37:11.466Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: src/js/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:37:11.466Z
Learning: Applies to src/js/{builtins,node,bun,thirdparty,internal}/**/*.ts : Builtin functions must include `this` parameter typing in TypeScript to enable direct method binding in C++

Applied to files:

  • src/codegen/bundle-functions.ts
📚 Learning: 2025-11-24T18:37:11.466Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: src/js/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:37:11.466Z
Learning: Applies to src/js/{builtins,node,bun,thirdparty,internal}/**/*.{ts,js} : Export modules using `export default { ... }` syntax; modules are NOT ES modules

Applied to files:

  • src/codegen/bundle-functions.ts
📚 Learning: 2025-11-24T18:36:59.706Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: src/bun.js/bindings/v8/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:36:59.706Z
Learning: Applies to src/bun.js/bindings/v8/V8*.cpp : Include ASSERT_V8_TYPE_LAYOUT_MATCHES(v8::ClassName) macro at the beginning of each V8 class implementation file to verify type layout compatibility with V8

Applied to files:

  • src/bun.js/bindings/BunGCOutputConstraint.h
📚 Learning: 2025-11-24T18:36:59.706Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: src/bun.js/bindings/v8/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:36:59.706Z
Learning: Applies to src/bun.js/bindings/v8/V8*.h : Create V8 class headers with .h extension following the pattern V8ClassName.h that include pragma once, v8.h, V8Local.h, V8Isolate.h, and declare classes extending from Data with BUN_EXPORT static methods

Applied to files:

  • src/bun.js/bindings/BunGCOutputConstraint.h
📚 Learning: 2025-11-24T18:36:59.706Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: src/bun.js/bindings/v8/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:36:59.706Z
Learning: Applies to src/bun.js/bindings/v8/V8*.cpp : Create V8 class implementations with .cpp extension following the pattern V8ClassName.cpp that include the header, v8_compatibility_assertions.h, use ASSERT_V8_TYPE_LAYOUT_MATCHES macro, and implement methods using isolate->currentHandleScope()->createLocal<T>() for handle creation

Applied to files:

  • src/bun.js/bindings/BunGCOutputConstraint.h
  • src/bun.js/bindings/bindings.cpp
📚 Learning: 2025-11-24T18:36:59.706Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: src/bun.js/bindings/v8/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:36:59.706Z
Learning: Applies to src/bun.js/bindings/v8/V8*.cpp : Use JSC::WriteBarrier for heap-allocated references in V8 objects and implement visitChildren() for custom heap objects to support garbage collection

Applied to files:

  • src/bun.js/bindings/BunGCOutputConstraint.h
  • src/bun.js/bindings/webcore/PerformanceUserTiming.cpp
  • src/bun.js/bindings/ZigGlobalObject.cpp
  • src/bun.js/bindings/bindings.cpp
📚 Learning: 2025-10-17T01:20:22.188Z
Learnt from: taylordotfish
Repo: oven-sh/bun PR: 23755
File: src/bun.js/bindings/BunIDLConvert.h:72-97
Timestamp: 2025-10-17T01:20:22.188Z
Learning: In Bun's IDL bindings (src/bun.js/bindings/BunIDLConvert.h), converters inheriting from `Bun::DefaultTryConverter` automatically get `conversionHasSideEffects = true` via the inheritance chain (`DefaultTryConverter` → `WebCore::DefaultConverter`). No explicit declaration of `conversionHasSideEffects` is needed when using `DefaultTryConverter` as the base.

Applied to files:

  • src/bun.js/bindings/BunGCOutputConstraint.h
📚 Learning: 2025-12-16T00:21:32.179Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-16T00:21:32.179Z
Learning: Applies to src/bun.js/bindings/**/*.cpp : Create classes in three parts in C++ when there is a public constructor: Foo (JSDestructibleObject), FooPrototype (JSNonFinalObject), and FooConstructor (InternalFunction)

Applied to files:

  • src/bun.js/bindings/BunGCOutputConstraint.h
  • src/bun.js/bindings/bindings.cpp
📚 Learning: 2025-12-16T00:21:32.179Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-16T00:21:32.179Z
Learning: Applies to src/bun.js/bindings/**/*.cpp : Define properties using HashTableValue arrays in C++ JavaScript class bindings

Applied to files:

  • src/bun.js/bindings/webcrypto/JSCryptoKey.cpp
  • src/bun.js/bindings/webcrypto/JSSubtleCrypto.cpp
  • src/bun.js/bindings/webcore/PerformanceUserTiming.cpp
  • src/bun.js/bindings/webcrypto/JSCryptoKeyUsage.cpp
📚 Learning: 2025-12-16T00:21:32.179Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-16T00:21:32.179Z
Learning: Applies to src/bun.js/bindings/**/*.cpp : Add iso subspaces for C++ classes with fields in JavaScript class bindings

Applied to files:

  • src/bun.js/bindings/webcrypto/JSCryptoKey.cpp
  • src/bun.js/bindings/webcrypto/JSSubtleCrypto.cpp
  • src/bun.js/bindings/webcore/PerformanceUserTiming.cpp
  • src/bun.js/bindings/ZigGlobalObject.cpp
  • src/bun.js/bindings/bindings.cpp
  • src/bun.js/bindings/webcrypto/JSCryptoKeyUsage.cpp
📚 Learning: 2025-12-23T06:50:41.142Z
Learnt from: Jarred-Sumner
Repo: oven-sh/bun PR: 25429
File: src/bun.js/bindings/helpers.h:422-422
Timestamp: 2025-12-23T06:50:41.142Z
Learning: In Bun's C++ bindings (src/bun.js/bindings/helpers.h and similar files), when returning an empty JSC::Identifier and a VM is accessible, prefer using `vm.propertyNames->emptyIdentifier` over constructing with `JSC::Identifier(JSC::Identifier::EmptyIdentifierFlag::EmptyIdentifier)`. The cached identifier from the VM's property names table is more efficient and consistent with WebKit upgrade patterns.

Applied to files:

  • src/bun.js/bindings/webcrypto/JSCryptoKey.cpp
  • src/bun.js/bindings/webcrypto/JSSubtleCrypto.cpp
  • src/bun.js/bindings/webcore/PerformanceUserTiming.cpp
  • src/bun.js/bindings/ZigGlobalObject.cpp
  • src/bun.js/bindings/bindings.cpp
  • src/bun.js/bindings/webcrypto/JSCryptoKeyUsage.cpp
📚 Learning: 2025-09-05T18:44:43.223Z
Learnt from: markovejnovic
Repo: oven-sh/bun PR: 21728
File: src/bun.js/bindings/bindings.cpp:6429-6432
Timestamp: 2025-09-05T18:44:43.223Z
Learning: The JSC::JSMap::size() method in JavaScriptCore returns a value that can be represented as uint32_t, and the binding functions in src/bun.js/bindings/bindings.cpp correctly use uint32_t as the return type for JSC__JSMap__size. JavaScript Maps are practically limited to 2^32 - 1 elements.

Applied to files:

  • src/bun.js/bindings/webcrypto/JSCryptoKey.cpp
📚 Learning: 2025-11-24T18:36:59.706Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: src/bun.js/bindings/v8/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:36:59.706Z
Learning: Applies to src/bun.js/bindings/v8/V8*.cpp : Use localToJSValue() to convert V8 handles to JSC values and perform JSC operations within V8 method implementations

Applied to files:

  • src/bun.js/bindings/webcrypto/JSCryptoKey.cpp
  • src/bun.js/bindings/ZigGlobalObject.cpp
  • src/bun.js/bindings/bindings.cpp
📚 Learning: 2025-12-16T00:21:32.179Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-16T00:21:32.179Z
Learning: Applies to src/bun.js/bindings/**/*.cpp : Cache structures in ZigGlobalObject for JavaScript class bindings

Applied to files:

  • src/bun.js/bindings/webcrypto/JSCryptoKey.cpp
  • src/bun.js/bindings/ZigGlobalObject.cpp
📚 Learning: 2025-11-24T18:36:59.706Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: src/bun.js/bindings/v8/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:36:59.706Z
Learning: Applies to src/bun.js/bindings/v8/src/symbols.txt : Add symbol names without leading underscore to src/symbols.txt for each new V8 API method

Applied to files:

  • src/bun.js/bindings/webcrypto/JSCryptoKey.cpp
  • src/bun.js/bindings/webcrypto/JSSubtleCrypto.cpp
  • src/bun.js/bindings/webcore/PerformanceUserTiming.cpp
  • src/bun.js/bindings/bindings.cpp
📚 Learning: 2025-11-24T18:36:59.706Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: src/bun.js/bindings/v8/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:36:59.706Z
Learning: Applies to src/bun.js/bindings/v8/src/symbols.dyn : Add symbol names with leading underscore and semicolons in braces to src/symbols.dyn for each new V8 API method

Applied to files:

  • src/bun.js/bindings/webcrypto/JSSubtleCrypto.cpp
  • src/bun.js/bindings/webcore/PerformanceUserTiming.cpp
  • src/bun.js/bindings/ZigGlobalObject.cpp
📚 Learning: 2025-11-24T18:37:47.899Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: src/bun.js/bindings/v8/AGENTS.md:0-0
Timestamp: 2025-11-24T18:37:47.899Z
Learning: Applies to src/bun.js/bindings/v8/**/<UNKNOWN> : <UNKNOWN>

Applied to files:

  • src/bun.js/bindings/webcrypto/JSSubtleCrypto.cpp
  • src/bun.js/bindings/ZigGlobalObject.cpp
  • src/bun.js/bindings/bindings.cpp
📚 Learning: 2025-11-24T18:37:11.466Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: src/js/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:37:11.466Z
Learning: Applies to src/js/{builtins,node,bun,thirdparty,internal}/**/*.{ts,js} : Use JSC intrinsics (prefixed with `$`) such as `$Array.from()`, `$isCallable()`, and `$newArrayWithSize()` for performance-critical operations

Applied to files:

  • src/bun.js/bindings/webcore/PerformanceUserTiming.cpp
📚 Learning: 2025-11-24T18:36:59.706Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: src/bun.js/bindings/v8/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:36:59.706Z
Learning: Applies to src/bun.js/bindings/v8/src/napi/napi.zig : For each new V8 C++ method, add both GCC/Clang and MSVC mangled symbol names to the V8API struct in src/napi/napi.zig using extern fn declarations

Applied to files:

  • src/bun.js/bindings/ZigGlobalObject.cpp
📚 Learning: 2025-11-03T20:43:06.996Z
Learnt from: pfgithub
Repo: oven-sh/bun PR: 24273
File: src/bun.js/test/snapshot.zig:19-19
Timestamp: 2025-11-03T20:43:06.996Z
Learning: In Bun's Zig codebase, when storing JSValue objects in collections like ArrayList, use `jsc.Strong.Optional` (not raw JSValue). When adding values, wrap them with `jsc.Strong.Optional.create(value, globalThis)`. In cleanup code, iterate the collection calling `.deinit()` on each Strong.Optional item before calling `.deinit()` on the ArrayList itself. This pattern automatically handles GC protection. See examples in src/bun.js/test/ScopeFunctions.zig and src/bun.js/node/node_cluster_binding.zig.

Applied to files:

  • src/bun.js/bindings/ZigGlobalObject.cpp
📚 Learning: 2025-11-24T18:36:59.706Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: src/bun.js/bindings/v8/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:36:59.706Z
Learning: Applies to src/bun.js/bindings/v8/V8*.cpp : Use V8_UNIMPLEMENTED() macro for functions not yet implemented in V8 compatibility classes

Applied to files:

  • src/bun.js/bindings/ZigGlobalObject.cpp
📚 Learning: 2025-11-24T18:36:59.706Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: src/bun.js/bindings/v8/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:36:59.706Z
Learning: Applies to src/bun.js/bindings/v8/test/v8/v8-module/main.cpp : Create test functions in test/v8/v8-module/main.cpp that take FunctionCallbackInfo<Value> parameter, use the test V8 API, print results for comparison with Node.js, and return Undefined

Applied to files:

  • src/bun.js/bindings/ZigGlobalObject.cpp
  • src/bun.js/bindings/bindings.cpp
📚 Learning: 2025-10-01T21:49:27.862Z
Learnt from: taylordotfish
Repo: oven-sh/bun PR: 23169
File: src/bun.js/bindings/BunIDLConvert.h:29-42
Timestamp: 2025-10-01T21:49:27.862Z
Learning: In Bun's IDL bindings (src/bun.js/bindings/BunIDLConvert.h), IDLStrictNull intentionally treats both undefined and null as null (using isUndefinedOrNull()), matching WebKit's IDLNull & IDLNullable behavior. This is the correct implementation and should not be changed to only accept null.

Applied to files:

  • src/bun.js/bindings/bindings.cpp
📚 Learning: 2025-09-19T19:55:22.427Z
Learnt from: markovejnovic
Repo: oven-sh/bun PR: 22568
File: src/valkey/js_valkey_functions.zig:853-854
Timestamp: 2025-09-19T19:55:22.427Z
Learning: In Bun's JSPromise API, `resolvedPromiseValue(globalThis: *JSGlobalObject, value: JSValue) JSValue` returns a JSValue directly (not a JSPromise that needs `.toJS()` called on it). This is different from `resolvedPromise()` which returns a *JSPromise that would need `.toJS()`.

Applied to files:

  • src/bun.js/bindings/bindings.cpp
📚 Learning: 2025-09-05T19:49:26.188Z
Learnt from: markovejnovic
Repo: oven-sh/bun PR: 21728
File: src/valkey/js_valkey_functions.zig:852-867
Timestamp: 2025-09-05T19:49:26.188Z
Learning: In Bun's Zig codebase, `.js_undefined` is a valid way to represent JavaScript's undefined value when working with JSPromise.resolve() and similar JavaScript interop functions. This is the correct pattern to use rather than `jsc.JSValue.jsUndefined()`.

Applied to files:

  • src/bun.js/bindings/bindings.cpp
📚 Learning: 2025-09-05T19:49:26.188Z
Learnt from: markovejnovic
Repo: oven-sh/bun PR: 21728
File: src/valkey/js_valkey_functions.zig:852-867
Timestamp: 2025-09-05T19:49:26.188Z
Learning: In Bun’s Zig code, `.js_undefined` is a valid and preferred JSValue literal for “undefined” (e.g., resolving JSPromise). Do not refactor usages to `jsc.JSValue.jsUndefined()`, especially in src/valkey/js_valkey_functions.zig unsubscribe().

Applied to files:

  • src/bun.js/bindings/bindings.cpp
🧬 Code graph analysis (3)
src/bun.js/bindings/webcore/EventInit.h (2)
packages/bun-uws/src/HttpContext.h (1)
  • nodiscard (45-89)
src/bun.js/bindings/webcore/MessageEvent.h (1)
  • EventInit (56-62)
src/bun.js/bindings/BunGCOutputConstraint.h (2)
src/bun.js/bindings/JSPropertyIterator.cpp (1)
  • WTF_DEPRECATED_MAKE_FAST_ALLOCATED (36-36)
src/bun.js/bindings/JSFFIFunction.cpp (1)
  • WTF_DEPRECATED_MAKE_FAST_ALLOCATED (42-42)
src/bun.js/bindings/ZigGlobalObject.cpp (1)
src/bake/BakeGlobalObject.cpp (2)
  • globalObjectMethodTable (201-233)
  • globalObjectMethodTable (201-201)
🔇 Additional comments (21)
src/bun.js/bindings/webcore/HTTPHeaderMap.h (1)

264-264: LGTM! Standard attribute modernization.

The replacement of WARN_UNUSED_RETURN with the C++17 standard attribute [[nodiscard]] is a good modernization that maintains the same semantics while using the standardized syntax. This aligns with the WebKit upgrade patterns.

src/bun.js/bindings/webcrypto/JSCryptoKey.cpp (1)

90-94: LGTM! Consistent codegen pattern modernization.

The refactoring from nested array initialization to direct SortedArrayMap construction via std::to_array is clean and consistent with the pattern applied across other webcrypto files in this PR. The lookup semantics remain unchanged while initialization is more concise.

Note: This is generated code from the bindings generator, so the change reflects an update to the code generation templates.

.claude/commands/upgrade-webkit.md (2)

9-9: LGTM! Explicit build command.

Making the build command explicit (bun build.ts debug) improves the workflow clarity and ensures the correct build step is executed during the WebKit upgrade process.


24-26: Excellent addition of verification checklist.

The new "Things to check for a successful upgrade" section adds valuable verification steps:

  • JSType alignment check: Ensures enum values stay synchronized between vendor/WebKit and src/bun.js/bindings/JSType.zig, catching potential ABI mismatches.
  • Codegen inspection: Prompts review of generated bindings for C++ compilation issues, which is critical given that this PR includes codegen changes.

These checks will help catch common upgrade pitfalls early.

src/bun.js/bindings/webcrypto/JSSubtleCrypto.cpp (1)

99-104: LGTM! Consistent with other webcrypto enum refactors.

The replacement of the static array mapping with direct SortedArrayMap initialization matches the pattern applied in JSCryptoKey.cpp and JSCryptoKeyUsage.cpp. The generated code is consistent and maintains the same lookup behavior.

src/bun.js/bindings/webcrypto/JSCryptoKeyUsage.cpp (1)

67-76: LGTM! Completes the webcrypto enum mapping modernization.

This final webcrypto file adopts the same SortedArrayMap initialization pattern, completing the consistent refactoring across all webcrypto enumeration conversions (CryptoKey::Type, SubtleCrypto::KeyFormat, and CryptoKeyUsage). The generated code maintains uniform structure throughout the module.

src/codegen/bindgen.ts (1)

758-767: LGTM! SortedArrayMap initialization refactor.

The migration from a separate static array + SortedArrayMap construction to inline initialization via std::to_array is consistent with modern WebKit patterns and simplifies the code. The lookup via tryGet remains unchanged.

src/codegen/bindgenv2/internal/enumeration.ts (1)

146-158: LGTM! Consistent SortedArrayMap initialization pattern.

The refactor aligns with the same pattern applied in bindgen.ts, consolidating the static array declaration with the SortedArrayMap initialization using std::to_array.

src/codegen/bundle-functions.ts (1)

328-330: LGTM! Good defensive visibility handling for async functions.

The comment clearly explains the rationale: JSC's parser upgrades async functions when they use await, so assigning Private visibility by default ensures consistency with the internal JSC handling. This prevents potential mismatches between the builtin's declared visibility and JSC's expectations.

src/bun.js/bindings/webcore/EventInit.h (1)

36-36: LGTM! Modernized to standard C++ attribute.

Replacing the WebKit-specific WARN_UNUSED_RETURN macro with the standard C++17 [[nodiscard]] attribute is a good modernization that improves portability and aligns with the codebase's existing usage (e.g., packages/bun-uws/src/HttpContext.h).

src/bun.js/bindings/webcore/PerformanceUserTiming.cpp (1)

46-68: LGTM! SortedArrayMap initialization refactor.

The migration to inline initialization with std::to_array is consistent with the broader PR pattern. All mark-to-function mappings are preserved, and the contains() lookup on line 72 correctly uses the new structure.

src/bun.js/bindings/node/crypto/CryptoSignJob.h (1)

14-14: LGTM! Correct allocation tag for the struct.

The WTF_MAKE_TZONE_ALLOCATED macro should receive the actual type name (SignJobCtx) for proper memory allocation tracking, not a placeholder like name.

src/bun.js/bindings/BunGCOutputConstraint.h (1)

39-39: LGTM! Typo fix in allocation macro.

Corrected the typo from DOMEGCOutputConstraint to DOMGCOutputConstraint to match the actual class name. This ensures proper allocation tracking.

cmake/tools/SetupWebKit.cmake (2)

5-5: LGTM - WebKit version upgrade

The WebKit version update to d5bd162d9ab2 aligns with the PR objectives and includes significant performance improvements and bug fixes as documented in the PR description.


37-37: Include path reordering looks fine

The JavaScriptCore/DerivedSources/inspector path has been reordered but remains in the include list. This should not cause issues, though include order can occasionally matter for header resolution. This change only affects local WebKit builds.

src/bun.js/bindings/ZigGlobalObject.cpp (5)

733-736: LGTM - Clean microtask forwarding helper

The new queueMicrotaskToEventLoop static helper correctly forwards tasks to the VM's microtask queue. This enables the GlobalObjectMethodTable to hook into the microtask scheduling mechanism.


744-744: Correctly wired microtask queue hook for GlobalObject

The GlobalObjectMethodTable now properly hooks queueMicrotaskToEventLoop in the queueTaskToEventLoop slot, enabling microtask scheduling for this global object type. This aligns with the WebKit upgrade changes.


773-773: Correctly wired microtask queue hook for EvalGlobalObject

The EvalGlobalObject method table is consistently updated with the same queueMicrotaskToEventLoop hook, ensuring uniform microtask handling across both global object types.


3110-3110: QueuedTask construction consistent with functionQueueMicrotask

The QueuedTask construction here consistently includes the new 0 parameter, matching the pattern established in functionQueueMicrotask. This construction uses BunInvokeJobWithArguments to pass native callback arguments via the microtask trampoline, as documented in the comment above.


1079-1079: QueuedTask construction pattern is consistent and correctly applied

The QueuedTask construction at line 1079 follows the WebKit upgrade requirements with the nullptr first parameter and 0 as the third parameter to support distinguishing empty JSValue from undefined. This pattern is consistently applied across all QueuedTask constructions in the codebase (ZigGlobalObject.cpp and bindings.cpp). The accompanying comment correctly explains that the runtime inspects argumentCount to determine which arguments are present.

src/bun.js/bindings/bindings.cpp (1)

5388-5433: No action required — all QueuedTask aggregate initializers in the codebase use the same pattern consistently.

The third field (the 0) matches all other initializations in ZigGlobalObject.cpp (lines 1079, 3110) and bindings.cpp (line 3543). This consistent usage across the repository confirms the field ordering is correct. No WebKit-provided named constant for this field exists in the available API surface.

This updates the WebKit version to use the preview build from PR #135
which fixes async context preservation across await for AsyncLocalStorage.

Fixes the failing test: test-diagnostics-channel-tracing-channel-promise-run-stores.js
@sosukesuzuki
sosukesuzuki force-pushed the jarred/webkit-upgrade-jan-10 branch from 859a500 to c83254a Compare January 13, 2026 05:03
sosukesuzuki added a commit to oven-sh/WebKit that referenced this pull request Jan 13, 2026
When an async function awaits a promise, Bun's AsyncLocalStorage context was
being lost. This happened because the upstream WebKit change moved the Microtask
handling to C++, and the InternalMicrotask::AsyncFunctionResume case was not
restoring Bun's async context.

The fix:
1. In JSPromise::resolveWithInternalMicrotaskForAsyncAwait: Capture the current
   async context and wrap it together with the generator in an InternalFieldTuple.
2. In runInternalMicrotask (AsyncFunctionResume case): Extract the async context
   from the InternalFieldTuple and restore it during the microtask execution.

This mirrors the existing async context handling in PromiseReactionJob and ensures
that AsyncLocalStorage.getStore() returns the correct context after await points.

Fixes: oven-sh/bun#25958
Use $promiseResolveWithThen to wrap promise chains in readableStreamIntoText
and readableStreamIntoArray to ensure they return regular Promise instead of
InternalPromise.

Builtin async functions return InternalPromise by design, but this caused
`stream.text() instanceof Promise` to return false. The fix uses the existing
$promiseResolveWithThen function which 'shields' InternalPromise by wrapping
it in a regular Promise.

Claude-Generated-By: Claude Code (cli/claude-opus-4-5=100%)
Claude-Steers: 19
Claude-Permission-Prompts: 1
Claude-Escapes: 0
@alii alii mentioned this pull request Jan 14, 2026
Claude-Generated-By: Claude Code (cli/claude-opus-4-5=100%)
Claude-Steers: 1
Claude-Permission-Prompts: 0
Claude-Escapes: 0
Remove the $promiseResolveWithThen wrappers that were causing user's
Promise.prototype.then override to be called. The WebKit fix in JSPromise.cpp
now properly handles InternalPromise to Promise conversion using internal
microtasks, avoiding user-visible .then() calls.

Claude-Generated-By: Claude Code (cli/claude-opus-4-5=100%)
Claude-Steers: 2
Claude-Permission-Prompts: 0
Claude-Escapes: 0
@sosukesuzuki
sosukesuzuki force-pushed the jarred/webkit-upgrade-jan-10 branch 2 times, most recently from 2944887 to d34c4b6 Compare January 14, 2026 13:35
Claude-Generated-By: Claude Code (cli/claude-opus-4-5=100%)
Claude-Steers: 0
Claude-Permission-Prompts: 0
Claude-Escapes: 0
@sosukesuzuki
sosukesuzuki force-pushed the jarred/webkit-upgrade-jan-10 branch from d34c4b6 to 913ba25 Compare January 14, 2026 14:27
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.

3 participants