Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 9a160ff054ee88d4ec12d8410a54e5ad42c9270c
      
https://github.com/WebKit/WebKit/commit/9a160ff054ee88d4ec12d8410a54e5ad42c9270c
  Author: Sam Weinig <wei...@apple.com>
  Date:   2024-05-25 (Sat, 25 May 2024)

  Changed paths:
    M Source/WTF/wtf/TrailingArray.h
    M Source/WebCore/Headers.cmake
    M Source/WebCore/Modules/applepay-ams-ui/ApplePayAMSUIPaymentHandler.cpp
    M Source/WebCore/Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp
    M Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp
    M Source/WebCore/Modules/mediastream/RTCRtpSFrameTransform.cpp
    M Source/WebCore/Modules/mediastream/RTCRtpScriptTransformer.cpp
    M Source/WebCore/Modules/paymentrequest/PaymentRequest.cpp
    M Source/WebCore/Modules/permissions/Permissions.cpp
    M Source/WebCore/Modules/streams/TransformStream.cpp
    M Source/WebCore/Modules/webaudio/AudioWorkletGlobalScope.cpp
    M Source/WebCore/Modules/webtransport/DatagramSink.cpp
    M Source/WebCore/Modules/webxr/WebXRInputSource.h
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    M Source/WebCore/animation/KeyframeEffect.cpp
    M Source/WebCore/bindings/IDLTypes.h
    M Source/WebCore/bindings/js/InternalReadableStream.cpp
    M Source/WebCore/bindings/js/JSCallbackData.h
    M Source/WebCore/bindings/js/JSCustomElementRegistryCustom.cpp
    M Source/WebCore/bindings/js/JSDOMConvertAny.h
    M Source/WebCore/bindings/js/JSDOMConvertBase.h
    M Source/WebCore/bindings/js/JSDOMConvertBoolean.h
    M Source/WebCore/bindings/js/JSDOMConvertBufferSource.h
    M Source/WebCore/bindings/js/JSDOMConvertCallbacks.h
    M Source/WebCore/bindings/js/JSDOMConvertDate.h
    M Source/WebCore/bindings/js/JSDOMConvertDictionary.h
    M Source/WebCore/bindings/js/JSDOMConvertEnumeration.h
    M Source/WebCore/bindings/js/JSDOMConvertEventListener.h
    M Source/WebCore/bindings/js/JSDOMConvertInterface.h
    M Source/WebCore/bindings/js/JSDOMConvertJSON.h
    M Source/WebCore/bindings/js/JSDOMConvertNull.h
    M Source/WebCore/bindings/js/JSDOMConvertNullable.h
    M Source/WebCore/bindings/js/JSDOMConvertNumbers.cpp
    M Source/WebCore/bindings/js/JSDOMConvertNumbers.h
    M Source/WebCore/bindings/js/JSDOMConvertObject.h
    A Source/WebCore/bindings/js/JSDOMConvertOptional.h
    M Source/WebCore/bindings/js/JSDOMConvertPromise.h
    M Source/WebCore/bindings/js/JSDOMConvertRecord.h
    A Source/WebCore/bindings/js/JSDOMConvertResult.h
    M Source/WebCore/bindings/js/JSDOMConvertScheduledAction.h
    M Source/WebCore/bindings/js/JSDOMConvertSequences.h
    M Source/WebCore/bindings/js/JSDOMConvertSerializedScriptValue.h
    M Source/WebCore/bindings/js/JSDOMConvertStrings.cpp
    M Source/WebCore/bindings/js/JSDOMConvertStrings.h
    M Source/WebCore/bindings/js/JSDOMConvertUnion.h
    M Source/WebCore/bindings/js/JSDOMConvertVariadic.h
    M Source/WebCore/bindings/js/JSDOMConvertXPathNSResolver.h
    M Source/WebCore/bindings/js/JSDOMWindowCustom.cpp
    M Source/WebCore/bindings/js/JSDocumentCustom.cpp
    M Source/WebCore/bindings/js/JSElementCustom.cpp
    M Source/WebCore/bindings/js/JSElementInternalsCustom.cpp
    M Source/WebCore/bindings/js/JSEventListener.cpp
    M Source/WebCore/bindings/js/JSExtendableMessageEventCustom.cpp
    M Source/WebCore/bindings/js/JSNodeIteratorCustom.cpp
    M Source/WebCore/bindings/js/JSRTCRtpSFrameTransformCustom.cpp
    M Source/WebCore/bindings/js/JSTreeWalkerCustom.cpp
    M Source/WebCore/bindings/js/JSWebAnimationCustom.cpp
    M Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
    M Source/WebCore/bindings/scripts/test/JS/JSExposedToWorkerAndWindow.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSExposedToWorkerAndWindow.h
    M Source/WebCore/bindings/scripts/test/JS/JSTestCEReactions.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestCallTracer.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunction.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunction.h
    M Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunctionRethrow.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunctionRethrow.h
    M 
Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunctionWithThisObject.h
    M 
Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.h
    M 
Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunctionWithVariadic.cpp
    M 
Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunctionWithVariadic.h
    M Source/WebCore/bindings/scripts/test/JS/JSTestCallbackInterface.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestCallbackInterface.h
    M Source/WebCore/bindings/scripts/test/JS/JSTestConditionalIncludes.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestConditionallyReadWrite.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestDOMJIT.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestDefaultToJSON.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestDefaultToJSONInherit.cpp
    M 
Source/WebCore/bindings/scripts/test/JS/JSTestDefaultToJSONInheritFinal.cpp
    M 
Source/WebCore/bindings/scripts/test/JS/JSTestDelegateToSharedSyntheticAttribute.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestDerivedDictionary.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestDerivedDictionary.h
    M Source/WebCore/bindings/scripts/test/JS/JSTestDerivedDictionary2.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestDerivedDictionary2.h
    M Source/WebCore/bindings/scripts/test/JS/JSTestDictionary.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestDictionary.h
    M 
Source/WebCore/bindings/scripts/test/JS/JSTestDictionaryWithOnlyConditionalMembers.cpp
    M 
Source/WebCore/bindings/scripts/test/JS/JSTestDictionaryWithOnlyConditionalMembers.h
    M Source/WebCore/bindings/scripts/test/JS/JSTestDomainSecurity.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestEmptyDictionary.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestEmptyDictionary.h
    M Source/WebCore/bindings/scripts/test/JS/JSTestEnabledBySetting.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestEventConstructor.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestEventConstructor.h
    M Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestGlobalObject.cpp
    M 
Source/WebCore/bindings/scripts/test/JS/JSTestIndexedSetterNoIdentifier.cpp
    M 
Source/WebCore/bindings/scripts/test/JS/JSTestIndexedSetterThrowingException.cpp
    M 
Source/WebCore/bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestInheritedDictionary.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestInheritedDictionary.h
    M Source/WebCore/bindings/scripts/test/JS/JSTestInheritedDictionary2.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestInheritedDictionary2.h
    M Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestLegacyFactoryFunction.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestLegacyNoInterfaceObject.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestLegacyOverrideBuiltIns.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestMapLike.cpp
    M 
Source/WebCore/bindings/scripts/test/JS/JSTestMapLikeWithOverriddenOperations.cpp
    M 
Source/WebCore/bindings/scripts/test/JS/JSTestNamedAndIndexedSetterNoIdentifier.cpp
    M 
Source/WebCore/bindings/scripts/test/JS/JSTestNamedAndIndexedSetterThrowingException.cpp
    M 
Source/WebCore/bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.cpp
    M 
Source/WebCore/bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.cpp
    M 
Source/WebCore/bindings/scripts/test/JS/JSTestNamedGetterWithIdentifier.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterNoIdentifier.cpp
    M 
Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterThrowingException.cpp
    M 
Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.cpp
    M 
Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.cpp
    M 
Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.cpp
    M 
Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterWithLegacyOverrideBuiltIns.cpp
    M 
Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterWithLegacyUnforgeableProperties.cpp
    M 
Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterWithLegacyUnforgeablePropertiesAndLegacyOverrideBuiltIns.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestNamespaceObject.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestNode.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestObj.h
    M Source/WebCore/bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp
    M 
Source/WebCore/bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestPromiseRejectionEvent.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestPromiseRejectionEvent.h
    M Source/WebCore/bindings/scripts/test/JS/JSTestReadOnlyMapLike.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestReadOnlySetLike.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestScheduledAction.cpp
    M 
Source/WebCore/bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestSetLike.cpp
    M 
Source/WebCore/bindings/scripts/test/JS/JSTestSetLikeWithOverriddenOperations.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestStandaloneDictionary.h
    M Source/WebCore/bindings/scripts/test/JS/JSTestStringContext.cpp
    M 
Source/WebCore/bindings/scripts/test/JS/JSTestStringifierReadWriteAttribute.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestVoidCallbackFunction.h
    M Source/WebCore/crypto/SubtleCrypto.cpp
    M Source/WebCore/css/CSSStyleSheetObservableArray.cpp
    M Source/WebCore/html/HTMLCanvasElement.cpp
    M Source/WebCore/html/OffscreenCanvas.cpp
    M Source/WebCore/inspector/InspectorCanvas.cpp
    M Source/WebCore/inspector/InspectorCanvasCallTracer.h
    M Source/WebCore/worklets/PaintWorkletGlobalScope.cpp
    M Source/WebKit/WebProcess/Network/WebTransportSendStreamSink.cpp

  Log Message:
  -----------
  Introduce a concrete result type for JSValue -> Implementation conversions
https://bugs.webkit.org/show_bug.cgi?id=274682

Reviewed by Ryosuke Niwa.

Introduces "ConversionResult" a template type that serves as the return value
for all the JSValue -> Implementation conversion functions. It acts much like
ExceptionOr, is even implemented similarly on top of Expected, but instead of
storing either a result or the exception information, it stores the result or
a token indicating an exception exists on the JS stack.

The goal of this type is to allow conversions to non-default initializable
types, crucially, dictionaries and unions with Ref members. This introductory
change does not utilize that, but rather has deferred that to a follow up.

This change is mostly comprised of:

- Updating the code generator to handle the new return type.
- Updating JSDOM* converters to return the new type.
- Update non-generated uses of the convert<...> family of functions to handle
  the new result type.

* Source/WTF/wtf/TrailingArray.h:
(WTF::TrailingArray::TrailingArray):
    - Ensure the destructors don't run on the uninitialized elements when
      initializing trailing array's from a generator.

* Source/WebCore/Headers.cmake:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
    - Add new files

* Source/WebCore/bindings/scripts/CodeGeneratorJS.pm:
    - Update code generation to handle new conversion result type.

* Source/WebCore/bindings/IDLTypes.h:
    - Add new trait types ConversionResultType and NullableConversionResultType
      to allow customization of the storage in ConversionResult for that type.

    - Also adds a new IDLOptional type that the generator uses to streamline
      optional arguments and optional dictionary members.

* Source/WebCore/bindings/js/JSDOMConvertResult.h: Added.
    - New result type.

* Source/WebCore/bindings/js/JSCallbackData.h:
    - Callback functions and interfaces now generate a 
JSDOMCallbackConverterTraits
      instance to allow generic mapping from the JS callback type to the 
implementation
      callback type.

* Source/WebCore/bindings/js/JSDOMConvertAny.h:
* Source/WebCore/bindings/js/JSDOMConvertBase.h:
* Source/WebCore/bindings/js/JSDOMConvertBoolean.h:
* Source/WebCore/bindings/js/JSDOMConvertBufferSource.h:
* Source/WebCore/bindings/js/JSDOMConvertCallbacks.h:
* Source/WebCore/bindings/js/JSDOMConvertDate.h:
* Source/WebCore/bindings/js/JSDOMConvertDictionary.h:
* Source/WebCore/bindings/js/JSDOMConvertEnumeration.h:
* Source/WebCore/bindings/js/JSDOMConvertEventListener.h:
* Source/WebCore/bindings/js/JSDOMConvertInterface.h:
* Source/WebCore/bindings/js/JSDOMConvertJSON.h:
* Source/WebCore/bindings/js/JSDOMConvertNull.h:
* Source/WebCore/bindings/js/JSDOMConvertNullable.h:
* Source/WebCore/bindings/js/JSDOMConvertNumbers.cpp:
* Source/WebCore/bindings/js/JSDOMConvertNumbers.h:
* Source/WebCore/bindings/js/JSDOMConvertObject.h:
* Source/WebCore/bindings/js/JSDOMConvertOptional.h:
* Source/WebCore/bindings/js/JSDOMConvertPromise.h:
* Source/WebCore/bindings/js/JSDOMConvertRecord.h:
* Source/WebCore/bindings/js/JSDOMConvertScheduledAction.h:
* Source/WebCore/bindings/js/JSDOMConvertSequences.h:
* Source/WebCore/bindings/js/JSDOMConvertSerializedScriptValue.h:
* Source/WebCore/bindings/js/JSDOMConvertXPathNSResolver.h:
* Source/WebCore/bindings/js/JSDOMConvertStrings.cpp:
* Source/WebCore/bindings/js/JSDOMConvertStrings.h:
    - Update to return new ConversionResult type.

    - Where there was a lot of unnecessary repetition, such as typed arrays,
      strings and numbers, intermediary converters were added to help reduce
      the overhead.

* Source/WebCore/bindings/js/JSDOMConvertUnion.h:
    - In addition to updating to the new result type, some simplification was
      done using constexpr to replace "Conditional*" meta-functions.

* Source/WebCore/bindings/js/JSDOMConvertVariadic.h:
    - Updated to use the recently introduced 
FixedVector::createWithSizeFromGenerator,
      which allows creation with non-default constructible arguments that can 
fail.

* Source/WebCore/Modules/applepay-ams-ui/ApplePayAMSUIPaymentHandler.cpp:
* Source/WebCore/Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
* Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp:
* Source/WebCore/Modules/mediastream/RTCRtpSFrameTransform.cpp:
* Source/WebCore/Modules/mediastream/RTCRtpScriptTransformer.cpp:
* Source/WebCore/Modules/paymentrequest/PaymentRequest.cpp:
* Source/WebCore/Modules/permissions/Permissions.cpp:
* Source/WebCore/Modules/streams/TransformStream.cpp:
* Source/WebCore/Modules/webaudio/AudioWorkletGlobalScope.cpp:
* Source/WebCore/Modules/webtransport/DatagramSink.cpp:
* Source/WebCore/animation/KeyframeEffect.cpp:
* Source/WebCore/bindings/js/InternalReadableStream.cpp:
* Source/WebCore/bindings/js/JSCustomElementRegistryCustom.cpp:
* Source/WebCore/bindings/js/JSDOMWindowCustom.cpp:
* Source/WebCore/bindings/js/JSDocumentCustom.cpp:
* Source/WebCore/bindings/js/JSElementCustom.cpp:
* Source/WebCore/bindings/js/JSElementInternalsCustom.cpp:
* Source/WebCore/bindings/js/JSEventListener.cpp:
* Source/WebCore/bindings/js/JSExtendableMessageEventCustom.cpp:
* Source/WebCore/bindings/js/JSNodeIteratorCustom.cpp:
* Source/WebCore/bindings/js/JSRTCRtpSFrameTransformCustom.cpp:
* Source/WebCore/bindings/js/JSTreeWalkerCustom.cpp:
* Source/WebCore/bindings/js/JSWebAnimationCustom.cpp:
* Source/WebCore/crypto/SubtleCrypto.cpp:
* Source/WebCore/css/CSSStyleSheetObservableArray.cpp:
* Source/WebCore/html/HTMLCanvasElement.cpp:
* Source/WebCore/html/OffscreenCanvas.cpp:
* Source/WebCore/inspector/InspectorCanvas.cpp:
* Source/WebCore/inspector/InspectorCanvasCallTracer.h:
* Source/WebCore/worklets/PaintWorkletGlobalScope.cpp:
* Source/WebKit/WebProcess/Network/WebTransportSendStreamSink.cpp:
    - Update account for new result types.

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to