Skip to content

chore(sync): merge upstream WebKit for Bun 1.4.6 - #56

Draft
vincentkoc wants to merge 1330 commits into
openclaw/mainfrom
claude/sync-webkit-bun-1.4.6-20261119
Draft

vincentkoc wants to merge 1330 commits into
openclaw/mainfrom
claude/sync-webkit-bun-1.4.6-20261119

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

The current Bun upstream sync requires WebKit 0befb64c5f30ae5af5137f31c1ebd4f7c3f908d4; the fork still uses the older engine API. This merges the required upstream engine into the fork while retaining its fixes.

History is preserved by signed merge 43e094f47e7e927602ccfcd253cec1fb435c95e6, with parents 3357f9d63e6dd87a53f2aade723482130a55c0cd and 0befb64c5f30ae5af5137f31c1ebd4f7c3f908d4. Land with a merge commit to retain both histories.

The resolution preserves separate import/require namespace views, original module instances under mocks, async context, callsite positions, worker collection wakeups, and ArrayBuffer/Wasm accounting. It adapts the new spread-call opcode and AOT typed-array mode access to the fork's layouts. The inherited publishing workflow remains deleted.

Validation

Current head: 2672541eb4f9a44519709d535c2e43509ba2bb0e. Qualification is frozen to Bun 473748f714bee47d452a9796205640865682e722, including its tree, manifest blob and harness hashes.

  • Independent source review covered the conflicts and affected automatic merges. No conflict markers or newly introduced whitespace errors.
  • The mixed-spread callsite regression is in the existing JSC stress suite; the public jest.requireActual regression is in the paired Bun PR.
  • At current head 2672541eb4f9a44519709d535c2e43509ba2bb0e, the Linux engine passed 1,901 JSC stress and 1,639 module tests, four sampling tiers, five ArrayBuffer modes, seven stack modes and stack-cache checks. Windows ARM64 build/runtime and macOS artifact lanes passed at current head. Evidence: https://github.com/openclaw/WebKit/actions/runs/44578842723. Linux ARM64 passed at the previous metadata-only head: https://github.com/openclaw/WebKit/actions/runs/44510526956.
  • The current Linux consumer qualification failed in Bun's native compilation at the process-exit discriminator. The separate AOT pair also exposed parser and source-map API mismatches. The companion repairs these in de8fd6394d6231a67c09efddb6013de7748213ed; no passing Bun qualification is claimed yet.
  • The real source/provenance entry point passes with 127 fork patch commits and the original history floor. All 69 synthetic pipeline checks passed previously. After the current candidate identity update, all 45 consumer-identity and 15 comparison checks passed again; independent review verified unchanged harness preimage/output hashes.

Pending matched qualification

  • Frozen consumer qualification failed on the older Bun candidate: https://github.com/openclaw/WebKit/actions/runs/44578842723.
  • Bun 4fe734bbe9f8546ad0d61d24941481399559fc39 subsequently passed its matched Linux native build, packaging, trimming policy and AOT/source-map unit tests: https://github.com/openclaw/bun/actions/runs/44686700965. Its broad report contained 21 failing test files.
  • Current Bun head 108557a84b535cd7ae65e1155739cdde0b2a6346 contains independently reviewed runtime/compiler repairs, lazy CommonJS aliases, final IPC reply drainage, map-free cache persistence, decoded plugin importer identity and directive normalization.
  • Full matched qualification: https://github.com/openclaw/bun/actions/runs/44690757600. It uses ICU exported from this engine's exact pinned recipe and runs the unchanged schema-generator tests against this engine. Results are pending. The superseded system-ICU replay was cancelled.
  • After the full native/runtime pass succeeds, update the frozen consumer identity and rerun its pipeline. Engine source remains unchanged.

Companion: openclaw/bun#222. This stays draft until native and matched-consumer qualification pass. Existing published assets and consumer pins are unchanged; no release, tag or rollout is included.

sammygill and others added 30 commits November 6, 2026 08:00
…pp page

https://bugs.webkit.org/show_bug.cgi?id=330389
rdar://188849586

Reviewed by Brent Fulgham.

On iPads with 8 or more CPU cores, such as M-series iPad Pro,
disneyplus.com sends a logged-in subscriber to a download-the-app page
instead of letting them stream in Safari. We added a quirk for this
behavior in 285093@main and extended it to iPad in 293785@main, since it
kept users from getting the Desktop Class Browsing experience on these
devices. That quirk hides `pointer: coarse`, which the site fell back to
because its maxTouchPoints check had a typo. The site has fixed the
typo, and since WebKit always exposes maxTouchPoints as a number, the
fallback is never reached. The site now treats a Macintosh user agent as
a mobile device when navigator.maxTouchPoints is at least 5 and
navigator.hardwareConcurrency is at least 8.

In this patch we apply NeedsZeroMaxTouchPointsQuirk to disneyplus.com on
iPad. HomeView already uses this quirk for the same site, so we can
reuse it rather than add a new one. To limit the quirk to iPad, we add a
Desktop URLEnvironment backed by PAL::currentUserInterfaceIdiomIsDesktop(),
which, combined with the iOS build condition, matches iPad.

* LayoutTests/platform/ipad/fast/quirks/active-quirks-by-domain-expected.txt:
disneyplus.com now also gets NeedsZeroMaxTouchPointsQuirk.

* Source/WebCore/page/QuirkMatchPattern.cpp:
(WebCore::evaluateURLEnvironment): Evaluate Desktop with the current user
interface idiom so that we can apply the quirk on iPad.

* Source/WebCore/page/QuirkMatchPattern.h: Add URLEnvironment::Desktop.

* Source/WebCore/page/QuirkTable.json: Apply NeedsZeroMaxTouchPointsQuirk
to disneyplus.com on iPad.

* Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in: Add

URLEnvironment::Desktop.
Canonical link: https://commits.webkit.org/325935@main
…seSharedArrayBuffer.

https://bugs.webkit.org/show_bug.cgi?id=330358
rdar://191971055

Reviewed by Anne van Kesteren.

This is done to disambiguate it from Options::allowSharedArrayBuffer.  Also restructure guard
checks in JSGlobalObject::exposeSharedArrayBuffer() to make it clear why we abort if
Options::alwaysUseSharedArrayBuffer is set.

No new tests because there is no behavior change.

* JSTests/test262/config.yaml:
* JSTests/wasm/stress/memory-type-reflects-current-size.js:
* LayoutTests/fast/workers/worker-terminate-atomics-wait.html:
* LayoutTests/fast/workers/worker-terminate-wasm-atomic-wait.html:
* LayoutTests/http/tests/broadcastchannel/postmessage-sharedarraybuffer.html:
* LayoutTests/js/Atomics-waitasync-invocable-on-main-thread.html:
* LayoutTests/js/dom/resizable-array-buffer-serialization.html:
* LayoutTests/js/dom/resizable-array-buffer-should-be-rejected-by-default.html:
* LayoutTests/js/dom/resizable-array-buffer-view-serialization-out-of-bounds-explicit-length.html:
* LayoutTests/js/dom/resizable-array-buffer-view-serialization-out-of-bounds.html:
* LayoutTests/js/dom/resizable-array-buffer-view-serialization.html:
* LayoutTests/js/dom/resizable-data-view-serialization-out-of-bounds-explicit-length.html:
* LayoutTests/js/dom/resizable-data-view-serialization-out-of-bounds.html:
* LayoutTests/js/dom/webassembly-memory-shared-basic.html:
* LayoutTests/js/dom/webassembly-memory-shared-zero-maximum-clone.html:
* LayoutTests/js/regress-311234.html:
* LayoutTests/js/shared-array-buffer-webgl.html:
* LayoutTests/js/structuredClone/structured-clone-of-ResizableSharedArrayBuffer.html:
* LayoutTests/webaudio/dom-exceptions.html:
* LayoutTests/webgl/webgl-allow-shared-typed-array.html:
* LayoutTests/webgl/webgl-allow-shared.html:
* LayoutTests/workers/sab/growable-shared-array-buffer-serialization.html:
* LayoutTests/workers/sab/growable-shared-array-buffer-view-serialization-explicit-length.html:
* LayoutTests/workers/sab/growable-shared-array-buffer-view-serialization.html:
* LayoutTests/workers/sab/postMessage-clones-growable.html:
* LayoutTests/workers/worker-set-delete-terminate-crash.html:
* LayoutTests/workers/worker-terminate-crash.html:
* Source/JavaScriptCore/jsc.cpp:
(CommandLine::parseArguments):
* Source/JavaScriptCore/runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::init):
(JSC::JSGlobalObject::exposeSharedArrayBuffer):
* Source/JavaScriptCore/runtime/Options.cpp:
(JSC::disableAllSignalHandlerBasedOptions):
* Source/JavaScriptCore/runtime/OptionsList.h:
* Source/JavaScriptCore/wasm/js/WebAssemblyMemoryConstructor.cpp:
(JSC::WebAssemblyMemoryConstructor::createMemoryFromDescriptor):
* Source/WebCore/bindings/js/SerializedScriptValue.cpp:
(WebCore::CloneSerializer::allowsSharedMemorySerialization):
* Tools/Scripts/test262/README.md:
* Tools/Scripts/test262/runner_unittest.py:
(TestGetFeatureFlags.test_basic_feature_flag):
(TestGetFeatureFlags.test_multiple_features):
(TestGetFeatureFlags.test_unmapped_feature):
(TestGetFeatureFlags.test_no_features):
(TestGetFeatureFlags.test_can_block_with_features):
(TestRunJsc.test_feature_flags_in_command):

Canonical link: https://commits.webkit.org/325936@main
https://bugs.webkit.org/show_bug.cgi?id=323098
rdar://182227183

Reviewed by David Kilzer.

convert<IDLSequence> is using Array.prototype[Symbol.iterator], which the page script can override.
Instead of using convert<IDLSequence> in InternalReadableStream::tee, we directly look at indexed properties, so it cannot be intercepted.
For good measure, we validate that both objects are internal readable streams.
We also apply the same approach for createInternalTransformStream, via the addition of the helper routine getInternalBuiltinResultObjects.

The patch is changing behavior for LayoutTests/streams/transform-stream-poisoned-iterator-crash.html.
The subtests no longer crash as Array.prototype[Symbol.iterator] is not used.
We copy the test to sar3/streams/transform-stream-poisoned-iterator-crash.html and update it there with the new behavior.
The original test is marked as failing in LayoutTests/sar3/TestExpectations.

Test: sar3/streams/readable-stream-tee-poisoned-iterator-crash.html
      sar3/streams/transform-stream-poisoned-iterator-crash.html.

* Source/WebCore/Modules/streams/TransformStream.cpp:
(WebCore::createInternalTransformStream):
* Source/WebCore/bindings/js/InternalReadableStream.cpp:
(WebCore::isInternalReadableStream):
(WebCore::InternalReadableStream::fromObject):
(WebCore::InternalReadableStream::tee):
* Source/WebCore/bindings/js/JSDOMBindingFacade.cpp:
(WebCore::getInternalBuiltinResultObjects):
(WebCore::arrayFromValue):
(WebCore::objectFromArrayAt):
* Source/WebCore/bindings/js/JSDOMBindingFacade.h:
(WebCore::getInternalBuiltinResultObjects):
* LayoutTests/sar3/TestExpectations: Added.
* LayoutTests/sar3/streams/readable-stream-tee-poisoned-iterator-crash-expected.txt: Added.
* LayoutTests/sar3/streams/readable-stream-tee-poisoned-iterator-crash.html: Added.
* LayoutTests/sar3/streams/transform-stream-poisoned-iterator-crash-expected.txt: Added.
* LayoutTests/sar3/streams/transform-stream-poisoned-iterator-crash.html: Added.

Originally-landed-as: 316606.601@safari-7625-branch (0d73f0d). rdar://191051127
Canonical link: https://commits.webkit.org/325937@main
https://bugs.webkit.org/show_bug.cgi?id=136335
rdar://problem/35035119

Reviewed by Abrar Rahman Protyasha.

Currently we defer printing while the active DocumentLoader isLoading()
which can be true when we are waiting for subresources to load. This
seems to be at odds with other engines and the spec.

When the document is not "ready for post-load tasks," then the "print
when loaded," flag needs to be set which defers the print from
happening. Once the document has fired the load event it is then marked
as "ready for post-load tasks."

https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-print
https://html.spec.whatwg.org/multipage/parsing.html#the-end
https://html.spec.whatwg.org/multipage/parsing.html#ready-for-post-load-tasks

In this patch we make the changes to start matching other engines and
the spec in this regard. Once the load event has fired we will no longer
defer prints even if we are waiting for subresources.

Tests: http/tests/printing/print-after-document-open-with-pending-image.html
       http/tests/printing/print-after-load-with-loading-iframe.html
       http/tests/printing/print-after-load-with-pending-fetch.html
       http/tests/printing/print-before-load-prints-after-load-event.html
       http/tests/printing/print-from-load-handler-with-pending-fetch.html
       http/tests/printing/print-from-load-handler.html

* Source/WebCore/dom/Document.cpp:
(WebCore::Document::implicitClose):
Call into runPrintWhenLoadedSteps() which will run any print that was attempted
before the load event fired.

* Source/WebCore/page/LocalDOMWindow.cpp:
(WebCore::LocalDOMWindow::print):
Only defer the print if we are still processing the load event or if it
has not finished and we are still loading.

Canonical link: https://commits.webkit.org/325938@main
https://bugs.webkit.org/show_bug.cgi?id=330407
rdar://192009420

Unreviewed test gardening

* LayoutTests/platform/mac-wk2/TestExpectations:

Canonical link: https://commits.webkit.org/325939@main
https://bugs.webkit.org/show_bug.cgi?id=330441
rdar://192057057

Reviewed by Alan Baradlay.

Add a short AGENTS file for rendering, following the style and css ones.
It covers how rendering consumes style and how the render tree is built
and updated. Layout, painting and hit testing are left for later.

* Source/WebCore/rendering/AGENTS.md: Added.
* Source/WebCore/rendering/CLAUDE.md: Added.
* Source/WebCore/style/AGENTS.md:

Only box-dependent used values are banned from ComputedStyle. Many style
level used* accessors remain.

Canonical link: https://commits.webkit.org/325940@main
https://bugs.webkit.org/show_bug.cgi?id=326753
rdar://189460513

Reviewed by Sam Sneddon.

Only cache commits from production branches on canonical remotes, since those branches never move
backwards, tracking each remote's copy of a branch separately and computing identifiers on demand.

* Tools/Scripts/libraries/webkitscmpy/webkitscmpy/local/git.py:
(Git.Cache): Cache keys are full remote refs.
(Git.Cache.load): Only read cached lists, discarding branches which aren't from canonical remotes.
(Git.Cache.is_cacheable): Only the default branch and production branches are cached.
(Git.Cache._remotes_for): The default branch is only tracked on the default remote.
(Git.Cache._key): Construct a cache key from a remote and branch.
(Git.Cache._parse_key): Extract the remote and branch from a cache key.
(Git.Cache._keys_for): Cache keys for a branch, ordered by remote security level.
(Git.Cache._save): Shared logic for atomically writing the cache to disk.
(Git.Cache._reset): Discard computed identifiers.
(Git.Cache._fill_branch): Compute identifiers for each copy of a branch.
(Git.Cache._branch_point): Determine a branch point from its position on the default branch, only identifiers on the default branch are branch points.
(Git.Cache._identifier_for):
(Git.Cache._search): Compute identifiers one branch at a time until a commit is found.
(Git.Cache._fill): Compute identifiers for a single remote's copy of a branch.
(Git.Cache.populate): Update every canonical copy of a branch, populating the default branch for branches we don't cache.
(Git.Cache._history_through): Find history shared with another copy of a branch.
(Git.Cache._populate): Walk a remote branch, skipping the walk if another copy already contains the tip. Fail if a branch intersects with itself without shared history. Never abbreviate commit hashes.
(Git.Cache._populate._append): Match branch names exactly.
(Git.Cache._lookup): Find an identifier on any copy of a branch.
(Git.Cache.to_hash): Use _lookup.
(Git.Cache.to_revision): Ditto.
(Git.Cache.to_identifier): Use _search.
(Git): Define the default remote before constructing the cache.
(Git.default_branch): Fall back to 'main' instead of None.
(Git.commit): Never abbreviate commit hashes.
(Git.commits): Ditto.
(Git.find): The default branch can no longer be None.
(Git.rebase): Local branches are no longer cached.
(Git.pull): Ditto.
(Git.remote_for):
(Git.Cache.populate._append): Deleted.
(Git.Cache.clear): Deleted.
* Tools/Scripts/libraries/webkitscmpy/webkitscmpy/mocks/local/git.py:
(resolve_all_commits): Handle remote refs moved by update-ref.
(rev_list.resolve): Resolve remote refs by the branch they name.
(rev_list): Use resolve.
* Tools/Scripts/libraries/webkitscmpy/webkitscmpy/scm_base.py:
(ScmBase.default_branch): The default branch can no longer be None.
(ScmBase.branch_priority): Sort key used to canonicalize commits.
(ScmBase.prioritize_branches): Use branch_priority.
(ScmBase.find): The default branch can no longer be None.
* Tools/Scripts/libraries/webkitscmpy/webkitscmpy/test/git_unittest.py:
(TestGit.test_log):
(test_remote_for_default_branch):
* Tools/Scripts/libraries/webkitscmpy/webkitscmpy/test/scm_unittest.py:
(TestScm.test_prod_branches):
(TestScm):
(TestScm._Repository):
(TestScm.test_branch_priority):
(TestScm.test_branch_priority_sorted):
(TestScm.test_prioritize_branches):
(TestScm.test_prioritize_branches_preferred):

Canonical link: https://commits.webkit.org/325941@main
…rker is terminated during a Timeline recording

rdar://192009454
https://bugs.webkit.org/show_bug.cgi?id=330406

Reviewed by BJ Burg, Sihui Liu, and Zak Ridouh.

When Web Inspector records with samples, the SamplingProfiler references
the inspector controller's execution Stopwatch, and the sampling
profiler thread references the SamplingProfiler. A Worker's VM is
destroyed before its WorkerInspectorController, so the sampling thread
can run ~SamplingProfiler and release the Stopwatch while the Worker
thread still references it, racing on a non-thread-safe reference count.

SamplingProfiler is ThreadSafeRefCounted and can be destroyed on any
thread, so the Stopwatch it references needs a thread-safe reference
count too. Its destructor only frees a Vector, so it is safe on any
thread.

No new tests. inspector/timeline/timeline-recording-multiple-targets.html
(webkit.org/b/329182) crashes intermittently on the GTK and WPE bots
without this change.

* Source/WTF/wtf/Stopwatch.h:

Canonical link: https://commits.webkit.org/325942@main
rdar://192031617
https://bugs.webkit.org/show_bug.cgi?id=330425

Reviewed by Anne van Kesteren.

DocumentPictureInPicture now has an unfortunate namespace collision
with the WICG spec of the same name. Make things less confusing by
renaming it to emphasize that class is _not_ implementing the
Document Picture-in-Picture spec.

* Source/WebCore/Modules/pictureinpicture/Document+PictureInPicture.idl:
* Source/WebCore/Modules/pictureinpicture/VideoPictureInPicture.cpp: Renamed from Source/WebCore/Modules/pictureinpicture/DocumentPictureInPicture.cpp.
(WebCore::VideoPictureInPicture::pictureInPictureEnabled):
(WebCore::VideoPictureInPicture::exitPictureInPicture):
(WebCore::VideoPictureInPicture::from):
* Source/WebCore/Modules/pictureinpicture/VideoPictureInPicture.h: Renamed from Source/WebCore/Modules/pictureinpicture/DocumentPictureInPicture.h.
(WebCore::VideoPictureInPicture::supplementName):
(isType):
* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/platform/Supplementable.h:
(WebCore::SupplementBase::isVideoPictureInPicture const):
(WebCore::SupplementBase::isDocumentPictureInPicture const): Deleted.

Canonical link: https://commits.webkit.org/325943@main
https://bugs.webkit.org/show_bug.cgi?id=330201
rdar://191849052

Reviewed by Alexey Proskuryakov.

Pass run-webdriver-tests the builder details and --report, as RunAPITests does, so that the GTK, WPE and Mac WebDriver
testers report their results. This needs the upload support in run-webdriver-tests from bug 330148. A failed upload
shows as "results upload failed" in the step summary, as it does for RunWebKitTests, so that a results server outage
doesn't look like a regression.

* Tools/CISupport/build-webkit-org/steps.py:
(RunWebDriverTests.__init__): Don't log the environment, which now has the results server's API key.
(RunWebDriverTests.run):
(RunWebDriverTests.getResultSummary):
* Tools/CISupport/build-webkit-org/steps_unittest.py:
(TestRunWebDriverTests):

Canonical link: https://commits.webkit.org/325944@main
…os (e.g. initializeCommonAtomStrings)

https://bugs.webkit.org/show_bug.cgi?id=325117

Reviewed by Michael Catanzaro.

When running downstream applications or unit tests using WebKitGTK under
LeakSanitizer (-Db_sanitize=leak or ASAN_OPTIONS=detect_leaks=1), LSan
reports false-positive memory leaks for intentional, process-lifetime
global allocations created during WebCore initialization (such as common
atom strings initialized during initializeCommonAtomStrings).

This patch introduces LeakSanitizer support macros and helper utilities
to suppress leak reports across intentional one-time initialization:

- Define LSAN_ENABLED and SUPPRESS_LSAN in wtf/Compiler.h.
- Add wtf/ScopedLeakSanitizerDisabler.h defining weak symbol references to
  LeakSanitizer entry points (__lsan_disable, __lsan_enable) and an RAII
  ScopedLeakSanitizerDisabler helper to disable leak detection within a
  scope without imposing a hard dependency on the sanitizer runtime.
- Annotate initializeCommonAtomStrings() with ScopedLeakSanitizerDisabler.

No new tests, as this only adds sanitizer annotations for intentional allocations.

* Source/WTF/WTF.xcodeproj/project.pbxproj:
* Source/WTF/wtf/CMakeLists.txt:
* Source/WTF/wtf/Compiler.h:
* Source/WTF/wtf/ScopedLeakSanitizerDisabler.h: Added.
(WTF::ScopedLeakSanitizerDisabler::ScopedLeakSanitizerDisabler):
(WTF::ScopedLeakSanitizerDisabler::~ScopedLeakSanitizerDisabler):
* Source/WebCore/platform/CommonAtomStrings.cpp:
(WebCore::initializeCommonAtomStrings):

Canonical link: https://commits.webkit.org/325945@main
https://bugs.webkit.org/show_bug.cgi?id=330360
rdar://191972461

Reviewed by Alan Baradlay.

RenderCombineText existed for legacy line layout: it fitted text-combine-upright
text into 1em and replaced its rendered text with U+FFFC so legacy line layout
could measure and paint it as a single replaced-like character. Because inline
layout already operates on the real text and the box's combined state, the
U+FFFC substitution only leaked into innerText, copy, and accessibility, while
requiring a dedicated RenderText subclass that had to be recreated whenever
text-combine-upright changed.

Remove RenderCombineText and handle text-combine-upright directly on RenderText
and Layout::InlineTextBox:
- BoxTreeUpdater computes the fitted horizontal font and glyph bounds
  (InlineTextBox::CombinedText, stored in a side table for combined boxes) when
  text content or text-combine-upright, writing-mode, or font changes.
- Combined text retains its real text in both RenderText and
  InlineDisplay::Box::Text, and TextBoxPainter and InlineIterator::TextBox read
  the fitted font and bounds from InlineTextBox::combinedText().
- Because combined text forms a single InlineTextItem, transitioning between
  combined and uncombined states via style or text changes invalidates line
  layout.
- Toggling text-combine-upright on text or ::marker updates in place instead of
  recreating renderers.

Render tree and text dumps now output RenderText and the actual combined text
instead of RenderCombineText and U+FFFC. Rendering is unchanged.

Generated content and first-letter text with text-combine-upright now combine
too. Before, only DOM text and list markers did.

Test: imported/w3c/web-platform-tests/css/css-writing-modes/text-combine-upright-generated-content-001.html

* LayoutTests/fast/text/international/dynamic-text-combine-crash-expected.txt:
* LayoutTests/fast/text/tatechuyoko-expected.txt:
* LayoutTests/fast/text/text-combine-crash-expected.txt:
* LayoutTests/fast/text/text-combine-surroundContents-crash-expected.txt:
* LayoutTests/fast/text/textCombine-update-embeddedObj-assert-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/reference/text-combine-upright-generated-content-001-ref.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/text-combine-upright-generated-content-001-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/text-combine-upright-generated-content-001.html: Added.
* LayoutTests/platform/glib/fast/dynamic/text-combine-expected.txt:
* LayoutTests/platform/glib/fast/text/decorations-with-text-combine-expected.txt:
* LayoutTests/platform/glib/fast/text/emphasis-combined-text-expected.txt:
* LayoutTests/platform/glib/fast/text/international/text-combine-image-test-expected.txt:
* LayoutTests/platform/glib/fast/text/tatechuyoko-expected.txt:
* LayoutTests/platform/glib/fast/text/text-combine-different-fonts-expected.txt:
* LayoutTests/platform/glib/fast/text/text-combine-shrink-on-color-change-expected.txt:
* LayoutTests/platform/ios/fast/dynamic/text-combine-expected.txt:
* LayoutTests/platform/ios/fast/text/decorations-with-text-combine-expected.txt:
* LayoutTests/platform/ios/fast/text/emphasis-combined-text-expected.txt:
* LayoutTests/platform/ios/fast/text/international/text-combine-image-test-expected.txt:
* LayoutTests/platform/ios/fast/text/text-combine-different-fonts-expected.txt:
* LayoutTests/platform/ios/fast/text/text-combine-shrink-on-color-change-expected.txt:
* LayoutTests/platform/mac/fast/dynamic/text-combine-expected.txt:
* LayoutTests/platform/mac/fast/text/decorations-with-text-combine-expected.txt:
* LayoutTests/platform/mac/fast/text/emphasis-combined-text-expected.txt:
* LayoutTests/platform/mac/fast/text/international/text-combine-image-test-expected.txt:
* LayoutTests/platform/mac/fast/text/text-combine-different-fonts-expected.txt:
* LayoutTests/platform/mac/fast/text/text-combine-shrink-on-color-change-expected.txt:
* LayoutTests/platform/win/fast/dynamic/text-combine-expected.txt:
* LayoutTests/platform/win/fast/text/decorations-with-text-combine-expected.txt:
* LayoutTests/platform/win/fast/text/emphasis-combined-text-expected.txt:
* LayoutTests/platform/win/fast/text/international/text-combine-image-test-expected.txt:
* LayoutTests/platform/win/fast/text/text-combine-different-fonts-expected.txt:
* LayoutTests/platform/win/fast/text/text-combine-shrink-on-color-change-expected.txt:
* Source/WebCore/SaferCPPExpectations/UncheckedCallArgsCheckerExpectations:
* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/dom/Text.cpp:
(WebCore::Text::createTextRenderer):
* Source/WebCore/dom/Text.h:
* Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayContentBuilder.cpp:
(WebCore::Layout::InlineDisplayContentBuilder::appendTextDisplayBox):
* Source/WebCore/layout/integration/LayoutIntegrationBoxTreeUpdater.cpp:
(WebCore::LayoutIntegration::computeCombinedText): Moved from RenderCombineText::combineTextIfNeeded.
(WebCore::LayoutIntegration::BoxTreeUpdater::updateCombinedText):
(WebCore::LayoutIntegration::BoxTreeUpdater::updateContent):
* Source/WebCore/layout/integration/LayoutIntegrationBoxTreeUpdater.h:
* Source/WebCore/layout/integration/inline/InlineIteratorTextBox.cpp:
(WebCore::InlineIterator::TextBox::fontCascade const):
* Source/WebCore/layout/integration/inline/InlineIteratorTextBox.h:
(WebCore::InlineIterator::TextBox::selectableRange const):
* Source/WebCore/layout/integration/inline/LayoutIntegrationLineLayout.cpp:
(WebCore::LayoutIntegration::LineLayout::updateTextContent):
* Source/WebCore/layout/layouttree/LayoutInlineTextBox.cpp:
(WebCore::Layout::combinedTextMap):
(WebCore::Layout::InlineTextBox::~InlineTextBox):
(WebCore::Layout::InlineTextBox::combinedText const):
(WebCore::Layout::InlineTextBox::setCombinedText):
* Source/WebCore/layout/layouttree/LayoutInlineTextBox.h:
(WebCore::Layout::InlineTextBox::setIsCombined): Deleted.
* Source/WebCore/rendering/RenderBlock.cpp:
* Source/WebCore/rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::markInlineContentDirtyForLayout):
* Source/WebCore/rendering/RenderCombineText.cpp: Removed.
* Source/WebCore/rendering/RenderCombineText.h: Removed.
* Source/WebCore/rendering/RenderObject.h:
(WebCore::RenderObject::isRenderCombineText const): Deleted.
* Source/WebCore/rendering/RenderText.cpp:
(WebCore::RenderText::styleDidChange):
(WebCore::combineTextWidth):
* Source/WebCore/rendering/RenderText.h:
* Source/WebCore/rendering/TextBoxPainter.cpp:
(WebCore::TextBoxPainter::TextBoxPainter):
(WebCore::TextBoxPainter::paintForegroundForMarkedText):
(WebCore::TextBoxPainter::fontCascade const):
(WebCore::TextBoxPainter::textOriginFromPaintRect const):
* Source/WebCore/rendering/TextBoxPainter.h:
* Source/WebCore/rendering/TextPainter.cpp:
(WebCore::TextPainter::TextPainter):
(WebCore::TextPainter::paintTextWithShadows):
(WebCore::TextPainter::paintTextAndEmphasisMarksIfNeeded):
* Source/WebCore/rendering/TextPainter.h:
* Source/WebCore/rendering/updating/RenderTreeUpdater.cpp:
(WebCore::RenderTreeUpdater::createTextRenderer):
* Source/WebCore/rendering/updating/RenderTreeBuilderList.cpp:
(WebCore::RenderTreeBuilder::List::updateItemMarker):
(WebCore::createMarkerTextRenderer):
* Source/WebCore/rendering/updating/RenderTreeUpdaterGeneratedContent.cpp:
(WebCore::createContentRenderer):
* Source/WebCore/style/StyleChange.cpp:
(WebCore::Style::determineChanges):

Canonical link: https://commits.webkit.org/325946@main
…nting

rdar://192077525
https://bugs.webkit.org/show_bug.cgi?id=330467

Reviewed by Jonathan Bedard.

325907@main broke the watchOS device build. PrintPageInfo::count is a size_t, which is 32-bit on
arm64_32.

Cast the page count to size_t.

* Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::computePageInfoForPrintingiOS):

Canonical link: https://commits.webkit.org/325947@main
…saging.

https://webkit.org/b/330104
rdar://problem/191800053

Reviewed by Brian Weinstein.

runtime.sendMessage(), tabs.sendMessage() and Port.postMessage() always serialized messages as
JSON, so an ArrayBuffer, Map, Date or Blob arrived as an empty object or a string. Extensions that
move binary data had to encode it as base64 and split it into chunks.

The manifest key opt-in follows w3c/webextensions#931.

Add the "message_serialization" manifest key. With "structured_clone" the sender serializes with
SerializedScriptValue instead of JSON. Messages and replies now travel as a WebExtensionMessage,
which holds either a JSON string or a SerializedScriptValue, and a receiver accepts both, so each
sender only needs its own manifest. Web page messages, replies to web pages, native messaging and
ports that target a native app or a web page stay JSON, since the other end has no manifest to
opt in with. A reply is now a std::optional, so a missing reply and an empty reply no longer share
a null string. An invalid value records an InvalidManifestEntry error and falls back to JSON.
sendMessage() and tabs.sendMessage() keep the message until the reply arrives, so a Blob it
references stays alive while the receiver reads it.

Chromium opts in with the same manifest key and Firefox always uses structured clone.

* Source/WebKit/Shared/Extensions/WebExtensionContextParameters.h:
* Source/WebKit/Shared/Extensions/WebExtensionContextParameters.serialization.in:
Add usesStructuredCloneMessageSerialization.
* Source/WebKit/Shared/Extensions/WebExtensionMessage.h: Added.
(WebKit::WebExtensionMessage::json const):
(WebKit::WebExtensionMessage::structuredClone const):
(WebKit::WebExtensionMessage::length const):
* Source/WebKit/Shared/Extensions/WebExtensionMessage.serialization.in: Added.
* Source/WebKit/UIProcess/Extensions/Cocoa/API/WebExtensionContextAPIPortCocoa.mm:
(WebKit::WebExtensionContext::portPostMessage): Take a WebExtensionMessage.
(WebKit::WebExtensionContext::firePortMessageEventsIfNeeded): Ditto. Only deliver JSON to a
native port.
(WebKit::WebExtensionContext::sendQueuedNativePortMessagesIfNeeded): Skip structured clones.
* Source/WebKit/UIProcess/Extensions/Cocoa/API/WebExtensionContextAPIRuntimeCocoa.mm:
(WebKit::WebExtensionContext::runtimeSendMessage): Take and reply with a WebExtensionMessage.
(WebKit::WebExtensionContext::runtimeWebPageSendMessage): Wrap the page's JSON and reply with JSON
only.
* Source/WebKit/UIProcess/Extensions/Cocoa/API/WebExtensionContextAPITabsCocoa.mm:
(WebKit::WebExtensionContext::tabsSendMessage): Take and reply with a WebExtensionMessage.
* Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionMessagePortCocoa.mm:
(WebKit::WebExtensionMessagePort::sendMessage): Wrap the JSON in a WebExtensionMessage.
* Source/WebKit/UIProcess/Extensions/WebExtension.cpp:
(WebKit::WebExtension::createError): Add a description for InvalidMessageSerialization.
(WebKit::WebExtension::errors): Populate the message serialization.
(WebKit::WebExtension::usesStructuredCloneMessageSerialization): Added.
(WebKit::WebExtension::populateMessageSerializationIfNeeded): Added.
* Source/WebKit/UIProcess/Extensions/WebExtension.h:
* Source/WebKit/UIProcess/Extensions/WebExtensionContext.cpp:
(WebKit::WebExtensionContext::parameters const): Pass usesStructuredCloneMessageSerialization.
* Source/WebKit/UIProcess/Extensions/WebExtensionContext.h:
* Source/WebKit/UIProcess/Extensions/WebExtensionContext.messages.in:
* Source/WebKit/WebKit.xcodeproj/project.pbxproj:
* Source/WebKit/CMakeLists.txt:
* Source/WebKit/DerivedSources.make:
* Source/WebKit/DerivedSources-input.xcfilelist:
Add the WebExtensionMessage files and use it in the message definitions.
* Source/WebCore/en.lproj/Localizable.strings: Add the InvalidMessageSerialization description.
* Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIPortCocoa.mm:
(WebKit::WebExtensionAPIPort::postMessage): Take a WebExtensionMessage.
(WebKit::WebExtensionAPIPort::fireMessageEventIfNeeded): Ditto.
(WebKit::WebExtensionContextProxy::dispatchPortMessageEvent): Ditto.
* Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIRuntimeCocoa.mm:
(WebKit::WebExtensionContextProxy::internalDispatchRuntimeMessageEvent): Take a
WebExtensionMessage and reply with an optional one.
(WebKit::WebExtensionContextProxy::dispatchRuntimeMessageEventOnceBackgroundServiceWorkerIsActive):
Ditto. Serialize replies with structured clone unless the sender is a web page.
* Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPITabsCocoa.mm:
(WebKit::WebExtensionAPITabs::sendMessage): Take a WebExtensionMessage and hold it until the
reply arrives.
* Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIObject.h:
(WebKit::WebExtensionAPIObject::usesStructuredCloneMessageSerialization const): Added.
* Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIPort.h:
(WebKit::WebExtensionAPIPort::usesStructuredCloneMessageSerialization const): Added. Keep JSON
for native and web page targets.
* Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIRuntime.cpp:
(WebKit::WebExtensionAPIRuntime::sendMessage): Take a WebExtensionMessage and hold it until the
reply arrives.
(WebKit::WebExtensionContextProxy::dispatchRuntimeMessageEvent): Ditto.
* Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIRuntime.h:
* Source/WebKit/WebProcess/Extensions/API/WebExtensionAPITabs.h:
* Source/WebKit/WebProcess/Extensions/WebExtensionContextProxy.h:
* Source/WebKit/WebProcess/Extensions/WebExtensionContextProxy.messages.in:
* Source/WebKit/WebProcess/Extensions/glib/WebExtensionContextProxyGLib.cpp:
Use WebExtensionMessage in the declarations.
* Source/WebKit/WebProcess/Extensions/WebExtensionContextProxy.cpp:
(WebKit::WebExtensionContextProxy::getOrCreate): Store usesStructuredCloneMessageSerialization.
* Source/WebKit/WebProcess/Extensions/Bindings/JSWebExtensionWrapper.cpp:
(WebKit::serializeMessage): Added.
(WebKit::WebExtensionMessage::toJSValue const): Added.
* Source/WebKit/WebProcess/Extensions/Bindings/JSWebExtensionWrapper.h:
* Source/WebKit/WebProcess/Extensions/Bindings/Scripts/CodeGeneratorExtensions.pm:
* Source/WebKit/WebProcess/Extensions/Bindings/Scripts/IDLAttributes.json:
Add the Message serialization for IDL arguments.
* Source/WebKit/WebProcess/Extensions/Interfaces/WebExtensionAPIPort.idl:
* Source/WebKit/WebProcess/Extensions/Interfaces/WebExtensionAPIRuntime.idl:
* Source/WebKit/WebProcess/Extensions/Interfaces/WebExtensionAPITabs.idl:
Use the Message serialization for message arguments.
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WKWebExtension.mm:
(TestWebKitAPI::TEST(WKWebExtension, MessageSerializationParsing)): Added.
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WKWebExtensionAPIRuntime.mm:
(TestWebKitAPI::structuredCloneContentScriptManifest): Added.
(TestWebKitAPI::TEST(WKWebExtensionAPIRuntime, SendMessageWithStructuredClone)): Added.
(TestWebKitAPI::TEST(WKWebExtensionAPIRuntime, SendMessageWithStructuredCloneBlob)): Added.
(TestWebKitAPI::TEST(WKWebExtensionAPIRuntime, SendMessageWithStructuredCloneNullReply)): Added.
(TestWebKitAPI::TEST(WKWebExtensionAPIRuntime, SendMessageWithoutStructuredCloneUsesJSON)): Added.
(TestWebKitAPI::TEST(WKWebExtensionAPIRuntime, SendMessageWithStructuredCloneRejectsUnclonableValue)):
Added.
(TestWebKitAPI::TEST(WKWebExtensionAPIRuntime, PortPostMessageWithStructuredClone)): Added.
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WKWebExtensionAPITabs.mm:
(TestWebKitAPI::TEST(WKWebExtensionAPITabs, SendMessageWithStructuredClone)): Added.

Canonical link: https://commits.webkit.org/325948@main
…d as the frame's initial about:blank

https://bugs.webkit.org/show_bug.cgi?id=327859
rdar://190248382

Reviewed by Sihui Liu.

With site isolation, when a parent navigates its cross-site iframe to about:blank, the
navigation continues in the parent's process. That frame starts out displaying its own
initial empty document, so DocumentLoader marks the about:blank it loads as the initial
about:blank, even though the iframe's browsing context had already loaded a cross-site
document.

Since the about:blank frame is treated as the initial about:blank, several code paths try
to replace the about:blank frame's history entry. This means that if a frame navigates
from about:blank to a different site, history.back() would not return the iframe to
about:blank (since the about:blank history entry was replaced).

The frame in the parent's process is a new LocalFrame, so FrameLoader::init() puts its
FrameLoaderStateMachine in DisplayingInitialEmptyDocument, as if its browsing context had just
been created. But a load that continues from another process navigates a browsing context that
already has a document in that other process, so the about:blank it loads is never the browsing
context's initial about:blank. DocumentLoader::maybeLoadEmpty now only marks an about:blank as
the initial about:blank when its load does not continue from another process. The state machine
itself already moves past the initial empty document when the about:blank commits, so this
classification is the only record that was wrong.

This also covers main frames. A popup that its opener navigates to about:blank continues its
load in the opener's process, and was likewise treated as showing its initial about:blank.

With 325382@main (webkit.org/b/318255), which restores the origin an about:blank inherited
on history traversals,
imported/w3c/web-platform-tests/content-security-policy/inheritance/history-iframe.sub.html
now passes with site isolation enabled.

The first layout test has its parent navigate a cross-site iframe to about:blank, so the
about:blank inherits the parent's origin, then navigates the iframe cross-site and goes
back only in the iframe. It checks that each navigation added a history entry, and that
the restored about:blank has the parent's origin again. The second layout test has an
opener navigate its cross-site popup to about:blank, and checks that the about:blank has a
Navigation API entry and that pushState() adds a history entry. Neither holds for an
initial about:blank, which has no Navigation API entries and whose pushState() replaces
the current entry. The API test checks that the iframe returns to the parent's process.

Tests: Tools/TestWebKitAPI/Tests/WebKit/WKWebView/SiteIsolation.mm
       http/tests/site-isolation/history/about-blank-iframe-history-back-preserves-inherited-origin.html
       http/tests/site-isolation/history/about-blank-popup-navigated-by-opener-is-not-initial-about-blank.html

* LayoutTests/http/tests/site-isolation/history/about-blank-iframe-history-back-preserves-inherited-origin-expected.txt: Added.
* LayoutTests/http/tests/site-isolation/history/about-blank-iframe-history-back-preserves-inherited-origin.html: Added.
* LayoutTests/http/tests/site-isolation/history/about-blank-popup-navigated-by-opener-is-not-initial-about-blank-expected.txt: Added.
* LayoutTests/http/tests/site-isolation/history/about-blank-popup-navigated-by-opener-is-not-initial-about-blank.html: Added.
* LayoutTests/platform/ios-site-isolation/TestExpectations:
* LayoutTests/platform/mac-site-isolation/TestExpectations:
* Source/WebCore/loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::maybeLoadEmpty):
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/SiteIsolation.mm:
(TestWebKitAPI::TEST(SiteIsolation, AboutBlankIframeHistoryBackReturnsToInitiatorProcess)):

Canonical link: https://commits.webkit.org/325949@main
…s already gone.

https://webkit.org/b/330379
rdar://problem/191940828

Reviewed by Brian Weinstein.

-[WKWebView callAsyncJavaScript:arguments:inFrame:inContentWorld:completionHandler:] converted every
argument before it looked at the target frame. A caller holding a handle to a removed frame paid for
the full conversion of its arguments and then received an invalid frame target error. Check that the
frame still exists first and fail with the same error without converting anything.

Test: Tools/TestWebKitAPI/Tests/WebKit/WKWebView/AsyncFunction.mm

* Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _evaluateJavaScript:asAsyncFunction:withSourceURL:withArguments:forceUserGesture:inFrame:inWorld:completionHandler:]):
Report WKErrorJavaScriptInvalidFrameTarget before converting the arguments when the frame is gone.
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/AsyncFunction.mm:
(TestWebKitAPI::TEST(AsyncFunction, RemovedFrameDoesNotExtractArguments)): Added.

Canonical link: https://commits.webkit.org/325950@main
…acter were as wide as a space

https://bugs.webkit.org/show_bug.cgi?id=330146

Reviewed by Vitor Roriz.

On Cocoa, text in a fixed pitch font is measured with FontCascade::widthForSimpleTextWithFixedPitch, which counts every
character as the primary font's space width. With text-orientation: upright, glyphs use their vertical advance (1em for
Courier and Menlo) while the space keeps its horizontal width (0.6em), so upright text was measured much narrower than it
is painted: line breaking let lines overflow and a block ellipsis was placed over the content.

Don't take the fixed pitch fast path for upright text.

vertical-monospace-text-measuring.html compares the measured width with and without the fast path (letter-spacing
turns it off) in each text orientation, also for the symbols that stay upright in mixed orientation.

Tests: fast/writing-mode/upright-monospace-text-measuring.html
       fast/writing-mode/vertical-monospace-text-measuring.html

* LayoutTests/fast/writing-mode/upright-monospace-text-measuring-expected.html: Added.
* LayoutTests/fast/writing-mode/upright-monospace-text-measuring.html: Added.
* LayoutTests/fast/writing-mode/vertical-monospace-text-measuring-expected.txt: Added.
* LayoutTests/fast/writing-mode/vertical-monospace-text-measuring.html: Added.
* Source/WebCore/platform/graphics/FontCascadeFonts.cpp:
(WebCore::FontCascadeFonts::determineCanTakeFixedPitchFastContentMeasuring):

Canonical link: https://commits.webkit.org/325951@main
… tests are failing

https://bugs.webkit.org/show_bug.cgi?id=330359
rdar://191971603

Reviewed by Ryosuke Niwa and Abrar Rahman Protyasha.

These tests check the selection right after doubleTapAtPoint() finishes. With site isolation,
the tap is routed through the main frame's process before it reaches the iframe's process,
so the tests checked the selection (and removed the editable) before the tap landed.
Verified that by waiting for the taps to reach the iframe's process, the tests both pass.

Wait for the next selectionChange event to check the selection.
* LayoutTests/fast/events/touch/ios/double-tap-on-editable-and-noneditable.html:

Wait for a range selection, then check that the selected word is the expected word "magna".
* LayoutTests/fast/events/touch/ios/double-tap-on-editable-content-for-selection-then-drag-left-to-change-selected-text.html:

Canonical link: https://commits.webkit.org/325952@main
https://bugs.webkit.org/show_bug.cgi?id=330396
rdar://192003747

Reviewed by Richard Robinson and Zak Ridouh.

Guarding the code based on compiler version to use unsafe correctly.

Test: Tools/TestWebKitAPI/Tests/WebKit/WebPage/WebPageTests.swift

* Source/WebCore/PAL/pal/crypto/WTFExtras.swift:
* Source/WebGPU/WebGPU/StdLibExtras.swift:
(MutableSpan.copyMemory(from:)):
* Source/WebKit/GPUProcess/graphics/Model/ModelBridge.swift:
* Source/WebKit/GPUProcess/graphics/Model/ModelUtils.swift:
(copyDataIntoBuffer(_:from:)):
* Source/WebKit/GPUProcess/graphics/Model/USDModel+Deformation.swift:
(MTLBuffer.copyMemory(from:byteOffset:)):
(writeData(into:from:)):
* Source/WebKit/GPUProcess/graphics/Model/USDModel.swift:
* Source/WebKit/UIProcess/StdlibExtras.swift:
* Tools/TestWebKitAPI/Helpers/cocoa/StdLibExtras.swift:
(WTF.description):
* Tools/TestWebKitAPI/Runner/GoogleTestsController.swift:
* Tools/TestWebKitAPI/Tests/WebKit/WebPage/WebPageTests.swift:
(WebPageTests.qualifiedServerTrust):

Canonical link: https://commits.webkit.org/325953@main
https://bugs.webkit.org/show_bug.cgi?id=330472
rdar://192082268

Test added to 325684@main incorrectly required WKA

Reverted change:

    [WebGPU] wrong result when a literal argument is folded into an inlined function (Metal compiler miscompile, FB25287999)
    https://bugs.webkit.org/show_bug.cgi?id=329094
    rdar://191220871
    325684@main (ffbc9e4)

Canonical link: https://commits.webkit.org/325954@main
https://bugs.webkit.org/show_bug.cgi?id=330439

Reviewed by Youenn Fablet.

Enable this test since it has been passing since 319006@main.

* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/SiteIsolation.mm:
(TestWebKitAPI::TEST(SiteIsolation, PlayAudioInMultipleFrames)):
(TestWebKitAPI::TEST(SiteIsolation, DISABLED_PlayAudioInMultipleFrames)): Deleted.

Canonical link: https://commits.webkit.org/325955@main
…d for the vertical block ellipsis

https://bugs.webkit.org/show_bug.cgi?id=330354

Reviewed by Alan Baradlay.

Add web-platform-tests, to be exported, for behavior covered so far only by WebKit-specific tests:
- text-overflow clips rather than ellipses the first character of a block ellipsis that starts the line (bug 329149).
- text-overflow truncates a block ellipsis in each bidi run, in either paragraph direction, like the same text as
  content.
- text-overflow measures a block ellipsis without the ::first-line style, which does not apply to it.
- text-overflow does not truncate a block ellipsis whose punctuation hangs.
- text-overflow hides whole grapheme clusters of a block ellipsis, also when it runs opposite to the line's
  direction (bug 329840).
- text-overflow hides whole grapheme clusters of content running opposite to the line's direction.
- A string block ellipsis is laid out and painted like the same text as content in vertical writing modes (bug 329596).

Remove the fast/inline tests that these replace.

* LayoutTests/fast/inline/line-clamp-block-ellipsis-vertical-expected.html: Removed.
* LayoutTests/fast/inline/line-clamp-block-ellipsis-vertical.html: Removed.
* LayoutTests/fast/inline/line-clamp-text-overflow-block-ellipsis-bidi-expected.html: Removed.
* LayoutTests/fast/inline/line-clamp-text-overflow-block-ellipsis-bidi.html: Removed.
* LayoutTests/fast/inline/line-clamp-text-overflow-block-ellipsis-first-character-expected.html: Removed.
* LayoutTests/fast/inline/line-clamp-text-overflow-block-ellipsis-first-character.html: Removed.
* LayoutTests/fast/inline/line-clamp-text-overflow-block-ellipsis-first-line-expected.html: Removed.
* LayoutTests/fast/inline/line-clamp-text-overflow-block-ellipsis-first-line.html: Removed.
* LayoutTests/fast/inline/line-clamp-text-overflow-block-ellipsis-hanging-punctuation-expected.html: Removed.
* LayoutTests/fast/inline/line-clamp-text-overflow-block-ellipsis-hanging-punctuation.html: Removed.
* LayoutTests/imported/w3c/web-platform-tests/css/css-overflow/line-clamp/block-ellipsis-vertical-001-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-overflow/line-clamp/block-ellipsis-vertical-001.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-overflow/line-clamp/line-clamp-with-text-overflow-bidi-001-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-overflow/line-clamp/line-clamp-with-text-overflow-bidi-001.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-overflow/line-clamp/line-clamp-with-text-overflow-first-character-001-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-overflow/line-clamp/line-clamp-with-text-overflow-first-character-001.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-overflow/line-clamp/line-clamp-with-text-overflow-first-line-001-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-overflow/line-clamp/line-clamp-with-text-overflow-first-line-001.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-overflow/line-clamp/line-clamp-with-text-overflow-grapheme-001-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-overflow/line-clamp/line-clamp-with-text-overflow-grapheme-001.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-overflow/line-clamp/line-clamp-with-text-overflow-hanging-punctuation-001-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-overflow/line-clamp/line-clamp-with-text-overflow-hanging-punctuation-001.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-overflow/line-clamp/reference/block-ellipsis-vertical-001-ref.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-overflow/line-clamp/reference/line-clamp-with-text-overflow-bidi-001-ref.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-overflow/line-clamp/reference/line-clamp-with-text-overflow-first-character-001-ref.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-overflow/line-clamp/reference/line-clamp-with-text-overflow-first-line-001-ref.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-overflow/line-clamp/reference/line-clamp-with-text-overflow-grapheme-001-ref.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-overflow/line-clamp/reference/line-clamp-with-text-overflow-hanging-punctuation-001-ref.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-overflow/reference/text-overflow-ellipsis-bidi-grapheme-001-ref.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-overflow/text-overflow-ellipsis-bidi-grapheme-001-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-overflow/text-overflow-ellipsis-bidi-grapheme-001.html: Added.

Canonical link: https://commits.webkit.org/325956@main
…final-url.html is a flaky failure

https://bugs.webkit.org/show_bug.cgi?id=330255

Reviewed by Zak Ridouh.

SessionHistoryTraversalQueue runs one history traversal at a time. It waits for the current
traversal's main-frame load to commit or fail before starting the next one.

If a traversal swaps processes and another navigation replaces it before its load starts,
ProvisionalPageProxy::cancel() returns without reporting anything. The queue keeps waiting,
and every later history traversal on the page is dropped.

This is why fast/history/site-isolation/history-back-initial-vs-final-url.html test times out.
The test which runs before it on CI bots, go-back-then-navigate-subframe.html,
leaves a history.back() running, and WebKitTestRunner's next load replaces it.

Fixed by telling the queue when cancel() drops a load that never started.

Test: Fixes fast/history/site-isolation/history-back-initial-vs-final-url.html
with site isolation enabled.

* Source/WebKit/UIProcess/ProvisionalPageProxy.cpp:
(WebKit::ProvisionalPageProxy::cancel):
    When a provisional load is cancelled before ever starting,
    remove the navigation from the traversal queue.

* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::provisionalLoadWasCancelledBeforeStarting):
    New helper to remove a navigation which never started from the
    history traversal queue.

Canonical link: https://commits.webkit.org/325957@main
…efault

https://bugs.webkit.org/show_bug.cgi?id=330448
rdar://192063190

Reviewed by Sihui Liu.

SiteIsolationGlobalDebuggerPauseEnabled made a paused frame hold the frames of its page in other
processes. That behavior is now always on for a page with site isolation, so the preference is
removed. The two gates that read it read SiteIsolationEnabled instead: DebuggerSuspensionController
reports a paused frame to the UI process, and WebPageProxy accepts the report, only for a page with
site isolation, as pages without it did before.

pause-holds-cross-process-frames-disabled.html tested the behavior with the preference off and is
removed. The other tests no longer set the preference in their headers.

break-on-exception-throw-in-promise.html loses its "Unhandled Promise Rejection" console messages
when the page is paused with site isolation on, which it did not with the preference off. It is
expected to fail in the site isolation configuration until that is understood.

No new tests (the tests that used the preference now run with the behavior always on).

* LayoutTests/http/tests/site-isolation/inspector/debugger/pause-holds-cross-process-frames-disabled-expected.txt: Deleted.
* LayoutTests/http/tests/site-isolation/inspector/debugger/pause-holds-cross-process-frames-disabled.html: Deleted.
* LayoutTests/http/tests/site-isolation/inspector/debugger/pause-holds-cross-process-frames-until-paused-frame-goes-away.html:
* LayoutTests/http/tests/site-isolation/inspector/debugger/pause-holds-cross-process-frames-while-another-frame-is-paused.html:
* LayoutTests/http/tests/site-isolation/inspector/debugger/pause-holds-cross-process-frames-while-stepping.html:
* LayoutTests/http/tests/site-isolation/inspector/debugger/pause-holds-cross-process-frames.html:
* LayoutTests/http/tests/site-isolation/inspector/debugger/pause-holds-late-joiner-new-process-frame.html:
* LayoutTests/http/tests/site-isolation/inspector/debugger/pause-holds-late-joiner-subframe-navigation.html:
* LayoutTests/http/tests/site-isolation/inspector/debugger/pause-holds-loading-frame-defers-lifecycle-events.html:
* LayoutTests/http/tests/site-isolation/inspector/debugger/pause-holds-pages-of-browsing-context-group.html:
* LayoutTests/http/tests/site-isolation/inspector/debugger/pause-holds-same-process-pages-of-session-processes.html:
* LayoutTests/http/tests/site-isolation/inspector/debugger/pause-session-cancels-armed-pause.html:
* LayoutTests/http/tests/site-isolation/inspector/debugger/pause-session-concurrent-stoppers.html:
* LayoutTests/http/tests/site-isolation/inspector/debugger/pause-session-continuation-delivers-events.html:
* LayoutTests/http/tests/site-isolation/inspector/debugger/pause-session-main-frame-navigation-cancelled-while-cross-site-frame-stopped.html:
* LayoutTests/http/tests/site-isolation/inspector/debugger/pause-session-main-frame-navigation-ignores-first-pause-until-commit.html:
* LayoutTests/http/tests/site-isolation/inspector/debugger/pause-session-main-frame-navigation-ignores-pauses-until-commit.html:
* LayoutTests/http/tests/site-isolation/inspector/debugger/pause-session-main-frame-navigation-replaced-while-cross-site-frame-stopped.html:
* LayoutTests/http/tests/site-isolation/inspector/debugger/pause-session-main-frame-navigation-resumes-when-it-starts.html:
* LayoutTests/http/tests/site-isolation/inspector/debugger/pause-session-main-frame-navigation-while-cross-site-frame-stopped.html:
* LayoutTests/http/tests/site-isolation/inspector/debugger/pause-session-main-frame-navigation-while-main-frame-stopped.html:
* LayoutTests/http/tests/site-isolation/inspector/debugger/pause-session-reports-session-changes.html:
* LayoutTests/platform/mac-site-isolation/TestExpectations:
* Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml:
* Source/WebCore/inspector/DebuggerSuspensionController.cpp:
(WebCore::DebuggerSuspensionController::frameDebuggerDidPause):
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::frameDidPauseForDebugger):

Canonical link: https://commits.webkit.org/325958@main
https://bugs.webkit.org/show_bug.cgi?id=330042
rdar://problem/191738535

Reviewed by Abrar Rahman Protyasha.

Add WebPhoneNumberPossessionCoordinator, the web content process's
PhoneNumberPossessionCoordinatorClient, which sends requests to
WebPhoneNumberPossessionCoordinatorProxy in the UI process.

The proxy checks each request again with the UI process's own view of the
frame, since a compromised web content process could skip WebCore's checks:
- the request passes validatePhoneNumberPossessionRequest(), as in WebCore
- the frame's document origin is secure and not opaque
- the page is visible and focused
- the frame has a transient activation that no earlier request used
- the RP ID is a registrable domain suffix of the frame's origin
  (Related origins are currently rejected, but will be supported in a
  future commit)

It then passes the request to PhoneNumberPossessionController.

The tests send the proxy's messages directly with the IPC testing API, as a
compromised web content process could, and cover each of its checks.

Tests: http/tests/ipc/cocoa/phone-number-possession/is-available-and-mock-checks.html
       http/tests/ipc/cocoa/phone-number-possession/request-activation-checks.html
       http/tests/ipc/cocoa/phone-number-possession/request-frame-and-origin-checks.html
       http/tests/ipc/cocoa/phone-number-possession/request-ip-address-origin.html
       http/tests/ipc/cocoa/phone-number-possession/request-message-checks.html
       http/tests/ipc/cocoa/phone-number-possession/request-rp-id-and-pending-checks.html

* LayoutTests/http/tests/ipc/cocoa/phone-number-possession/resources/phone-number-possession-ipc.js: Added.
(redirectToLocalhost):
(hasPhoneNumberPossessionIPC):
(async setUpPhoneNumberPossessionIPC):
(messageName):
(serializeArguments):
(sendWithReply):
(makeRequest):
    Helpers that send the proxy's messages and parse its replies.
* Source/WebCore/Modules/phonenumberpossession/PhoneNumberPossessionCoordinator.cpp:
(WebCore::PhoneNumberPossessionCoordinator::discoverFromExternalSource):
(WebCore::PhoneNumberPossessionCoordinator::isAvailable):
    Fill in the default RP ID, and lowercase the RP ID, before validating, so
    that both processes check the same form of it.
* Source/WebCore/Modules/phonenumberpossession/PhoneNumberPossessionCoordinatorClient.h:
    isAvailable() takes the frame, so the UI process can check it.
* Source/WebCore/Modules/phonenumberpossession/PhoneNumberPossessionRequest.cpp:
(WebCore::validatePhoneNumberPossessionRequest):
    Hold every rule WebCore applies to a request, since the UI process runs it
    too: the challenge is 1 to 1024 bytes, the RP ID isn't empty, the phone
    number suffix hint is digits, and the PNPI suffix hint is at most 32 bytes.
* Source/WebKit/UIProcess/PhoneNumberPossession/Cocoa/PhoneNumberPossessionController.swift:
    Expose the controller and each member the proxy calls with @_expose(Cxx),
    so that whole-module optimization doesn't remove the members.
* Source/WebKit/UIProcess/PhoneNumberPossession/Cocoa/WebPhoneNumberPossessionCoordinatorProxyCocoa.mm: Added.
(WebKit::WebPhoneNumberPossessionCoordinatorProxy::platformRequestPhoneNumberPossession):
(WebKit::createController):
(WebKit::WebPhoneNumberPossessionCoordinatorProxy::platformIsAvailable):
    Pass the request, the frame's origin and the page's window to
    PhoneNumberPossessionController, using the mock manager if a test set one.
* Source/WebKit/UIProcess/PhoneNumberPossession/WebPhoneNumberPossessionCoordinatorProxy.cpp: Added.
(WebKit::exceptionForError):
    A request the user cancels and one that fails reject with the same
    NotAllowedError, so that a page can't tell them apart.
(WebKit::WebPhoneNumberPossessionCoordinatorProxy::sharedPreferencesForWebProcess const):
    Check the preferences that enable the messages against the process that sent
    each one.
(WebKit::WebPhoneNumberPossessionCoordinatorProxy::frameForMessage const):
    The frame must be in this page and in the sending process. A frame that's
    gone or moved because of a navigation is rejected rather than treated as a
    bad message.
* Source/WebKit/UIProcess/PhoneNumberPossession/WebPhoneNumberPossessionCoordinatorProxy.messages.in: Added.
    SetMockConfiguration is test-only IPC, so only a web view that allows
    test-only IPC can make the proxy use the mock manager.
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didDestroyFrame):
(WebKit::WebPageProxy::didStartProvisionalLoadForFrameShared):
    Cancel a pending request when its frame navigates or is destroyed, or when
    the main frame navigates.

Canonical link: https://commits.webkit.org/325959@main
…ite iframe

https://bugs.webkit.org/show_bug.cgi?id=330327
rdar://191131417

Reviewed by Abrar Rahman Protyasha and Aditya Keerthi.

When extending a text selection with a touch gesture on macOS, the UI process sends
UpdateSelectionWithExtentPointAndBoundary to the process of the focused frame with the point in
the main frame's root view coordinates. WebPage::updateSelectionWithExtentPointAndBoundary
converts the point to the root view coordinates of the focused frame's local root with
mainFrameCoordinatesToRootView but only after passing the original point to the PDF plugin when
the focused frame is a PDF. When the PDF was in a cross-site iframe, the plugin interpreted the
point in the main frame's coordinates as if it were in the iframe's, so the selection was
extended to a point offset by the iframe's position.

Fix the bug by converting the point before passing it to the plugin. Do the same for the PDF
plugin in WebPage::updateSelectionWithTouches on iOS, which had the same problem although a PDF
in a subframe is shown as an image instead of in the plugin there.

Test: TestWebKitAPI.AppKitGesturesTests/SiteIsolation/draggingToExtendSelectionInPDFInIframeSelectsTextUnderPointer(crossSite:)

* Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
(WebKit::WebPage::updateSelectionWithExtentPointAndBoundary):
* Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::updateSelectionWithTouches):
* Tools/TestWebKitAPI/Tests/WebKit/WebPage/AppKit Gesture Tests/SiteIsolationAppKitGesturesTests.swift:
(AppKitGesturesTests.draggingToExtendSelectionInPDFInIframeSelectsTextUnderPointer(_:)):
(AppKitGesturesTests.copySelectedText):

Canonical link: https://commits.webkit.org/325960@main
…ng history entry and returns the wrong errors

https://bugs.webkit.org/show_bug.cgi?id=328189

Reviewed by Alexey Proskuryakov.

browsingContext.traverseHistory took the delta, added the back list count to it, and then passed
that absolute index to WebBackForwardList::itemAtDeltaFromCurrentIndex(), which expects a delta, so
every traversal but one landed on the wrong entry, and the entry was reported as missing with
"invalid argument" rather than the specified "no such history entry". It also accepted child
browsing contexts, which have no session history of their own to traverse, an empty or unknown
context was reported as "no such window" rather than "no such frame", and a non-integer or
unsafe-integer delta was truncated instead of rejected.

Resolve the context with extractBrowsingContextHandles() like the other browsingContext commands,
so an unknown context fails with "no such frame" and a child context with "invalid argument".
Declare delta as a number in the protocol and reject anything that is not a safe integer with
"invalid argument". Look the entry up by delta without the API's skipping of entries that script
added without a user gesture, as history.go() does, since the spec traverses the session history as
it is; a missing entry fails with the new NoSuchHistoryEntry error, which the BiDi processor maps to
"no such history entry". The command keeps waiting for the traversal's navigation, as Back and
Forward do.

* Source/WebKit/UIProcess/Automation/Automation.json:
* Source/WebKit/UIProcess/Automation/BidiBrowsingContextAgent.cpp:
(WebKit::BidiBrowsingContextAgent::traverseHistory): Validate the delta and the context.
* Source/WebKit/UIProcess/Automation/BidiBrowsingContextAgent.h:
* Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp:
(WebKit::WebAutomationSession::traverseHistoryInBrowsingContext): Look the entry up by delta.
* Source/WebKit/UIProcess/Automation/WebDriverBidiProcessor.cpp:
(WebKit::toBidiErrorCode):
* Source/WebKit/UIProcess/Automation/protocol/BidiBrowsingContext.json:
* WebDriverTests/TestExpectations.json: traverse_history/{context,delta,invalid}.py pass on GTK, except
delta.py test_history_push_state, which trips over script.callFunction JSON-parsing its string
arguments twice (bug 288058). The Mac and Mac Site Isolation TIMEOUT expectations are kept, since this
was not tested on Mac. The Selenium history tests move from the resolved bug to this one.

Canonical link: https://commits.webkit.org/325961@main
…king Safari's media controls

https://bugs.webkit.org/show_bug.cgi?id=330398
rdar://177395486

Reviewed by Brent Fulgham.

On yelp.com's video lightbox, a Share/Report bar spans the full width of the top of the video
and receives all pointer events there. Safari's native media controls put the Enter Full Screen
button in the top-left of the video, so it sits under the bar and clicks never reach it. Chrome
and Firefox put their controls at the bottom, so Yelp's layout doesn't hurt them.

This patch adds a Yelp quirk that injects a user style sheet. It sets pointer-events: none on
the bar and pointer-events: auto on the Share and Report buttons, so the buttons still work and
the rest of the bar lets events through to the video. The bar's class names seem generated and
unstable, so the rule matches on the buttons' aria-labels, like so:

    div:has(button[aria-label="Share"]):has(button[aria-label="Report"]):not(:has(video))

* LayoutTests/fast/quirks/active-quirks-by-domain-expected.txt:
* LayoutTests/fast/quirks/active-quirks-by-domain.html:
* LayoutTests/platform/glib/fast/quirks/active-quirks-by-domain-expected.txt:
* LayoutTests/platform/ios/fast/quirks/active-quirks-by-domain-expected.txt:
* LayoutTests/platform/ipad/fast/quirks/active-quirks-by-domain-expected.txt:
* LayoutTests/platform/mac-sequoia/fast/quirks/active-quirks-by-domain-expected.txt:
* LayoutTests/platform/mac-tahoe/fast/quirks/active-quirks-by-domain-expected.txt:
* Source/WebCore/page/QuirkTable.json:

Canonical link: https://commits.webkit.org/325962@main
… overwritten by other processes

https://bugs.webkit.org/show_bug.cgi?id=327637
rdar://problem/190086236

Reviewed by Ryosuke Niwa.

A web process sends an autocorrection context before it shows a JavaScript dialog, and the UI process cached it from
any process, so an alert() in the main frame replaced the focused iframe's context with an empty one. WebContent now
tags the context with the frame it is for, and the UI process only accepts a context tagged with the focused frame's
ID. The UI process also no longer waits on a process without a connection.

Test: Tools/TestWebKitAPI/Tests/WebKit/WKWebView/SiteIsolationAutocorrectionTests.swift
Canonical link: https://commits.webkit.org/325963@main
https://bugs.webkit.org/show_bug.cgi?id=330390
rdar://191996898

Reviewed by Keith Miller.

278477@main made Thread::mayBeGCThread() also return true on compilation
threads, marked "TODO: FIX THIS", with no explanation. Remove it.

* Source/WTF/wtf/Threading.cpp:
(WTF::Thread::mayBeGCThread):

Canonical link: https://commits.webkit.org/325964@main
Jarred-Sumner and others added 24 commits November 14, 2026 01:14
…apply() (oven-sh#1055)

The JavaScriptCore side of the next round of fixes of Bun's ahead-of-time compiler (`bun build
--compile --aot` and `bun test --aot`, both experimental). Bun's side is a pull request that pins
this one. This follows oven-sh#1047.

40 files, +733 -81, all in Source/JavaScriptCore/aot/.

Executables

- `list[key] = key` stored the number 1 in place of the string "1" where the compiler knew the key
  to be the text of an array index.

- A generator that only calculates with numbers could run for ever, where a step ends its turn with
  a test against the value that a variable had before the turn; a step whose frame some ways had
  not made read a register. A loop over a generator that is left early was walked in place although
  a built-in in it, such as `String.raw`, reads a property of a primitive through a getter of the
  program.

- A build stopped where a built-in is read behind `?.`, out of a closure, or out of a variable of
  the file that may be undefined, and a static of it is called; a program stopped where a
  function's prototype is an instance of another function whose field has the name of one of its
  methods. A built-in that a file stores in a variable is let go, as on main.

- A build stopped where a class inside a function that runs once fills a static field at its first
  read. A pattern that takes a pair apart throws where the step in front of it is done.

- A function that passes its arguments on with `f.apply(this, arguments)` inside another function
  lost methods of the object. A sum over a list with a hole gave a number for NaN. A loop that
  stored in front of a chain of list methods could run for ever.

- `Reflect.set()` of a property of an object that has lived a while answered false although the
  property was stored.

- A read of a name that a getter answers with a field kept its first answer across a store into
  that field, where the object has no layout that the compiler knows.

Test runs

- `import(path, options)` read its options twice under a pending mock; a package could not require
  a package whose mock awaits its original; graphs that are required during an import, data files
  that are required before they are imported, and barrels of mocked CommonJS files answer as in
  `bun test`.
…f checks (oven-sh#1059)

Eight fixes of Bun's ahead-of-time compiler (`bun build --compile --aot` and `bun test --aot`, both
experimental). Bun's side is a pull request that pins this one. This follows oven-sh#1055.

14 files, +204 -30, all in Source/JavaScriptCore/aot/.

- A CommonJS file that throws while import() calls of it are in flight runs again behind them, as Bun
  runs it: a compiled program threw the first run's error. The same where the file calls import() of
  itself and throws, and where several retries at once come behind a required ES module that failed.

- A name that two `export *` give, one of them through a CommonJS file that an earlier test file has
  loaded, is ambiguous in a test run. A compiled test run handed out one of the two.

- With --aot-harden=proof-checks a build stopped where a list has a getter that stores into a list and
  a read that the compiler remembers is made again to be checked, and where a pattern takes every name
  of an object away. A program stopped with a failed type check where closures hold a variable that a
  loop stores ahead of its reads.

- `for (const x of list) switch (x) { case "a": n += x.name; }` ended the build by a signal.

- What a mock of a file that runs from source replaces in compiled code can be read by the host that
  puts it back, such a mock reaches the names of a CommonJS file, and the mock is read, stored and put
  back on the load that the source file's names are bound to.

Known: where a CommonJS file behind such a mock is loaded a second time, the mock can reach the readers
of its first load, and a namespace that was imported from a compiled barrel reads the second load.
oven-sh#1050 is a draft of the same by the place that the mock wrote.
… frames of built-ins (oven-sh#1060)

Nine fixes of Bun's ahead-of-time compiler (`bun build --compile --aot` and `bun test --aot`, both
experimental). Bun's side is a pull request that pins this one. This follows oven-sh#1059.

34 files, +301 -71: 31 in Source/JavaScriptCore/aot/, and FunctionPrototype.cpp, JSFunction.cpp
and Options.cpp in Source/JavaScriptCore/runtime/.

- A generator that a call gives back was taken for the one that the call made: `walk(id(g))` and
  then `next(g)` gave a value where the generator has ended, also out of an object, a closure and
  `Reflect.apply()`. It came with oven-sh#1028.

- What a mock of a compiled file replaces is read without running code of the program, and the
  read has a throw scope of its own.

- Frames of built-in functions keep their names and files in an executable built with
  `--obfuscate` or with an external source map. What the program writes stays hidden.

- A fresh `Uint8Array` that a program makes and hands to a function whose parameter is a `Buffer`
  was read as a `Buffer`.

- A built-in function that is JavaScript of the engine throws a TypeError for a store of `bind`,
  `call` or `apply`, as native functions do; it was dropped without an error.

- `x instanceof f` for functions of `node:fs` that are bound asks the target, as plain Bun does.

- A helper's mock of a JSON file that the test file imports stopped the test run or made the
  import undefined.

- WebAssembly vectors are refused where the processor has no AVX, with and without the JIT. Plain
  Bun without the JIT crashed there.

- With `--aot-harden=proof-checks` the list of the cells that the checks poison takes less memory.

Known issues are those of oven-sh/bun#48815, oven-sh/bun#48926 and oven-sh#1059.
…s, lookups in loops (oven-sh#1061)

Fixes of Bun's ahead-of-time compiler (`bun build --compile --aot` and `bun test --aot`, both
experimental). Bun's side is oven-sh/bun#49004, which pins this one. This follows
oven-sh#1060. Most of the faults are main's.

129 files, +4,345 -234: 112 in Source/JavaScriptCore/aot/, 12 in Source/JavaScriptCore/runtime/ and
5 in Source/JavaScriptCore/llint/.

Executables that ended

- A function that is handed a Buffer by one call and a number, a string or nothing by another, and
  reads its elements in a loop.

- Bun's own modules that run from source beside a compiled program could not define
  `Symbol.hasInstance`. It came with oven-sh#1060, which Bun's main does not pin.

- Elements of a list that keeps integers and fractions by place, read together; a store under a
  joined name that finds a setter laid by a descriptor; a Uint8Array that a cast hands on where
  Buffer is written; an instance of a built-in class below an heir of another; a required graph
  whose file throws and is asked for again.

Wrong answers without a message

- `f.x` behind `o.x = v` in a small function that also stores on a frozen literal; a generator with
  a for-in loop that a loop steps by hand; the function that a literal holds under the name of one
  of its own methods; a parent of a class over Map that constructs through other code; the files
  behind one that throws in a required graph; a code file that is also loaded as text, JSON or a
  file, whose other half is Bun's; a CommonJS file behind a mock that is required again.

Builds that stopped

- Loops over records whose fields are lists, stores that only some ways of a loop make,
  `for (const x of t.matchAll(/./g)) s += x`, own fields over methods of their name, and sums of a
  list's length and first element under proof checks.

- What an entry exports reaches the parts of library classes that it holds.

Run-time code (`import()` of a file, `new Function`)

- for-in, for-of over Sets and iterators, symbols, dictionaries, Maps and Sets read, filled and
  deleted from, spreads, typed arrays, stores, proxies and conversions take the interpreter's road
  of compiled programs. Plain Bun does not run it.

Speed

- A loop that asks an unknown object under a key that each iteration brings, and a walk of a tree
  whose classes a helper lays: deeply nested HTML. Test runs ask a bit for what they asked a list.

- Order files, opt-in: a recorder writes what a start entered, and a build with the file lays that
  code, and what it uses, side by side.

If you don't use `--aot`

- No answer changes. oven-sh#1060 made each store to a function ask whether a built-in
  function refuses the name. One to a function of the program asks nothing now, and one to a
  built-in function asks one bit. Of 254 rows without compiled code and without the JIT, `new Set`
  of an array takes 0.41% more instructions on x64 and 0.21% on arm64, `defineProperty` 0.21%, a
  class made 0.41% (by the address of a name alone: shown) and an iterator of a class 0.16% (not
  shown) on arm64, an error with its stack 0.17% and `new Error().stack` 0.15% on x64. Other rows
  waver by up to 0.7% between links and are not told apart from noise beyond that.

Known issues are those of oven-sh/bun#48815, oven-sh/bun#48926, oven-sh/bun#48993 and
oven-sh#1060.
…ven-sh#1063)

Fixes of Bun's ahead-of-time compiler (`bun build --compile --aot` and `bun test --aot`, both
experimental). Bun's side is oven-sh/bun#49037, which pins this one. This follows
oven-sh#1061.

23 files, +327 -115: 20 in Source/JavaScriptCore/aot/ and 3 in Source/JavaScriptCore/runtime/.

Test runs

- Importers of a module that is mocked without a factory run in the order of the imports. They ran
  behind the files that their importer imports after it, which was a known issue of
  oven-sh/bun#49004.

- A method that is laid over one of require's reads the main module and its children.

Builds and executables

- A build of a program with catches into blocks that only jump could end by a signal, and a build
  of an ordinary class method could abort. Both build.

- A nest of loops that adds up elements by rows and columns could take positions from products
  that 64 bits don't hold. An index that the nest can't hold exactly isn't folded into it.

- `==` between a BigInt and an object that converts to undefined or null is right under a limit on
  virtual memory.

- `isFilled()` takes the object and the base of its slot.

Debug builds and tests

- In three places the iterator of a table that several threads ask ended behind the unlock. It
  ends in front of it.

- The cells of stub tests lie in memory of a cage, with empty bytes below them.

If you don't use `--aot`

- `new Set(list)` and `new Map(pairs)` don't ask whether the process has compiled code, and what
  defines a value that a prototype of a compiled program holds stands in a function of its own.
  They are a few instructions a call faster than oven-sh#1061 had them.
…maller fixes (oven-sh#1064)

Fixes of Bun's ahead-of-time compiler (`bun build --compile --aot` and `bun test --aot`, both
experimental). Bun's side is oven-sh/bun#49081, which pins this one. This follows
oven-sh#1063.

78 files, +1,926 -203: 75 in Source/JavaScriptCore/aot/ (+1,916 -200) and 3 outside it,
LLIntSlowPaths.cpp, JSModuleLoader.cpp and JSObjectElementsStartOffset.cpp.

Programs

- A generator that a loop left can be resumed by code that the compiler doesn't see, also inside
  an iteration over matches. The program ended with "generator check failed".
- A field that a row lacks is undefined in a sum with a field that isn't a number, where code runs
  between the two reads. It was NaN.
- An array that elements are added to at its start and removed from at its end has a capacity that
  is bounded as the room in front of its first element is. The work grew with the square of the
  number of them, and so did the memory.
- In a compiled program, code that is interpreted asks again for a property that is stored by name
  through a setter into an object that is also used as a table.
- `Object.isExtensible()` is true of what `require()` returned for an ES module that exports
  `__esModule` itself. A list of 2^28 characters is made. Positions that are integers of 53 bits
  are folded into nests of sums again.

Test runs

- While a `require()` loads an ES module, an ES file that is required meanwhile reads what a
  CommonJS file exports by then, and the files of such a load run in plain Bun's order.
- Mocks that end behind a reset and a `require()`, and over what an earlier test file loaded, give
  their values back. What is laid through a module of a CommonJS file under a mock reaches the
  file, and spies beside such modules are seen.
- Behind a reset, what a test file that has ended loaded is released, as in plain `bun test`. Test
  files that mock modules keep it, as before. `module.children` lists a file that threw behind a
  `require()` that it had answered.

Builds

- Builds of a loop that stores under what it reads out of a list, and of a function that returns
  early in front of its loop, could end by a signal or stop. Both build.
- An order file that was recorded in another folder is compared as that folder sees it, files that
  were moved or renamed are found by their functions, and an order file of another program is
  warned about.
- Under `--aot-harden=proof-checks` builds that stopped without a cause build, and more of what
  the compiler knows is compared with memory.

If you don't use `--aot`

- An array that elements are added to at its start has a smaller capacity where its end is
  emptied.
- The other two files ask one question more in a process that has compiled code, or of a compiled
  module. A plain program's reads, stores and loads don't change.
Compiled programs now work with ENABLE(RETURN_ADDRESS_SIGNING), and the
hardened arm64 lane that has the compiler is built with it.

- Functions and stubs sign the link register to save it and authenticate it
  as they load it. The saved word is the one LLInt and the JITs save.
- The address where a generator or an async function resumes is signed.
- The unwinder authenticates the addresses by which it looks for a handler.
- A check follows the linked code of an image and fails the build where a
  rule of aot/README.md, "Signed return addresses", is broken.
…runs, and smaller fixes (oven-sh#1067)

Fixes of Bun's ahead-of-time compiler (`bun build --compile --aot` and `bun test --aot`, both
experimental). Bun's side is oven-sh/bun#49108, which pins this one. This follows
oven-sh#1064.

31 files, +624 -106: 29 in Source/JavaScriptCore/aot/ (+606 -104) and 2 outside it, JSMicrotask.cpp
and CyclicModuleRecord.cpp.

Programs

- While a load goes on, an ES module that is required meanwhile reads what a CommonJS file exports
  by then, also where the loader has made the file's record and not stored it. Of graphs that are
  imported at once, a CommonJS file runs when its text comes.
- A file loaded from disk that imports a member which a built-in module makes when it is first
  read has the member made when its binding is made.
- A generator that a time limit ended counts as running. It answered `{ done: true }`.
- A symbol that a call may make in a loop is no name that the compiler knows. The process ended
  with a check of the compiler where it was laid on a prototype.
- A loop that moves the elements of a table which is its own row asks for the kinds of elements
  that its tests allow.
- A constructor function that gives another object in front of its own stores, as with
  `return new Other()`, ended the process with a check of the compiler. What it holds filled is
  asked where it gives the object that was made.

Test runs

- A CommonJS file is released at the end of a test file where no import of it is pending, so a mock
  of what it requires isn't seen by the next test file. Mocks of a file and of what it requires come
  back together. A file that is mocked by its original takes what it exports by then.
- `importActual()` of a file that two mocks of an earlier test file lay over settles. The modules
  of a `require()` that failed belong to the test file.
- A hook's uncalled mock, an unmock over a file of a preload, and a preload's mock by its original
  are told apart from the mocks of the next test file.

Builds

- Builds that stopped are built: `s += g[y * y + x] ?? 0` in a loop with a break, and on arm64 a
  loop that polls and hands over numbers in turns.
- The build of an edit distance whose rows are pushed, which stopped, is built. For an entry that
  exports what a file outside the build answers, what lies in each layout is visited once.
- The link goes on with the flow that it has run without direct evals, where it was run twice.
- Checks of the link, the machine code and the types are compiled for size.

If you don't use `--aot`

- The loader asks a module's class where its record is made and where it is stored
  (`JSMicrotask.cpp`). For each module that a plain program makes, runModuleRegistryFetchSettled()
  takes 60 instructions on x64 and 62 on arm64 (it took 50 and 53), and
  runModuleRegistryModuleSettled() 58 and 66 (48 and 49).
- What a binding of a compiled module is made of is recorded behind `hasCompiledCode()`
  (`CyclicModuleRecord.cpp`). A named import takes 61.2 instructions on x64 and 55.8 on arm64
  (it took 62.8 and 61.0); the rest of initializeEnvironment() is the same.

Known: the compiler's own check that its types have reached a fixed point fails on a few large
bundles, as on main. No wrong answer is known.
It took any register that is stored beside the frame pointer for a return
address, and refused valid programs at the `stp x28, x29` of a stub that
saves every register. It now looks at the word behind the frame pointer.

It also finds a link register that is saved or authenticated after its
signature was stripped, and hints for the other key or for no modifier.
The code that is generated does not change.
The check of linked code now runs for every image of an engine that signs,
not only where it is asked for.

- It goes through code that no known entry leads to, and refuses
  instructions that it does not know.
- It refuses the address of a label that goes to memory without a
  signature, and a jump to what came off the stack.
- What it says of a stub does not depend on the program that calls it.
- The word of a resume address and the code of a handler are out of reach
  of code that does not go through the functions that sign and
  authenticate, on every platform.
- A hardened build for arm64 Linux signs unless it is told not to, and does
  not compile without -mbranch-protection=pac-ret.
- The tests of a lane that signs fail on a runner without pointer
  authentication.
…ong views, and smaller fixes (oven-sh#1069)

Fixes of Bun's ahead-of-time compiler (`bun build --compile --aot` and `bun test --aot`, both
experimental). Bun's side is oven-sh/bun#49145, which pins this one. This follows
oven-sh#1067.

22 files, +213 -65: 14 in Source/JavaScriptCore/aot/ (+176 -30) and 8 outside it.

Programs

- A name that a program was found not to have on a short typed array (`4294967295`) was taken for
  one that a view of 4,294,967,296 elements doesn't have either. It is asked of the view.
- Code that is made at run time and stores to a constant of a script throws, as in plain Bun.
- `for..of` over an object whose `[Symbol.iterator]()` hands back an iterator of a collection that
  code has laid a `return()` or a `next()` on, kept or stepped, calls the iterator's own.

Test runs

- Code from source beside a preload's mock whose entry a reset has removed asks for the entry again.
- An import under another file's patch and a file that threw in an earlier test file are told apart
  from what they were taken for.
- A `require()` under a second patch that waits is told of.

Builds

- A build that stopped under `--aot-harden=proof-checks` is built: where the name that a check asks
  about is handed on at the head of a loop, at a join or at a call that was copied, and where
  something stands between a branch and what it narrowed. One that stopped under
  `--aot-check=VerifyEachStage` is built too.

If you don't use `--aot`

- The loader asks whether a process has compiled code in front of a module's class. A fresh module
  takes 17 instructions fewer of 145,683 on x64 and 55 of 142,515 on arm64, one that imports 44 and
  194 fewer. innerModuleLinking() and innerModuleEvaluation() take three to eleven more.
- A store of code made at run time into a global variable takes 66 instructions on x64, as before,
  and 63.5 on arm64 (it took 61.5).

Known: the compiler's own check that its types have reached a fixed point fails on a few large
bundles, as on main. No wrong answer is known.
Each generator of code signed the return address by hand, and a check of the
finished image failed the build where one forgot. Now the ARM64 assembler does
it at the one place where it emits an instruction: what leaves the link
register is signed, and what enters it is authenticated. An image takes code
from ImageAssembler alone, which cannot be told to stop. The check is gone.

- offlineasm keeps the same rules for all of LowLevelInterpreterAOT.asm.
- removeCodePtrTag() and StubWords::isReturnAddress() take a signature off.
- CMake adds -mbranch-protection=pac-ret where return addresses are signed.
The labels that note where an operation begins kept the load that follows an
authentication, so a build with a map had other code than one without. A note
now takes a place that pins nothing and makes its label when the code is
written.

- The load is left out only where the jump to the address comes next.
- A WebAssembly function returns without it too.
…mage

- offlineasm left an instruction alone that names no register but the link
  register unless it was one of four. It now has to be arithmetic.
- offlineasm no longer signs in front of a load through the link register,
  which would have made the load fault.
- WebAssembly code for an image asks for neither the map of origins nor the
  disassembler. Nothing read them, and their labels kept a load.

The interpreter that offlineasm generates is the same as before.
…ddresses

AOT: sign return addresses on arm64 Linux
The variant was built for amd64 alone.
…t-webassembly

Build lto-hardened-aot-no-webassembly for Linux arm64
Build the bit set in a local, call storeStoreFence(), then store the
pointer, as other lazily created members in JSC are stored.
[JSC] IsoCellSet::addSlow fences before storing a new bit set
The pointer to the known weights changes once the default collator is made,
but it lay in a part of the instance that a hardened build makes read-only.
It now has a writable part of its own.
Without one, a generator with a loop had no body to go on in after its
consumer's loop had left it, and the program ended with "generator check
failed".
…le-compare-and-loop-polls

AOT: fix localeCompare in hardened builds, and generators where loop polls do not fault
Merge oven-sh/WebKit at 0befb64 with both histories intact. Retain the fork namespace, async-context, callsite-position, worker-GC and buffer-accounting contracts across the upstream API changes.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.