Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 0c7e7ad97b9c50e549387914d31ecc2908ae0171
      
https://github.com/WebKit/WebKit/commit/0c7e7ad97b9c50e549387914d31ecc2908ae0171
  Author: Richard Robinson <[email protected]>
  Date:   2026-08-23 (Sun, 23 Aug 2026)

  Changed paths:
    M Source/JavaScriptCore/wasm/WasmConstExprGenerator.cpp
    M Source/JavaScriptCore/wasm/WasmIPIntGenerator.cpp
    M Source/JavaScriptCore/wasm/WasmOMGIRGenerator.cpp
    M Source/WTF/wtf/Expected.h
    M Source/WTF/wtf/Forward.h
    M Source/WTF/wtf/NativePromise.h
    M Source/WTF/wtf/Ref.h
    M Source/WTF/wtf/RefPtr.h
    M Source/WTF/wtf/TypeTraits.h
    M Source/WebCore/Modules/applepay-ams-ui/ApplePayAMSUIPaymentHandler.h
    M Source/WebCore/css/CSSRule.h
    M Source/WebCore/inspector/agents/frame/FrameCSSAgent.cpp
    M Source/WebCore/inspector/agents/frame/FrameDOMStorageAgent.cpp
    M
Source/WebCore/platform/graphics/ImageFrameAnimator.cpp
    M Source/WebGPU/WGSL/AST/ASTVisitor.h
    M Source/WebGPU/WGSL/ConstantFunctions.h
    M Source/WebKit/UIProcess/Automation/BidiBrowsingContextAgent.cpp
    M Source/WebKit/UIProcess/Inspector/Agents/ProxyingNetworkAgent.cpp
    M Source/WebKit/UIProcess/Inspector/Agents/ProxyingPageAgent.cpp
    M Source/WebKit/WebProcess/Inspector/FrameNetworkAgentProxy.cpp
    M Source/WebKit/WebProcess/Inspector/PageAgentProxy.cpp
    M Source/WebKit/WebProcess/Inspector/WebInspectorBackend.cpp
    M Tools/TestWebKitAPI/Tests/WTF/NativePromise.cpp

  Log Message:
  -----------
  [WTF] Use std::expected instead of our own std::experimental::expected 
implementation
https://bugs.webkit.org/show_bug.cgi?id=322297
rdar://185536453

Reviewed by Ryan Reno, Alex Christensen, Abrar Rahman Protyasha, and Cole 
Carley.

Switch to using the normal `std::expected` type instead of our own 
implementation based on an
outdated
version.

Since `std::expected` is stricter than ours was, several fixes are needed:

1. It has no non-template constructor taking `const T&`, only `template<class U 
= T> expected(U&&)`.
`U` cannot be deduced through a braced-init-list, so it falls back to `U = T` 
and the parameter
becomes `T&&`, which will not bind to an lvalue. Consequently `return { { 
someLvalue } }` no longer
compiles, and the extra braces are dropped. This only affected the cases where 
the inner element was
an lvalue of type `T`.

2. Its assignment operators require `is_nothrow_move_constructible_v<T> || 
is_nothrow_move_constructible_v<E>`,
where ours were unconditional. Neither `Exception` nor `String` qualified, 
because `RefPtr`'s move
constructor was never marked `noexcept`, and that propagated up through 
`String`'s defaulted move
constructor. The result was that copy and move assignment were silently deleted 
for nearly every
`ExceptionOr<T>` and `Expected<T, String>` use.

Fix by marking the
`Ref` and `RefPtr` move constructors `noexcept`. Since it makes `String` and
therefore `Exception` nothrow-move-constructible, it satisfies the requirement 
for every `Expected`
using them as the error type, whatever the value type is.

3. `value()` requires `is_copy_constructible_v<E>`, since it throws 
`bad_expected_access<E>` when
there is no value, which breaks move-only reject types in `NativePromise`. Use 
`operator*` instead,
which doesn't have this requirement and whose only requirement is already 
guaranteed by the enclosing
`if (result)`.

4. Fix `BidiBrowsingContextAgent::getTree` to forward its result instead of 
unwrapping and
rewrapping it, which was discarding the error case.

Test: Tools/TestWebKitAPI/Tests/WTF/NativePromise.cpp

* Source/WTF/wtf/Expected.h:
(): Deleted.
(std::experimental::fundamentals_v3::bad_expected_access<void>::bad_expected_access):
 Deleted.
(std::experimental::fundamentals_v3::bad_expected_access::bad_expected_access):
Deleted.
(std::experimental::fundamentals_v3::bad_expected_access::error): Deleted.
(std::experimental::fundamentals_v3::bad_expected_access::error const): Deleted.
(std::experimental::fundamentals_v3::__expected_detail::__expected_terminate): 
Deleted.
(std::experimental::fundamentals_v3::__expected_detail::base::base): Deleted.
(std::experimental::fundamentals_v3::__expected_detail::voidbase::voidbase): 
Deleted.
(std::experimental::fundamentals_v3::expected::expected): Deleted.
(std::experimental::fundamentals_v3::expected::operator=): Deleted.
(std::experimental::fundamentals_v3::expected::swap): Deleted.
(std::experimental::fundamentals_v3::expected::operator bool const): Deleted.
(std::experimental::fundamentals_v3::expected::has_value const): Deleted.
(std::experimental::fundamentals_v3::expected::value_or const): Deleted.
(std::experimental::fundamentals_v3::expected::value_or): Deleted.
(std::experimental::fundamentals_v3::operator==):
Deleted.
(std::experimental::fundamentals_v3::swap): Deleted.
* Source/WTF/wtf/Forward.h:
* Source/WTF/wtf/NativePromise.h:
* Source/WTF/wtf/Ref.h:
* Source/WTF/wtf/RefPtr.h:
* Source/WTF/wtf/TypeTraits.h:
* Source/WebGPU/WGSL/ConstantFunctions.h:
(WGSL::CONSTANT_FUNCTION):
* Source/WebKit/UIProcess/Automation/BidiBrowsingContextAgent.cpp:
(WebKit::BidiBrowsingContextAgent::getTree):
* Tools/TestWebKitAPI/Tests/WTF/NativePromise.cpp:
(TestWebKitAPI::TEST(NativePromise, MoveOnlyType)):

Canonical link: 
https://flagged.apple.com:443/proxy?t2=Df1X1o9yk0&o=aHR0cHM6Ly9jb21taXRzLndlYmtpdC5vcmcvMzE5NjgxQG1haW4=&emid=170927a3-ecdb-42a8-ae57-08709409f179&c=11



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to