Upgrade WebKit to d5bd162d9ab2 - #25958
Conversation
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>
|
Updated 6:00 AM PT - Jan 15th, 2026
❌ @sosukesuzuki, your commit b6d97cc has 3 failures in
🧪 To try this PR locally: bunx bun-pr 25958That installs a local version of the PR into your bun-25958 --bun |
WalkthroughUpdates 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
Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Disabled knowledge base sources:
📒 Files selected for processing (2)
🧰 Additional context used🧠 Learnings (10)📓 Common learnings📚 Learning: 2025-11-24T18:36:59.706ZApplied to files:
📚 Learning: 2025-10-15T20:19:37.256ZApplied to files:
📚 Learning: 2025-09-20T05:35:57.318ZApplied to files:
📚 Learning: 2025-10-01T21:48:38.278ZApplied to files:
📚 Learning: 2025-11-24T18:36:59.706ZApplied to files:
📚 Learning: 2025-10-15T20:19:38.580ZApplied to files:
📚 Learning: 2025-11-24T18:36:59.706ZApplied to files:
📚 Learning: 2025-11-14T16:07:01.064ZApplied to files:
📚 Learning: 2026-01-15T03:22:50.711ZApplied to files:
🔇 Additional comments (3)
✏️ Tip: You can disable this entire section by setting Comment |
There was a problem hiding this comment.
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 normalizedasyncContextin the queued microtask at line 3543.The code normalizes
asyncContext(lines 3535–3537) to convert emptyJSValuetojsUndefined(), but then passes the raw un-normalized field toQueuedTaskinstead of the normalized variable. This defeats the normalization and is inconsistent with the same pattern correctly implemented inZigGlobalObject.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.
📒 Files selected for processing (15)
.claude/commands/upgrade-webkit.mdcmake/tools/SetupWebKit.cmakesrc/bun.js/bindings/BunGCOutputConstraint.hsrc/bun.js/bindings/ZigGlobalObject.cppsrc/bun.js/bindings/bindings.cppsrc/bun.js/bindings/node/crypto/CryptoSignJob.hsrc/bun.js/bindings/webcore/EventInit.hsrc/bun.js/bindings/webcore/HTTPHeaderMap.hsrc/bun.js/bindings/webcore/PerformanceUserTiming.cppsrc/bun.js/bindings/webcrypto/JSCryptoKey.cppsrc/bun.js/bindings/webcrypto/JSCryptoKeyUsage.cppsrc/bun.js/bindings/webcrypto/JSSubtleCrypto.cppsrc/codegen/bindgen.tssrc/codegen/bindgenv2/internal/enumeration.tssrc/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.cppsrc/bun.js/bindings/webcrypto/JSSubtleCrypto.cppsrc/bun.js/bindings/webcore/PerformanceUserTiming.cppsrc/bun.js/bindings/ZigGlobalObject.cppsrc/bun.js/bindings/bindings.cppsrc/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.mdsrc/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.mdsrc/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.hsrc/bun.js/bindings/BunGCOutputConstraint.hsrc/bun.js/bindings/webcrypto/JSCryptoKey.cppsrc/bun.js/bindings/webcrypto/JSSubtleCrypto.cppsrc/bun.js/bindings/webcore/HTTPHeaderMap.hsrc/codegen/bindgenv2/internal/enumeration.tssrc/bun.js/bindings/webcore/PerformanceUserTiming.cppsrc/codegen/bindgen.tssrc/bun.js/bindings/bindings.cppsrc/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.hsrc/bun.js/bindings/BunGCOutputConstraint.hsrc/bun.js/bindings/node/crypto/CryptoSignJob.hsrc/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.tssrc/bun.js/bindings/BunGCOutputConstraint.hsrc/bun.js/bindings/webcrypto/JSSubtleCrypto.cppsrc/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.hsrc/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.hsrc/bun.js/bindings/webcore/PerformanceUserTiming.cppsrc/bun.js/bindings/ZigGlobalObject.cppsrc/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.hsrc/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.cppsrc/bun.js/bindings/webcrypto/JSSubtleCrypto.cppsrc/bun.js/bindings/webcore/PerformanceUserTiming.cppsrc/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.cppsrc/bun.js/bindings/webcrypto/JSSubtleCrypto.cppsrc/bun.js/bindings/webcore/PerformanceUserTiming.cppsrc/bun.js/bindings/ZigGlobalObject.cppsrc/bun.js/bindings/bindings.cppsrc/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.cppsrc/bun.js/bindings/webcrypto/JSSubtleCrypto.cppsrc/bun.js/bindings/webcore/PerformanceUserTiming.cppsrc/bun.js/bindings/ZigGlobalObject.cppsrc/bun.js/bindings/bindings.cppsrc/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.cppsrc/bun.js/bindings/ZigGlobalObject.cppsrc/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.cppsrc/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.cppsrc/bun.js/bindings/webcrypto/JSSubtleCrypto.cppsrc/bun.js/bindings/webcore/PerformanceUserTiming.cppsrc/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.cppsrc/bun.js/bindings/webcore/PerformanceUserTiming.cppsrc/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.cppsrc/bun.js/bindings/ZigGlobalObject.cppsrc/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.cppsrc/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_RETURNwith 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
SortedArrayMapconstruction viastd::to_arrayis 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
SortedArrayMapinitialization 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
SortedArrayMapinitialization 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_arrayis consistent with modern WebKit patterns and simplifies the code. The lookup viatryGetremains 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 theSortedArrayMapinitialization usingstd::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 assigningPrivatevisibility 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_RETURNmacro 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_arrayis consistent with the broader PR pattern. All mark-to-function mappings are preserved, and thecontains()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_ALLOCATEDmacro should receive the actual type name (SignJobCtx) for proper memory allocation tracking, not a placeholder likename.src/bun.js/bindings/BunGCOutputConstraint.h (1)
39-39: LGTM! Typo fix in allocation macro.Corrected the typo from
DOMEGCOutputConstrainttoDOMGCOutputConstraintto match the actual class name. This ensures proper allocation tracking.cmake/tools/SetupWebKit.cmake (2)
5-5: LGTM - WebKit version upgradeThe WebKit version update to
d5bd162d9ab2aligns with the PR objectives and includes significant performance improvements and bug fixes as documented in the PR description.
37-37: Include path reordering looks fineThe
JavaScriptCore/DerivedSources/inspectorpath 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 helperThe new
queueMicrotaskToEventLoopstatic 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 GlobalObjectThe GlobalObjectMethodTable now properly hooks
queueMicrotaskToEventLoopin 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 EvalGlobalObjectThe EvalGlobalObject method table is consistently updated with the same
queueMicrotaskToEventLoophook, ensuring uniform microtask handling across both global object types.
3110-3110: QueuedTask construction consistent with functionQueueMicrotaskThe QueuedTask construction here consistently includes the new
0parameter, matching the pattern established infunctionQueueMicrotask. This construction usesBunInvokeJobWithArgumentsto pass native callback arguments via the microtask trampoline, as documented in the comment above.
1079-1079: QueuedTask construction pattern is consistent and correctly appliedThe QueuedTask construction at line 1079 follows the WebKit upgrade requirements with the
nullptrfirst parameter and0as 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 — allQueuedTaskaggregate 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
859a500 to
c83254a
Compare
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
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
2944887 to
d34c4b6
Compare
Claude-Generated-By: Claude Code (cli/claude-opus-4-5=100%) Claude-Steers: 0 Claude-Permission-Prompts: 0 Claude-Escapes: 0
d34c4b6 to
913ba25
Compare
Summary
Updates WebKit from 1d0216219a3c to d5bd162d9ab2.
Key WebKit Changes
Performance Improvements:
Regular Expressions:
Async/Generator:
Bun-Specific Fixes
performPromiseThenWithContextfor passing extra context to promise handlersPromiseReactionJobto checkisEmpty() || isUndefinedOrNull()before passing context (empty JSValue ≠ undefined)@thenproperty toJSInternalPromisePrototypeviaaddOwnInternalSlotsBunPerformMicrotaskJobandBunInvokeJobWithArgumentscases that were lost during mergeTest plan
test/js/bun/plugin/plugins.test.tspassestest/js/node/test/parallel/test-readable-from.jspassestest/js/node/test/parallel/test-stream-duplex-from.jspassestest/js/web/streams/streams.test.jsReadableStream for Blob test passes🤖 Generated with Claude Code