Skip to content

Use XPCObjectPtr more for XPC objects - #54029

Merged
webkit-commit-queue merged 1 commit into
WebKit:mainfrom
cdumez:302620_use_XPCObjectPtr_more
Nov 18, 2025
Merged

webkit-commit-queue merged 1 commit into
WebKit:mainfrom
cdumez:302620_use_XPCObjectPtr_more

Conversation

@cdumez

@cdumez cdumez commented Nov 17, 2025 •

Copy link
Copy Markdown
Contributor

f896ca1

Use XPCObjectPtr more for XPC objects
https://bugs.webkit.org/show_bug.cgi?id=302620

Reviewed by Geoffrey Garen.

Unfortunately, we have to specify the template parameter explicitly for now
because some of our bots use an older version of LLVM which doesn't support
template deduction for templated aliases (XPCObjectPtr is a templated alias
for OSObjectPtr). See llvm/llvm-project#54051

* Source/JavaScriptCore/inspector/remote/cocoa/RemoteInspectorXPCConnection.mm:
(Inspector::RemoteInspectorXPCConnection::deserializeMessage):
* Source/WebKit/NetworkProcess/Authentication/cocoa/AuthenticationManagerCocoa.mm:
(WebKit::AuthenticationManager::initializeConnection):
* Source/WebKit/NetworkProcess/cocoa/LaunchServicesDatabaseObserver.mm:
(WebKit::LaunchServicesDatabaseObserver::initializeConnection):
* Source/WebKit/Shared/Cocoa/XPCEndpointClient.mm:
(WebKit::XPCEndpointClient::setEndpoint):
* Source/WebKit/Shared/EntryPointUtilities/Cocoa/Daemon/PCMDaemonEntryPoint.mm:
(WebKit::CompletionHandler<void):
* Source/WebKit/Shared/EntryPointUtilities/Cocoa/XPCService/XPCEndpointMessages.mm:
(WebKit::handleLaunchServiceDatabaseMessage):
* Source/WebKit/Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.mm:
(WebKit::XPCServiceInitializerDelegate::getExtraInitializationData):
* Source/WebKit/Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm:
(WebKit::XPCServiceEventHandler):
* Source/WebKit/UIProcess/Authentication/cocoa/AuthenticationChallengeProxyCocoa.mm:
(WebKit::AuthenticationChallengeProxy::sendClientCertificateCredentialOverXpc):
* Source/WebKit/UIProcess/Cocoa/AuxiliaryProcessProxyCocoa.mm:
(WebKit::AuxiliaryProcessProxy::platformStartConnectionTerminationWatchdog):
* Source/WebKit/UIProcess/Cocoa/PlaybackSessionManagerProxy.mm:
(WebKit::PlaybackSessionManagerProxy::setVideoReceiverEndpoint):
(WebKit::PlaybackSessionManagerProxy::swapVideoReceiverEndpoints):
* Source/WebKit/UIProcess/Launcher/cocoa/ProcessLauncherCocoa.mm:
(WebKit::ProcessLauncher::finishLaunchingProcess):
* Source/WebKit/UIProcess/Network/NetworkProcessProxyCocoa.mm:
(WebKit::NetworkProcessProxy::sendXPCEndpointToProcess):
* Source/WebKit/WebProcess/cocoa/LaunchServicesDatabaseManager.mm:
(WebKit::LaunchServicesDatabaseManager::handleEvent):

Canonical link: https://commits.webkit.org/303163@main

a9113b1

Misc iOS, visionOS, tvOS & watchOS macOS Linux Windows Apple Internal
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe   🛠 win ✅ 🛠 ios-apple
✅ 🛠 ios-sim ✅ 🛠 mac-AS-debug   🧪 wpe-wk2   🧪 win-tests ✅ 🛠 mac-apple
✅ 🧪 webkitperl   🧪 ios-wk2 ✅ 🧪 api-mac ✅ 🧪 api-wpe ✅ 🛠 vision-apple
  🧪 ios-wk2-wpt   🧪 api-mac-debug ✅ 🛠 wpe-cairo
✅ 🛠 🧪 jsc   🧪 api-ios ❌ 🧪 mac-wk1 ✅ 🛠 gtk
✅ 🛠 🧪 jsc-arm64 ✅ 🛠 vision ✅ 🧪 mac-wk2   🧪 gtk-wk2
✅ 🛠 vision-sim ✅ 🧪 mac-AS-debug-wk2 ✅ 🧪 api-gtk
✅ 🛠 🧪 merge ✅ 🧪 vision-wk2 ✅ 🧪 mac-wk2-stress ✅ 🛠 playstation
✅ 🛠 tv ✅ 🧪 mac-intel-wk2 ✅ 🛠 jsc-armv7
✅ 🛠 tv-sim ✅ 🛠 mac-safer-cpp ⏳ 🧪 jsc-armv7-tests
  🛠 watch
✅ 🛠 watch-sim

@cdumez cdumez self-assigned this Nov 17, 2025
@cdumez cdumez added the WebCore Misc. For miscellaneous bugs in the WebCore framework (and not JavaScriptCore or WebKit). label Nov 17, 2025
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Nov 17, 2025
@cdumez cdumez removed the merging-blocked Applied to prevent a change from being merged label Nov 17, 2025
@cdumez
cdumez force-pushed the 302620_use_XPCObjectPtr_more branch from 291e3c4 to 0ec4e39 Compare November 17, 2025 07:01
@cdumez
cdumez force-pushed the 302620_use_XPCObjectPtr_more branch from 0ec4e39 to da26319 Compare November 17, 2025 07:50
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Nov 17, 2025
@cdumez cdumez removed the merging-blocked Applied to prevent a change from being merged label Nov 17, 2025
@cdumez
cdumez force-pushed the 302620_use_XPCObjectPtr_more branch from da26319 to 379e646 Compare November 17, 2025 09:18
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Nov 17, 2025
@cdumez cdumez removed the merging-blocked Applied to prevent a change from being merged label Nov 17, 2025
@cdumez
cdumez force-pushed the 302620_use_XPCObjectPtr_more branch from 379e646 to e578cd6 Compare November 17, 2025 11:19
@cdumez
cdumez force-pushed the 302620_use_XPCObjectPtr_more branch from e578cd6 to b863ac8 Compare November 17, 2025 12:18
@cdumez
cdumez force-pushed the 302620_use_XPCObjectPtr_more branch from b863ac8 to fac767b Compare November 17, 2025 12:44
@cdumez
cdumez force-pushed the 302620_use_XPCObjectPtr_more branch from fac767b to 6f9ee14 Compare November 17, 2025 13:02
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Nov 17, 2025
@cdumez cdumez removed the merging-blocked Applied to prevent a change from being merged label Nov 17, 2025
@cdumez
cdumez force-pushed the 302620_use_XPCObjectPtr_more branch from 6f9ee14 to f3aa068 Compare November 17, 2025 22:19
@cdumez
cdumez force-pushed the 302620_use_XPCObjectPtr_more branch from f3aa068 to 713e966 Compare November 17, 2025 22:27
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Nov 17, 2025
@cdumez cdumez removed the merging-blocked Applied to prevent a change from being merged label Nov 18, 2025
@cdumez
cdumez force-pushed the 302620_use_XPCObjectPtr_more branch from 713e966 to bb1a48b Compare November 18, 2025 01:11
@cdumez
cdumez force-pushed the 302620_use_XPCObjectPtr_more branch from bb1a48b to a9113b1 Compare November 18, 2025 01:46
@cdumez
cdumez marked this pull request as ready for review November 18, 2025 02:40
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Nov 18, 2025
@cdumez cdumez added merge-queue Applied to send a pull request to merge-queue and removed merging-blocked Applied to prevent a change from being merged labels Nov 18, 2025
https://bugs.webkit.org/show_bug.cgi?id=302620

Reviewed by Geoffrey Garen.

Unfortunately, we have to specify the template parameter explicitly for now
because some of our bots use an older version of LLVM which doesn't support
template deduction for templated aliases (XPCObjectPtr is a templated alias
for OSObjectPtr). See llvm/llvm-project#54051

* Source/JavaScriptCore/inspector/remote/cocoa/RemoteInspectorXPCConnection.mm:
(Inspector::RemoteInspectorXPCConnection::deserializeMessage):
* Source/WebKit/NetworkProcess/Authentication/cocoa/AuthenticationManagerCocoa.mm:
(WebKit::AuthenticationManager::initializeConnection):
* Source/WebKit/NetworkProcess/cocoa/LaunchServicesDatabaseObserver.mm:
(WebKit::LaunchServicesDatabaseObserver::initializeConnection):
* Source/WebKit/Shared/Cocoa/XPCEndpointClient.mm:
(WebKit::XPCEndpointClient::setEndpoint):
* Source/WebKit/Shared/EntryPointUtilities/Cocoa/Daemon/PCMDaemonEntryPoint.mm:
(WebKit::CompletionHandler<void):
* Source/WebKit/Shared/EntryPointUtilities/Cocoa/XPCService/XPCEndpointMessages.mm:
(WebKit::handleLaunchServiceDatabaseMessage):
* Source/WebKit/Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.mm:
(WebKit::XPCServiceInitializerDelegate::getExtraInitializationData):
* Source/WebKit/Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm:
(WebKit::XPCServiceEventHandler):
* Source/WebKit/UIProcess/Authentication/cocoa/AuthenticationChallengeProxyCocoa.mm:
(WebKit::AuthenticationChallengeProxy::sendClientCertificateCredentialOverXpc):
* Source/WebKit/UIProcess/Cocoa/AuxiliaryProcessProxyCocoa.mm:
(WebKit::AuxiliaryProcessProxy::platformStartConnectionTerminationWatchdog):
* Source/WebKit/UIProcess/Cocoa/PlaybackSessionManagerProxy.mm:
(WebKit::PlaybackSessionManagerProxy::setVideoReceiverEndpoint):
(WebKit::PlaybackSessionManagerProxy::swapVideoReceiverEndpoints):
* Source/WebKit/UIProcess/Launcher/cocoa/ProcessLauncherCocoa.mm:
(WebKit::ProcessLauncher::finishLaunchingProcess):
* Source/WebKit/UIProcess/Network/NetworkProcessProxyCocoa.mm:
(WebKit::NetworkProcessProxy::sendXPCEndpointToProcess):
* Source/WebKit/WebProcess/cocoa/LaunchServicesDatabaseManager.mm:
(WebKit::LaunchServicesDatabaseManager::handleEvent):

Canonical link: https://commits.webkit.org/303163@main
@webkit-commit-queue
webkit-commit-queue force-pushed the 302620_use_XPCObjectPtr_more branch from a9113b1 to f896ca1 Compare November 18, 2025 04:23
@webkit-commit-queue

Copy link
Copy Markdown
Collaborator

Committed 303163@main (f896ca1): https://commits.webkit.org/303163@main

Reviewed commits have been landed. Closing PR #54029 and removing active labels.

@webkit-commit-queue
webkit-commit-queue merged commit f896ca1 into WebKit:main Nov 18, 2025
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Nov 18, 2025
webkit-commit-queue pushed a commit to basuke/WebKit that referenced this pull request Jul 22, 2026
https://bugs.webkit.org/show_bug.cgi?id=319944
rdar://182860876

Reviewed by Alex Christensen.

The imported WPT idlharness harness (webidl2.js@e6d8ab8) requires the
single-token "async_iterable" WebIDL syntax and emits a validation error
for the older two-token "async iterable" syntax. The imported dependency
IDL files streams.idl and fs.idl still used the old syntax, so every
idl_test that pulls in streams.idl recorded a spurious
"FAIL idl_test validation" line, affecting idlharness expected files
across compression, encoding, fs, streams, webrtc-encoded-transform, and
webtransport.

Update both imported IDL files to the async_iterable syntax and rebaseline
the affected idlharness expected files. The new IDL matches upstream
web-platform-tests, taken from commit
14c7ae5dd9a2c7f726ed51f968dc2340cb4fbe74 (2025-08-20, "Sync interfaces/
with @webref/idl 3.66.2", WebKit#54029), which updated both interfaces/streams.idl
and interfaces/fs.idl to async_iterable.

Covered by existing tests (the rebaselined idlharness tests).

* LayoutTests/imported/w3c/web-platform-tests/compression/idlharness.https.any-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/compression/idlharness.https.any.worker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/encoding/idlharness.any-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/encoding/idlharness.any.serviceworker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/encoding/idlharness.any.sharedworker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/encoding/idlharness.any.worker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fs/idlharness.https.any-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fs/idlharness.https.any.worker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/interfaces/fs.idl:
* LayoutTests/imported/w3c/web-platform-tests/interfaces/streams.idl:
* LayoutTests/imported/w3c/web-platform-tests/streams/idlharness.any-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/streams/idlharness.any.serviceworker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/streams/idlharness.any.sharedworker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/streams/idlharness.any.worker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/webrtc-encoded-transform/idlharness.https.window-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/webtransport/idlharness.https.sub.any-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/webtransport/idlharness.https.sub.any.serviceworker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/webtransport/idlharness.https.sub.any.sharedworker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/webtransport/idlharness.https.sub.any.worker-expected.txt:

Canonical link: https://commits.webkit.org/317691@main
Jarred-Sumner pushed a commit to oven-sh/WebKit that referenced this pull request Jul 28, 2026
* AX: Inefficiencies around id dirtying and searching when building accessibility relations
https://bugs.webkit.org/show_bug.cgi?id=319937
rdar://182309307

Reviewed by Dominic Mazzoni and Chris Fleizach.

When accessibility relations are rebuilt, updateRelationsIfNeeded() iterates
m_elementsWithRelationAttributes, which can hold detached elements. For an origin
that is not in a tree scope, Element::elementsArrayForAttributeInternal() cannot
use the TreeScope id map and falls back to getElementByIdIncludingDisconnected(),
which linearly scans the entire detached subtree once per referenced id. On pages
with large detached subtrees that carry ARIA relation attributes, this can severely
harm performance.

Fix this by skipping resolution of  relations for origins that are not in a tree scope.
Such elements have no accessibility object, so their relations have no consumer.

Additionally, this commit reduces how often relations are rebuilt. performDeferredCacheUpdate()
used to mark all relations dirty on every id-attribute change, forcing a full rebuild, regardless
of whether that id was part of a relation. Now we track every id referenced by a relation attribute
(resolved or not) in a new m_referencedRelationTargetIds set and only dirty relations when a changed
id can actually affect one.

* LayoutTests/accessibility/aria-relations-disconnected-subtree-no-timeout-expected.txt: Added.
* LayoutTests/accessibility/aria-relations-disconnected-subtree-no-timeout.html: Added.
* Source/WebCore/accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::performDeferredCacheUpdate):
(WebCore::AXObjectCache::updateRelationsIfNeeded):
(WebCore::AXObjectCache::idChangeCanAffectRelations const):
(WebCore::AXObjectCache::addRelation):
(WebCore::AXObjectCache::addLabelForRelation):
* Source/WebCore/accessibility/AXObjectCache.h:

Canonical link: https://commits.webkit.org/317690@main

* [WPT] Update imported streams.idl and fs.idl to async_iterable syntax
https://bugs.webkit.org/show_bug.cgi?id=319944
rdar://182860876

Reviewed by Alex Christensen.

The imported WPT idlharness harness (webidl2.js@e6d8ab8) requires the
single-token "async_iterable" WebIDL syntax and emits a validation error
for the older two-token "async iterable" syntax. The imported dependency
IDL files streams.idl and fs.idl still used the old syntax, so every
idl_test that pulls in streams.idl recorded a spurious
"FAIL idl_test validation" line, affecting idlharness expected files
across compression, encoding, fs, streams, webrtc-encoded-transform, and
webtransport.

Update both imported IDL files to the async_iterable syntax and rebaseline
the affected idlharness expected files. The new IDL matches upstream
web-platform-tests, taken from commit
14c7ae5dd9a2c7f726ed51f968dc2340cb4fbe74 (2025-08-20, "Sync interfaces/
with @webref/idl 3.66.2", #54029), which updated both interfaces/streams.idl
and interfaces/fs.idl to async_iterable.

Covered by existing tests (the rebaselined idlharness tests).

* LayoutTests/imported/w3c/web-platform-tests/compression/idlharness.https.any-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/compression/idlharness.https.any.worker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/encoding/idlharness.any-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/encoding/idlharness.any.serviceworker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/encoding/idlharness.any.sharedworker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/encoding/idlharness.any.worker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fs/idlharness.https.any-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fs/idlharness.https.any.worker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/interfaces/fs.idl:
* LayoutTests/imported/w3c/web-platform-tests/interfaces/streams.idl:
* LayoutTests/imported/w3c/web-platform-tests/streams/idlharness.any-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/streams/idlharness.any.serviceworker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/streams/idlharness.any.sharedworker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/streams/idlharness.any.worker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/webrtc-encoded-transform/idlharness.https.window-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/webtransport/idlharness.https.sub.any-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/webtransport/idlharness.https.sub.any.serviceworker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/webtransport/idlharness.https.sub.any.sharedworker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/webtransport/idlharness.https.sub.any.worker-expected.txt:

Canonical link: https://commits.webkit.org/317691@main

* [GLIB] imported/w3c/web-platform-tests/css/css-text/white-space/white-space-trim-inline-block.html is failing since added in 317172@main
https://bugs.webkit.org/show_bug.cgi?id=319954

Unreviewed test gardening.

* LayoutTests/platform/glib/TestExpectations:

Canonical link: https://commits.webkit.org/317692@main

* [iOS 27] REGRESSION (314741@main): Text fields lose focus immediately after showing the keyboard in iPhone Mirroring
https://bugs.webkit.org/show_bug.cgi?id=319948
rdar://181639089

Reviewed by Abrar Rahman Protyasha.

Revert the changes in 314741@main for now; this caused the keyboard on iOS to dismiss immediately
after focusing a text field in iPhone Mirroring mode, from macOS.

* LayoutTests/editing/selection/ios/select-text-by-long-press-with-focused-element-expected.txt: Removed.
* LayoutTests/editing/selection/ios/select-text-by-long-press-with-focused-element.html: Removed.
* LayoutTests/editing/selection/ios/select-text-by-long-press-with-hardware-keyboard-expected.txt: Removed.
* LayoutTests/editing/selection/ios/select-text-by-long-press-with-hardware-keyboard.html: Removed.
* LayoutTests/editing/selection/ios/tap-focused-input-clears-outside-selection-expected.txt: Removed.
* LayoutTests/editing/selection/ios/tap-focused-input-clears-outside-selection.html: Removed.
* Source/WebKit/UIProcess/ios/WKContentViewInteraction.h:
* Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView cleanUpInteraction]):
(-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):
(-[WKContentView selectPositionAtPoint:completionHandler:]):
(-[WKContentView _selectPositionAtPoint:stayingWithinFocusedElement:completionHandler:]):
(-[WKContentView _hideKeyboard:]):
(-[WKContentView _elementDidBlur]):
(-[WKContentView _updateSelectionAssistantSuppressionState]):

Canonical link: https://commits.webkit.org/317693@main

* [YARR] `InputStream::reread()` should check the code unit before a trail surrogate, not after
https://bugs.webkit.org/show_bug.cgi?id=319932

Reviewed by Yusuke Suzuki.

reread() returns errorCodePoint for a trail surrogate whose *following* code
unit is a lead. The error case is a read landing in the middle of a pair, so it
must look at the preceding unit; readCheckedDontAdvance() already does this.

tryConsumeBackReference() rereads the captured text, and errorCodePoint there
fails the backreference unconditionally. Patterns with a lookbehind always run
in the interpreter, so this reproduces with default options:

    var unit = "\uDC00\uD800a";
    /(?<=^)(...)\1/u.test(unit + unit);  // false, should be true

Also move the from + 1 < length check into the lead branch, so that a trail
surrogate at the end of the input is still checked.

Introduced in 280563@main.

Test: JSTests/stress/regexp-backreference-lone-trail-then-lone-lead.js

* JSTests/stress/regexp-backreference-lone-trail-then-lone-lead.js: Added.
(shouldBe):
* Source/JavaScriptCore/yarr/YarrInterpreter.cpp:
(JSC::Yarr::Interpreter::InputStream::reread):

Canonical link: https://commits.webkit.org/317694@main

* [Selection] ::selection text-decoration is not painted when only the selection has a decoration.
https://bugs.webkit.org/show_bug.cgi?id=319947
rdar://182864748

Reviewed by Wenson Hsieh.

hasDecoration in paintForegroundAndDecorations only accounted for the originating element, custom highlights,
and spelling/grammar — not ::selection. So when text had no decoration of its own and only ::selection did,
the decoration-paint path was skipped and the selection's decoration never painted. Add a hasSelectionDecoration
check so the path runs, making selection-text-decoration-currentcolor.html and target-text-005.html pass.

imported/w3c/web-platform-tests/css/css-pseudo/selection-text-decoration-currentcolor.html
imported/w3c/web-platform-tests/css/css-pseudo/target-text-005.html

* LayoutTests/TestExpectations:
* LayoutTests/platform/ios/TestExpectations:
* Source/WebCore/rendering/TextBoxPainter.cpp:
(WebCore::TextBoxPainter::paintForegroundAndDecorations):

Canonical link: https://commits.webkit.org/317695@main

* Enable ASM support in dav1d
rdar://182509958
https://bugs.webkit.org/show_bug.cgi?id=319666

Reviewed by Andy Estes and Jean-Yves Avenard.

We update the project to include asm and .S files.
We exclude them for non arm64/arm64e builds.
We update Source/WebCore/PAL/ThirdParty/dav1d/config.h to enable ASM for arm64.
We add Source/WebCore/PAL/ThirdParty/dav1d/config folder from upstream repo as it is useful to update Source/WebCore/PAL/ThirdParty/dav1d/config.h.

Covered by existing tests.

* Source/WebCore/PAL/ThirdParty/dav1d/Configurations/dav1d.xcconfig:
* Source/WebCore/PAL/ThirdParty/dav1d/config.h:
* Source/WebCore/PAL/ThirdParty/dav1d/config/apple/arm/config.h: Added.
* Source/WebCore/PAL/ThirdParty/dav1d/config/apple/arm64/config.h: Added.
* Source/WebCore/PAL/ThirdParty/dav1d/config/apple/x64/config.asm: Added.
* Source/WebCore/PAL/ThirdParty/dav1d/config/apple/x64/config.h: Added.
* Source/WebCore/PAL/ThirdParty/dav1d/config/apple/x86/config.asm: Added.
* Source/WebCore/PAL/ThirdParty/dav1d/config/apple/x86/config.h: Added.
* Source/WebCore/PAL/ThirdParty/dav1d/config/linux-noasm/generic/config.h: Added.
* Source/WebCore/PAL/ThirdParty/dav1d/config/linux-noasm/x64/config.h: Added.
* Source/WebCore/PAL/ThirdParty/dav1d/config/linux/arm/config.h: Added.
* Source/WebCore/PAL/ThirdParty/dav1d/config/linux/arm64/config.h: Added.
* Source/WebCore/PAL/ThirdParty/dav1d/config/linux/riscv64/config.h: Added.
* Source/WebCore/PAL/ThirdParty/dav1d/config/linux/riscv64/cpu-renamed.c: Added.
* Source/WebCore/PAL/ThirdParty/dav1d/config/linux/x64/config.asm: Added.
* Source/WebCore/PAL/ThirdParty/dav1d/config/linux/x64/config.h: Added.
* Source/WebCore/PAL/ThirdParty/dav1d/config/linux/x86/config.asm: Added.
* Source/WebCore/PAL/ThirdParty/dav1d/config/linux/x86/config.h: Added.
* Source/WebCore/PAL/ThirdParty/dav1d/config/win/arm64/config.h: Added.
* Source/WebCore/PAL/ThirdParty/dav1d/config/win/x64/config.asm: Added.
* Source/WebCore/PAL/ThirdParty/dav1d/config/win/x64/config.h: Added.
* Source/WebCore/PAL/ThirdParty/dav1d/config/win/x86/config.asm: Added.
* Source/WebCore/PAL/ThirdParty/dav1d/config/win/x86/config.h: Added.
* Source/WebCore/PAL/ThirdParty/dav1d/dav1d.xcodeproj/project.pbxproj:

Canonical link: https://commits.webkit.org/317696@main

* Web Inspector: [SI] route shadowRootPushed/Popped to per-frame FrameDOMAgent
https://bugs.webkit.org/show_bug.cgi?id=X
rdar://179248483

Reviewed by Qianlang Chen.

Under Site Isolation a cross-origin iframe's DOM lives in a separate
WebProcess with its own FrameDOMAgent. The DOM.shadowRootPushed and
shadowRootPopped events are fired through InstrumentingAgents, which only
notified the page-level agent, so attaching a shadow root inside a cross-
origin iframe reached no agent for that frame -- and even when it did, the
frontend dropped it for a FrameTarget. The shadow root never appeared in the
Elements tree.

didPushShadowRootImpl and willPopShadowRootImpl now resolve the host's frame
and notify that frame's persistentFrameDOMAgent before falling through to the
page agent, matching the branch already used by the sibling per-node hooks
(didModifyDOMAttr, didInsertDOMNode). The main frame has no
persistentFrameDOMAgent and the page agent's boundNodeId() guard suppresses
subframe hosts, so there is no double-fire. DOM.json widens both events'
targetTypes from ["page"] to ["frame","page"] so the generated dispatcher
accepts them from a FrameTarget; FrameDOMAgent already implemented
didPushShadowRoot/willPopShadowRoot.

On the frontend, DOMObserver replaces the two FrameTarget FIXME early-returns
with _frameTargetShadowRootPushed/_frameTargetShadowRootPopped, modeled on
_frameTargetChildNodeInserted/Removed. They scope the shadow-root WI.DOMNode
to the owning frame target (target.identifier + ":" + nodeId) so colliding
raw NodeIds across frames stay distinct.

shadowRootPopped is wired but has no end-to-end test: author shadow roots have
no scriptable detach, so willPopShadowRoot only fires on host destruction, and
removing the host first unbinds the root (FrameDOMAgent::unbind), leaving
boundNodeId 0 so the backend suppresses the event.

Tests: http/tests/site-isolation/inspector/dom/shadow-root-cross-frame-isolation-frame-target.html
       http/tests/site-isolation/inspector/dom/shadow-root-pushed-frame-target.html

* LayoutTests/http/tests/site-isolation/inspector/dom/resources/shadow-root-child-frame.html: Added.
* LayoutTests/http/tests/site-isolation/inspector/dom/resources/shadow-root-frame.html: Added.
* LayoutTests/http/tests/site-isolation/inspector/dom/resources/shadow-root-grandchild-frame.html: Added.
* LayoutTests/http/tests/site-isolation/inspector/dom/shadow-root-cross-frame-isolation-frame-target-expected.txt: Added.
* LayoutTests/http/tests/site-isolation/inspector/dom/shadow-root-cross-frame-isolation-frame-target.html: Added.
* LayoutTests/http/tests/site-isolation/inspector/dom/shadow-root-pushed-frame-target-expected.txt: Added.
* LayoutTests/http/tests/site-isolation/inspector/dom/shadow-root-pushed-frame-target.html: Added.
* Source/JavaScriptCore/inspector/protocol/DOM.json:
* Source/WebCore/inspector/InspectorInstrumentation.cpp:
(WebCore::InspectorInstrumentation::didPushShadowRootImpl):
(WebCore::InspectorInstrumentation::willPopShadowRootImpl):
* Source/WebInspectorUI/UserInterface/Controllers/DOMManager.js:
(WI.DOMManager.prototype._frameTargetShadowRootPushed):
(WI.DOMManager.prototype._frameTargetShadowRootPopped):
* Source/WebInspectorUI/UserInterface/Protocol/DOMObserver.js:
(WI.DOMObserver.prototype.shadowRootPushed):
(WI.DOMObserver.prototype.shadowRootPopped):

Canonical link: https://commits.webkit.org/317697@main

* Web Inspector: [SI] coordinate Cmd+Z across per-frame undo stacks
https://bugs.webkit.org/show_bug.cgi?id=315597
rdar://177978474

Reviewed by Qianlang Chen.

Replace WI.DOMUndoCoordinator's single _lastEditTarget slot with a pair
of LIFO target stacks that record one entry per edit, in order. Each
edit's target — the main page or a cross-origin iframe — is pushed when
didEdit is called. undo pops the top, dispatches to that target's
DOMAgent, and pushes to the redo stack on completion; redo is the
symmetric inverse. Empty-stack undo and redo fall back to the main
target as a no-op without pushing onto either stack. TargetRemoved
filters both stacks so a torn-down frame can't be popped later.

End-user effect: edit a node in a cross-origin iframe, edit a node on
the main page, press Cmd+Z — the main edit reverses; press Cmd+Z again,
the iframe edit reverses.

The existing single-target dispatch test is updated to await the now-
async undo/redo entry points.

Test: http/tests/site-isolation/inspector/dom/cross-frame-undo-coordinator.html

* LayoutTests/http/tests/site-isolation/inspector/dom/cross-frame-undo-coordinator-expected.txt: Added.
* LayoutTests/http/tests/site-isolation/inspector/dom/cross-frame-undo-coordinator.html: Added.
* LayoutTests/http/tests/site-isolation/inspector/dom/undo-coordinator-frame-target-expected.txt:
* LayoutTests/http/tests/site-isolation/inspector/dom/undo-coordinator-frame-target.html:
* Source/WebInspectorUI/UserInterface/Controllers/DOMUndoCoordinator.js:
(WI.DOMUndoCoordinator):
(WI.DOMUndoCoordinator.prototype.didEdit):
(WI.DOMUndoCoordinator.prototype.markUndoableState):
(WI.DOMUndoCoordinator.prototype.undo):
(WI.DOMUndoCoordinator.prototype.redo):
(WI.DOMUndoCoordinator.prototype._performOperationSoon):
(WI.DOMUndoCoordinator.prototype.async _undo):
(WI.DOMUndoCoordinator.prototype.async _redo):
(WI.DOMUndoCoordinator.prototype._handleTargetRemoved):

Canonical link: https://commits.webkit.org/317698@main

* [Web Inspector] [Site Isolation] Deliver DOM custom-element and pseudo-element events to Frame Targets
https://bugs.webkit.org/show_bug.cgi?id=NNNNNN
rdar://179176056

Reviewed by Qianlang Chen.

Web Inspector's Elements tree for an out-of-process iframe went
stale on these lifecycle changes:

- DOM.customElementStateChanged
- DOM.pseudoElementAdded
- DOM.pseudoElementRemoved

They were stubbed off at every layer for the frame target: the protocol declared
them "page"-only, InspectorInstrumentation routed them only to the page-level
persistentDOMAgent(), and the frontend DOMObserver early-returned with a FIXME
for FrameTarget. FrameDOMAgent already had complete, correct implementations of
all three methods, so this is a pure wiring change, not a new feature.

This adds the missing routing following the existing convention used by
didInsertDOMNode / didModifyDOMAttr (notify the frame's own FrameDOMAgent, then
the page agent), declares the events for the frame target, and adds the
scoped-id frontend handlers so the iframe's Elements tree stays live.

The added layout test deliberately covers multiple, repeated, and interleaved
scenarios rather than a single event per type, since these handlers manage
per-node and per-pseudo-type state: two custom elements upgraded back-to-back
(no cross-contamination), ::before and ::after coexisting, targeted single-pseudo
removal leaving the sibling intact, and an add/remove/re-add cycle guarding
against stale-node leaks. It also documents that one upgrade legitimately emits
two transitions (FailedOrPrecustomized then Custom), which the frame target
relays just like the page target.

Test: http/tests/site-isolation/inspector/dom/custom-elements-and-pseudo-elements-frame-target.html

* LayoutTests/http/tests/site-isolation/inspector/dom/custom-elements-and-pseudo-elements-frame-target-expected.txt: Added.
* LayoutTests/http/tests/site-isolation/inspector/dom/custom-elements-and-pseudo-elements-frame-target.html: Added.
* LayoutTests/http/tests/site-isolation/inspector/dom/resources/custom-elements-and-pseudo-elements-frame.html: Added.
* Source/JavaScriptCore/inspector/protocol/DOM.json:
* Source/WebCore/inspector/InspectorInstrumentation.cpp:
(WebCore::InspectorInstrumentation::didChangeCustomElementStateImpl):
(WebCore::InspectorInstrumentation::pseudoElementCreatedImpl):
(WebCore::InspectorInstrumentation::pseudoElementDestroyedImpl):
* Source/WebInspectorUI/UserInterface/Controllers/DOMManager.js:
(WI.DOMManager.prototype._frameTargetCustomElementStateChanged):
(WI.DOMManager.prototype._frameTargetPseudoElementAdded):
(WI.DOMManager.prototype._frameTargetPseudoElementRemoved):
* Source/WebInspectorUI/UserInterface/Protocol/DOMObserver.js:
(WI.DOMObserver.prototype.customElementStateChanged):
(WI.DOMObserver.prototype.pseudoElementAdded):
(WI.DOMObserver.prototype.pseudoElementRemoved):

Canonical link: https://commits.webkit.org/317699@main

* [JSC] Use pass-by-value for `resultIndex` argument of `JS::fastFlatIntoBuffer()`
https://bugs.webkit.org/show_bug.cgi?id=319673

Reviewed by Sosuke Suzuki.

This change is related to only the fast path of `Array#flat()`.
`resultIndex` is 8-bytes (`uint64_t`). It's enough small size.

Interestingly, this change has a side-effect which is a micro benchmark
progression on macOS arm64 at least.

                                             TipOfTree                  Patched

array-prototype-flat-depth-1-string      124.7313+-15.7674    ?    126.7053+-14.0930       ? might be 1.0158x slower
array-prototype-flat-depth-1-double       85.8047+-8.6982     ?     88.9680+-4.1780        ? might be 1.0369x slower
array-prototype-flat-large-nested         45.0930+-2.4765     ^     27.1562+-1.0824        ^ definitely 1.6605x faster
array-prototype-flat-huge-arrays          10.5353+-1.8040           10.0453+-1.7224          might be 1.0488x faster
array-prototype-flat-small-arrays          3.4522+-0.1238            3.3026+-0.0755          might be 1.0453x faster
array-prototype-flat-depth-infinity      117.2919+-1.0095          117.0930+-0.6006
array-prototype-flat-depth-2              94.7117+-1.3260     ?     95.6852+-4.3372        ? might be 1.0103x slower
array-prototype-flat-depth-1-int32        85.2135+-4.3134     ?     88.4635+-2.5566        ? might be 1.0381x slower
array-prototype-flat-depth-3             105.7020+-7.5027          102.3541+-4.5175          might be 1.0327x faster
array-prototype-flat-sparse-array        152.1396+-3.2477     ?    161.3152+-11.0580       ? might be 1.0603x slower
array-prototype-flat-depth-1-mixed        93.9877+-4.2939     ?     94.3616+-4.7335        ?

<geometric>                               57.9736+-0.6088     ^     55.5547+-0.9141        ^ definitely 1.0435x faster

No new tests.
It wlll be covered by exist test cases.

Canonical link: https://commits.webkit.org/317700@main

* WebInspectorBackendProxy::setEmulatedConditions fails to compile when ENABLE_INSPECTOR_NETWORK_THROTTLING is enabled
https://bugs.webkit.org/show_bug.cgi?id=319487

Reviewed by Devin Rousso.

Move the owned std::optional<int64_t> when forwarding it to
WebInspectorUIProxy::setEmulatedConditions().

WebInspectorBackendProxy owns the std::optional by value but forwards it
to a function taking std::optional<int64_t>&&, causing compilation to
fail when ENABLE_INSPECTOR_NETWORK_THROTTLING is enabled.

Forward the optional using WTF::move().

* Source/WebKit/UIProcess/Inspector/WebInspectorBackendProxy.cpp:
(WebKit::WebInspectorBackendProxy::setEmulatedConditions):

Canonical link: https://commits.webkit.org/317701@main

* [EvaluationTimeZoom] Convert view-timeline-inset property to use unzoomed lengths
https://bugs.webkit.org/show_bug.cgi?id=319905

Reviewed by Antoine Quint.

Converts the view-timeline-inset CSS property to use unzoomed lengths.

New test added showing view-timeline-inset working properly with inherited + zoomed values.

Tests: imported/w3c/web-platform-tests/css/css-viewport/zoom/view-timeline-inset.html
* LayoutTests/imported/w3c/web-platform-tests/css/css-viewport/zoom/reference/view-timeline-inset-ref.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-viewport/zoom/view-timeline-inset-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-viewport/zoom/view-timeline-inset.html: Added.
* Source/WebCore/Headers.cmake:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/animation/CSSAnimation.cpp:
* Source/WebCore/animation/ResolvableViewTimelineInsets.h: Added.
* Source/WebCore/animation/StyleOriginatedTimelinesController.cpp:
* Source/WebCore/animation/StyleOriginatedTimelinesController.h:
* Source/WebCore/animation/ViewTimeline.cpp:
* Source/WebCore/animation/ViewTimeline.h:
* Source/WebCore/style/Styleable.cpp:
* Source/WebCore/style/values/scroll-animations/StyleViewTimelineInsetItem.h:

Canonical link: https://commits.webkit.org/317702@main

* [WPE] `webrtc/remoteAudio-never-played.html` is a rare flaky crash
https://bugs.webkit.org/show_bug.cgi?id=319974

Unreviewed test gardening.

* LayoutTests/platform/wpe/TestExpectations:

Canonical link: https://commits.webkit.org/317703@main

* [WPE] `fast/events/wheel/wheelevent-basic.html` is a constant crash
https://bugs.webkit.org/show_bug.cgi?id=319949

Unreviewed test gardening.

This test was marked as expected to crash in glib/TestExpectations in
317682@main but there was an override of in wpe/TestExpectations.

Temporarily comment out the override.

* LayoutTests/platform/wpe/TestExpectations:

Canonical link: https://commits.webkit.org/317704@main

* WebSWServerConnection::networkProcess should account for a nullptr m_networkConnectionToWebProcess
rdar://182761259
https://bugs.webkit.org/show_bug.cgi?id=319968

Reviewed by Chris Dumez.

WebSWServerConnection sometimes calls networkProcess() asynchronously following an IPC message, for instance in WebSWServerConnection::postMessageToServiceWorkerClient.
In that case, there is no guarantee that m_networkConnectionToWebProcess is not nullptr and calling WebSWServerConnection::networkProcess should return nullptr.

We change WebSWServerConnection::networkProcess to account for this and return a NetworkProcess pointer instead of a ref.
At call sites, we check for networkProcess being nullptr for async cases.

Covered by existing tests.

* Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
(WebKit::WebSWServerConnection::networkProcess):
(WebKit::WebSWServerConnection::sharedPreferencesForWebProcess const):
(WebKit::WebSWServerConnection::resolveUnregistrationJobInClient):
* Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.h:

Canonical link: https://commits.webkit.org/317705@main

* WPEWebKit font rendering has different thickness than WebKitGTK
https://bugs.webkit.org/show_bug.cgi?id=312461

Reviewed by Carlos Garcia Campos.

This change unifies the default font rendering settings between GTK
and WPE.

To be more precise, it changes the WPE's default value for
subpixel layout from RGB to NONE so that it matches the default from
FontRenderOptions that is used by GTK normally.

Canonical link: https://commits.webkit.org/317706@main

* Allow subclassing of WritableStreamDefaultWriter
rdar://182400674
https://bugs.webkit.org/show_bug.cgi?id=319570

Reviewed by Chris Dumez.

WebTransport is subclassing WritableStreamDefaultWriter in WebTransportWriter.
To prepare for implementing WebTransportWriter, we make WritableStreamDefaultWriter a standard C++ class instead of a JS built-in.
We beef up InternalWritableStreamWriter to support more bindings API and we forward WritableStreamDefaultWriter calls to InternalWritableStreamWriter.

Covered by existing tests.

* Source/WebCore/CMakeLists.txt:
* Source/WebCore/DerivedSources-input.xcfilelist:
* Source/WebCore/DerivedSources-output.xcfilelist:
* Source/WebCore/DerivedSources.make:
* Source/WebCore/Modules/streams/WritableStream.cpp:
(WebCore::WritableStream::getWriter):
(WebCore::JSWritableStream::getWriter): Deleted.
* Source/WebCore/Modules/streams/WritableStream.h:
* Source/WebCore/Modules/streams/WritableStream.idl:
* Source/WebCore/Modules/streams/WritableStreamDefaultWriter.cpp: Added.
(WebCore::WritableStreamDefaultWriter::create):
(WebCore::WritableStreamDefaultWriter::WritableStreamDefaultWriter):
(WebCore::WritableStreamDefaultWriter::desiredSize):
(WebCore::WritableStreamDefaultWriter::releaseLock):
(WebCore::JSWritableStreamDefaultWriter::closed const):
(WebCore::JSWritableStreamDefaultWriter::ready const):
(WebCore::JSWritableStreamDefaultWriter::abort):
(WebCore::JSWritableStreamDefaultWriter::close):
(WebCore::JSWritableStreamDefaultWriter::write):
* Source/WebCore/Modules/streams/WritableStreamDefaultWriter.h: Added.
(WebCore::WritableStreamDefaultWriter::internalWriter):
* Source/WebCore/Modules/streams/WritableStreamDefaultWriter.idl:
* Source/WebCore/Modules/streams/WritableStreamDefaultWriter.js: Removed.
* Source/WebCore/Modules/streams/WritableStreamInternals.js:
(acquireWritableStreamDefaultWriter):
(writableStreamDefaultWriterClosedForBindings):
(writableStreamDefaultWriterReadyForBindings):
(writableStreamDefaultWriterDesiredSizeForBindings):
(writableStreamDefaultWriterAbortForBindings):
(writableStreamDefaultWriterCloseForBindings):
(writableStreamDefaultWriterReleaseLockForBindings):
(writableStreamDefaultWriterWriteForBindings):
* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/bindings/js/InternalWritableStreamWriter.cpp:
(WebCore::InternalWritableStreamWriter::closedForBindings):
(WebCore::InternalWritableStreamWriter::desiredSizeForBindings):
(WebCore::InternalWritableStreamWriter::readyForBindings):
(WebCore::InternalWritableStreamWriter::abortForBindings):
(WebCore::InternalWritableStreamWriter::closeForBindings):
(WebCore::InternalWritableStreamWriter::releaseLockForBindings):
(WebCore::InternalWritableStreamWriter::writeForBindings):
* Source/WebCore/bindings/js/InternalWritableStreamWriter.h:

Canonical link: https://commits.webkit.org/317707@main

* Address recent safer cpp regressions in layout code
https://bugs.webkit.org/show_bug.cgi?id=319959

Reviewed by Alan Baradlay.

The failures seem related to 317593@main.

* Source/WebCore/SaferCPPExpectations/NoUncheckedPtrMemberCheckerExpectations:
* Source/WebCore/SaferCPPExpectations/UncheckedCallArgsCheckerExpectations:
* Source/WebCore/SaferCPPExpectations/UncheckedLocalVarsCheckerExpectations:
* Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp:
(WebCore::FlexFormattingContext::layout):
(WebCore::FlexFormattingContext::layoutFlexItems):
(WebCore::FlexFormattingContext::handleCrossAxisAlignmentForFlexLines):
(WebCore::FlexFormattingContext::performBaselineAlignment):
(WebCore::FlexFormattingContext::computeFlexItemRects):
(WebCore::FlexFormattingContext::placeFlexItems):
(WebCore::FlexFormattingContext::reverseColumnLinesFromContainerMainEndIfNeeded):
(WebCore::FlexFormattingContext::layoutColumnReverse):
(WebCore::ScopedFlexBasisAsFlexItemMainSize::ScopedFlexBasisAsFlexItemMainSize):
(WebCore::ScopedFlexBasisAsFlexItemMainSize::~ScopedFlexBasisAsFlexItemMainSize):
(WebCore::FlexFormattingContext::flexBaseSizeForFlexItem):
(WebCore::FlexFormattingContext::flexBaseSizeNeedsBlockAxisContentSize):
(WebCore::FlexFormattingContext::ensureBlockAxisContentSizeForFlexItemIfNeeded):
(WebCore::FlexFormattingContext::computeContentBasedMinMainSize):
(WebCore::FlexFormattingContext::computeMainAxisExtentForFlexItem):
(WebCore::FlexFormattingContext::computeMainSizeFromAspectRatioUsing const):
(WebCore::FlexFormattingContext::flexItemIntrinsicLogicalHeight const):
(WebCore::FlexFormattingContext::flexItemCrossSizeIsDefinite):
(WebCore::FlexFormattingContext::trimMainAxisMarginStart):
(WebCore::FlexFormattingContext::trimMainAxisMarginEnd):
(WebCore::FlexFormattingContext::trimCrossAxisMarginStart):
(WebCore::FlexFormattingContext::trimCrossAxisMarginEnd):
(WebCore::FlexFormattingContext::canFitItemWithTrimmedMarginEnd const):
(WebCore::FlexFormattingContext::removeMarginEndFromFlexSizes const):
(WebCore::FlexFormattingContext::applyStretchAlignmentToFlexItem):
(WebCore::FlexFormattingContext::applyStretchMinMaxCrossSize):
* Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.h:
* Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.cpp:
(WebCore::LayoutIntegration::FlexLayout::collectFlexItems):
(WebCore::LayoutIntegration::FlexLayout::flexItemForFirstBaseline const):
(WebCore::LayoutIntegration::FlexLayout::flexItemForLastBaseline const):
(WebCore::LayoutIntegration::FlexLayout::baselineFlexItemInLine const):
* Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.h:
* Source/WebCore/rendering/RenderFlexibleBox.cpp:
* Source/WebCore/rendering/RenderFlexibleBox.h:

Canonical link: https://commits.webkit.org/317708@main

* LogStream leaks its IPC connection (and Mach port / kqueue workloop) after the WebContent process exits
https://bugs.webkit.org/show_bug.cgi?id=319952

Reviewed by Per Arne Vollan.

When log forwarding is enabled, each WebContent process gets a LogStream in the UI process
(WebProcessProxy::createLogStream), backed by a StreamServerConnection over its own IPC::Connection.

LogStream::stopListeningForIPC() only called StreamServerConnection::stopReceivingMessages(),
which unregisters the message receiver but never invalidates the underlying IPC::Connection. An
open connection keeps itself alive through its Mach-receive dispatch source (which holds a Ref
back to the connection) and holds its Mach port / kqueue workloop until it is explicitly
invalidated. So tearing down the WebProcessProxy released its reference to the LogStream but did
not release the connection: StreamServerConnection::m_receivers and the connection's own receive
source kept the LogStream / StreamServerConnection / IPC::Connection alive as a self-sustaining
island with a dead peer.

One such connection leaked per WebContent process. Over a long session these accumulate in the UI
process until it is killed for Mach port exhaustion (32768) or kqueue workloop exhaustion (2048),
whichever limit is reached first.

Fix LogStream::stopListeningForIPC() to also invalidate() the connection: stopReceivingMessages()
clears the receiver map (breaking the m_receivers <-> m_connection retain cycle so the objects can
be freed) and invalidate() cancels the receive source and releases the Mach port / kqueue workloop.

Also tear the log stream down from WebProcessProxy::shutDown() (via a new stopLogStream() helper,
shared with platformDestroy()) so the connection is released as soon as the process shuts down,
rather than waiting for the proxy object to be destroyed.

* Source/WebKit/Shared/LogStream.mm:
(WebKit::LogStream::stopListeningForIPC):
* Source/WebKit/UIProcess/Cocoa/WebProcessProxyCocoa.mm:
(WebKit::WebProcessProxy::platformDestroy):
(WebKit::WebProcessProxy::stopLogStream):
* Source/WebKit/UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::shutDown):
* Source/WebKit/UIProcess/WebProcessProxy.h:

Canonical link: https://commits.webkit.org/317709@main

* Reduce further unnecessary usage of ternary operator in WebCore
https://bugs.webkit.org/show_bug.cgi?id=319933
rdar://182856553

Reviewed by Chris Dumez.

This improves readability and enforces more idiomatic C++ by resorting to
equivalent binary boolean operations.

* Source/WebCore/css/parser/CSSPropertyParserConsumer+Transform.cpp:
(WebCore::CSSPropertyParserHelpers::consumeRotate):
* Source/WebCore/css/typedom/CSSNumericValue.cpp:
(WebCore::operationOnValuesOfSameUnit):
* Source/WebCore/dom/Document.cpp:
(WebCore::Document::hasTouchEventHandlers const):
* Source/WebCore/dom/Node.cpp:
(WebCore::Node::canStartSelection const):
* Source/WebCore/dom/ScriptExecutionContext.cpp:
(WebCore::ScriptExecutionContext::allowsMediaDevices const):
* Source/WebCore/rendering/LogicalSelectionOffsetCachesInlines.h:
(WebCore::LogicalSelectionOffsetCaches::ContainingBlockInfo::setBlock):
* Source/WebCore/rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::MarginInfo::MarginInfo):
(WebCore::RenderBlockFlow::styleWillChange):
(WebCore::RenderBlockFlow::hasContentfulInlineOrBlockLine const):
(WebCore::RenderBlockFlow::hasContentfulInlineLine const):
* Source/WebCore/rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::adjustedPositionRelativeToOffsetParent const):
* Source/WebCore/rendering/RenderLayer.cpp:
(WebCore::RenderLayer::referenceBoxRectForClipPath const):
(WebCore::RenderLayer::calculateClipRects const):
* Source/WebCore/rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::updateCompositingLayers):
* Source/WebCore/rendering/RenderLayoutState.cpp:
(WebCore::RenderLayoutState::computeOffsets):
* Source/WebCore/rendering/RenderObject.cpp:
(WebCore::RenderObject::canUpdateSelectionOnRootLineBoxes):
* Source/WebCore/rendering/RenderTreeAsText.cpp:
(WebCore::writeLayers):
* Source/WebCore/rendering/shapes/ShapeInterval.h:
(WebCore::ShapeInterval::isEmpty const):
* Source/WebCore/rendering/svg/RenderSVGInlineText.cpp:
(WebCore::RenderSVGInlineText::styleDidChange):

Canonical link: https://commits.webkit.org/317710@main

* Improve the Immersive API documentation
https://bugs.webkit.org/show_bug.cgi?id=319983
rdar://179862957

Reviewed by Etienne Segonzac.

Align the immersive documentation syntax with the other API documentations.

* Source/WebKit/UIProcess/API/Cocoa/WKImmersiveEnvironment.h:
* Source/WebKit/UIProcess/API/Cocoa/WKImmersiveEnvironmentDelegate.h:
* Source/WebKit/UIProcess/API/Swift/WebPage+Configuration.swift:
* Source/WebKit/UIProcess/API/Swift/WebPage+ImmersiveEnvironment.swift:
* Source/WebKit/_WebKit_SwiftUI/API/View+WebViewModifiers.swift:
* Source/WebKit/_WebKit_SwiftUI/API/WebViewImmersiveEnvironmentView.swift:

Canonical link: https://commits.webkit.org/317711@main

* [GFC][Cleanup] Remove some code duplication for resolving margins
https://bugs.webkit.org/show_bug.cgi?id=319942
rdar://problem/182860702

Reviewed by Cole Carley.

After track sizing is finished, we attempt to resolve the margins for
grid items in two different places: once during the final sizing of the
item and then when we want to align them. The logic to do this is
exactly the same and we do it in two different ways in both scenarios
when we do not need to. Instead, let's just use the static helper
function that we already have during item sizing and remove the lambdas
that were basically just duplicate code.

This change requires us to compute a list of the margins for each grid
item rather than resolve the margins one at a time, but this is
basically just a matter of plumbing the values to the right place.

* Source/WebCore/layout/formattingContexts/grid/GridLayout.cpp:
Remove the local UsedMargins definition now that it lives in
GridLayoutUtils.h.

(WebCore::Layout::GridLayout::layoutGridItems const):
Resolve each grid item's used margins with computeMarginsForAxis and pass
them into the sizing functions.

* Source/WebCore/layout/formattingContexts/grid/GridLayoutUtils.cpp:
(WebCore::Layout::GridLayoutUtils::stretchFitSize):
(WebCore::Layout::GridLayoutUtils::inlinePreferredSize):
(WebCore::Layout::GridLayoutUtils::blockPreferredSize):
(WebCore::Layout::GridLayoutUtils::inlineUsedSize):
(WebCore::Layout::GridLayoutUtils::blockUsedSize):
Aforementioned plumbing from GridLayout::layoutGridItems to the spots
where we were manually resolving them in the lambdas.

Canonical link: https://commits.webkit.org/317712@main

* libwebrtc workerThread should be networkThread and not signalingThread
rdar://182758228
https://bugs.webkit.org/show_bug.cgi?id=319969

Reviewed by Jean-Yves Avenard.

In M150 libwebrtc resync, explicit hopping from network thread to worker thread was removed from WebRtcVideoReceiveChannel::OnPacketReceived.
This is ok in Chrome since network thread and worker thread are the same.
We apply the same setup in WebKit in LibWebRTCProvider::createPeerConnectionFactory.

The issue is that while Call::DeliverRtpPacket use a safety task to make sure the Call pointer is valid after hopping to worker thread,
the OnUndemuxablePacketHandler is keeping a pointer to WebRtcVideoReceiveChannel/WebRtcVoiceReceiveChannel, which are not guaranteed to stay valid in our previous config where worker thread and signalling thread were the same.
For good measure, we make sure that the OnUndemuxablePacketHandler given to Call::DeliverRtpPacket from WebRtcVideoReceiveChannel and WebRtcVoiceReceiveChannel use safety flags so that we protect from any misuse pointers.

* Source/ThirdParty/libwebrtc/Source/webrtc/media/engine/webrtc_video_engine.cc:
* Source/ThirdParty/libwebrtc/Source/webrtc/media/engine/webrtc_voice_engine.cc:
* Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
(WebCore::LibWebRTCProvider::createPeerConnectionFactory):

Canonical link: https://commits.webkit.org/317713@main

* Rename WKJSHandle.frame to WKJSHandle.sourceFrame
rdar://182612413
https://bugs.webkit.org/show_bug.cgi?id=319922

Reviewed by Alex Christensen.

There's already many `.frame` properties on various classes on Cocoa platforms, most of which are NS/CGRect.
This new property is a bit confusing for devs cognitively, and also trips up tooling.

Let's rename to something that already has WebKit precedent.

* Source/WebKit/UIProcess/API/Cocoa/WKJSHandle.h:
* Source/WebKit/UIProcess/API/Cocoa/WKJSHandle.mm:
(-[WKJSHandle sourceFrame]):
(-[_WKJSHandle frame]):
(-[WKJSHandle frame]): Deleted.
* Source/WebKit/UIProcess/API/Cocoa/_WKJSHandle.h:

Canonical link: https://commits.webkit.org/317714@main

* [WebDriver] Implement the "consume user activation" command

https://bugs.webkit.org/show_bug.cgi?id=247996
rdar://102634281

Reviewed by BJ Burg.

Implement the "consume user activation of Window" WebDriver extension command
(POST /session/{id}/window/consume-user-activation) defined in HTML, which
consumes the current browsing context active window's transient user activation
and returns whether activation was present. The command mirrors the existing
getComputedRole automation command, routing from the UI process to the web
process to call LocalDOMWindow::consumeTransientActivation().

* Source/WebDriver/Session.cpp:
(WebDriver::Session::consumeUserActivation):
* Source/WebDriver/Session.h:
* Source/WebDriver/WebDriverService.cpp:
(WebDriver::WebDriverService::consumeUserActivation):
* Source/WebDriver/WebDriverService.h:
* Source/WebKit/UIProcess/Automation/Automation.json:
* Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp:
(WebKit::WebAutomationSession::consumeUserActivation):
* Source/WebKit/UIProcess/Automation/WebAutomationSession.h:
* Source/WebKit/UIProcess/WebPageProxy.cpp:
* Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.cpp:
(WebKit::WebAutomationSessionProxy::consumeUserActivation):
* Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.h:
* Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.messages.in:

Canonical link: https://commits.webkit.org/317715@main

* WeakPtr::is()/UniqueRef::is() const variadic overloads should be named isAnyOf
https://bugs.webkit.org/show_bug.cgi?id=319815
rdar://182714057

Reviewed by Sam Weinig.

The const variadic overloads in WeakPtr.h and UniqueRef.h were
mistakenly named is() instead of isAnyOf(), colliding with the
const single-argument is() overload and leaving isAnyOf() without
a const overload for these two types. Ref.h, RefPtr.h, CheckedPtr.h,
and CheckedRef.h all name this overload isAnyOf() correctly.

* Source/WTF/wtf/UniqueRef.h:
(WTF::isAnyOf):
* Source/WTF/wtf/WeakPtr.h:
(WTF::isAnyOf):

Canonical link: https://commits.webkit.org/317716@main

* [JSC][Temporal] japanese calendar can use ISO year, day, month, monthcode
https://bugs.webkit.org/show_bug.cgi?id=319964
rdar://182889728

Reviewed by Yijia Huang.

Since japanese calendar is using proleptic Gregorian calendar, for year,
day, month, monthcode, we do not need to query to the calendar, we can
just use ISO 8601 values. For era related ones need to query to the
actual calendar.

Test: JSTests/stress/temporal-japanese-calendar-proleptic-gregorian.js

* JSTests/stress/temporal-japanese-calendar-proleptic-gregorian.js: Added.
(shouldBe):
(checkDateFields):
(checkEra):
* Source/JavaScriptCore/runtime/temporal/core/CalendarICUBridge.cpp:
(JSC::TemporalCore::isoToCalendarFields):
(JSC::TemporalCore::calendarMonth):
(JSC::TemporalCore::calendarMonthCode):
(JSC::TemporalCore::calendarDay):

Canonical link: https://commits.webkit.org/317717@main

* Store and query EWS test results in the results database
https://bugs.webkit.org/show_bug.cgi?id=319400
rdar://157892382

Reviewed by Aakash Jain.

EWSContext defines the EWS results schema (bug 319113); this adds the read
and write path on top of it. register() classifies a run's unexpected
failures and stores them, routing to the flaky table when given a
flaky_type and the failed table otherwise, and find_for_test() queries
either table via a flaky flag. EWSContext is wired into Model, with a mock
helper (add_mock_ews_results) and unit tests.

This also refines the landed skeleton: the result column becomes result_id,
a build_number column is added, and a Source value type bundles the
provenance columns (remote, pr_number, commit_hash, build_number).

* Tools/Scripts/libraries/resultsdbpy/resultsdbpy/model/ews_context.py:
(Source):
(Source.unpack):
(EWSContext):
(EWSContext.EWSResultsBase):
(EWSContext.EWSResultsBase.unpack):
(EWSContext.EWSFailedTestsByCommit):
(EWSContext.EWSFlakyTestsByCommit):
(EWSContext.__init__):
(EWSContext.register):
(EWSContext._classify_unexpected):
(EWSContext.find_for_test):
* Tools/Scripts/libraries/resultsdbpy/resultsdbpy/model/ews_context_unittest.py: Added.
(EWSContextTest):
(EWSContextTest.init_database):
(EWSContextTest._find):
(EWSContextTest.test_unexpected_failures_stored):
(EWSContextTest.test_metadata_stored):
(EWSContextTest.test_flaky_results_stored):
(EWSContextTest.test_retries_preserved_for_same_commit):
(EWSContextTest.test_no_unexpected_failures):
(EWSContextTest.test_no_results):
* Tools/Scripts/libraries/resultsdbpy/resultsdbpy/model/mock_model_factory.py:
(MockModelFactory):
(MockModelFactory.add_mock_ews_results):
* Tools/Scripts/libraries/resultsdbpy/resultsdbpy/model/model.py:
(Model.__init__):

Canonical link: https://commits.webkit.org/317718@main

* OpenSSL 3.x compatibility improvements
https://bugs.webkit.org/show_bug.cgi?id=319982

Reviewed by Patrick Griffis.

Problems fixed:

1)
const usage in Source/WebCore/crypto/openssl/CryptoKeyRSAOpenSSL.cpp
https://docs.openssl.org/3.0/man7/migration_guide/#functions-that-return-an-internal-key-should-be-treated-as-read-only
"the value returned from EVP_PKEY_get0_RSA(3), ... have been made const"

2)
Feature test ifdefs in Source/WebCore/crypto/openssl/CryptoAlgorithmRSA_OAEPOpenSSL.cpp no longer work
https://github.com/WebKit/WebKit/blob/6d8ca7e79a097c2013cf960c16489930cad90f11/Source/WebCore/crypto/openssl/CryptoAlgorithmRSA_OAEPOpenSSL.cpp#L39
These were macros in OpenSSL 1.x, but are now real functions in OpenSSL 3.x:
https://docs.openssl.org/3.0/man3/EVP_PKEY_CTX_ctrl/#history "In OpenSSL 1.1.1 and below the functions were mostly macros. From OpenSSL 3.0 they are all functions."
So the ifdefs do not see the macros defined (because they are now functions), so the code incorrectly returns ExceptionCode::NotSupportedError.
The solution is to remove these feature checks, surely no one is still using OpenSSL 0.x from before these were added as macros.

3)
Runtime GCM failures. In Source/WebCore/crypto/openssl/CryptoAlgorithmAESGCMOpenSSL.cpp EVP_CIPHER_CTX_set_padding() is called *before*
EVP_EncryptInit_ex() and EVP_DecryptInit_ex().
The OpenSSL documentation says:
"This function should be called after the context is set up for encryption or decryption"
https://docs.openssl.org/3.0/man3/EVP_EncryptInit/#description .
In OpenSSL 1.x this did not matter because EVP_EncryptInit_ex() always returned 1:
https://github.com/openssl/openssl/blob/OpenSSL_1_1_1-stable/crypto/evp/evp_enc.c#L650 ,
but in OpenSSL 3.x it can return 0 if it is called incorrectly, as here with a null ctx->cipher.
The solution is to move the function calls after the init functions.

No new tests: fixes behaviour in non default configuration

* Source/WebCore/crypto/openssl/CryptoAlgorithmAESGCMOpenSSL.cpp: move EVP_CIPHER_CTX_set_padding() calls
(WebCore::cryptEncrypt): move EVP_CIPHER_CTX_set_padding() call after EVP_EncryptInit_ex()
(WebCore::cryptDecrypt): move EVP_CIPHER_CTX_set_padding() call after EVP_DecryptInit_ex()
* Source/WebCore/crypto/openssl/CryptoAlgorithmRSA_OAEPOpenSSL.cpp: delete broken feature check #ifs
(WebCore::CryptoAlgorithmRSA_OAEP::platformEncrypt): delete broken feature check #if
(WebCore::CryptoAlgorithmRSA_OAEP::platformDecrypt): delete broken feature check #if
* Source/WebCore/crypto/openssl/CryptoAlgorithmRSA_PSSOpenSSL.cpp: delete broken feature check #ifs
(WebCore::CryptoAlgorithmRSA_PSS::platformSign): delete broken feature check #if
(WebCore::CryptoAlgorithmRSA_PSS::platformVerify): delete broken feature check #if
* Source/WebCore/crypto/openssl/CryptoKeyRSAOpenSSL.cpp: Add const to match OpenSSL 3.x API changes
(WebCore::getRSAModulusLength): add const
(WebCore::CryptoKeyRSA::keySizeInBits const): add const
(WebCore::CryptoKeyRSA::algorithm const): add const
(WebCore::CryptoKeyRSA::exportData const): add const

Canonical link: https://commits.webkit.org/317719@main

* [WebTransport] Add exportKeyingMaterial() IDL interface
https://bugs.webkit.org/show_bug.cgi?id=319994
rdar://182925790

Reviewed by Alex Christensen.

Add the WebTransport.exportKeyingMaterial() IDL surface so the WebTransport
idlharness WPT conformance checks pass. This covers the interface shape only:
the IDL operation, the prototype property, and argument-arity behavior. The
implementation rejects the returned promise with NotSupportedError because
deriving TLS keying material requires a Network.framework SPI that libnetcore
does not yet expose; the functional implementation remains tracked by
rdar://167646346.

Clears 3 idlharness subtest FAILs per variant across the 4 webtransport
idlharness variants. No IPC or network-process changes.

* LayoutTests/imported/w3c/web-platform-tests/webtransport/idlharness.https.sub.any-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/webtransport/idlharness.https.sub.any.serviceworker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/webtransport/idlharness.https.sub.any.sharedworker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/webtransport/idlharness.https.sub.any.worker-expected.txt:
* Source/WebCore/Modules/webtransport/WebTransport.cpp:
(WebCore::WebTransport::exportKeyingMaterial):
* Source/WebCore/Modules/webtransport/WebTransport.h:
* Source/WebCore/Modules/webtransport/WebTransport.idl:

Canonical link: https://commits.webkit.org/317720@main

* Simplify RenderLayer::calculateLayerBounds() to compute the local clip rect
https://bugs.webkit.org/show_bug.cgi?id=319986

Reviewed by Simon Fraser.

RenderLayer::localClipRect() is public, but only used by
RenderLayer::calculateLayerBounds() so it could be simplified by making
it a simple lambda inside calculateLayerBounds(). This way we don't need
the LocalClipRectMode enum nor the clipExceedsBounds out parameter.

No new tests since this shouldn't change the behavior.

* Source/WebCore/rendering/RenderLayer.cpp:
(WebCore::RenderLayer::calculateClipRects const):
* Source/WebCore/rendering/RenderLayer.h:

Canonical link: https://commits.webkit.org/317721@main

* Copy fonts when transferring a display list between RemoteRenderingBackends
https://bugs.webkit.org/show_bug.cgi?id=309793
rdar://169616107

Reviewed by Ryosuke Niwa, Zak Ridouh, and Brent Fulgham.

WebCore::Font uses non-thread-safe RefCounted. A DrawGlyphs display list item holds
a Ref<const Font>, and a DisplayList-backed ImageBuffer can be transferred to another
RemoteRenderingBackend, which runs on its own work-queue thread. After the transfer
both threads run ref and deref on the same Font, which races the non-atomic refcount
and leads to a use-after-free.

Making Font ThreadSafeRefCounted would require dropping its single-thread weak
pointers (e.g. GlyphPage weakly points back at its Font to break the Font/GlyphPage
ownership cycle) in favor of strong references, which would change Font lifetime:
fonts would retain each other and could no longer be purged.

Instead, when a display list is transferred, replace each Font it references with the
data needed to rebuild it (its FontInternalAttributes and FontPlatformData) on the
source backend thread, and rebuild the Font on the destination backend thread,
recursing into nested DrawDisplayList items. Font stamps its single-thread weak
pointer with the thread that constructs it, so rebuilding on the destination keeps
each Font constructed, used and destroyed on a single thread. The rebuild data holds
no single-thread state, and its FontPlatformData internals (FontCustomPlatformData,
and on Skia SkiaHarfBuzzFont) are made ThreadSafeRefCounted, so it is safe to move
across the two threads.

Separately, ImageBufferDisplayListBackend::copyNativeImage now replays through the
backend own ControlFactory instead of the main-thread ControlFactory::singleton(),
which is not safe to access off the main thread.

* Source/WebCore/platform/graphics/FontCustomPlatformData.h:
* Source/WebCore/platform/graphics/skia/SkiaHarfBuzzFont.h:
* Source/WebCore/platform/graphics/displaylists/DisplayListItems.h:
(WebCore::DisplayList::DrawGlyphs::font):
(WebCore::DisplayList::DrawGlyphs::replaceFontWithRebuildData):
(WebCore::DisplayList::DrawGlyphs::rebuildFont):
* Source/WebCore/platform/graphics/displaylists/DisplayListItems.cpp:
(WebCore::DisplayList::DrawGlyphs::apply):
(WebCore::DisplayList::DrawDisplayList::setDisplayList):
* Source/WebCore/platform/graphics/displaylists/DisplayListRecorderImpl.h:
* Source/WebCore/platform/graphics/displaylists/DisplayListRecorderImpl.cpp:
(WebCore::DisplayList::RecorderImpl::replaceFontsWithRebuildData):
(WebCore::DisplayList::RecorderImpl::rebuildFonts):
* Source/WebCore/platform/graphics/ImageBuffer.h:
* Source/WebCore/platform/graphics/ImageBuffer.cpp:
(WebCore::ImageBuffer::replaceFontsWithRebuildData):
(WebCore::ImageBuffer::rebuildFonts):
* Source/WebCore/platform/graphics/ImageBufferBackend.h:
(WebCore::ImageBufferBackend::replaceFontsWithRebuildData):
(WebCore::ImageBufferBackend::rebuildFonts):
* Source/WebCore/platform/graphics/ImageBufferDisplayListBackend.h:
* Source/WebCore/platform/graphics/ImageBufferDisplayListBackend.cpp:
(WebCore::ImageBufferDisplayListBackend::copyNativeImage):
(WebCore::ImageBufferDisplayListBackend::replaceFontsWithRebuildData):
(WebCore::ImageBufferDisplayListBackend::rebuildFonts):
* Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.cpp:
(WebKit::RemoteRenderingBackend::moveToSerializedBuffer):
(WebKit::RemoteRenderingBackend::moveToImageBuffer):
* LayoutTests/ipc/move-to-image-buffer-cross-thread-font-crash.html: Added.
* LayoutTests/ipc/move-to-image-buffer-cross-thread-font-crash-expected.txt: Added.

Canonical link: https://commits.webkit.org/317722@main

* Clean up JS Temporal getNamedTimeZoneEpochNanoseconds
https://bugs.webkit.org/show_bug.cgi?id=319296
rdar://182132863

Reviewed by Yijia Huang and Yusuke Suzuki.

getNamedTimeZoneEpochNanoseconds makes a number of ICU calls which could
be reduced by invoking ICU function ucal_getTimeZoneOffsetFromLocal to
deal with time zone offsets. New JSTests/ microbenchmark appears
performance neutral.

                                                     ToT                     Patched

temporal-zoned-date-time-from-named-time-zone  19.3681+-0.0994           19.3105+-0.0791
<geometric>                                    19.3681+-0.0994           19.3105+-0.0791          might be 1.0030x faster

* JSTests/microbenchmarks/temporal-zoned-date-time-from-named-time-zone.js: Added.
* Source/JavaScriptCore/runtime/temporal/core/TimeZoneICUBridge.cpp:

Canonical link: https://commits.webkit.org/317723@main

* Start implementing fetch stream uploads
rdar://182510365
https://bugs.webkit.org/show_bug.cgi?id=319667

Reviewed by Alex Christensen.

We add a runtime flag to control fetch stream uploads.
When flag is on, we pass a stream identifier as part of a form data.
This is sent over to the networking process that can read it via FormDataStreamCFNet.

We update FormDataStreamCFNet to handle this case and fail the load as a temporary measure.
A follow-up patch will tie the FormData with NetworkDataTaskCocoa to detect whether H1 or H2.

We do not yet support reading a stream form data from a service worker, we currently reject with NotSupportedError.
A follow-up patch will fix this.

We explicitly fail the load in NetworkDataTaskSoup for now to align with cocoa.

Covered by existing and rebased tests.

* LayoutTests/http/wpt/fetch/fetch-request-with-stream-body.html:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-upload.any-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-upload.any.serviceworker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-upload.any.sharedworker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/basic/request-upload.any.worker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-upload.h2.any-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-upload.h2.any.serviceworker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-upload.h2.any.sharedworker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-upload.h2.any.worker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event.https-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event.https.h2-expected.txt:
* LayoutTests/platform/glib/imported/w3c/web-platform-tests/fetch/api/basic/request-upload.any-expected.txt:
* LayoutTests/platform/glib/imported/w3c/web-platform-tests/fetch/api/basic/request-upload.any.serviceworker-expected.txt:
* LayoutTests/platform/glib/imported/w3c/web-platform-tests/fetch/api/basic/request-upload.any.sharedworker-expected.txt:
* LayoutTests/platform/glib/imported/w3c/web-platform-tests/fetch/api/basic/request-upload.any.worker-expected.txt:
* Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml:
* Source/WebCore/Headers.cmake:
* Source/WebCore/Modules/fetch/FetchBody.cpp:
(WebCore::FetchBody::bodyAsFormData const):
* Source/WebCore/Modules/fetch/FetchResponse.cpp:
(WebCore::FetchResponse::fetch):
* Source/WebCore/Modules/fetch/FormDataConsumer.cpp:
(WebCore::FormDataConsumer::read):
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/platform/network/FormData.cpp:
(WebCore::FormData::create):
(WebCore::FormDataElement::lengthInBytes const):
(WebCore::FormDataElement::isolatedCopy const):
(WebCore::FormData::isPendingStream const):
(WebCore::FormData::resolveBlobReferences):
* Source/WebCore/platform/network/FormData.h:
(WebCore::FormDataElement::FormDataElement):
(WebCore::FormDataElement::operator== const):
* Source/WebCore/platform/network/PendingStreamIdentifier.h: Added.
* Source/WebCore/platform/network/cf/FormDataStreamCFNet.mm:
(WebCore::advanceCurrentStream):
(WebCore::formOpen):
(WebCore::formRead):
(WebCore::formCanRead):
(WebCore::formCopyProperty):
(WebCore::createHTTPBodyCFReadStream):
* Source/WebCore/platform/network/curl/CurlFormDataStream.cpp:
(WebCore::CurlFormDataStream::read):
* Source/WebCore/platform/network/soup/WebKitFormDataInputStream.cpp:
(webkitFormDataInputStreamCreateNextStream):
* Source/WebKit/NetworkProcess/NetworkDataTask.cpp:
(WebKit::NetworkDataTask::NetworkDataTask):
* Source/WebKit/NetworkProcess/NetworkDataTask.h:
(WebKit::NetworkDataTask::hasPendingStreamBody const):
* Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
(WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
* Source/WebKit/NetworkProcess/soup/NetworkDataTaskSoup.cpp:
(WebKit::NetworkDataTaskSoup::createRequest):
* Source/WebKit/Scripts/webkit/messages.py:
(atomic_object_identifier):
(serialized_identifiers):
* Source/WebKit/Scripts/webkit/opaque_ipc_types.tracking.in:
* Source/WebKit/Shared/WTFArgumentCoders.serialization.in:
* Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in:
* Source/WebKit/WebProcess/WebCoreSupport/SessionStateConversion.cpp:
(WebKit::toHTTPBody):

Canonical link: https://commits.webkit.org/317724@main

* Fix CMake build on arm64 broken by 317696@main (Enable ASM support in dav1d)
https://bugs.webkit.org/show_bug.cgi?id=319992
rdar://182923403

Reviewed by Alex Christensen.

317696@main ("Enable ASM support in dav1d") changed config.h so that
HAVE_ASM=1 on arm64 and updated the Xcode project to compile the arm64
.S assembly, but Source/ThirdParty/dav1d/CMakeLists.txt was left behind.
The ASM-enabled C then referenced dav1d_*_neon symbols with no assembly
compiled, breaking the arm64 CMake build.

Compile the arm64 .S files (and the generic arm/cpu.c) in the CMake build
when WTF_CPU_ARM64, mirroring the aarch64 source list in src/meson.build.
The .S files are compiled once into a dedicated OBJECT library (no BITDEPTH)
and set their own architecture via .arch, so no extra assembler flags are
needed. Other architectures keep HAVE_ASM=0 and build no assembly.

* Source/ThirdParty/dav1d/CMakeLists.txt:

Canonical link: https://commits.webkit.org/317725@main

* [JSC] Add VectorZipX(a, all-zeros) strength reduction
https://bugs.webkit.org/show_bug.cgi?id=319991
rdar://182920842

Reviewed by Yijia Huang.

This patch adds strength reduction rules for

    VectorZipHigher(a, all-zeros)
    VectorZipLower(a, all-zeros)

Taking low / high part of each narrow lane and extending it with zeros,
so this is VectorExtendHigh / VectorExtendLow.

Tests: Source/JavaScriptCore/b3/testb3_1.cpp
       Source/JavaScriptCore/b3/testb3_7.cpp

* Source/JavaScriptCore/b3/B3ReduceStrength.cpp:
* Source/JavaScriptCore/b3/testb3.h:
* Source/JavaScriptCore/b3/testb3_1.cpp:
(run):
* Source/JavaScriptCore/b3/testb3_7.cpp:
(testVectorZipZeroExtendForLane):
(testVectorZipWithZeroIsZeroExtend):

Canonical link: https://commits.webkit.org/317726@main

* Web Inspector: Add Versioned Protocol for iOS 27.0 and macOS 27.0
https://bugs.webkit.org/show_bug.cgi?id=319988
rdar://169956207

Reviewed by Qianlang Chen and Devin Rousso.

Snapshot of inspector protocol changes since 26.4.

* Source/WebInspectorUI/UserInterface/Protocol/Legacy/iOS/27.0/InspectorBackendCommands.js: Added.
* Source/WebInspectorUI/UserInterface/Protocol/Legacy/macOS/27.0/InspectorBackendCommands.js: Added.
* Source/WebInspectorUI/UserInterface/Views/DOMTreeContentView.js:
(WI.DOMTreeContentView.prototype._populateConfigureDOMTreeBadgesNavigationItemContextMenu):
* Source/WebInspectorUI/Versions/Inspector-iOS-27.0.json: Added.
* Source/WebInspectorUI/Versions/Inspector-macOS-27.0.json: Added.

Canonical link: https://commits.webkit.org/317727@main

* REGRESSION (315527@main): AudioVideoRendererAVFObjC must be destroyed on the main thread
<https://bugs.webkit.org/show_bug.cgi?id=319979>
<rdar://182796386>

Reviewed by Youenn Fablet.

`AudioVideoRendererAVFObjC` requires main-thread destruction.  Its
destructor tears down AVFoundation objects, removes its synchronizer
time observer, and calls `VideoMediaSampleRenderer::shutdown()`, whose
first statement asserts it is running on the main thread.

Specify `DestructionThread::Main` so the final dereference routes
deletion through the main thread regardless of which thread drops the
last reference, matching the destruction-thread policy already used by
`VideoMediaSampleRenderer` and the sibling AVFoundation renderers.

No new tests since this change is not directly testable.

* Source/WebCore/platform/graphics/avfoundation/AudioVideoRendererAVFObjC.h:

Canonical link: https://commits.webkit.org/317728@main

* [WPT import] META: variant= is not expanded into the generated wrapper for .window.js/.worker.js templated tests
https://bugs.webkit.org/show_bug.cgi?id=319965
rdar://182891397

Reviewed by Sam Sneddon.

import-w3c-tests only copied META: variant= lines into the generated
HTML wrapper for .any.js tests. For .window.js and .worker.js tests,
write_html_files_for_templated_js_tests() wrote a wrapper with no
variant info at all, so WebKit's test runner never split the test
into one run per variant. The test instead ran once with an empty
location.search, which addWindow-urlType.window.js and
addIframe-urlType.window.js treat as an unhandled urlType and throw.

Read variants from the .window.js/.worker.js source the same way
.any.js already does, and pass them through to the generated
wrapper's META: variant= comments so each variant runs and gets its
own expected result.

* LayoutTests/imported/w3c/web-platform-tests/html/browsers/browsing-the-web/remote-context-helper-tests/addIframe-urlType.window-expected.txt: Removed.
* LayoutTests/imported/w3c/web-platform-tests/html/browsers/browsing-the-web/remote-context-helper-tests/addIframe-urlType.window.html:
* LayoutTests/imported/w3c/web-platform-tests/html/browsers/browsing-the-web/remote-context-helper-tests/addIframe-urlType.window_urlType=blank-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/browsers/browsing-the-web/remote-context-helper-tests/addIframe-urlType.window_urlType=blob-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/browsers/browsing-the-web/remote-context-helper-tests/addIframe-urlType.window_urlType=data-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/browsers/browsing-the-web/remote-context-helper-tests/addIframe-urlType.window_urlType=origin-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/browsers/browsing-the-web/remote-context-helper-tests/addWindow-urlType.window-expected.txt: Removed.
* LayoutTests/imported/w3c/web-platform-tests/html/browsers/browsing-the-web/remote-context-helper-tests/addWindow-urlType.window.html:
* LayoutTests/imported/w3c/web-platform-tests/html/browsers/browsing-the-web/remote-context-helper-tests/addWindow-urlType.window_urlType=blank-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/browsers/browsing-the-web/remote-context-helper-tests/addWindow-urlType.window_urlType=blob-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/browsers/browsing-the-web/remote-context-helper-tests/a…
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

WebCore Misc. For miscellaneous bugs in the WebCore framework (and not JavaScriptCore or WebKit).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants