-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce a concrete result type for JSValue -> Implementation conversions #29085
Introduce a concrete result type for JSValue -> Implementation conversions #29085
Conversation
EWS run on previous version of this PR (hash 4294501) |
4294501
to
3d7ddba
Compare
EWS run on previous version of this PR (hash 3d7ddba) |
3d7ddba
to
91ca944
Compare
EWS run on previous version of this PR (hash 91ca944) |
91ca944
to
bf3b064
Compare
EWS run on previous version of this PR (hash bf3b064) |
bf3b064
to
b15a379
Compare
EWS run on previous version of this PR (hash b15a379) |
b15a379
to
720aa32
Compare
EWS run on previous version of this PR (hash 720aa32) |
720aa32
to
c2de37b
Compare
EWS run on current version of this PR (hash c2de37b) |
…sions 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
c2de37b
to
9a160ff
Compare
Committed 279321@main (9a160ff): https://commits.webkit.org/279321@main Reviewed commits have been landed. Closing PR #29085 and removing active labels. |
9a160ff
c2de37b
🧪 wpe-wk2🧪 ios-wk2🧪 ios-wk2-wpt🧪 api-ios🧪 mac-AS-debug-wk2🧪 gtk-wk2🧪 api-gtk