Changeset 267007 in webkit


Ignore:
Timestamp:
Sep 13, 2020 5:00:42 PM (4 years ago)
Author:
weinig@apple.com
Message:

[WebIDL] Remove need for [MayThrowException] on constructors and legacy factory functions
https://bugs.webkit.org/show_bug.cgi?id=216442

Reviewed by Darin Adler.

Deduce implementation potentially throwing by using the existing overload of
toJSNewlyCreated that conditionally checks for exceptions based on the return
type. constexpr IsExceptionOr to maintain existing optimizations around conditional
calls to RETURN_IF_EXCEPTION.

  • bindings/scripts/CodeGeneratorJS.pm:

(GenerateConstructorDefinition):
Update code generation to output code that can handle constructors that return either
ExceptionOr or not. Maintain existing static assertion that the underlying return type
is a Ref<> using std::conditional_t predicated on IsExceptionOr and maintain the existing
optimization to not check for an exception after toJSNewlyCreated if one could not have
been made by again utilizing IsExceptionOr.

  • bindings/scripts/IDLAttributes.json:

Remove [LegacyFactoryFunctionMayThrowException] now that it is not needed.

  • Modules/applepay/ApplePaySession.idl:
  • Modules/encryptedmedia/legacy/WebKitMediaKeys.idl:
  • Modules/fetch/FetchHeaders.idl:
  • Modules/fetch/FetchRequest.idl:
  • Modules/fetch/FetchResponse.idl:
  • Modules/mediarecorder/MediaRecorder.idl:
  • Modules/mediastream/RTCIceCandidate.idl:
  • Modules/mediastream/RTCPeerConnection.idl:
  • Modules/paymentrequest/MerchantValidationEvent.idl:
  • Modules/paymentrequest/PaymentRequest.idl:
  • Modules/webaudio/AnalyserNode.idl:
  • Modules/webaudio/AudioBuffer.idl:
  • Modules/webaudio/AudioBufferSourceNode.idl:
  • Modules/webaudio/AudioContext.idl:
  • Modules/webaudio/BiquadFilterNode.idl:
  • Modules/webaudio/ChannelMergerNode.idl:
  • Modules/webaudio/ChannelSplitterNode.idl:
  • Modules/webaudio/ConstantSourceNode.idl:
  • Modules/webaudio/ConvolverNode.idl:
  • Modules/webaudio/DelayNode.idl:
  • Modules/webaudio/DynamicsCompressorNode.idl:
  • Modules/webaudio/GainNode.idl:
  • Modules/webaudio/IIRFilterNode.idl:
  • Modules/webaudio/MediaElementAudioSourceNode.idl:
  • Modules/webaudio/MediaStreamAudioDestinationNode.idl:
  • Modules/webaudio/MediaStreamAudioSourceNode.idl:
  • Modules/webaudio/OfflineAudioContext.idl:
  • Modules/webaudio/OscillatorNode.idl:
  • Modules/webaudio/PannerNode.idl:
  • Modules/webaudio/PeriodicWave.idl:
  • Modules/webaudio/StereoPannerNode.idl:
  • Modules/webaudio/WaveShaperNode.idl:
  • Modules/webaudio/WebKitAudioContext.idl:
  • Modules/webaudio/WebKitOfflineAudioContext.idl:
  • Modules/websockets/WebSocket.idl:
  • Modules/webxr/WebXRRigidTransform.idl:
  • Modules/webxr/WebXRWebGLLayer.idl:
  • animation/KeyframeEffect.idl:
  • css/DOMMatrix.idl:
  • css/DOMMatrixReadOnly.idl:
  • css/WebKitCSSMatrix.idl:
  • dom/StaticRange.idl:
  • dom/TextDecoder.idl:
  • dom/TextDecoderStreamDecoder.idl:
  • html/DOMURL.idl:
  • html/HTMLOptionElement.h:
  • html/HTMLOptionElement.idl:
  • html/ImageData.idl:
  • html/URLSearchParams.idl:
  • html/track/TextTrackCue.idl:
  • page/EventSource.idl:
  • page/IntersectionObserver.idl:
  • workers/Worker.idl:

Remove all uses of [LegacyFactoryFunctionMayThrowException] and [MayThrowException]
on constructors.

  • html/HTMLAudioElement.cpp:

(WebCore::HTMLAudioElement::createForLegacyFactoryFunction):
(WebCore::HTMLAudioElement::createForJSConstructor): Deleted.

  • html/HTMLAudioElement.h:
  • html/HTMLImageElement.cpp:

(WebCore::HTMLImageElement::createForLegacyFactoryFunction):
(WebCore::HTMLImageElement::createForJSConstructor): Deleted.

  • html/HTMLImageElement.h:
  • html/HTMLOptionElement.cpp:

(WebCore::HTMLOptionElement::createForLegacyFactoryFunction):
(WebCore::HTMLOptionElement::createForJSConstructor): Deleted.
Renamed createForJSConstructor to createForLegacyFactoryFunction to better
match current WebIDL terminology.

  • bindings/scripts/test/JS/JSExposedToWorkerAndWindow.cpp:

(WebCore::JSExposedToWorkerAndWindowConstructor::construct):

  • bindings/scripts/test/JS/JSTestEventConstructor.cpp:

(WebCore::JSTestEventConstructorConstructor::construct):

  • bindings/scripts/test/JS/JSTestInterface.cpp:

(WebCore::JSTestInterfaceConstructor::construct):

  • bindings/scripts/test/JS/JSTestLegacyFactoryFunction.cpp:

(WebCore::JSTestLegacyFactoryFunctionLegacyFactoryFunction::construct):

  • bindings/scripts/test/JS/JSTestNode.cpp:

(WebCore::JSTestNodeConstructor::construct):

  • bindings/scripts/test/JS/JSTestObj.cpp:

(WebCore::JSTestObjConstructor::construct):

  • bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:

(WebCore::constructJSTestOverloadedConstructors1):
(WebCore::constructJSTestOverloadedConstructors2):
(WebCore::constructJSTestOverloadedConstructors3):
(WebCore::constructJSTestOverloadedConstructors4):
(WebCore::constructJSTestOverloadedConstructors5):

  • bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:

(WebCore::constructJSTestOverloadedConstructorsWithSequence1):
(WebCore::constructJSTestOverloadedConstructorsWithSequence2):

  • bindings/scripts/test/JS/JSTestPromiseRejectionEvent.cpp:

(WebCore::JSTestPromiseRejectionEventConstructor::construct):

  • bindings/scripts/test/JS/JSTestTypedefs.cpp:

(WebCore::JSTestTypedefsConstructor::construct):

  • bindings/scripts/test/TestLegacyFactoryFunction.idl:

Update tests/expectations.

Location:
trunk/Source/WebCore
Files:
76 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r267006 r267007  
     12020-09-13  Sam Weinig  <weinig@apple.com>
     2
     3        [WebIDL] Remove need for [MayThrowException] on constructors and legacy factory functions
     4        https://bugs.webkit.org/show_bug.cgi?id=216442
     5
     6        Reviewed by Darin Adler.
     7
     8        Deduce implementation potentially throwing by using the existing overload of
     9        toJSNewlyCreated that conditionally checks for exceptions based on the return
     10        type. constexpr IsExceptionOr to maintain existing optimizations around conditional
     11        calls to RETURN_IF_EXCEPTION.
     12
     13        * bindings/scripts/CodeGeneratorJS.pm:
     14        (GenerateConstructorDefinition):
     15        Update code generation to output code that can handle constructors that return either
     16        ExceptionOr or not. Maintain existing static assertion that the underlying return type
     17        is a Ref<> using std::conditional_t predicated on IsExceptionOr and maintain the existing
     18        optimization to not check for an exception after toJSNewlyCreated if one could not have
     19        been made by again utilizing IsExceptionOr.
     20
     21        * bindings/scripts/IDLAttributes.json:
     22        Remove [LegacyFactoryFunctionMayThrowException] now that it is not needed.
     23
     24        * Modules/applepay/ApplePaySession.idl:
     25        * Modules/encryptedmedia/legacy/WebKitMediaKeys.idl:
     26        * Modules/fetch/FetchHeaders.idl:
     27        * Modules/fetch/FetchRequest.idl:
     28        * Modules/fetch/FetchResponse.idl:
     29        * Modules/mediarecorder/MediaRecorder.idl:
     30        * Modules/mediastream/RTCIceCandidate.idl:
     31        * Modules/mediastream/RTCPeerConnection.idl:
     32        * Modules/paymentrequest/MerchantValidationEvent.idl:
     33        * Modules/paymentrequest/PaymentRequest.idl:
     34        * Modules/webaudio/AnalyserNode.idl:
     35        * Modules/webaudio/AudioBuffer.idl:
     36        * Modules/webaudio/AudioBufferSourceNode.idl:
     37        * Modules/webaudio/AudioContext.idl:
     38        * Modules/webaudio/BiquadFilterNode.idl:
     39        * Modules/webaudio/ChannelMergerNode.idl:
     40        * Modules/webaudio/ChannelSplitterNode.idl:
     41        * Modules/webaudio/ConstantSourceNode.idl:
     42        * Modules/webaudio/ConvolverNode.idl:
     43        * Modules/webaudio/DelayNode.idl:
     44        * Modules/webaudio/DynamicsCompressorNode.idl:
     45        * Modules/webaudio/GainNode.idl:
     46        * Modules/webaudio/IIRFilterNode.idl:
     47        * Modules/webaudio/MediaElementAudioSourceNode.idl:
     48        * Modules/webaudio/MediaStreamAudioDestinationNode.idl:
     49        * Modules/webaudio/MediaStreamAudioSourceNode.idl:
     50        * Modules/webaudio/OfflineAudioContext.idl:
     51        * Modules/webaudio/OscillatorNode.idl:
     52        * Modules/webaudio/PannerNode.idl:
     53        * Modules/webaudio/PeriodicWave.idl:
     54        * Modules/webaudio/StereoPannerNode.idl:
     55        * Modules/webaudio/WaveShaperNode.idl:
     56        * Modules/webaudio/WebKitAudioContext.idl:
     57        * Modules/webaudio/WebKitOfflineAudioContext.idl:
     58        * Modules/websockets/WebSocket.idl:
     59        * Modules/webxr/WebXRRigidTransform.idl:
     60        * Modules/webxr/WebXRWebGLLayer.idl:
     61        * animation/KeyframeEffect.idl:
     62        * css/DOMMatrix.idl:
     63        * css/DOMMatrixReadOnly.idl:
     64        * css/WebKitCSSMatrix.idl:
     65        * dom/StaticRange.idl:
     66        * dom/TextDecoder.idl:
     67        * dom/TextDecoderStreamDecoder.idl:
     68        * html/DOMURL.idl:
     69        * html/HTMLOptionElement.h:
     70        * html/HTMLOptionElement.idl:
     71        * html/ImageData.idl:
     72        * html/URLSearchParams.idl:
     73        * html/track/TextTrackCue.idl:
     74        * page/EventSource.idl:
     75        * page/IntersectionObserver.idl:
     76        * workers/Worker.idl:
     77        Remove all uses of [LegacyFactoryFunctionMayThrowException] and [MayThrowException]
     78        on constructors.
     79
     80        * html/HTMLAudioElement.cpp:
     81        (WebCore::HTMLAudioElement::createForLegacyFactoryFunction):
     82        (WebCore::HTMLAudioElement::createForJSConstructor): Deleted.
     83        * html/HTMLAudioElement.h:
     84        * html/HTMLImageElement.cpp:
     85        (WebCore::HTMLImageElement::createForLegacyFactoryFunction):
     86        (WebCore::HTMLImageElement::createForJSConstructor): Deleted.
     87        * html/HTMLImageElement.h:
     88        * html/HTMLOptionElement.cpp:
     89        (WebCore::HTMLOptionElement::createForLegacyFactoryFunction):
     90        (WebCore::HTMLOptionElement::createForJSConstructor): Deleted.
     91        Renamed createForJSConstructor to createForLegacyFactoryFunction to better
     92        match current WebIDL terminology.
     93
     94        * bindings/scripts/test/JS/JSExposedToWorkerAndWindow.cpp:
     95        (WebCore::JSExposedToWorkerAndWindowConstructor::construct):
     96        * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
     97        (WebCore::JSTestEventConstructorConstructor::construct):
     98        * bindings/scripts/test/JS/JSTestInterface.cpp:
     99        (WebCore::JSTestInterfaceConstructor::construct):
     100        * bindings/scripts/test/JS/JSTestLegacyFactoryFunction.cpp:
     101        (WebCore::JSTestLegacyFactoryFunctionLegacyFactoryFunction::construct):
     102        * bindings/scripts/test/JS/JSTestNode.cpp:
     103        (WebCore::JSTestNodeConstructor::construct):
     104        * bindings/scripts/test/JS/JSTestObj.cpp:
     105        (WebCore::JSTestObjConstructor::construct):
     106        * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
     107        (WebCore::constructJSTestOverloadedConstructors1):
     108        (WebCore::constructJSTestOverloadedConstructors2):
     109        (WebCore::constructJSTestOverloadedConstructors3):
     110        (WebCore::constructJSTestOverloadedConstructors4):
     111        (WebCore::constructJSTestOverloadedConstructors5):
     112        * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:
     113        (WebCore::constructJSTestOverloadedConstructorsWithSequence1):
     114        (WebCore::constructJSTestOverloadedConstructorsWithSequence2):
     115        * bindings/scripts/test/JS/JSTestPromiseRejectionEvent.cpp:
     116        (WebCore::JSTestPromiseRejectionEventConstructor::construct):
     117        * bindings/scripts/test/JS/JSTestTypedefs.cpp:
     118        (WebCore::JSTestTypedefsConstructor::construct):
     119        * bindings/scripts/test/TestLegacyFactoryFunction.idl:
     120        Update tests/expectations.
     121
    11222020-09-13  Sam Weinig  <weinig@apple.com>
    2123
  • trunk/Source/WebCore/Modules/applepay/ApplePaySession.idl

    r266311 r267007  
    3030    EnabledForContext,
    3131] interface ApplePaySession : EventTarget {
    32     [CallWith=Document, MayThrowException] constructor(unsigned long version, ApplePayPaymentRequest paymentRequest);
     32    [CallWith=Document] constructor(unsigned long version, ApplePayPaymentRequest paymentRequest);
    3333
    3434    const unsigned short STATUS_SUCCESS = 0;
  • trunk/Source/WebCore/Modules/encryptedmedia/legacy/WebKitMediaKeys.idl

    r266360 r267007  
    2828    EnabledBySetting=LegacyEncryptedMediaAPI,
    2929] interface WebKitMediaKeys {
    30     [MayThrowException] constructor(DOMString keySystem);
     30    constructor(DOMString keySystem);
    3131
    3232    [CallWith=ScriptExecutionContext, MayThrowException] WebKitMediaKeySession createSession(DOMString type, Uint8Array initData);
  • trunk/Source/WebCore/Modules/fetch/FetchHeaders.idl

    r266311 r267007  
    3535    InterfaceName=Headers,
    3636] interface FetchHeaders {
    37     [MayThrowException] constructor(optional HeadersInit init);
     37    constructor(optional HeadersInit init);
    3838
    3939    [MayThrowException] undefined append(ByteString name, ByteString value);
  • trunk/Source/WebCore/Modules/fetch/FetchRequest.idl

    r266523 r267007  
    4040    InterfaceName=Request,
    4141] interface FetchRequest {
    42     [CallWith=ScriptExecutionContext, MayThrowException] constructor(RequestInfo input, optional FetchRequestInit init);
     42    [CallWith=ScriptExecutionContext] constructor(RequestInfo input, optional FetchRequestInit init);
    4343
    4444    readonly attribute ByteString method;
  • trunk/Source/WebCore/Modules/fetch/FetchResponse.idl

    r266523 r267007  
    4545    InterfaceName=Response,
    4646] interface FetchResponse {
    47     [CallWith=ScriptExecutionContext, MayThrowException] constructor(optional BodyInit? body = null, optional FetchResponseInit init);
     47    [CallWith=ScriptExecutionContext] constructor(optional BodyInit? body = null, optional FetchResponseInit init);
    4848
    4949    [CallWith=ScriptExecutionContext, NewObject] static FetchResponse error();
  • trunk/Source/WebCore/Modules/mediarecorder/MediaRecorder.idl

    r266360 r267007  
    3131    Exposed=Window
    3232] interface MediaRecorder : EventTarget {
    33     [CallWith=Document, MayThrowException] constructor(MediaStream stream, optional MediaRecorderOptions options);
     33    [CallWith=Document] constructor(MediaStream stream, optional MediaRecorderOptions options);
    3434
    3535    // FIXME: Implement commented out methods/attributes.
  • trunk/Source/WebCore/Modules/mediastream/RTCIceCandidate.idl

    r266698 r267007  
    3636    ImplementationLacksVTable,
    3737] interface RTCIceCandidate {
    38     [MayThrowException] constructor(RTCIceCandidateInit candidateInitDict);
     38    constructor(RTCIceCandidateInit candidateInitDict);
    3939
    4040    readonly attribute DOMString candidate;
  • trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.idl

    r266662 r267007  
    7777    ExportMacro=WEBCORE_EXPORT,
    7878] interface RTCPeerConnection : EventTarget {
    79     [CallWith=Document, MayThrowException] constructor(optional RTCConfiguration configuration);
     79    [CallWith=Document] constructor(optional RTCConfiguration configuration);
    8080
    8181    // 4.3.2 Interface Definition
  • trunk/Source/WebCore/Modules/paymentrequest/MerchantValidationEvent.idl

    r266311 r267007  
    3030    SecureContext,
    3131] interface MerchantValidationEvent : Event {
    32     [CallWith=Document, MayThrowException] constructor(DOMString type, optional MerchantValidationEventInit eventInitDict);
     32    [CallWith=Document] constructor(DOMString type, optional MerchantValidationEventInit eventInitDict);
    3333
    3434    readonly attribute DOMString methodName;
  • trunk/Source/WebCore/Modules/paymentrequest/PaymentRequest.idl

    r266311 r267007  
    3131    SecureContext,
    3232] interface PaymentRequest : EventTarget {
    33     [CallWith=Document, MayThrowException] constructor(sequence<PaymentMethodData> methodData, PaymentDetailsInit details, optional PaymentOptions options);
     33    [CallWith=Document] constructor(sequence<PaymentMethodData> methodData, PaymentDetailsInit details, optional PaymentOptions options);
    3434
    3535    [CallWith=Document] Promise<PaymentResponse> show(optional Promise<PaymentDetailsUpdate> detailsPromise);
  • trunk/Source/WebCore/Modules/webaudio/AnalyserNode.idl

    r266311 r267007  
    2727    JSGenerateToJSObject,
    2828] interface AnalyserNode : AudioNode {
    29     [MayThrowException, EnabledBySetting=ModernUnprefixedWebAudio] constructor (BaseAudioContext context, optional AnalyserOptions options);
     29    [EnabledBySetting=ModernUnprefixedWebAudio] constructor (BaseAudioContext context, optional AnalyserOptions options);
    3030
    3131    attribute unsigned long fftSize;
  • trunk/Source/WebCore/Modules/webaudio/AudioBuffer.idl

    r266311 r267007  
    3333    ReportExtraMemoryCost,
    3434] interface AudioBuffer {
    35     [MayThrowException, EnabledBySetting=ModernUnprefixedWebAudio] constructor(AudioBufferOptions options);
     35    [EnabledBySetting=ModernUnprefixedWebAudio] constructor(AudioBufferOptions options);
    3636    readonly attribute unsigned long length; // in sample-frames
    3737    readonly attribute double duration; // in seconds
  • trunk/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.idl

    r266616 r267007  
    2929    JSGenerateToJSObject,
    3030] interface AudioBufferSourceNode : AudioScheduledSourceNode {
    31     [MayThrowException, EnabledBySetting=ModernUnprefixedWebAudio] constructor (BaseAudioContext context, optional AudioBufferSourceOptions options);
     31    [EnabledBySetting=ModernUnprefixedWebAudio] constructor (BaseAudioContext context, optional AudioBufferSourceOptions options);
    3232
    3333    attribute AudioBuffer? buffer;
  • trunk/Source/WebCore/Modules/webaudio/AudioContext.idl

    r266311 r267007  
    3131    JSGenerateToNativeObject,
    3232] interface AudioContext : BaseAudioContext {
    33     [CallWith=Document, MayThrowException] constructor(optional AudioContextOptions contextOptions);
     33    [CallWith=Document] constructor(optional AudioContextOptions contextOptions);
    3434
    3535    readonly attribute double baseLatency;
  • trunk/Source/WebCore/Modules/webaudio/BiquadFilterNode.idl

    r266311 r267007  
    2828    JSGenerateToJSObject,
    2929] interface BiquadFilterNode : AudioNode {
    30     [MayThrowException, EnabledBySetting=ModernUnprefixedWebAudio] constructor (BaseAudioContext context, optional BiquadFilterOptions options);
     30    [EnabledBySetting=ModernUnprefixedWebAudio] constructor (BaseAudioContext context, optional BiquadFilterOptions options);
    3131
    3232    attribute BiquadFilterType type;
  • trunk/Source/WebCore/Modules/webaudio/ChannelMergerNode.idl

    r265066 r267007  
    3131    JSGenerateToJSObject
    3232] interface ChannelMergerNode : AudioNode {
    33     [MayThrowException, EnabledBySetting=ModernUnprefixedWebAudio] constructor (BaseAudioContext context, optional ChannelMergerOptions options);
     33    [EnabledBySetting=ModernUnprefixedWebAudio] constructor (BaseAudioContext context, optional ChannelMergerOptions options);
    3434};
  • trunk/Source/WebCore/Modules/webaudio/ChannelSplitterNode.idl

    r265066 r267007  
    2727    JSGenerateToJSObject
    2828] interface ChannelSplitterNode : AudioNode {
    29     [MayThrowException, EnabledBySetting=ModernUnprefixedWebAudio] constructor (BaseAudioContext context, optional ChannelSplitterOptions options);
     29    [EnabledBySetting=ModernUnprefixedWebAudio] constructor (BaseAudioContext context, optional ChannelSplitterOptions options);
    3030};
  • trunk/Source/WebCore/Modules/webaudio/ConstantSourceNode.idl

    r265689 r267007  
    2929    EnabledBySetting=ModernUnprefixedWebAudio
    3030] interface ConstantSourceNode : AudioScheduledSourceNode {
    31     [MayThrowException] constructor (BaseAudioContext context, optional ConstantSourceOptions options);
     31    constructor (BaseAudioContext context, optional ConstantSourceOptions options);
    3232    readonly attribute AudioParam offset;
    3333};
  • trunk/Source/WebCore/Modules/webaudio/ConvolverNode.idl

    r265298 r267007  
    2929    JSGenerateToJSObject
    3030] interface ConvolverNode : AudioNode {
    31     [MayThrowException, EnabledBySetting=ModernUnprefixedWebAudio] constructor (BaseAudioContext context, optional ConvolverOptions options);
     31    [EnabledBySetting=ModernUnprefixedWebAudio] constructor (BaseAudioContext context, optional ConvolverOptions options);
    3232
    3333    attribute AudioBuffer? buffer;
  • trunk/Source/WebCore/Modules/webaudio/DelayNode.idl

    r265221 r267007  
    2727    JSGenerateToJSObject
    2828] interface DelayNode : AudioNode {
    29     [MayThrowException, EnabledBySetting=ModernUnprefixedWebAudio] constructor (BaseAudioContext context, optional DelayOptions options);
     29    [EnabledBySetting=ModernUnprefixedWebAudio] constructor (BaseAudioContext context, optional DelayOptions options);
    3030
    3131    readonly attribute AudioParam delayTime;
  • trunk/Source/WebCore/Modules/webaudio/DynamicsCompressorNode.idl

    r265336 r267007  
    2828    JSGenerateToJSObject
    2929] interface DynamicsCompressorNode : AudioNode {
    30     [MayThrowException, EnabledBySetting=ModernUnprefixedWebAudio] constructor (BaseAudioContext context, optional DynamicsCompressorOptions options);
     30    [EnabledBySetting=ModernUnprefixedWebAudio] constructor (BaseAudioContext context, optional DynamicsCompressorOptions options);
    3131
    3232    readonly attribute AudioParam threshold; // in Decibels
  • trunk/Source/WebCore/Modules/webaudio/GainNode.idl

    r265227 r267007  
    2727    JSGenerateToJSObject
    2828] interface GainNode : AudioNode {
    29     [MayThrowException, EnabledBySetting=ModernUnprefixedWebAudio] constructor (BaseAudioContext context, optional GainOptions options);
     29    [EnabledBySetting=ModernUnprefixedWebAudio] constructor (BaseAudioContext context, optional GainOptions options);
    3030
    3131    readonly attribute AudioParam gain;
  • trunk/Source/WebCore/Modules/webaudio/IIRFilterNode.idl

    r266311 r267007  
    2828    EnabledBySetting=ModernUnprefixedWebAudio,
    2929] interface IIRFilterNode : AudioNode {
    30     [MayThrowException, CallWith=ScriptExecutionContext] constructor(BaseAudioContext audioContext, IIRFilterOptions options);
     30    [CallWith=ScriptExecutionContext] constructor(BaseAudioContext audioContext, IIRFilterOptions options);
    3131    [MayThrowException] undefined getFrequencyResponse(Float32Array frequencyHz, Float32Array magResponse, Float32Array phaseResponse);
    3232};
  • trunk/Source/WebCore/Modules/webaudio/MediaElementAudioSourceNode.idl

    r265330 r267007  
    2828    JSGenerateToJSObject
    2929] interface MediaElementAudioSourceNode : AudioNode {
    30     [MayThrowException, EnabledBySetting=ModernUnprefixedWebAudio] constructor (AudioContext context, MediaElementAudioSourceOptions options);
     30    [EnabledBySetting=ModernUnprefixedWebAudio] constructor (AudioContext context, MediaElementAudioSourceOptions options);
    3131
    3232    readonly attribute HTMLMediaElement mediaElement;
  • trunk/Source/WebCore/Modules/webaudio/MediaStreamAudioDestinationNode.idl

    r265347 r267007  
    2727    JSGenerateToJSObject
    2828] interface MediaStreamAudioDestinationNode : AudioNode {
    29     [MayThrowException, EnabledBySetting=ModernUnprefixedWebAudio] constructor (AudioContext context, optional AudioNodeOptions options);
     29    [EnabledBySetting=ModernUnprefixedWebAudio] constructor (AudioContext context, optional AudioNodeOptions options);
    3030    readonly attribute MediaStream stream;
    3131};
  • trunk/Source/WebCore/Modules/webaudio/MediaStreamAudioSourceNode.idl

    r265342 r267007  
    2727    JSGenerateToJSObject
    2828] interface MediaStreamAudioSourceNode : AudioNode {
    29     [MayThrowException, EnabledBySetting=ModernUnprefixedWebAudio] constructor (AudioContext context, MediaStreamAudioSourceOptions options);
     29    [EnabledBySetting=ModernUnprefixedWebAudio] constructor (AudioContext context, MediaStreamAudioSourceOptions options);
    3030
    3131    readonly attribute MediaStream mediaStream;
  • trunk/Source/WebCore/Modules/webaudio/OfflineAudioContext.idl

    r266311 r267007  
    2828    JSGenerateToJSObject,
    2929] interface OfflineAudioContext : BaseAudioContext {
    30     [CallWith=ScriptExecutionContext, MayThrowException] constructor(OfflineAudioContextOptions contextOptions);
    31     [CallWith=ScriptExecutionContext, MayThrowException] constructor(unsigned long numberOfChannels, unsigned long length, float sampleRate);
     30    [CallWith=ScriptExecutionContext] constructor(OfflineAudioContextOptions contextOptions);
     31    [CallWith=ScriptExecutionContext] constructor(unsigned long numberOfChannels, unsigned long length, float sampleRate);
    3232   
    3333    [ImplementedAs=startOfflineRendering] Promise<AudioBuffer> startRendering();
  • trunk/Source/WebCore/Modules/webaudio/OscillatorNode.idl

    r266616 r267007  
    2929    ActiveDOMObject,
    3030] interface OscillatorNode : AudioScheduledSourceNode {
    31     [MayThrowException, EnabledBySetting=ModernUnprefixedWebAudio] constructor (BaseAudioContext context, optional OscillatorOptions options);
     31    [EnabledBySetting=ModernUnprefixedWebAudio] constructor (BaseAudioContext context, optional OscillatorOptions options);
    3232
    3333    attribute OscillatorType type;
  • trunk/Source/WebCore/Modules/webaudio/PannerNode.idl

    r266319 r267007  
    2828    EnabledBySetting=ModernUnprefixedWebAudio,
    2929] interface PannerNode : AudioNode {
    30     [MayThrowException] constructor (BaseAudioContext context, optional PannerOptions options);
     30    constructor (BaseAudioContext context, optional PannerOptions options);
    3131
    3232    // Default model for stereo is equalpower
  • trunk/Source/WebCore/Modules/webaudio/PeriodicWave.idl

    r264782 r267007  
    2828    ImplementationLacksVTable
    2929] interface PeriodicWave {
    30     [MayThrowException, EnabledBySetting=ModernUnprefixedWebAudio] constructor(BaseAudioContext context, optional PeriodicWaveOptions options);
     30    [EnabledBySetting=ModernUnprefixedWebAudio] constructor(BaseAudioContext context, optional PeriodicWaveOptions options);
    3131};
  • trunk/Source/WebCore/Modules/webaudio/StereoPannerNode.idl

    r265962 r267007  
    2929    EnabledBySetting=ModernUnprefixedWebAudio
    3030] interface StereoPannerNode : AudioNode {
    31     [MayThrowException] constructor (BaseAudioContext context, optional StereoPannerOptions options);
     31    constructor (BaseAudioContext context, optional StereoPannerOptions options);
    3232    readonly attribute AudioParam pan;
    3333};
  • trunk/Source/WebCore/Modules/webaudio/WaveShaperNode.idl

    r265152 r267007  
    2727    JSGenerateToJSObject
    2828] interface WaveShaperNode : AudioNode {
    29     [MayThrowException, EnabledBySetting=ModernUnprefixedWebAudio] constructor(BaseAudioContext context, optional WaveShaperOptions options);
     29    [EnabledBySetting=ModernUnprefixedWebAudio] constructor(BaseAudioContext context, optional WaveShaperOptions options);
    3030
    3131    attribute Float32Array? curve;
  • trunk/Source/WebCore/Modules/webaudio/WebKitAudioContext.idl

    r266311 r267007  
    3131    InterfaceName=webkitAudioContext,
    3232] interface WebKitAudioContext : EventTarget {
    33     [CallWith=Document, MayThrowException] constructor();
     33    [CallWith=Document] constructor();
    3434
    3535    // All rendered audio ultimately connects to destination, which represents the audio hardware.
  • trunk/Source/WebCore/Modules/webaudio/WebKitOfflineAudioContext.idl

    r263270 r267007  
    2929    JSGenerateToJSObject,
    3030] interface WebKitOfflineAudioContext : WebKitAudioContext {
    31     [CallWith=ScriptExecutionContext, MayThrowException] constructor(unsigned long numberOfChannels, unsigned long numberOfFrames, unrestricted float sampleRate);
     31    [CallWith=ScriptExecutionContext] constructor(unsigned long numberOfChannels, unsigned long numberOfFrames, unrestricted float sampleRate);
    3232};
  • trunk/Source/WebCore/Modules/websockets/WebSocket.idl

    r266311 r267007  
    3535    EnabledAtRuntime=WebSocket
    3636] interface WebSocket : EventTarget {
    37     [CallWith=ScriptExecutionContext, MayThrowException] constructor(USVString url, optional sequence<DOMString> protocols = []);
    38     [CallWith=ScriptExecutionContext, MayThrowException] constructor(USVString url, DOMString protocol);
     37    [CallWith=ScriptExecutionContext] constructor(USVString url, optional sequence<DOMString> protocols = []);
     38    [CallWith=ScriptExecutionContext] constructor(USVString url, DOMString protocol);
    3939
    4040    readonly attribute USVString URL; // Lowercased .url is the one in the spec, but leaving .URL for compatibility reasons.
  • trunk/Source/WebCore/Modules/webxr/WebXRRigidTransform.idl

    r263160 r267007  
    3232    InterfaceName=XRRigidTransform
    3333] interface WebXRRigidTransform {
    34     [MayThrowException] constructor(optional DOMPointInit position, optional DOMPointInit orientation);
     34    constructor(optional DOMPointInit position, optional DOMPointInit orientation);
    3535
    3636    [SameObject] readonly attribute DOMPointReadOnly position;
  • trunk/Source/WebCore/Modules/webxr/WebXRWebGLLayer.idl

    r263403 r267007  
    3939    InterfaceName=XRWebGLLayer
    4040] interface WebXRWebGLLayer : WebXRLayer {
    41     [MayThrowException] constructor(WebXRSession session, WebXRWebGLRenderingContext context, optional XRWebGLLayerInit layerInit);
     41    constructor(WebXRSession session, WebXRWebGLRenderingContext context, optional XRWebGLLayerInit layerInit);
    4242
    4343    // Attributes
  • trunk/Source/WebCore/animation/KeyframeEffect.idl

    r266311 r267007  
    3131    JSGenerateToNativeObject,
    3232] interface KeyframeEffect : AnimationEffect {
    33     [CallWith=GlobalObject, MayThrowException] constructor(Element? target, object? keyframes, optional (unrestricted double or KeyframeEffectOptions) options);
    34     [CallWith=GlobalObject, MayThrowException] constructor(KeyframeEffect source);
     33    [CallWith=GlobalObject] constructor(Element? target, object? keyframes, optional (unrestricted double or KeyframeEffectOptions) options);
     34    [CallWith=GlobalObject] constructor(KeyframeEffect source);
    3535
    3636    attribute Element? target;
  • trunk/Source/WebCore/bindings/js/JSDOMAbstractOperations.h

    r266983 r267007  
    124124    using ReturnType = std::invoke_result_t<Functor>;
    125125
    126     if constexpr (IsExceptionOr<ReturnType>::value) {
     126    if constexpr (IsExceptionOr<ReturnType>) {
    127127        auto result = functor();
    128128        if (result.hasException()) {
  • trunk/Source/WebCore/bindings/js/JSDOMConvertBase.h

    r266999 r267007  
    9595template<typename T, typename U> inline JSC::JSValue toJS(JSC::JSGlobalObject&, JSDOMGlobalObject&, U&&);
    9696template<typename T, typename U> inline JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject&, JSDOMGlobalObject&, U&&);
    97 template<typename T, typename U> inline auto toJS(JSC::JSGlobalObject&, JSC::ThrowScope&, U&&) -> std::enable_if_t<IsExceptionOr<U>::value, JSC::JSValue>;
    98 template<typename T, typename U> inline auto toJS(JSC::JSGlobalObject&, JSC::ThrowScope&, U&&) -> std::enable_if_t<!IsExceptionOr<U>::value, JSC::JSValue>;
    99 template<typename T, typename U> inline auto toJS(JSC::JSGlobalObject&, JSDOMGlobalObject&, JSC::ThrowScope&, U&&) -> std::enable_if_t<IsExceptionOr<U>::value, JSC::JSValue>;
    100 template<typename T, typename U> inline auto toJS(JSC::JSGlobalObject&, JSDOMGlobalObject&, JSC::ThrowScope&, U&&) -> std::enable_if_t<!IsExceptionOr<U>::value, JSC::JSValue>;
    101 template<typename T, typename U> inline auto toJSNewlyCreated(JSC::JSGlobalObject&, JSDOMGlobalObject&, JSC::ThrowScope&, U&&) -> std::enable_if_t<IsExceptionOr<U>::value, JSC::JSValue>;
    102 template<typename T, typename U> inline auto toJSNewlyCreated(JSC::JSGlobalObject&, JSDOMGlobalObject&, JSC::ThrowScope&, U&&) -> std::enable_if_t<!IsExceptionOr<U>::value, JSC::JSValue>;
     97template<typename T, typename U> inline auto toJS(JSC::JSGlobalObject&, JSC::ThrowScope&, U&&) -> std::enable_if_t<IsExceptionOr<U>, JSC::JSValue>;
     98template<typename T, typename U> inline auto toJS(JSC::JSGlobalObject&, JSC::ThrowScope&, U&&) -> std::enable_if_t<!IsExceptionOr<U>, JSC::JSValue>;
     99template<typename T, typename U> inline auto toJS(JSC::JSGlobalObject&, JSDOMGlobalObject&, JSC::ThrowScope&, U&&) -> std::enable_if_t<IsExceptionOr<U>, JSC::JSValue>;
     100template<typename T, typename U> inline auto toJS(JSC::JSGlobalObject&, JSDOMGlobalObject&, JSC::ThrowScope&, U&&) -> std::enable_if_t<!IsExceptionOr<U>, JSC::JSValue>;
     101template<typename T, typename U> inline auto toJSNewlyCreated(JSC::JSGlobalObject&, JSDOMGlobalObject&, JSC::ThrowScope&, U&&) -> std::enable_if_t<IsExceptionOr<U>, JSC::JSValue>;
     102template<typename T, typename U> inline auto toJSNewlyCreated(JSC::JSGlobalObject&, JSDOMGlobalObject&, JSC::ThrowScope&, U&&) -> std::enable_if_t<!IsExceptionOr<U>, JSC::JSValue>;
    103103
    104104template<typename T, bool needsState = JSConverter<T>::needsState, bool needsGlobalObject = JSConverter<T>::needsGlobalObject>
     
    159159}
    160160
    161 template<typename T, typename U> inline auto toJS(JSC::JSGlobalObject& lexicalGlobalObject, JSC::ThrowScope& throwScope, U&& value) -> std::enable_if_t<IsExceptionOr<U>::value, JSC::JSValue>
     161template<typename T, typename U> inline auto toJS(JSC::JSGlobalObject& lexicalGlobalObject, JSC::ThrowScope& throwScope, U&& value) -> std::enable_if_t<IsExceptionOr<U>, JSC::JSValue>
    162162{
    163163    if (UNLIKELY(value.hasException())) {
     
    169169}
    170170
    171 template<typename T, typename U> inline auto toJS(JSC::JSGlobalObject& lexicalGlobalObject, JSC::ThrowScope&, U&& value) -> std::enable_if_t<!IsExceptionOr<U>::value, JSC::JSValue>
     171template<typename T, typename U> inline auto toJS(JSC::JSGlobalObject& lexicalGlobalObject, JSC::ThrowScope&, U&& value) -> std::enable_if_t<!IsExceptionOr<U>, JSC::JSValue>
    172172{
    173173    return toJS<T>(lexicalGlobalObject, std::forward<U>(value));
    174174}
    175175
    176 template<typename T, typename U> inline auto toJS(JSC::JSGlobalObject& lexicalGlobalObject, JSDOMGlobalObject& globalObject, JSC::ThrowScope& throwScope, U&& value) -> std::enable_if_t<IsExceptionOr<U>::value, JSC::JSValue>
     176template<typename T, typename U> inline auto toJS(JSC::JSGlobalObject& lexicalGlobalObject, JSDOMGlobalObject& globalObject, JSC::ThrowScope& throwScope, U&& value) -> std::enable_if_t<IsExceptionOr<U>, JSC::JSValue>
    177177{
    178178    if (UNLIKELY(value.hasException())) {
     
    184184}
    185185
    186 template<typename T, typename U> inline auto toJS(JSC::JSGlobalObject& lexicalGlobalObject, JSDOMGlobalObject& globalObject, JSC::ThrowScope&, U&& value) -> std::enable_if_t<!IsExceptionOr<U>::value, JSC::JSValue>
     186template<typename T, typename U> inline auto toJS(JSC::JSGlobalObject& lexicalGlobalObject, JSDOMGlobalObject& globalObject, JSC::ThrowScope&, U&& value) -> std::enable_if_t<!IsExceptionOr<U>, JSC::JSValue>
    187187{
    188188    return toJS<T>(lexicalGlobalObject, globalObject, std::forward<U>(value));
    189189}
    190190
    191 template<typename T, typename U> inline auto toJSNewlyCreated(JSC::JSGlobalObject& lexicalGlobalObject, JSDOMGlobalObject& globalObject, JSC::ThrowScope& throwScope, U&& value) -> std::enable_if_t<IsExceptionOr<U>::value, JSC::JSValue>
     191template<typename T, typename U> inline auto toJSNewlyCreated(JSC::JSGlobalObject& lexicalGlobalObject, JSDOMGlobalObject& globalObject, JSC::ThrowScope& throwScope, U&& value) -> std::enable_if_t<IsExceptionOr<U>, JSC::JSValue>
    192192{
    193193    if (UNLIKELY(value.hasException())) {
     
    199199}
    200200
    201 template<typename T, typename U> inline auto toJSNewlyCreated(JSC::JSGlobalObject& lexicalGlobalObject, JSDOMGlobalObject& globalObject, JSC::ThrowScope&, U&& value) -> std::enable_if_t<!IsExceptionOr<U>::value, JSC::JSValue>
     201template<typename T, typename U> inline auto toJSNewlyCreated(JSC::JSGlobalObject& lexicalGlobalObject, JSDOMGlobalObject& globalObject, JSC::ThrowScope&, U&& value) -> std::enable_if_t<!IsExceptionOr<U>, JSC::JSValue>
    202202{
    203203    return toJSNewlyCreated<T>(lexicalGlobalObject, globalObject, std::forward<U>(value));
  • trunk/Source/WebCore/bindings/js/JSDOMExceptionHandling.h

    r266999 r267007  
    9494    using ReturnType = std::invoke_result_t<Functor>;
    9595
    96     if constexpr (IsExceptionOr<ReturnType>::value) {
     96    if constexpr (IsExceptionOr<ReturnType>) {
    9797        auto result = functor();
    9898        if (UNLIKELY(result.hasException()))
  • trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm

    r266999 r267007  
    74917491            GenerateArgumentsCountCheck($outputArray, $operation, $interface, "    ");
    74927492
    7493             my $functionImplementationName = $generatingLegacyFactoryFunction ? "createForJSConstructor" : "create";
     7493            my $functionImplementationName = $generatingLegacyFactoryFunction ? "createForLegacyFactoryFunction" : "create";
    74947494            my $functionString = GenerateParametersCheck($outputArray, $operation, $interface, $functionImplementationName, "    ");
    74957495
    74967496            push(@$outputArray, "    auto object = ${functionString};\n");
    74977497            push(@$outputArray, "    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());\n") if $codeGenerator->ExtendedAttributeContains($interface->extendedAttributes->{CallWith}, "ExecState");
    7498             if ($interface->extendedAttributes->{LegacyFactoryFunctionMayThrowException} || $operation->extendedAttributes->{MayThrowException}) {
    7499                 push(@$outputArray, "    static_assert(IsExceptionOr<decltype(object)>::value);\n");
    7500                 push(@$outputArray, "    static_assert(decltype(object)::ReturnType::isRef);\n");
    7501             } else {
    7502                 push(@$outputArray, "    static_assert(decltype(object)::isRef);\n");
    7503             }
     7498
     7499            push(@$outputArray, "    static_assert(TypeOrExceptionOrUnderlyingType<decltype(object)>::isRef);\n");
    75047500
    75057501            my $IDLType = GetIDLType($interface, $interface->type);
     
    75117507            push(@constructionConversionArguments, "*lexicalGlobalObject");
    75127508            push(@constructionConversionArguments, "*castedThis->globalObject()");
    7513             push(@constructionConversionArguments, "throwScope") if $interface->extendedAttributes->{LegacyFactoryFunctionMayThrowException} || $operation->extendedAttributes->{MayThrowException};
     7509            push(@constructionConversionArguments, "throwScope");
    75147510            push(@constructionConversionArguments, "WTFMove(object)");
    75157511
    75167512            # FIXME: toJSNewlyCreated should return JSObject* instead of JSValue.
    75177513            push(@$outputArray, "    auto jsValue = toJSNewlyCreated<${IDLType}>(" . join(", ", @constructionConversionArguments) . ");\n");
    7518             push(@$outputArray, "    RETURN_IF_EXCEPTION(throwScope, { });\n") if $interface->extendedAttributes->{LegacyFactoryFunctionMayThrowException} || $operation->extendedAttributes->{MayThrowException};
     7514            push(@$outputArray, "    if constexpr (IsExceptionOr<decltype(object)>)\n");
     7515            push(@$outputArray, "        RETURN_IF_EXCEPTION(throwScope, { });\n");
    75197516            push(@$outputArray, "    setSubclassStructureIfNeeded<${implType}>(lexicalGlobalObject, callFrame, asObject(jsValue));\n");
    75207517            push(@$outputArray, "    RETURN_IF_EXCEPTION(throwScope, { });\n");
  • trunk/Source/WebCore/bindings/scripts/IDLAttributes.json

    r266800 r267007  
    317317            "supportsConjunction": true
    318318        },
    319         "LegacyFactoryFunctionMayThrowException": {
    320             "contextsAllowed": ["interface"]
    321         },
    322319        "LegacyLenientSetter": {
    323320            "contextsAllowed": ["attribute"],
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSExposedToWorkerAndWindow.cpp

    r266615 r267007  
    136136    ASSERT(castedThis);
    137137    auto object = ExposedToWorkerAndWindow::create();
    138     static_assert(decltype(object)::isRef);
    139     auto jsValue = toJSNewlyCreated<IDLInterface<ExposedToWorkerAndWindow>>(*lexicalGlobalObject, *castedThis->globalObject(), WTFMove(object));
     138    static_assert(TypeOrExceptionOrUnderlyingType<decltype(object)>::isRef);
     139    auto jsValue = toJSNewlyCreated<IDLInterface<ExposedToWorkerAndWindow>>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, WTFMove(object));
     140    if constexpr (IsExceptionOr<decltype(object)>)
     141        RETURN_IF_EXCEPTION(throwScope, { });
    140142    setSubclassStructureIfNeeded<ExposedToWorkerAndWindow>(lexicalGlobalObject, callFrame, asObject(jsValue));
    141143    RETURN_IF_EXCEPTION(throwScope, { });
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEventConstructor.cpp

    r264855 r267007  
    181181    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
    182182    auto object = TestEventConstructor::create(WTFMove(type), WTFMove(eventInitDict));
    183     static_assert(decltype(object)::isRef);
    184     auto jsValue = toJSNewlyCreated<IDLInterface<TestEventConstructor>>(*lexicalGlobalObject, *castedThis->globalObject(), WTFMove(object));
     183    static_assert(TypeOrExceptionOrUnderlyingType<decltype(object)>::isRef);
     184    auto jsValue = toJSNewlyCreated<IDLInterface<TestEventConstructor>>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, WTFMove(object));
     185    if constexpr (IsExceptionOr<decltype(object)>)
     186        RETURN_IF_EXCEPTION(throwScope, { });
    185187    setSubclassStructureIfNeeded<TestEventConstructor>(lexicalGlobalObject, callFrame, asObject(jsValue));
    186188    RETURN_IF_EXCEPTION(throwScope, { });
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp

    r266753 r267007  
    277277    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
    278278    auto object = TestInterface::create(*context, WTFMove(str1), WTFMove(str2));
    279     static_assert(IsExceptionOr<decltype(object)>::value);
    280     static_assert(decltype(object)::ReturnType::isRef);
     279    static_assert(TypeOrExceptionOrUnderlyingType<decltype(object)>::isRef);
    281280    auto jsValue = toJSNewlyCreated<IDLInterface<TestInterface>>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, WTFMove(object));
    282     RETURN_IF_EXCEPTION(throwScope, { });
     281    if constexpr (IsExceptionOr<decltype(object)>)
     282        RETURN_IF_EXCEPTION(throwScope, { });
    283283    setSubclassStructureIfNeeded<TestInterface>(lexicalGlobalObject, callFrame, asObject(jsValue));
    284284    RETURN_IF_EXCEPTION(throwScope, { });
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestLegacyFactoryFunction.cpp

    r266649 r267007  
    124124    auto str3 = argument2.value().isUndefined() ? String() : convert<IDLDOMString>(*lexicalGlobalObject, argument2.value());
    125125    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
    126     auto object = TestLegacyFactoryFunction::createForJSConstructor(document, WTFMove(str1), WTFMove(str2), WTFMove(str3));
    127     static_assert(IsExceptionOr<decltype(object)>::value);
    128     static_assert(decltype(object)::ReturnType::isRef);
     126    auto object = TestLegacyFactoryFunction::createForLegacyFactoryFunction(document, WTFMove(str1), WTFMove(str2), WTFMove(str3));
     127    static_assert(TypeOrExceptionOrUnderlyingType<decltype(object)>::isRef);
    129128    auto jsValue = toJSNewlyCreated<IDLInterface<TestLegacyFactoryFunction>>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, WTFMove(object));
    130     RETURN_IF_EXCEPTION(throwScope, { });
     129    if constexpr (IsExceptionOr<decltype(object)>)
     130        RETURN_IF_EXCEPTION(throwScope, { });
    131131    setSubclassStructureIfNeeded<TestLegacyFactoryFunction>(lexicalGlobalObject, callFrame, asObject(jsValue));
    132132    RETURN_IF_EXCEPTION(throwScope, { });
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNode.cpp

    r265046 r267007  
    116116    ASSERT(castedThis);
    117117    auto object = TestNode::create();
    118     static_assert(decltype(object)::isRef);
    119     auto jsValue = toJSNewlyCreated<IDLInterface<TestNode>>(*lexicalGlobalObject, *castedThis->globalObject(), WTFMove(object));
     118    static_assert(TypeOrExceptionOrUnderlyingType<decltype(object)>::isRef);
     119    auto jsValue = toJSNewlyCreated<IDLInterface<TestNode>>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, WTFMove(object));
     120    if constexpr (IsExceptionOr<decltype(object)>)
     121        RETURN_IF_EXCEPTION(throwScope, { });
    120122    setSubclassStructureIfNeeded<TestNode>(lexicalGlobalObject, callFrame, asObject(jsValue));
    121123    RETURN_IF_EXCEPTION(throwScope, { });
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp

    r266662 r267007  
    19791979    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
    19801980    auto object = TestObj::create(document, testCallback.releaseNonNull(), testCallbackFunction.releaseNonNull());
    1981     static_assert(decltype(object)::isRef);
    1982     auto jsValue = toJSNewlyCreated<IDLInterface<TestObj>>(*lexicalGlobalObject, *castedThis->globalObject(), WTFMove(object));
     1981    static_assert(TypeOrExceptionOrUnderlyingType<decltype(object)>::isRef);
     1982    auto jsValue = toJSNewlyCreated<IDLInterface<TestObj>>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, WTFMove(object));
     1983    if constexpr (IsExceptionOr<decltype(object)>)
     1984        RETURN_IF_EXCEPTION(throwScope, { });
    19831985    setSubclassStructureIfNeeded<TestObj>(lexicalGlobalObject, callFrame, asObject(jsValue));
    19841986    RETURN_IF_EXCEPTION(throwScope, { });
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp

    r266753 r267007  
    9898    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
    9999    auto object = TestOverloadedConstructors::create(*arrayBuffer);
    100     static_assert(decltype(object)::isRef);
    101     auto jsValue = toJSNewlyCreated<IDLInterface<TestOverloadedConstructors>>(*lexicalGlobalObject, *castedThis->globalObject(), WTFMove(object));
     100    static_assert(TypeOrExceptionOrUnderlyingType<decltype(object)>::isRef);
     101    auto jsValue = toJSNewlyCreated<IDLInterface<TestOverloadedConstructors>>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, WTFMove(object));
     102    if constexpr (IsExceptionOr<decltype(object)>)
     103        RETURN_IF_EXCEPTION(throwScope, { });
    102104    setSubclassStructureIfNeeded<TestOverloadedConstructors>(lexicalGlobalObject, callFrame, asObject(jsValue));
    103105    RETURN_IF_EXCEPTION(throwScope, { });
     
    115117    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
    116118    auto object = TestOverloadedConstructors::create(arrayBufferView.releaseNonNull());
    117     static_assert(decltype(object)::isRef);
    118     auto jsValue = toJSNewlyCreated<IDLInterface<TestOverloadedConstructors>>(*lexicalGlobalObject, *castedThis->globalObject(), WTFMove(object));
     119    static_assert(TypeOrExceptionOrUnderlyingType<decltype(object)>::isRef);
     120    auto jsValue = toJSNewlyCreated<IDLInterface<TestOverloadedConstructors>>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, WTFMove(object));
     121    if constexpr (IsExceptionOr<decltype(object)>)
     122        RETURN_IF_EXCEPTION(throwScope, { });
    119123    setSubclassStructureIfNeeded<TestOverloadedConstructors>(lexicalGlobalObject, callFrame, asObject(jsValue));
    120124    RETURN_IF_EXCEPTION(throwScope, { });
     
    132136    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
    133137    auto object = TestOverloadedConstructors::create(*blob);
    134     static_assert(decltype(object)::isRef);
    135     auto jsValue = toJSNewlyCreated<IDLInterface<TestOverloadedConstructors>>(*lexicalGlobalObject, *castedThis->globalObject(), WTFMove(object));
     138    static_assert(TypeOrExceptionOrUnderlyingType<decltype(object)>::isRef);
     139    auto jsValue = toJSNewlyCreated<IDLInterface<TestOverloadedConstructors>>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, WTFMove(object));
     140    if constexpr (IsExceptionOr<decltype(object)>)
     141        RETURN_IF_EXCEPTION(throwScope, { });
    136142    setSubclassStructureIfNeeded<TestOverloadedConstructors>(lexicalGlobalObject, callFrame, asObject(jsValue));
    137143    RETURN_IF_EXCEPTION(throwScope, { });
     
    149155    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
    150156    auto object = TestOverloadedConstructors::create(WTFMove(string));
    151     static_assert(decltype(object)::isRef);
    152     auto jsValue = toJSNewlyCreated<IDLInterface<TestOverloadedConstructors>>(*lexicalGlobalObject, *castedThis->globalObject(), WTFMove(object));
     157    static_assert(TypeOrExceptionOrUnderlyingType<decltype(object)>::isRef);
     158    auto jsValue = toJSNewlyCreated<IDLInterface<TestOverloadedConstructors>>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, WTFMove(object));
     159    if constexpr (IsExceptionOr<decltype(object)>)
     160        RETURN_IF_EXCEPTION(throwScope, { });
    153161    setSubclassStructureIfNeeded<TestOverloadedConstructors>(lexicalGlobalObject, callFrame, asObject(jsValue));
    154162    RETURN_IF_EXCEPTION(throwScope, { });
     
    165173    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
    166174    auto object = TestOverloadedConstructors::create(WTFMove(longArgs));
    167     static_assert(decltype(object)::isRef);
    168     auto jsValue = toJSNewlyCreated<IDLInterface<TestOverloadedConstructors>>(*lexicalGlobalObject, *castedThis->globalObject(), WTFMove(object));
     175    static_assert(TypeOrExceptionOrUnderlyingType<decltype(object)>::isRef);
     176    auto jsValue = toJSNewlyCreated<IDLInterface<TestOverloadedConstructors>>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, WTFMove(object));
     177    if constexpr (IsExceptionOr<decltype(object)>)
     178        RETURN_IF_EXCEPTION(throwScope, { });
    169179    setSubclassStructureIfNeeded<TestOverloadedConstructors>(lexicalGlobalObject, callFrame, asObject(jsValue));
    170180    RETURN_IF_EXCEPTION(throwScope, { });
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp

    r264855 r267007  
    9797    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
    9898    auto object = TestOverloadedConstructorsWithSequence::create(WTFMove(sequenceOfStrings));
    99     static_assert(decltype(object)::isRef);
    100     auto jsValue = toJSNewlyCreated<IDLInterface<TestOverloadedConstructorsWithSequence>>(*lexicalGlobalObject, *castedThis->globalObject(), WTFMove(object));
     99    static_assert(TypeOrExceptionOrUnderlyingType<decltype(object)>::isRef);
     100    auto jsValue = toJSNewlyCreated<IDLInterface<TestOverloadedConstructorsWithSequence>>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, WTFMove(object));
     101    if constexpr (IsExceptionOr<decltype(object)>)
     102        RETURN_IF_EXCEPTION(throwScope, { });
    101103    setSubclassStructureIfNeeded<TestOverloadedConstructorsWithSequence>(lexicalGlobalObject, callFrame, asObject(jsValue));
    102104    RETURN_IF_EXCEPTION(throwScope, { });
     
    114116    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
    115117    auto object = TestOverloadedConstructorsWithSequence::create(WTFMove(string));
    116     static_assert(decltype(object)::isRef);
    117     auto jsValue = toJSNewlyCreated<IDLInterface<TestOverloadedConstructorsWithSequence>>(*lexicalGlobalObject, *castedThis->globalObject(), WTFMove(object));
     118    static_assert(TypeOrExceptionOrUnderlyingType<decltype(object)>::isRef);
     119    auto jsValue = toJSNewlyCreated<IDLInterface<TestOverloadedConstructorsWithSequence>>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, WTFMove(object));
     120    if constexpr (IsExceptionOr<decltype(object)>)
     121        RETURN_IF_EXCEPTION(throwScope, { });
    118122    setSubclassStructureIfNeeded<TestOverloadedConstructorsWithSequence>(lexicalGlobalObject, callFrame, asObject(jsValue));
    119123    RETURN_IF_EXCEPTION(throwScope, { });
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestPromiseRejectionEvent.cpp

    r264855 r267007  
    182182    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
    183183    auto object = TestPromiseRejectionEvent::create(*castedThis->globalObject(), WTFMove(type), WTFMove(eventInitDict));
    184     static_assert(decltype(object)::isRef);
    185     auto jsValue = toJSNewlyCreated<IDLInterface<TestPromiseRejectionEvent>>(*lexicalGlobalObject, *castedThis->globalObject(), WTFMove(object));
     184    static_assert(TypeOrExceptionOrUnderlyingType<decltype(object)>::isRef);
     185    auto jsValue = toJSNewlyCreated<IDLInterface<TestPromiseRejectionEvent>>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, WTFMove(object));
     186    if constexpr (IsExceptionOr<decltype(object)>)
     187        RETURN_IF_EXCEPTION(throwScope, { });
    186188    setSubclassStructureIfNeeded<TestPromiseRejectionEvent>(lexicalGlobalObject, callFrame, asObject(jsValue));
    187189    RETURN_IF_EXCEPTION(throwScope, { });
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp

    r265046 r267007  
    173173    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
    174174    auto object = TestTypedefs::create(WTFMove(hello), testCallbackFunction.releaseNonNull(), testCallbackInterface.releaseNonNull());
    175     static_assert(decltype(object)::isRef);
    176     auto jsValue = toJSNewlyCreated<IDLInterface<TestTypedefs>>(*lexicalGlobalObject, *castedThis->globalObject(), WTFMove(object));
     175    static_assert(TypeOrExceptionOrUnderlyingType<decltype(object)>::isRef);
     176    auto jsValue = toJSNewlyCreated<IDLInterface<TestTypedefs>>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, WTFMove(object));
     177    if constexpr (IsExceptionOr<decltype(object)>)
     178        RETURN_IF_EXCEPTION(throwScope, { });
    177179    setSubclassStructureIfNeeded<TestTypedefs>(lexicalGlobalObject, callFrame, asObject(jsValue));
    178180    RETURN_IF_EXCEPTION(throwScope, { });
  • trunk/Source/WebCore/bindings/scripts/test/TestLegacyFactoryFunction.idl

    r266649 r267007  
    3333    ActiveDOMObject,
    3434    LegacyFactoryFunction=Audio(DOMString str1, optional DOMString str2 = "defaultString", optional DOMString str3),
    35     LegacyFactoryFunctionCallWith=Document,
    36     LegacyFactoryFunctionMayThrowException
     35    LegacyFactoryFunctionCallWith=Document
    3736] interface TestLegacyFactoryFunction {
    3837};
  • trunk/Source/WebCore/css/DOMMatrix.idl

    r263160 r267007  
    3030    ImplementationLacksVTable
    3131] interface DOMMatrix : DOMMatrixReadOnly {
    32     [CallWith=ScriptExecutionContext, MayThrowException] constructor(optional (DOMString or sequence<unrestricted double>) init);
     32    [CallWith=ScriptExecutionContext] constructor(optional (DOMString or sequence<unrestricted double>) init);
    3333
    3434    [MayThrowException, NewObject] static DOMMatrix fromMatrix(optional DOMMatrixInit other);
  • trunk/Source/WebCore/css/DOMMatrixReadOnly.idl

    r263160 r267007  
    2929    ImplementationLacksVTable
    3030] interface DOMMatrixReadOnly {
    31     [CallWith=ScriptExecutionContext, MayThrowException] constructor(optional (DOMString or sequence<unrestricted double>) init);
     31    [CallWith=ScriptExecutionContext] constructor(optional (DOMString or sequence<unrestricted double>) init);
    3232
    3333    [MayThrowException, NewObject] static DOMMatrixReadOnly fromMatrix(optional DOMMatrixInit other);
  • trunk/Source/WebCore/css/WebKitCSSMatrix.idl

    r266311 r267007  
    2828    ImplementationLacksVTable,
    2929] interface WebKitCSSMatrix {
    30     [MayThrowException] constructor(optional DOMString cssValue);
     30    constructor(optional DOMString cssValue);
    3131
    3232    // These attributes are simple aliases for certain elements of the 4x4 matrix
  • trunk/Source/WebCore/dom/ExceptionOr.h

    r266999 r267007  
    201201}
    202202
    203 template <typename T> struct IsExceptionOr : public std::integral_constant<bool, WTF::IsTemplate<std::decay_t<T>, ExceptionOr>::value> { };
     203template <typename T> inline constexpr bool IsExceptionOr = WTF::IsTemplate<std::decay_t<T>, ExceptionOr>::value;
     204
     205template <typename T, bool isExceptionOr = IsExceptionOr<T>> struct TypeOrExceptionOrUnderlyingTypeImpl;
     206template <typename T> struct TypeOrExceptionOrUnderlyingTypeImpl<T, true> { using Type = typename T::ReturnType; };
     207template <typename T> struct TypeOrExceptionOrUnderlyingTypeImpl<T, false> { using Type = T; };
     208template <typename T> using TypeOrExceptionOrUnderlyingType = typename TypeOrExceptionOrUnderlyingTypeImpl<T>::Type;
    204209
    205210}
  • trunk/Source/WebCore/dom/StaticRange.idl

    r266360 r267007  
    2929    Exposed=Window,
    3030] interface StaticRange {
    31     [MayThrowException] constructor(StaticRangeInit staticRangeInitDict);
     31    constructor(StaticRangeInit staticRangeInitDict);
    3232
    3333    readonly attribute unsigned long startOffset;
  • trunk/Source/WebCore/dom/TextDecoder.idl

    r263160 r267007  
    3737    ImplementationLacksVTable,
    3838] interface TextDecoder {
    39     [MayThrowException] constructor(optional DOMString label = "utf-8", optional TextDecoderOptions options);
     39    constructor(optional DOMString label = "utf-8", optional TextDecoderOptions options);
    4040
    4141    readonly attribute DOMString encoding;
  • trunk/Source/WebCore/dom/TextDecoderStreamDecoder.idl

    r266609 r267007  
    3030    PrivateIdentifier,
    3131] interface TextDecoderStreamDecoder {
    32     [MayThrowException] constructor(DOMString label, boolean fatal, boolean ignoreBOM);
     32    constructor(DOMString label, boolean fatal, boolean ignoreBOM);
    3333
    3434    [PrivateIdentifier] DOMString encoding();
  • trunk/Source/WebCore/html/DOMURL.idl

    r266311 r267007  
    3333    LegacyWindowAlias=webkitURL,
    3434] interface DOMURL {
    35     [MayThrowException] constructor(USVString url, optional USVString base);
    36     [MayThrowException] constructor(USVString url, DOMURL base);
     35    constructor(USVString url, optional USVString base);
     36    constructor(USVString url, DOMURL base);
    3737
    3838    [URL] stringifier attribute USVString href;
  • trunk/Source/WebCore/html/HTMLAudioElement.cpp

    r246490 r267007  
    5353}
    5454
    55 Ref<HTMLAudioElement> HTMLAudioElement::createForJSConstructor(Document& document, const AtomString& src)
     55Ref<HTMLAudioElement> HTMLAudioElement::createForLegacyFactoryFunction(Document& document, const AtomString& src)
    5656{
    5757    auto element = create(audioTag, document, false);
  • trunk/Source/WebCore/html/HTMLAudioElement.h

    r257039 r267007  
    3939public:
    4040    static Ref<HTMLAudioElement> create(const QualifiedName&, Document&, bool);
    41     static Ref<HTMLAudioElement> createForJSConstructor(Document&, const AtomString& src);
     41    static Ref<HTMLAudioElement> createForLegacyFactoryFunction(Document&, const AtomString& src);
    4242
    4343private:
  • trunk/Source/WebCore/html/HTMLImageElement.cpp

    r266373 r267007  
    103103}
    104104
    105 Ref<HTMLImageElement> HTMLImageElement::createForJSConstructor(Document& document, Optional<unsigned> width, Optional<unsigned> height)
     105Ref<HTMLImageElement> HTMLImageElement::createForLegacyFactoryFunction(Document& document, Optional<unsigned> width, Optional<unsigned> height)
    106106{
    107107    auto image = adoptRef(*new HTMLImageElement(imgTag, document));
  • trunk/Source/WebCore/html/HTMLImageElement.h

    r266342 r267007  
    5151    static Ref<HTMLImageElement> create(Document&);
    5252    static Ref<HTMLImageElement> create(const QualifiedName&, Document&, HTMLFormElement* = nullptr);
    53     static Ref<HTMLImageElement> createForJSConstructor(Document&, Optional<unsigned> width, Optional<unsigned> height);
     53    static Ref<HTMLImageElement> createForLegacyFactoryFunction(Document&, Optional<unsigned> width, Optional<unsigned> height);
    5454
    5555    virtual ~HTMLImageElement();
  • trunk/Source/WebCore/html/HTMLOptionElement.cpp

    r265514 r267007  
    7070}
    7171
    72 ExceptionOr<Ref<HTMLOptionElement>> HTMLOptionElement::createForJSConstructor(Document& document, const String& text, const String& value, bool defaultSelected, bool selected)
     72ExceptionOr<Ref<HTMLOptionElement>> HTMLOptionElement::createForLegacyFactoryFunction(Document& document, const String& text, const String& value, bool defaultSelected, bool selected)
    7373{
    7474    auto element = create(document);
  • trunk/Source/WebCore/html/HTMLOptionElement.h

    r265514 r267007  
    3636    static Ref<HTMLOptionElement> create(Document&);
    3737    static Ref<HTMLOptionElement> create(const QualifiedName&, Document&);
    38     static ExceptionOr<Ref<HTMLOptionElement>> createForJSConstructor(Document&, const String& text, const String& value, bool defaultSelected, bool selected);
     38    static ExceptionOr<Ref<HTMLOptionElement>> createForLegacyFactoryFunction(Document&, const String& text, const String& value, bool defaultSelected, bool selected);
    3939
    4040    WEBCORE_EXPORT String text() const;
  • trunk/Source/WebCore/html/HTMLOptionElement.idl

    r266649 r267007  
    2121[
    2222    JSGenerateToNativeObject,
    23     LegacyFactoryFunctionMayThrowException,
    2423    LegacyFactoryFunctionCallWith=Document,
    2524    LegacyFactoryFunction=Option(optional DOMString text = "", optional DOMString value, optional boolean defaultSelected = false, optional boolean selected = false),
  • trunk/Source/WebCore/html/ImageData.idl

    r263160 r267007  
    3333    ImplementationLacksVTable
    3434] interface ImageData {
    35     [MayThrowException] constructor(unsigned long sw, unsigned long sh);
    36     [MayThrowException] constructor(Uint8ClampedArray data, unsigned long sw, optional unsigned long sh);
     35    constructor(unsigned long sw, unsigned long sh);
     36    constructor(Uint8ClampedArray data, unsigned long sw, optional unsigned long sh);
    3737
    3838    readonly attribute unsigned long width;
  • trunk/Source/WebCore/html/URLSearchParams.idl

    r266311 r267007  
    2828    ImplementationLacksVTable,
    2929] interface URLSearchParams {
    30     [MayThrowException] constructor(optional (sequence<sequence<USVString>> or record<USVString, USVString> or USVString) init = "");
     30    constructor(optional (sequence<sequence<USVString>> or record<USVString, USVString> or USVString) init = "");
    3131
    3232    undefined append(USVString name, USVString value);
  • trunk/Source/WebCore/html/track/TextTrackCue.idl

    r266649 r267007  
    3333    LegacyFactoryFunctionEnabledBySetting=GenericCueAPI
    3434] interface TextTrackCue : EventTarget {
    35     [CallWith=Document, MayThrowException] constructor(double startTime, double endTime, DocumentFragment cueNode);
     35    [CallWith=Document] constructor(double startTime, double endTime, DocumentFragment cueNode);
    3636
    3737    readonly attribute TextTrack track;
  • trunk/Source/WebCore/page/EventSource.idl

    r266311 r267007  
    3434    ActiveDOMObject,
    3535] interface EventSource : EventTarget {
    36     [CallWith=ScriptExecutionContext, MayThrowException] constructor(USVString url, optional EventSourceInit eventSourceInitDict);
     36    [CallWith=ScriptExecutionContext] constructor(USVString url, optional EventSourceInit eventSourceInitDict);
    3737
    3838    readonly attribute USVString URL; // Lowercased .url is the one in the spec, but leaving .URL for compatibility reasons.
  • trunk/Source/WebCore/page/IntersectionObserver.idl

    r266360 r267007  
    3131    EnabledBySetting=IntersectionObserver
    3232] interface IntersectionObserver {
    33     [CallWith=Document, MayThrowException] constructor(IntersectionObserverCallback callback, optional IntersectionObserverInit options);
     33    [CallWith=Document] constructor(IntersectionObserverCallback callback, optional IntersectionObserverInit options);
    3434
    3535    readonly attribute Node? root;
  • trunk/Source/WebCore/workers/Worker.idl

    r266523 r267007  
    2828    ActiveDOMObject,
    2929] interface Worker : EventTarget {
    30     [CallWith=ScriptExecutionContext&RuntimeFlags, MayThrowException] constructor(USVString scriptUrl, optional WorkerOptions options);
     30    [CallWith=ScriptExecutionContext&RuntimeFlags] constructor(USVString scriptUrl, optional WorkerOptions options);
    3131
    3232    undefined terminate();
Note: See TracChangeset for help on using the changeset viewer.