Changeset 208308 in webkit


Ignore:
Timestamp:
Nov 2, 2016 3:15:14 PM (7 years ago)
Author:
weinig@apple.com
Message:

[WebIDL] Move interfaces and typed arrays over to JSDOMConvert
https://bugs.webkit.org/show_bug.cgi?id=164256

Reviewed by Alex Christensen.

Source/JavaScriptCore:

  • runtime/JSArrayBuffer.h:

(JSC::JSArrayBuffer::toWrapped):
Change return type to ArrayBuffer* to match WebCore's expectation.

Source/WebCore:

  • Add the ability to pass an "exception thrower" functor to the convert functions. This is only implemented for convert<IDLInterface<T>> and convert<IDLNullable<IDLInterface<T>>> for now, but can be extended for more types as necessary to improve exception messages.
  • Add support for using toJSNewlyCreated in JSDOMConvert.
  • bindings/generic/IDLTypes.h:

(WebCore::IDLString::extractValueFromNullable):
Use forwarding to simplify extraction function.

(WebCore::IDLInterface::nullValue):
Update nullValue to work for both RefPtr<T> and T*.

(WebCore::IDLInterface::extractValueFromNullable):
Use forwarding to simplify extraction function.

  • bindings/js/JSDOMConvert.h:

(WebCore::DefaultExceptionThrower::operator()):
Add a default "exception thrower" which throws a normal type error.

(WebCore::convert):
Add an overload of convert which takes an "exception thrower".

(WebCore::toJSNewlyCreated):
Add new overloaded function toJSNewlyCreated, matching the toJS overload set,
which will return "newly created" values. This only works for types that implement
a toJSNewlyCreated function for themselves.

(WebCore::Converter<IDLNullable<T>>::convert):
Fix the return type of Converter<IDLNullable<T>> to be specialized when
T is an IDLInterface. In that case, we want to match the return type of
inner converter.

Also add implementation of convert overload that takes an "exception thrower".

(WebCore::JSConverter<IDLNullable<T>>::convert):
(WebCore::JSConverter<IDLNullable<T>>::convertNewlyCreated):
Reimplement conversion to use forwarding of the value.

(WebCore::Converter<IDLInterface<T>>::convert):
Add support for an "exception thrower".

(WebCore::Detail::getPtrOrRef):
Add helper functions that extract either a pointer or reference, depending on the type,
and const_casts it allowing the value to be used with toJS functions.

(WebCore::JSConverter<IDLInterface<T>>::convert):
Re-implement to support more varied input values.

(WebCore::JSConverter<IDLInterface<T>>::convertNewlyCreated):
Added. Forwards to overloaded toJSNewlyCreated functions.

  • bindings/scripts/CodeGeneratorJS.pm:

(AddToImplIncludesForIDLType):
Add support for adding the right includes for SerializedScriptValue and Dictionary.

(GetArgumentExceptionThrower):
(GetAttributeExceptionThrower):
Add helpers to generate "exception thrower" lambdas for wrappers and typed arrays
being passed to setters and functions.

(GenerateParametersCheck):
Move around special cases so it is clear that it's not wrappers and typed arrays that
need specialization here, it is now just EventListener and XPathNSResolver.

(GetIDLInterfaceName):
Add helper to get the InterfaceName for use in IDLInterface template.

(GetBaseIDLType):
Use new GetIDLInterfaceName helper.

(IsValidContextForJSValueToNative):
Remove IDLOperation as a valid context. It is not.

(JSValueToNative):
Move JSDOMConvert based conversion to the bottom, to show that everything above it
is a special case that should be fixed. I have used explicit c-style if-statements
to make it clear what the types of the exceptional cases are.

(NativeToJSValueDOMConvertNeedsState):
(NativeToJSValueDOMConvertNeedsGlobalObject):
Add wrapper types and typed arrays to the list needing state and globalObject.

(NativeToJSValue):
Move JSDOMConvert based conversion to the bottom, to show that everything above it
is a special case that should be fixed. I have used explicit c-style if-statements
to make it clear what the types of the exceptional cases are.

(JSValueToNativeIsHandledByDOMConvert): Deleted.
(NativeToJSValueIsHandledByDOMConvert): Deleted.
Remove predicates protecting use of JSDOMConvert now that it is the default.

  • bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
  • bindings/scripts/test/JS/JSTestCEReactions.cpp:
  • bindings/scripts/test/JS/JSTestCallback.cpp:
  • bindings/scripts/test/JS/JSTestCallbackFunction.cpp:
  • bindings/scripts/test/JS/JSTestDOMJIT.cpp:
  • bindings/scripts/test/JS/JSTestEventTarget.cpp:
  • bindings/scripts/test/JS/JSTestInterface.cpp:
  • bindings/scripts/test/JS/JSTestObj.cpp:
  • bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
  • bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
  • bindings/scripts/test/JS/JSTestSerialization.cpp:
  • bindings/scripts/test/JS/JSTestTypedefs.cpp:

Update test results.

LayoutTests:

  • svg/custom/polyline-points-crash-expected.txt:
  • svg/dom/SVGLengthList-basics-expected.txt:
  • svg/dom/SVGNumberList-basics-expected.txt:
  • svg/dom/SVGPointList-basics-expected.txt:
  • svg/dom/SVGTransformList-basics-expected.txt:
  • svg/dom/SVGTransformList-expected.txt:

Update test results for improved error messages.

Location:
trunk
Files:
25 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r208304 r208308  
     12016-11-01  Sam Weinig  <sam@webkit.org>
     2
     3        [WebIDL] Move interfaces and typed arrays over to JSDOMConvert
     4        https://bugs.webkit.org/show_bug.cgi?id=164256
     5
     6        Reviewed by Alex Christensen.
     7
     8        * svg/custom/polyline-points-crash-expected.txt:
     9        * svg/dom/SVGLengthList-basics-expected.txt:
     10        * svg/dom/SVGNumberList-basics-expected.txt:
     11        * svg/dom/SVGPointList-basics-expected.txt:
     12        * svg/dom/SVGTransformList-basics-expected.txt:
     13        * svg/dom/SVGTransformList-expected.txt:
     14        Update test results for improved error messages.
     15
    1162016-11-02  Joseph Pecoraro  <pecoraro@apple.com>
    217
  • trunk/LayoutTests/svg/custom/polyline-points-crash-expected.txt

    r203328 r208308  
    1 Caught exception: SVG_WRONG_TYPE_ERR (DOM SVG Exception): An object of the wrong type was passed to an operation.
     1Caught exception: TypeError: Argument 1 ('item') to SVGPointList.appendItem must be an instance of SVGPoint
    22PASSED -- WebKit did not crash!
  • trunk/LayoutTests/svg/dom/SVGLengthList-basics-expected.txt

    r203333 r208308  
    1616PASS text1.x.baseVal.initialize('aString') threw exception TypeError: Argument 1 ('item') to SVGLengthList.initialize must be an instance of SVGLength.
    1717PASS text1.x.baseVal.initialize(text1) threw exception TypeError: Argument 1 ('item') to SVGLengthList.initialize must be an instance of SVGLength.
    18 PASS text1.x.baseVal.initialize(null) threw exception SVG_WRONG_TYPE_ERR (DOM SVG Exception): An object of the wrong type was passed to an operation..
     18PASS text1.x.baseVal.initialize(null) threw exception TypeError: Argument 1 ('item') to SVGLengthList.initialize must be an instance of SVGLength.
    1919
    2020Test uncommon arguments for getItem()
     
    5656PASS text1.x.baseVal.insertItemBefore('aString', 0) threw exception TypeError: Argument 1 ('item') to SVGLengthList.insertItemBefore must be an instance of SVGLength.
    5757PASS text1.x.baseVal.insertItemBefore(text1, 0) threw exception TypeError: Argument 1 ('item') to SVGLengthList.insertItemBefore must be an instance of SVGLength.
    58 PASS text1.x.baseVal.insertItemBefore(null, 0) threw exception SVG_WRONG_TYPE_ERR (DOM SVG Exception): An object of the wrong type was passed to an operation..
     58PASS text1.x.baseVal.insertItemBefore(null, 0) threw exception TypeError: Argument 1 ('item') to SVGLengthList.insertItemBefore must be an instance of SVGLength.
    5959
    6060Set x='1 2 3 4' for text1
     
    8686PASS text1.x.baseVal.replaceItem('aString', 0) threw exception TypeError: Argument 1 ('item') to SVGLengthList.replaceItem must be an instance of SVGLength.
    8787PASS text1.x.baseVal.replaceItem(text1, 0) threw exception TypeError: Argument 1 ('item') to SVGLengthList.replaceItem must be an instance of SVGLength.
    88 PASS text1.x.baseVal.replaceItem(null, 0) threw exception SVG_WRONG_TYPE_ERR (DOM SVG Exception): An object of the wrong type was passed to an operation..
     88PASS text1.x.baseVal.replaceItem(null, 0) threw exception TypeError: Argument 1 ('item') to SVGLengthList.replaceItem must be an instance of SVGLength.
    8989PASS text1.x.baseVal.replaceItem(text1.x.baseVal.getItem(0), 0) is text1.x.baseVal.getItem(0)
    9090PASS text1.x.baseVal.numberOfItems is 4
     
    154154PASS text1.x.baseVal.appendItem('aString') threw exception TypeError: Argument 1 ('item') to SVGLengthList.appendItem must be an instance of SVGLength.
    155155PASS text1.x.baseVal.appendItem(text1) threw exception TypeError: Argument 1 ('item') to SVGLengthList.appendItem must be an instance of SVGLength.
    156 PASS text1.x.baseVal.appendItem(null) threw exception SVG_WRONG_TYPE_ERR (DOM SVG Exception): An object of the wrong type was passed to an operation..
     156PASS text1.x.baseVal.appendItem(null) threw exception TypeError: Argument 1 ('item') to SVGLengthList.appendItem must be an instance of SVGLength.
    157157
    158158Testing animVal clear throws
  • trunk/LayoutTests/svg/dom/SVGNumberList-basics-expected.txt

    r203333 r208308  
    1313PASS text1.rotate.baseVal.initialize('aString') threw exception TypeError: Argument 1 ('item') to SVGNumberList.initialize must be an instance of SVGNumber.
    1414PASS text1.rotate.baseVal.initialize(text1) threw exception TypeError: Argument 1 ('item') to SVGNumberList.initialize must be an instance of SVGNumber.
    15 PASS text1.rotate.baseVal.initialize(null) threw exception SVG_WRONG_TYPE_ERR (DOM SVG Exception): An object of the wrong type was passed to an operation..
     15PASS text1.rotate.baseVal.initialize(null) threw exception TypeError: Argument 1 ('item') to SVGNumberList.initialize must be an instance of SVGNumber.
    1616
    1717Test uncommon arguments for getItem()
     
    5353PASS text1.rotate.baseVal.insertItemBefore('aString', 0) threw exception TypeError: Argument 1 ('item') to SVGNumberList.insertItemBefore must be an instance of SVGNumber.
    5454PASS text1.rotate.baseVal.insertItemBefore(text1, 0) threw exception TypeError: Argument 1 ('item') to SVGNumberList.insertItemBefore must be an instance of SVGNumber.
    55 PASS text1.rotate.baseVal.insertItemBefore(null, 0) threw exception SVG_WRONG_TYPE_ERR (DOM SVG Exception): An object of the wrong type was passed to an operation..
     55PASS text1.rotate.baseVal.insertItemBefore(null, 0) threw exception TypeError: Argument 1 ('item') to SVGNumberList.insertItemBefore must be an instance of SVGNumber.
    5656
    5757Set rotate='1 2 3 4' for text1
     
    7272PASS text1.rotate.baseVal.replaceItem('aString', 0) threw exception TypeError: Argument 1 ('item') to SVGNumberList.replaceItem must be an instance of SVGNumber.
    7373PASS text1.rotate.baseVal.replaceItem(text1, 0) threw exception TypeError: Argument 1 ('item') to SVGNumberList.replaceItem must be an instance of SVGNumber.
    74 PASS text1.rotate.baseVal.replaceItem(null, 0) threw exception SVG_WRONG_TYPE_ERR (DOM SVG Exception): An object of the wrong type was passed to an operation..
     74PASS text1.rotate.baseVal.replaceItem(null, 0) threw exception TypeError: Argument 1 ('item') to SVGNumberList.replaceItem must be an instance of SVGNumber.
    7575PASS text1.rotate.baseVal.replaceItem(text1.rotate.baseVal.getItem(0), 0) is text1.rotate.baseVal.getItem(0)
    7676PASS text1.rotate.baseVal.numberOfItems is 4
     
    119119PASS text1.rotate.baseVal.appendItem('aString') threw exception TypeError: Argument 1 ('item') to SVGNumberList.appendItem must be an instance of SVGNumber.
    120120PASS text1.rotate.baseVal.appendItem(text1) threw exception TypeError: Argument 1 ('item') to SVGNumberList.appendItem must be an instance of SVGNumber.
    121 PASS text1.rotate.baseVal.appendItem(null) threw exception SVG_WRONG_TYPE_ERR (DOM SVG Exception): An object of the wrong type was passed to an operation..
     121PASS text1.rotate.baseVal.appendItem(null) threw exception TypeError: Argument 1 ('item') to SVGNumberList.appendItem must be an instance of SVGNumber.
    122122
    123123Testing animVal clear throws
  • trunk/LayoutTests/svg/dom/SVGPointList-basics-expected.txt

    r203333 r208308  
    7575PASS poly1.points.insertItemBefore('aString', 0) threw exception TypeError: Argument 1 ('item') to SVGPointList.insertItemBefore must be an instance of SVGPoint.
    7676PASS poly1.points.insertItemBefore(poly1, 0) threw exception TypeError: Argument 1 ('item') to SVGPointList.insertItemBefore must be an instance of SVGPoint.
    77 PASS poly1.points.insertItemBefore(null, 0) threw exception SVG_WRONG_TYPE_ERR (DOM SVG Exception): An object of the wrong type was passed to an operation..
     77PASS poly1.points.insertItemBefore(null, 0) threw exception TypeError: Argument 1 ('item') to SVGPointList.insertItemBefore must be an instance of SVGPoint.
    7878
    7979Test uncommon arguments for replaceItem()
     
    8181PASS poly1.points.replaceItem('aString') threw exception TypeError: Not enough arguments.
    8282PASS poly1.points.replaceItem(poly1) threw exception TypeError: Not enough arguments.
    83 PASS poly1.points.replaceItem(null, 0) threw exception SVG_WRONG_TYPE_ERR (DOM SVG Exception): An object of the wrong type was passed to an operation..
     83PASS poly1.points.replaceItem(null, 0) threw exception TypeError: Argument 1 ('item') to SVGPointList.replaceItem must be an instance of SVGPoint.
    8484PASS poly1.points.replaceItem('aString', 0) threw exception TypeError: Argument 1 ('item') to SVGPointList.replaceItem must be an instance of SVGPoint.
    8585PASS poly1.points.replaceItem(poly1, 0) threw exception TypeError: Argument 1 ('item') to SVGPointList.replaceItem must be an instance of SVGPoint.
     
    143143PASS poly1.points.appendItem('aString') threw exception TypeError: Argument 1 ('item') to SVGPointList.appendItem must be an instance of SVGPoint.
    144144PASS poly1.points.appendItem(poly1) threw exception TypeError: Argument 1 ('item') to SVGPointList.appendItem must be an instance of SVGPoint.
    145 PASS poly1.points.appendItem(null) threw exception SVG_WRONG_TYPE_ERR (DOM SVG Exception): An object of the wrong type was passed to an operation..
     145PASS poly1.points.appendItem(null) threw exception TypeError: Argument 1 ('item') to SVGPointList.appendItem must be an instance of SVGPoint.
    146146PASS dumpPoint(poly1.points.appendItem(point)) is "x=200 y=100"
    147147PASS poly1.points.numberOfItems is 2
  • trunk/LayoutTests/svg/dom/SVGTransformList-basics-expected.txt

    r203333 r208308  
    1414PASS circle1.transform.baseVal.initialize('aString') threw exception TypeError: Argument 1 ('item') to SVGTransformList.initialize must be an instance of SVGTransform.
    1515PASS circle1.transform.baseVal.initialize(circle1) threw exception TypeError: Argument 1 ('item') to SVGTransformList.initialize must be an instance of SVGTransform.
    16 PASS circle1.transform.baseVal.initialize(null) threw exception SVG_WRONG_TYPE_ERR (DOM SVG Exception): An object of the wrong type was passed to an operation..
     16PASS circle1.transform.baseVal.initialize(null) threw exception TypeError: Argument 1 ('item') to SVGTransformList.initialize must be an instance of SVGTransform.
    1717
    1818Test uncommon arguments for getItem()
     
    5050PASS circle1.transform.baseVal.insertItemBefore('aString', 0) threw exception TypeError: Argument 1 ('item') to SVGTransformList.insertItemBefore must be an instance of SVGTransform.
    5151PASS circle1.transform.baseVal.insertItemBefore(circle1, 0) threw exception TypeError: Argument 1 ('item') to SVGTransformList.insertItemBefore must be an instance of SVGTransform.
    52 PASS circle1.transform.baseVal.insertItemBefore(null, 0) threw exception SVG_WRONG_TYPE_ERR (DOM SVG Exception): An object of the wrong type was passed to an operation..
     52PASS circle1.transform.baseVal.insertItemBefore(null, 0) threw exception TypeError: Argument 1 ('item') to SVGTransformList.insertItemBefore must be an instance of SVGTransform.
    5353
    5454Test overlapping edge cases for removeItem()
     
    7676PASS circle1.transform.baseVal.replaceItem('aString', 0) threw exception TypeError: Argument 1 ('item') to SVGTransformList.replaceItem must be an instance of SVGTransform.
    7777PASS circle1.transform.baseVal.replaceItem(circle1, 0) threw exception TypeError: Argument 1 ('item') to SVGTransformList.replaceItem must be an instance of SVGTransform.
    78 PASS circle1.transform.baseVal.replaceItem(null, 0) threw exception SVG_WRONG_TYPE_ERR (DOM SVG Exception): An object of the wrong type was passed to an operation..
     78PASS circle1.transform.baseVal.replaceItem(null, 0) threw exception TypeError: Argument 1 ('item') to SVGTransformList.replaceItem must be an instance of SVGTransform.
    7979PASS circle1.transform.baseVal.replaceItem(circle1.transform.baseVal.getItem(0), 0) is circle1.transform.baseVal.getItem(0)
    8080PASS circle1.transform.baseVal.numberOfItems is 4
     
    127127PASS circle1.transform.baseVal.appendItem('aString') threw exception TypeError: Argument 1 ('item') to SVGTransformList.appendItem must be an instance of SVGTransform.
    128128PASS circle1.transform.baseVal.appendItem(circle1) threw exception TypeError: Argument 1 ('item') to SVGTransformList.appendItem must be an instance of SVGTransform.
    129 PASS circle1.transform.baseVal.appendItem(null) threw exception SVG_WRONG_TYPE_ERR (DOM SVG Exception): An object of the wrong type was passed to an operation..
     129PASS circle1.transform.baseVal.appendItem(null) threw exception TypeError: Argument 1 ('item') to SVGTransformList.appendItem must be an instance of SVGTransform.
    130130
    131131Testing animVal clear throws
  • trunk/LayoutTests/svg/dom/SVGTransformList-expected.txt

    r203333 r208308  
    1212PASS transform.createSVGTransformFromMatrix(1) threw exception TypeError: Argument 1 ('matrix') to SVGTransformList.createSVGTransformFromMatrix must be an instance of SVGMatrix.
    1313PASS transform.createSVGTransformFromMatrix(true) threw exception TypeError: Argument 1 ('matrix') to SVGTransformList.createSVGTransformFromMatrix must be an instance of SVGMatrix.
    14 PASS transform.createSVGTransformFromMatrix(undefined) threw exception TypeMismatchError (DOM Exception 17): The type of an object was incompatible with the expected type of the parameter associated to the object..
    15 PASS transform.createSVGTransformFromMatrix(null) threw exception TypeMismatchError (DOM Exception 17): The type of an object was incompatible with the expected type of the parameter associated to the object..
     14PASS transform.createSVGTransformFromMatrix(undefined) threw exception TypeError: Argument 1 ('matrix') to SVGTransformList.createSVGTransformFromMatrix must be an instance of SVGMatrix.
     15PASS transform.createSVGTransformFromMatrix(null) threw exception TypeError: Argument 1 ('matrix') to SVGTransformList.createSVGTransformFromMatrix must be an instance of SVGMatrix.
    1616PASS successfullyParsed is true
    1717
  • trunk/Source/JavaScriptCore/ChangeLog

    r208306 r208308  
     12016-11-01  Sam Weinig  <sam@webkit.org>
     2
     3        [WebIDL] Move interfaces and typed arrays over to JSDOMConvert
     4        https://bugs.webkit.org/show_bug.cgi?id=164256
     5
     6        Reviewed by Alex Christensen.
     7
     8        * runtime/JSArrayBuffer.h:
     9        (JSC::JSArrayBuffer::toWrapped):
     10        Change return type to ArrayBuffer* to match WebCore's expectation.
     11
    1122016-11-02  Filip Pizlo  <fpizlo@apple.com>
    213
  • trunk/Source/JavaScriptCore/runtime/JSArrayBuffer.h

    r208209 r208308  
    5454   
    5555    // This is the default DOM unwrapping. It calls toUnsharedArrayBuffer().
    56     static RefPtr<ArrayBuffer> toWrapped(JSValue);
     56    static ArrayBuffer* toWrapped(JSValue);
    5757   
    5858protected:
     
    8686}
    8787
    88 inline RefPtr<ArrayBuffer> JSArrayBuffer::toWrapped(JSValue value)
     88inline ArrayBuffer* JSArrayBuffer::toWrapped(JSValue value)
    8989{
    9090    return toUnsharedArrayBuffer(value);
  • trunk/Source/WebCore/ChangeLog

    r208307 r208308  
     12016-11-01  Sam Weinig  <sam@webkit.org>
     2
     3        [WebIDL] Move interfaces and typed arrays over to JSDOMConvert
     4        https://bugs.webkit.org/show_bug.cgi?id=164256
     5
     6        Reviewed by Alex Christensen.
     7
     8        - Add the ability to pass an "exception thrower" functor to the convert functions.
     9          This is only implemented for convert<IDLInterface<T>> and convert<IDLNullable<IDLInterface<T>>>
     10          for now, but can be extended for more types as necessary to improve exception messages.
     11        - Add support for using toJSNewlyCreated in JSDOMConvert.
     12
     13        * bindings/generic/IDLTypes.h:
     14        (WebCore::IDLString::extractValueFromNullable):
     15        Use forwarding to simplify extraction function.
     16
     17        (WebCore::IDLInterface::nullValue):
     18        Update nullValue to work for both RefPtr<T> and T*.
     19
     20        (WebCore::IDLInterface::extractValueFromNullable):
     21        Use forwarding to simplify extraction function.
     22
     23        * bindings/js/JSDOMConvert.h:
     24        (WebCore::DefaultExceptionThrower::operator()):
     25        Add a default "exception thrower" which throws a normal type error.
     26
     27        (WebCore::convert):
     28        Add an overload of convert which takes an "exception thrower".
     29
     30        (WebCore::toJSNewlyCreated):
     31        Add new overloaded function toJSNewlyCreated, matching the toJS overload set,
     32        which will return "newly created" values. This only works for types that implement
     33        a toJSNewlyCreated function for themselves.
     34
     35        (WebCore::Converter<IDLNullable<T>>::convert):
     36        Fix the return type of Converter<IDLNullable<T>> to be specialized when
     37        T is an IDLInterface. In that case, we want to match the return type of
     38        inner converter.
     39       
     40        Also add implementation of convert overload that takes an "exception thrower".
     41
     42        (WebCore::JSConverter<IDLNullable<T>>::convert):
     43        (WebCore::JSConverter<IDLNullable<T>>::convertNewlyCreated):
     44        Reimplement conversion to use forwarding of the value.
     45
     46        (WebCore::Converter<IDLInterface<T>>::convert):
     47        Add support for an "exception thrower".
     48
     49        (WebCore::Detail::getPtrOrRef):
     50        Add helper functions that extract either a pointer or reference, depending on the type,
     51        and const_casts it allowing the value to be used with toJS functions.
     52
     53        (WebCore::JSConverter<IDLInterface<T>>::convert):
     54        Re-implement to support more varied input values.
     55
     56        (WebCore::JSConverter<IDLInterface<T>>::convertNewlyCreated):
     57        Added. Forwards to overloaded toJSNewlyCreated functions.
     58
     59        * bindings/scripts/CodeGeneratorJS.pm:
     60        (AddToImplIncludesForIDLType):
     61        Add support for adding the right includes for SerializedScriptValue and Dictionary.
     62
     63        (GetArgumentExceptionThrower):
     64        (GetAttributeExceptionThrower):
     65        Add helpers to generate "exception thrower" lambdas for wrappers and typed arrays
     66        being passed to setters and functions.
     67
     68        (GenerateParametersCheck):
     69        Move around special cases so it is clear that it's not wrappers and typed arrays that
     70        need specialization here, it is now just EventListener and XPathNSResolver.
     71
     72        (GetIDLInterfaceName):
     73        Add helper to get the InterfaceName for use in IDLInterface template.
     74
     75        (GetBaseIDLType):
     76        Use new GetIDLInterfaceName helper.
     77
     78        (IsValidContextForJSValueToNative):
     79        Remove IDLOperation as a valid context. It is not.
     80
     81        (JSValueToNative):
     82        Move JSDOMConvert based conversion to the bottom, to show that everything above it
     83        is a special case that should be fixed. I have used explicit c-style if-statements
     84        to make it clear what the types of the exceptional cases are.
     85
     86        (NativeToJSValueDOMConvertNeedsState):
     87        (NativeToJSValueDOMConvertNeedsGlobalObject):
     88        Add wrapper types and typed arrays to the list needing state and globalObject.
     89
     90        (NativeToJSValue):
     91        Move JSDOMConvert based conversion to the bottom, to show that everything above it
     92        is a special case that should be fixed. I have used explicit c-style if-statements
     93        to make it clear what the types of the exceptional cases are.
     94
     95        (JSValueToNativeIsHandledByDOMConvert): Deleted.
     96        (NativeToJSValueIsHandledByDOMConvert): Deleted.
     97        Remove predicates protecting use of JSDOMConvert now that it is the default.
     98
     99        * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
     100        * bindings/scripts/test/JS/JSTestCEReactions.cpp:
     101        * bindings/scripts/test/JS/JSTestCallback.cpp:
     102        * bindings/scripts/test/JS/JSTestCallbackFunction.cpp:
     103        * bindings/scripts/test/JS/JSTestDOMJIT.cpp:
     104        * bindings/scripts/test/JS/JSTestEventTarget.cpp:
     105        * bindings/scripts/test/JS/JSTestInterface.cpp:
     106        * bindings/scripts/test/JS/JSTestObj.cpp:
     107        * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
     108        * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
     109        * bindings/scripts/test/JS/JSTestSerialization.cpp:
     110        * bindings/scripts/test/JS/JSTestTypedefs.cpp:
     111        Update test results.
     112
    11132016-11-02  David Kilzer  <ddkilzer@apple.com>
    2114
  • trunk/Source/WebCore/bindings/generic/IDLTypes.h

    r208002 r208308  
    8484    static String nullValue() { return String(); }
    8585    static bool isNullValue(const String& value) { return value.isNull(); }
    86     static const String& extractValueFromNullable(const String& value) { return value; }
     86    template <typename U> static U&& extractValueFromNullable(U&& value) { return std::forward<U>(value); }
    8787};
    8888struct IDLDOMString : IDLString { };
     
    9696
    9797    using NullableType = RefPtr<T>;
    98     static RefPtr<T> nullValue() { return nullptr; }
     98    static std::nullptr_t nullValue() { return nullptr; }
    9999    static bool isNullValue(const RefPtr<T>& value) { return !value; }
    100     static const RefPtr<T>& extractValueFromNullable(const RefPtr<T>& value) { return value; }
     100    template <typename U> static U&& extractValueFromNullable(U&& value) { return std::forward<U>(value); }
    101101};
    102102
  • trunk/Source/WebCore/bindings/js/JSDOMConvert.h

    r208002 r208308  
    3838enum class StringConversionConfiguration { Normal, TreatNullAsEmptyString };
    3939
     40struct DefaultExceptionThrower {
     41    void operator()(JSC::ExecState& state, JSC::ThrowScope& scope)
     42    {
     43        throwTypeError(&state, scope);
     44    }
     45};
     46
    4047template<typename T> typename Converter<T>::ReturnType convert(JSC::ExecState&, JSC::JSValue);
    4148template<typename T> typename Converter<T>::ReturnType convert(JSC::ExecState&, JSC::JSValue, IntegerConversionConfiguration);
    4249template<typename T> typename Converter<T>::ReturnType convert(JSC::ExecState&, JSC::JSValue, StringConversionConfiguration);
     50template<typename T, typename ExceptionThrower> typename Converter<T>::ReturnType convert(JSC::ExecState&, JSC::JSValue, ExceptionThrower&&);
    4351
    4452// Specialized by generated code for IDL dictionary conversion.
     
    6371{
    6472    return Converter<T>::convert(state, value, configuration);
     73}
     74
     75template<typename T, typename ExceptionThrower> inline typename Converter<T>::ReturnType convert(JSC::ExecState& state, JSC::JSValue value, ExceptionThrower&& exceptionThrower)
     76{
     77    return Converter<T>::convert(state, value, std::forward<ExceptionThrower>(exceptionThrower));
    6578}
    6679
     
    7386template<typename T, typename U> inline JSC::JSValue toJS(JSC::ExecState&, JSC::ThrowScope&, ExceptionOr<U>&&);
    7487template<typename T, typename U> inline JSC::JSValue toJS(JSC::ExecState&, JSDOMGlobalObject&, JSC::ThrowScope&, ExceptionOr<U>&&);
     88template<typename T, typename U> inline JSC::JSValue toJSNewlyCreated(JSC::ExecState&, JSDOMGlobalObject&, U&&);
     89template<typename T, typename U> inline JSC::JSValue toJSNewlyCreated(JSC::ExecState&, JSDOMGlobalObject&, JSC::ThrowScope&, ExceptionOr<U>&&);
    7590
    7691// Specialized by generated code for IDL enumeration conversion.
     
    150165}
    151166
     167template<typename T, typename U> inline JSC::JSValue toJSNewlyCreated(JSC::ExecState& state, JSDOMGlobalObject& globalObject, U&& value)
     168{
     169    return JSConverter<T>::convertNewlyCreated(state, globalObject, std::forward<U>(value));
     170}
     171
     172template<typename T, typename U> inline JSC::JSValue toJSNewlyCreated(JSC::ExecState& state, JSDOMGlobalObject& globalObject, JSC::ThrowScope& throwScope, ExceptionOr<U>&& value)
     173{
     174    if (UNLIKELY(value.hasException())) {
     175        propagateException(state, throwScope, value.releaseException());
     176        return { };
     177    }
     178
     179    return toJSNewlyCreated<T>(state, globalObject, value.releaseReturnValue());
     180}
     181
    152182
    153183template<typename T> struct DefaultConverter {
     
    158188// MARK: Nullable type
    159189
     190namespace Detail {
     191    template<typename IDLType>
     192    struct NullableConversionType;
     193
     194    template<typename IDLType>
     195    struct NullableConversionType {
     196        using Type = typename IDLNullable<IDLType>::ImplementationType;
     197    };
     198
     199    template<typename T>
     200    struct NullableConversionType<IDLInterface<T>> {
     201        using Type = typename Converter<IDLInterface<T>>::ReturnType;
     202    };
     203}
     204
    160205template<typename T> struct Converter<IDLNullable<T>> : DefaultConverter<IDLNullable<T>> {
    161     using ReturnType = typename IDLNullable<T>::ImplementationType;
     206    using ReturnType = typename Detail::NullableConversionType<T>::Type;
    162207   
    163208    // 1. If Type(V) is not Object, and the conversion to an IDL value is being performed
     
    189234        return Converter<T>::convert(state, value, configuration);
    190235    }
     236
     237    template<typename ExceptionThrower = DefaultExceptionThrower>
     238    static ReturnType convert(JSC::ExecState& state, JSC::JSValue value, ExceptionThrower&& exceptionThrower)
     239    {
     240        if (value.isUndefinedOrNull())
     241            return T::nullValue();
     242        return Converter<T>::convert(state, value, std::forward<ExceptionThrower>(exceptionThrower));
     243    }
    191244};
    192245
     
    197250    static constexpr bool needsGlobalObject = JSConverter<T>::needsGlobalObject;
    198251
    199     static JSC::JSValue convert(const ImplementationType& value)
     252    template<typename U>
     253    static JSC::JSValue convert(U&& value)
    200254    {
    201255        if (T::isNullValue(value))
     
    203257        return JSConverter<T>::convert(T::extractValueFromNullable(value));
    204258    }
    205     static JSC::JSValue convert(JSC::ExecState& state, const ImplementationType& value)
     259    template<typename U>
     260    static JSC::JSValue convert(JSC::ExecState& state, U&& value)
    206261    {
    207262        if (T::isNullValue(value))
     
    209264        return JSConverter<T>::convert(state, T::extractValueFromNullable(value));
    210265    }
    211     static JSC::JSValue convert(JSC::ExecState& state, JSDOMGlobalObject& globalObject, const ImplementationType& value)
     266    template<typename U>
     267    static JSC::JSValue convert(JSC::ExecState& state, JSDOMGlobalObject& globalObject, U&& value)
     268    {
     269        if (T::isNullValue(value))
     270            return JSC::jsNull();
     271        return JSConverter<T>::convert(state, globalObject, T::extractValueFromNullable(value));
     272    }
     273
     274    template<typename U>
     275    static JSC::JSValue convertNewlyCreated(JSC::ExecState& state, JSDOMGlobalObject& globalObject, U&& value)
    212276    {
    213277        if (T::isNullValue(value))
     
    262326    using WrapperType = typename JSDOMWrapperConverterTraits<T>::WrapperClass;
    263327
    264     static ReturnType convert(JSC::ExecState& state, JSC::JSValue value)
     328    template<typename ExceptionThrower = DefaultExceptionThrower>
     329    static ReturnType convert(JSC::ExecState& state, JSC::JSValue value, ExceptionThrower&& exceptionThrower = ExceptionThrower())
    265330    {
    266331        JSC::VM& vm = state.vm();
    267332        auto scope = DECLARE_THROW_SCOPE(vm);
    268333        ReturnType object = WrapperType::toWrapped(value);
    269         if (!object)
    270             throwTypeError(&state, scope);
     334        if (UNLIKELY(!object))
     335            exceptionThrower(state, scope);
    271336        return object;
    272337    }
    273338};
     339
     340namespace Detail {
     341
     342template <typename T> inline T* getPtrOrRef(const T* p) { return const_cast<T*>(p); }
     343template <typename T> inline T& getPtrOrRef(const T& p) { return const_cast<T&>(p); }
     344template <typename T> inline T* getPtrOrRef(const RefPtr<T>& p) { return const_cast<T*>(p.get()); }
     345template <typename T> inline T& getPtrOrRef(const Ref<T>& p) { return const_cast<T&>(p.get()); }
     346
     347}
    274348
    275349template<typename T> struct JSConverter<IDLInterface<T>> {
     
    277351    static constexpr bool needsGlobalObject = true;
    278352
     353    template <typename U>
     354    static JSC::JSValue convert(JSC::ExecState& state, JSDOMGlobalObject& globalObject, const U& value)
     355    {
     356        return toJS(&state, &globalObject, Detail::getPtrOrRef(value));
     357    }
     358
    279359    template<typename U>
    280     static JSC::JSValue convert(JSC::ExecState& exec, JSDOMGlobalObject& globalObject, const U& value)
    281     {
    282         return toJS(&exec, &globalObject, WTF::getPtr(value));
     360    static JSC::JSValue convertNewlyCreated(JSC::ExecState& state, JSDOMGlobalObject& globalObject, U&& value)
     361    {
     362        return toJSNewlyCreated(&state, &globalObject, std::forward<U>(value));
    283363    }
    284364};
  • trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm

    r208256 r208308  
    289289        return;
    290290    }
     291   
     292    if ($type->name eq "SerializedScriptValue") {
     293        AddToImplIncludes("SerializedScriptValue.h", $conditional);
     294        return;
     295    }
     296
     297    if ($type->name eq "Dictionary") {
     298        AddToImplIncludes("Dictionary.h", $conditional);
     299        return;
     300    }
    291301}
    292302
     
    532542    return 1 if not $interface->extendedAttributes->{CustomToJSObject};
    533543    return 0;
     544}
     545
     546sub GetArgumentExceptionThrower
     547{
     548    my ($interface, $argument, $argumentIndex, $quotedFunctionName) = @_;
     549
     550    return undef if !$codeGenerator->IsWrapperType($argument->type) && !$codeGenerator->IsTypedArrayType($argument->type);
     551
     552    my $name = $argument->name;
     553    my $visibleInterfaceName = $codeGenerator->GetVisibleInterfaceName($interface);
     554    my $typeName = $argument->type->name;
     555   
     556    return "[](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, ${argumentIndex}, \"${name}\", \"${visibleInterfaceName}\", ${quotedFunctionName}, \"${typeName}\"); }"
     557}
     558
     559sub GetAttributeExceptionThrower
     560{
     561    my ($interface, $attribute) = @_;
     562
     563    return undef if !$codeGenerator->IsWrapperType($attribute->type) && !$codeGenerator->IsTypedArrayType($attribute->type);
     564   
     565    my $name = $attribute->name;
     566    my $visibleInterfaceName = $codeGenerator->GetVisibleInterfaceName($interface);
     567    my $typeName = $attribute->type->name;
     568   
     569    return "[](JSC::ExecState& state, JSC::ThrowScope& scope) { throwAttributeTypeError(state, scope, \"${visibleInterfaceName}\", \"${name}\", \"${typeName}\"); }"
    534570}
    535571
     
    32773313                    my $jsType = NativeToJSValueUsingReferences($attribute, 0, $interface, "${functionName}(" . join(", ", @arguments) . ")", "thisObject");
    32783314                    push(@implContent, "    auto& impl = thisObject.wrapped();\n") if !$attribute->isStatic;
    3279                     if ($codeGenerator->IsSVGAnimatedType($type)) {
    3280                         push(@implContent, "    auto obj = $jsType;\n");
    3281                         push(@implContent, "    JSValue result = toJS(&state, thisObject.globalObject(), obj.get());\n");
    3282                     } else {
    3283                         push(@implContent, "    JSValue result = $jsType;\n");
    3284                     }
     3315                    push(@implContent, "    JSValue result = $jsType;\n");
    32853316                }
    32863317
     
    35413572                push(@implContent, "    ExceptionCode ec = 0;\n") if $setterMayThrowLegacyException;
    35423573
    3543                 my $shouldPassByReference = ShouldPassWrapperByReference($attribute, $interface);
    3544 
    3545                 my ($nativeValue, $mayThrowException) = JSValueToNative($interface, $attribute, "value", $attribute->extendedAttributes->{Conditional}, "&state", "state", "thisObject");
    3546                 if (!$shouldPassByReference && ($codeGenerator->IsWrapperType($type) || $codeGenerator->IsTypedArrayType($type))) {
    3547                     $implIncludes{"<runtime/Error.h>"} = 1;
    3548                     push(@implContent, "    " . GetNativeType($interface, $attribute->type) . " nativeValue = nullptr;\n");
    3549                     push(@implContent, "    if (!value.isUndefinedOrNull()) {\n");
    3550                     push(@implContent, "        nativeValue = $nativeValue;\n");
    3551                     push(@implContent, "        RETURN_IF_EXCEPTION(throwScope, false);\n") if $mayThrowException;
    3552                     push(@implContent, "        if (UNLIKELY(!nativeValue)) {\n");
    3553                     push(@implContent, "            throwAttributeTypeError(state, throwScope, \"$visibleInterfaceName\", \"$name\", \"" . $type->name . "\");\n");
    3554                     push(@implContent, "            return false;\n");
    3555                     push(@implContent, "        }\n");
    3556                     push(@implContent, "    }\n");
    3557                 } else {
    3558                     push(@implContent, "    auto nativeValue = $nativeValue;\n");
    3559                     push(@implContent, "    RETURN_IF_EXCEPTION(throwScope, false);\n") if $mayThrowException;
    3560                 }
     3574                my $exceptionThrower = GetAttributeExceptionThrower($interface, $attribute);
     3575
     3576                my ($nativeValue, $mayThrowException) = JSValueToNative($interface, $attribute, "value", $attribute->extendedAttributes->{Conditional}, "&state", "state", "thisObject", $exceptionThrower);
     3577
     3578                push(@implContent, "    auto nativeValue = $nativeValue;\n");
     3579                push(@implContent, "    RETURN_IF_EXCEPTION(throwScope, false);\n") if $mayThrowException;
    35613580
    35623581                if ($codeGenerator->IsEnumType($type)) {
    35633582                    push (@implContent, "    if (UNLIKELY(!nativeValue))\n");
    35643583                    push (@implContent, "        return false;\n");
    3565                 }
    3566 
    3567                 if ($shouldPassByReference) {
    3568                     push(@implContent, "    if (UNLIKELY(!nativeValue)) {\n");
    3569                     push(@implContent, "        throwAttributeTypeError(state, throwScope, \"$visibleInterfaceName\", \"$name\", \"" . $type->name . "\");\n");
    3570                     push(@implContent, "        return false;\n");
    3571                     push(@implContent, "    }\n");
    35723584                }
    35733585
     
    36083620                        push(@arguments, "nativeValue.value()");
    36093621                    } else {
    3610                         push(@arguments, $shouldPassByReference ? "*nativeValue" : "WTFMove(nativeValue)");
     3622                        push(@arguments, ShouldPassWrapperByReference($attribute, $interface) ? "*nativeValue" : "WTFMove(nativeValue)");
    36113623                    }
    36123624                    my $implementedBy = $attribute->extendedAttributes->{ImplementedBy};
     
    44134425            my $nativeType = GetNativeType($interface, $argument->type);
    44144426            my $isTearOff = $codeGenerator->IsSVGTypeNeedingTearOff($type) && $interfaceName !~ /List$/;
    4415             my $shouldPassByReference = $isTearOff || ShouldPassWrapperByReference($argument, $interface);
    44164427
    44174428            die "Variadic argument is already handled here" if $argument->isVariadic;
    44184429            my $argumentLookupMethod = $argument->isOptional ? "argument" : "uncheckedArgument";
    44194430
    4420             if (!$shouldPassByReference && ($codeGenerator->IsWrapperType($type) || $codeGenerator->IsTypedArrayType($type))) {
    4421                 $implIncludes{"<runtime/Error.h>"} = 1;
    4422                 my $checkedArgument = "state->$argumentLookupMethod($argumentIndex)";
    4423                 my $uncheckedArgument = "state->uncheckedArgument($argumentIndex)";
    4424                 my ($nativeValue, $mayThrowException) = JSValueToNative($interface, $argument, $uncheckedArgument, $function->extendedAttributes->{Conditional});
    4425                 push(@$outputArray, "    $nativeType $name = nullptr;\n");
    4426                 push(@$outputArray, "    if (!$checkedArgument.isUndefinedOrNull()) {\n");
    4427                 push(@$outputArray, "        $name = $nativeValue;\n");
    4428                 push(@$outputArray, "        RETURN_IF_EXCEPTION(throwScope, encodedJSValue());\n") if $mayThrowException;
    4429                 push(@$outputArray, "        if (UNLIKELY(!$name))\n");
    4430                 push(@$outputArray, "            return throwArgumentTypeError(*state, throwScope, $argumentIndex, \"$name\", \"$visibleInterfaceName\", $quotedFunctionName, \"" . $type->name . "\");\n");
    4431                 push(@$outputArray, "    }\n");
    4432                 $value = "WTFMove($name)";
     4431            if ($argument->isOptional && defined($argument->default) && !WillConvertUndefinedToDefaultParameterValue($type, $argument->default)) {
     4432                my $defaultValue = $argument->default;
     4433
     4434                # String-related optimizations.
     4435                if ($codeGenerator->IsStringType($type)) {
     4436                    my $useAtomicString = $argument->extendedAttributes->{AtomicString};
     4437                    if ($defaultValue eq "null") {
     4438                        $defaultValue = $useAtomicString ? "nullAtom" : "String()";
     4439                    } elsif ($defaultValue eq "\"\"") {
     4440                        $defaultValue = $useAtomicString ? "emptyAtom" : "emptyString()";
     4441                    } else {
     4442                        $defaultValue = $useAtomicString ? "AtomicString($defaultValue, AtomicString::ConstructFromLiteral)" : "ASCIILiteral($defaultValue)";
     4443                    }
     4444                } else {
     4445                    $defaultValue = GenerateDefaultValue($interface, $argument->type, $argument->default);
     4446                }
     4447
     4448                $outer = "state->$argumentLookupMethod($argumentIndex).isUndefined() ? $defaultValue : ";
     4449                $inner = "state->uncheckedArgument($argumentIndex)";
     4450            } elsif ($argument->isOptional && !defined($argument->default)) {
     4451                # Use WTF::Optional<>() for optional arguments that are missing or undefined and that do not have a default value in the IDL.
     4452                $outer = "state->$argumentLookupMethod($argumentIndex).isUndefined() ? Optional<$nativeType>() : ";
     4453                $inner = "state->uncheckedArgument($argumentIndex)";
     4454            } elsif (($argument->type->name eq "EventListener" || $argument->type->name eq "XPathNSResolver") && ($argument->isOptional || $type->isNullable)) {
     4455                $outer = "";
     4456                $inner = "state->uncheckedArgument($argumentIndex)";
    44334457            } else {
    4434                 if ($argument->isOptional && defined($argument->default) && !WillConvertUndefinedToDefaultParameterValue($type, $argument->default)) {
    4435                     my $defaultValue = $argument->default;
    4436 
    4437                     # String-related optimizations.
    4438                     if ($codeGenerator->IsStringType($type)) {
    4439                         my $useAtomicString = $argument->extendedAttributes->{AtomicString};
    4440                         if ($defaultValue eq "null") {
    4441                             $defaultValue = $useAtomicString ? "nullAtom" : "String()";
    4442                         } elsif ($defaultValue eq "\"\"") {
    4443                             $defaultValue = $useAtomicString ? "emptyAtom" : "emptyString()";
    4444                         } else {
    4445                             $defaultValue = $useAtomicString ? "AtomicString($defaultValue, AtomicString::ConstructFromLiteral)" : "ASCIILiteral($defaultValue)";
    4446                         }
    4447                     } else {
    4448                         $defaultValue = GenerateDefaultValue($interface, $argument->type, $argument->default);
    4449                     }
    4450 
    4451                     $outer = "state->$argumentLookupMethod($argumentIndex).isUndefined() ? $defaultValue : ";
    4452                     $inner = "state->uncheckedArgument($argumentIndex)";
    4453                 } elsif ($argument->isOptional && !defined($argument->default)) {
    4454                     # Use WTF::Optional<>() for optional arguments that are missing or undefined and that do not have a default value in the IDL.
    4455                     $outer = "state->$argumentLookupMethod($argumentIndex).isUndefined() ? Optional<$nativeType>() : ";
    4456                     $inner = "state->uncheckedArgument($argumentIndex)";
     4458                $outer = "";
     4459                $inner = "state->$argumentLookupMethod($argumentIndex)";
     4460            }
     4461
     4462            my $argumentExceptionThrower = GetArgumentExceptionThrower($interface, $argument, $argumentIndex, $quotedFunctionName);
     4463            my ($nativeValue, $mayThrowException) = JSValueToNative($interface, $argument, $inner, $function->extendedAttributes->{Conditional}, "state", "*state", "", $argumentExceptionThrower);
     4464
     4465            if ($argument->type->name eq "EventListener" || $argument->type->name eq "XPathNSResolver") {
     4466                if ($argument->isOptional || $type->isNullable) {
     4467                    push(@$outputArray, "    $nativeType $name = nullptr;\n");
     4468                    push(@$outputArray, "    if (!state->$argumentLookupMethod($argumentIndex).isUndefinedOrNull()) {\n");
     4469                    push(@$outputArray, "        $name = $nativeValue;\n");
     4470                    push(@$outputArray, "        RETURN_IF_EXCEPTION(throwScope, encodedJSValue());\n") if $mayThrowException;
     4471                    push(@$outputArray, "        if (UNLIKELY(!$name))\n");
     4472                    push(@$outputArray, "            return throwArgumentTypeError(*state, throwScope, $argumentIndex, \"$name\", \"$visibleInterfaceName\", $quotedFunctionName, \"" . $type->name . "\");\n");
     4473                    push(@$outputArray, "    }\n");
    44574474                } else {
    4458                     $outer = "";
    4459                     $inner = "state->$argumentLookupMethod($argumentIndex)";
     4475                    push(@$outputArray, "    auto $name = $nativeValue;\n");
     4476                    push(@$outputArray, "    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());\n") if $mayThrowException;
     4477                    push(@$outputArray, "    if (UNLIKELY(!$name))\n");
     4478                    push(@$outputArray, "        return throwArgumentTypeError(*state, throwScope, $argumentIndex, \"$name\", \"$visibleInterfaceName\", $quotedFunctionName, \"" . $type->name . "\");\n");
    44604479                }
    4461 
    4462                 my ($nativeValue, $mayThrowException) = JSValueToNative($interface, $argument, $inner, $function->extendedAttributes->{Conditional});
     4480            } else {
    44634481                push(@$outputArray, "    auto $name = ${outer}${nativeValue};\n");
    4464                 $value = "WTFMove($name)";
    44654482                push(@$outputArray, "    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());\n") if $mayThrowException;
    44664483            }
    44674484
    4468             if ($shouldPassByReference) {
    4469                 push(@$outputArray, "    if (UNLIKELY(!$name))\n");
    4470                 push(@$outputArray, "        return throwArgumentTypeError(*state, throwScope, $argumentIndex, \"$name\", \"$visibleInterfaceName\", $quotedFunctionName, \"" . $type->name . "\");\n");
    4471                 $value = $isTearOff ? "$name->propertyReference()" : "*$name";
    4472             }
    4473 
    4474             if ($codeGenerator->IsTypedArrayType($type) and $type->name ne "ArrayBuffer") {
    4475                $value = $shouldPassByReference ? "$name.releaseNonNull()" : "WTFMove($name)";
    4476             } elsif ($codeGenerator->IsDictionaryType($type)) {
     4485            if ($isTearOff) {
     4486                $value = "$name->propertyReference()";
     4487            } elsif (ShouldPassWrapperByReference($argument, $interface)) {
     4488                if ($codeGenerator->IsTypedArrayType($type) and $type->name ne "ArrayBuffer") {
     4489                    $value = "$name.releaseNonNull()";
     4490                } else {
     4491                    $value = "*$name";
     4492                }
     4493            } else {
    44774494                $value = "WTFMove($name)";
    44784495            }
     
    50695086}
    50705087
     5088sub GetIDLInterfaceName
     5089{
     5090    my ($type) = @_;
     5091
     5092    return $codeGenerator->GetSVGTypeNeedingTearOff($type) if $codeGenerator->IsSVGTypeNeedingTearOff($type);
     5093    return $type->name;
     5094}
     5095
    50715096sub GetBaseIDLType
    50725097{
     
    51035128    return "IDLFrozenArray<" . GetIDLType($interface, @{$type->subtypes}[0]) . ">" if $codeGenerator->IsFrozenArrayType($type);
    51045129    return "IDLUnion<" . join(", ", GetIDLUnionMemberTypes($interface, $type)) . ">" if $type->isUnion;
    5105     return "IDLInterface<" . $type->name . ">";
     5130    return "IDLInterface<" . GetIDLInterfaceName($type) . ">";
    51065131}
    51075132
     
    52355260}
    52365261
    5237 sub JSValueToNativeIsHandledByDOMConvert
    5238 {
    5239     my ($type, $context) = @_;
    5240 
    5241     return 0 if $type->name eq "DOMString" && ($context->extendedAttributes->{RequiresExistingAtomicString} || $context->extendedAttributes->{AtomicString});
    5242 
    5243     return 1 if $type->isUnion;
    5244     return 1 if $type->name eq "any";
    5245     return 1 if $type->name eq "boolean";
    5246     return 1 if $type->name eq "Date";
    5247     return 1 if $type->name eq "BufferSource";
    5248     return 1 if $codeGenerator->IsIntegerType($type);
    5249     return 1 if $codeGenerator->IsFloatingPointType($type);
    5250     return 1 if $codeGenerator->IsSequenceOrFrozenArrayType($type);
    5251     return 1 if $codeGenerator->IsDictionaryType($type);
    5252     return 1 if $codeGenerator->IsStringType($type);
    5253     return 0;
    5254 }
    5255 
    52565262sub IsValidContextForJSValueToNative
    52575263{
    52585264    my $context = shift;
    52595265   
    5260     return ref($context) eq "IDLAttribute" || ref($context) eq "IDLOperation" || ref($context) eq "IDLArgument";
     5266    return ref($context) eq "IDLAttribute" || ref($context) eq "IDLArgument";
    52615267}
    52625268
     
    52655271sub JSValueToNative
    52665272{
    5267     my ($interface, $context, $value, $conditional, $statePointer, $stateReference, $thisObjectReference) = @_;
     5273    my ($interface, $context, $value, $conditional, $statePointer, $stateReference, $thisObjectReference, $exceptionThrower) = @_;
    52685274
    52695275    assert("Invalid context type") if !IsValidContextForJSValueToNative($context);
     
    52765282    $thisObjectReference = "*castedThis" unless $thisObjectReference;
    52775283
    5278     if (JSValueToNativeIsHandledByDOMConvert($type, $context)) {
    5279         AddToImplIncludes("JSDOMConvert.h");
    5280         AddToImplIncludesForIDLType($type, $conditional);
    5281 
    5282         my $IDLType = GetIDLType($interface, $type);
    5283 
    5284         my @conversionArguments = ();
    5285         push(@conversionArguments, "$stateReference");
    5286         push(@conversionArguments, "$value");
    5287         push(@conversionArguments, GetIntegerConversionConfiguration($context)) if $codeGenerator->IsIntegerType($type);
    5288         push(@conversionArguments, GetStringConversionConfiguration($context)) if $codeGenerator->IsStringType($type);
    5289 
    5290         return ("convert<$IDLType>(" . join(", ", @conversionArguments) . ")", 1);
    5291     }
     5284    AddToImplIncludesForIDLType($type, $conditional);
    52925285
    52935286    if ($type->name eq "DOMString") {
    52945287        return ("AtomicString($value.toString($statePointer)->toExistingAtomicString($statePointer))", 1) if $context->extendedAttributes->{RequiresExistingAtomicString};
    52955288        return ("$value.toString($statePointer)->toAtomicString($statePointer)", 1) if $context->extendedAttributes->{AtomicString};
    5296         assert("Unhandled string conversion.");
    52975289    }
    52985290
    52995291    if ($type->name eq "SerializedScriptValue") {
    5300         AddToImplIncludes("SerializedScriptValue.h", $conditional);
    53015292        return ("SerializedScriptValue::create($stateReference, $value)", 1);
    53025293    }
    53035294
    53045295    if ($type->name eq "Dictionary") {
    5305         AddToImplIncludes("Dictionary.h", $conditional);
    53065296        return ("Dictionary($statePointer, $value)", 0);
    53075297    }
    53085298
    5309     AddToImplIncludesForIDLType($type, $conditional);
    5310 
    5311     return ("toUnshared@{[$type->name]}($value)", 1) if $codeGenerator->IsTypedArrayType($type);
    5312     return ("parseEnumeration<" . GetEnumerationClassName($type, $interface) . ">($stateReference, $value)", 1) if $codeGenerator->IsEnumType($type);
     5299    if ($codeGenerator->IsEnumType($type)) {
     5300        return ("parseEnumeration<" . GetEnumerationClassName($type, $interface) . ">($stateReference, $value)", 1);
     5301    }
    53135302
    53145303    # FIXME: EventListener should be a callback interface.
    5315     return "JSEventListener::create($value, $thisObjectReference, false, currentWorld($statePointer))" if $type->name eq "EventListener";
    5316 
    5317     my $extendedAttributes = $codeGenerator->GetInterfaceExtendedAttributesFromName($type->name);
    5318     return ("JS" . $type->name . "::toWrapped($stateReference, $value)", 1) if $type->name eq "XPathNSResolver";
    5319     return ("JS" . $type->name . "::toWrapped($value)", 0);
    5320 }
    5321 
    5322 sub NativeToJSValueIsHandledByDOMConvert
    5323 {
    5324     my ($type) = @_;
    5325    
    5326     return 1 if $type->name eq "any";
    5327     return 1 if $type->name eq "boolean";
    5328     return 1 if $type->name eq "Date";
    5329     return 1 if $codeGenerator->IsIntegerType($type);
    5330     return 1 if $codeGenerator->IsFloatingPointType($type);
    5331     return 1 if $codeGenerator->IsStringType($type);
    5332     return 1 if $codeGenerator->IsEnumType($type);
    5333     return 1 if $codeGenerator->IsSequenceOrFrozenArrayType($type);
    5334     return 1 if $type->isUnion;
    5335 
    5336     return 0;
     5304    if ($type->name eq "EventListener") {
     5305        return ("JSEventListener::create($value, $thisObjectReference, false, currentWorld($statePointer))", 0);
     5306    }
     5307
     5308    # FIXME: XPathNSResolver should be a callback interface.
     5309    if ($type->name eq "XPathNSResolver") {
     5310        return ("JSXPathNSResolver::toWrapped($stateReference, $value)", 1);
     5311    }
     5312
     5313    AddToImplIncludes("JSDOMConvert.h");
     5314
     5315    my $IDLType = GetIDLType($interface, $type);
     5316
     5317    my @conversionArguments = ();
     5318    push(@conversionArguments, "$stateReference");
     5319    push(@conversionArguments, "$value");
     5320    push(@conversionArguments, GetIntegerConversionConfiguration($context)) if $codeGenerator->IsIntegerType($type);
     5321    push(@conversionArguments, GetStringConversionConfiguration($context)) if $codeGenerator->IsStringType($type);
     5322    push(@conversionArguments, $exceptionThrower) if $exceptionThrower;
     5323
     5324    return ("convert<$IDLType>(" . join(", ", @conversionArguments) . ")", 1);
    53375325}
    53385326
     
    53465334    return 1 if $codeGenerator->IsStringType($type);
    53475335    return 1 if $codeGenerator->IsEnumType($type);
     5336    return 1 if $codeGenerator->IsWrapperType($type);
     5337    return 1 if $codeGenerator->IsTypedArrayType($type);
    53485338    return 1 if $type->name eq "Date";
    53495339
     
    53585348    return 1 if $type->isUnion;
    53595349    return 1 if $codeGenerator->IsSequenceOrFrozenArrayType($type);
     5350    return 1 if $codeGenerator->IsWrapperType($type);
     5351    return 1 if $codeGenerator->IsTypedArrayType($type);
    53605352
    53615353    return 0;
     
    54175409    }
    54185410
    5419     if (NativeToJSValueIsHandledByDOMConvert($type)) {
    5420         AddToImplIncludes("JSDOMConvert.h");
    5421         AddToImplIncludesForIDLType($type, $conditional);
    5422 
    5423         my $IDLType = GetIDLType($interface, $type);
    5424 
    5425         my @conversionArguments = ();
    5426         push(@conversionArguments, "$stateReference") if NativeToJSValueDOMConvertNeedsState($type) || $mayThrowException;
    5427         push(@conversionArguments, "*$globalObject") if NativeToJSValueDOMConvertNeedsGlobalObject($type);
    5428         push(@conversionArguments, "throwScope") if $mayThrowException;
    5429         push(@conversionArguments, "$value");
    5430 
    5431         return "toJS<$IDLType>(" . join(", ", @conversionArguments) . ")";
    5432     }
     5411    AddToImplIncludesForIDLType($type, $conditional);
     5412
    54335413
    54345414    if ($type->name eq "SerializedScriptValue") {
    5435         AddToImplIncludes("SerializedScriptValue.h", $conditional);
    54365415        return "$value ? $value->deserialize($stateReference, $globalObject) : jsNull()";
    54375416    }
    5438 
    5439     AddToImplIncludesForIDLType($type, $conditional);
    5440 
    5441     return $value if $codeGenerator->IsSVGAnimatedType($type);
    5442 
    5443     if ($codeGenerator->IsSVGAnimatedType($interface->type) or ($interface->type->name eq "SVGViewSpec" and $type->name eq "SVGTransformList")) {
    5444         # Convert from abstract RefPtr<ListProperty> to real type, so the right toJS() method can be invoked.
    5445         $value = "static_cast<" . GetNativeType($interface, $type) . ">($value.get())";
    5446     } elsif ($interface->type->name eq "SVGViewSpec") {
    5447         # Convert from abstract SVGProperty to real type, so the right toJS() method can be invoked.
    5448         $value = "static_cast<" . GetNativeType($interface, $type) . ">($value)";
    5449     } elsif ($codeGenerator->IsSVGTypeNeedingTearOff($type) and not $interface->type->name =~ /List$/) {
    5450         my $tearOffType = $codeGenerator->GetSVGTypeNeedingTearOff($type);
    5451         if ($codeGenerator->IsSVGTypeWithWritablePropertiesNeedingTearOff($type) and !$inFunctionCall and not defined $context->extendedAttributes->{Immutable}) {
    5452             my $getter = $value;
    5453             $getter =~ s/impl\.//;
    5454             $getter =~ s/impl->//;
    5455             $getter =~ s/\(\)//;
    5456             my $updateMethod = "&" . $interface->type->name . "::update" . $codeGenerator->WK_ucfirst($getter);
    5457 
    5458             my $selfIsTearOffType = $codeGenerator->IsSVGTypeNeedingTearOff($interface->type);
    5459             if ($selfIsTearOffType) {
    5460                 # FIXME: Why SVGMatrix specifically?
    5461                 AddToImplIncludes("SVGMatrixTearOff.h", $conditional);
    5462                 $value = "SVGMatrixTearOff::create($wrapped, $value)";
    5463             } else {
    5464                 AddToImplIncludes("SVGStaticPropertyTearOff.h", $conditional);
    5465                 my $interfaceName = $interface->type->name;
    5466                 $tearOffType =~ s/SVGPropertyTearOff</SVGStaticPropertyTearOff<$interfaceName, /;
    5467                 $value = "${tearOffType}::create(impl, $value, $updateMethod)";
    5468             }
    5469         } elsif ($tearOffType =~ /SVGStaticListPropertyTearOff/) {
    5470             $value = "${tearOffType}::create(impl, $value)";
    5471         } elsif (not $tearOffType =~ /SVG(Point|PathSeg)List/) {
    5472             $value = "${tearOffType}::create($value)";
     5417   
     5418    if ($codeGenerator->IsWrapperType($type) && !$codeGenerator->IsSVGAnimatedType($type)) {
     5419        if ($codeGenerator->IsSVGAnimatedType($interface->type) or ($interface->type->name eq "SVGViewSpec" and $type->name eq "SVGTransformList")) {
     5420            # Convert from abstract RefPtr<ListProperty> to real type, so the right toJS() method can be invoked.
     5421            $value = "static_cast<" . GetNativeType($interface, $type) . ">($value.get())";
     5422        } elsif ($interface->type->name eq "SVGViewSpec") {
     5423            # Convert from abstract SVGProperty to real type, so the right toJS() method can be invoked.
     5424            $value = "static_cast<" . GetNativeType($interface, $type) . ">($value)";
     5425        } elsif ($codeGenerator->IsSVGTypeNeedingTearOff($type) and not $interface->type->name =~ /List$/) {
     5426            my $tearOffType = $codeGenerator->GetSVGTypeNeedingTearOff($type);
     5427            if ($codeGenerator->IsSVGTypeWithWritablePropertiesNeedingTearOff($type) and !$inFunctionCall and not defined $context->extendedAttributes->{Immutable}) {
     5428                my $getter = $value;
     5429                $getter =~ s/impl\.//;
     5430                $getter =~ s/impl->//;
     5431                $getter =~ s/\(\)//;
     5432                my $updateMethod = "&" . $interface->type->name . "::update" . $codeGenerator->WK_ucfirst($getter);
     5433
     5434                my $selfIsTearOffType = $codeGenerator->IsSVGTypeNeedingTearOff($interface->type);
     5435                if ($selfIsTearOffType) {
     5436                    # FIXME: Why SVGMatrix specifically?
     5437                    AddToImplIncludes("SVGMatrixTearOff.h", $conditional);
     5438                    $value = "SVGMatrixTearOff::create($wrapped, $value)";
     5439                } else {
     5440                    AddToImplIncludes("SVGStaticPropertyTearOff.h", $conditional);
     5441                    my $interfaceName = $interface->type->name;
     5442                    $tearOffType =~ s/SVGPropertyTearOff</SVGStaticPropertyTearOff<$interfaceName, /;
     5443                    $value = "${tearOffType}::create(impl, $value, $updateMethod)";
     5444                }
     5445            } elsif ($tearOffType =~ /SVGStaticListPropertyTearOff/) {
     5446                $value = "${tearOffType}::create(impl, $value)";
     5447            } elsif (not $tearOffType =~ /SVG(Point|PathSeg)List/) {
     5448                $value = "${tearOffType}::create($value)";
     5449            }
    54735450        }
    54745451    }
     
    54765453    $value = "BindingSecurity::checkSecurityForNode($stateReference, $value)" if $context->extendedAttributes->{CheckSecurityForNode};
    54775454
    5478     my $functionName = "toJS";
    5479     $functionName = "toJSNewlyCreated" if $context->extendedAttributes->{NewObject};
    5480 
    5481     my $arguments = "$statePointer, $globalObject, $value";
    5482     $arguments = "$stateReference, *$globalObject, throwScope, $value" if $mayThrowException;
    5483 
    5484     return "$functionName($arguments)";
     5455    AddToImplIncludes("JSDOMConvert.h");
     5456
     5457    my $IDLType = GetIDLType($interface, $type);
     5458
     5459    my @conversionArguments = ();
     5460    push(@conversionArguments, "$stateReference") if NativeToJSValueDOMConvertNeedsState($type) || $mayThrowException;
     5461    push(@conversionArguments, "*$globalObject") if NativeToJSValueDOMConvertNeedsGlobalObject($type);
     5462    push(@conversionArguments, "throwScope") if $mayThrowException;
     5463    push(@conversionArguments, "$value");
     5464
     5465    my $functionName = $context->extendedAttributes->{NewObject} ? "toJSNewlyCreated" : "toJS";
     5466
     5467    return "${functionName}<${IDLType}>(" . join(", ", @conversionArguments) . ")";
    54855468}
    54865469
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestActiveDOMObject.cpp

    r208124 r208308  
    215215    if (UNLIKELY(state->argumentCount() < 1))
    216216        return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
    217     auto nextChild = JSNode::toWrapped(state->uncheckedArgument(0));
    218     if (UNLIKELY(!nextChild))
    219         return throwArgumentTypeError(*state, throwScope, 0, "nextChild", "TestActiveDOMObject", "excitingFunction", "Node");
     217    auto nextChild = convert<IDLInterface<Node>>(*state, state->uncheckedArgument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 0, "nextChild", "TestActiveDOMObject", "excitingFunction", "Node"); });
     218    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
    220219    impl.excitingFunction(*nextChild);
    221220    return JSValue::encode(jsUndefined());
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCEReactions.cpp

    r208256 r208308  
    190190    UNUSED_PARAM(state);
    191191    auto& impl = thisObject.wrapped();
    192     JSValue result = toJS(&state, thisObject.globalObject(), impl.stringifierAttribute());
     192    JSValue result = toJS<IDLInterface<TestCEReactionsStringifier>>(state, *thisObject.globalObject(), impl.stringifierAttribute());
    193193    return result;
    194194}
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallback.cpp

    r207737 r208308  
    126126    ExecState* state = m_data->globalObject()->globalExec();
    127127    MarkedArgumentBuffer args;
    128     args.append(toJS(state, m_data->globalObject(), arrayParam));
     128    args.append(toJS<IDLInterface<Float32Array>>(*state, *m_data->globalObject(), arrayParam));
    129129
    130130    NakedPtr<JSC::Exception> returnedException;
     
    167167    ExecState* state = m_data->globalObject()->globalExec();
    168168    MarkedArgumentBuffer args;
    169     args.append(toJS(state, m_data->globalObject(), listParam));
     169    args.append(toJS<IDLInterface<DOMStringList>>(*state, *m_data->globalObject(), listParam));
    170170
    171171    NakedPtr<JSC::Exception> returnedException;
     
    208208    MarkedArgumentBuffer args;
    209209    args.append(toJS<IDLLong>(longParam));
    210     args.append(toJS(state, m_data->globalObject(), testNodeParam));
     210    args.append(toJS<IDLInterface<TestNode>>(*state, *m_data->globalObject(), testNodeParam));
    211211
    212212    NakedPtr<JSC::Exception> returnedException;
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunction.cpp

    r207737 r208308  
    9191    ExecState* state = m_data->globalObject()->globalExec();
    9292    MarkedArgumentBuffer args;
    93     args.append(toJS(state, m_data->globalObject(), arrayParam));
     93    args.append(toJS<IDLInterface<Float32Array>>(*state, *m_data->globalObject(), arrayParam));
    9494
    9595    NakedPtr<JSC::Exception> returnedException;
     
    134134    ExecState* state = m_data->globalObject()->globalExec();
    135135    MarkedArgumentBuffer args;
    136     args.append(toJS(state, m_data->globalObject(), listParam));
     136    args.append(toJS<IDLInterface<DOMStringList>>(*state, *m_data->globalObject(), listParam));
    137137
    138138    NakedPtr<JSC::Exception> returnedException;
     
    177177    MarkedArgumentBuffer args;
    178178    args.append(toJS<IDLLong>(longParam));
    179     args.append(toJS(state, m_data->globalObject(), testNodeParam));
     179    args.append(toJS<IDLInterface<TestNode>>(*state, *m_data->globalObject(), testNodeParam));
    180180
    181181    NakedPtr<JSC::Exception> returnedException;
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestDOMJIT.cpp

    r208124 r208308  
    603603    UNUSED_PARAM(state);
    604604    auto& impl = thisObject.wrapped();
    605     JSValue result = toJS(&state, thisObject.globalObject(), impl.byteStringAttr());
     605    JSValue result = toJS<IDLByteString>(state, *thisObject.globalObject(), impl.byteStringAttr());
    606606    return result;
    607607}
     
    657657    UNUSED_PARAM(state);
    658658    auto& impl = thisObject.wrapped();
    659     JSValue result = toJS(&state, thisObject.globalObject(), impl.nodeAttr());
     659    JSValue result = toJS<IDLInterface<Node>>(state, *thisObject.globalObject(), impl.nodeAttr());
    660660    return result;
    661661}
     
    10621062    UNUSED_PARAM(state);
    10631063    auto& impl = thisObject.wrapped();
    1064     JSValue result = toJS(&state, thisObject.globalObject(), impl.byteStringNullableAttr());
     1064    JSValue result = toJS<IDLNullable<IDLByteString>>(state, *thisObject.globalObject(), impl.byteStringNullableAttr());
    10651065    return result;
    10661066}
     
    11161116    UNUSED_PARAM(state);
    11171117    auto& impl = thisObject.wrapped();
    1118     JSValue result = toJS(&state, thisObject.globalObject(), impl.nodeNullableAttr());
     1118    JSValue result = toJS<IDLNullable<IDLInterface<Node>>>(state, *thisObject.globalObject(), impl.nodeNullableAttr());
    11191119    return result;
    11201120}
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.cpp

    r208124 r208308  
    221221    auto index = convert<IDLUnsignedLong>(*state, state->uncheckedArgument(0), IntegerConversionConfiguration::Normal);
    222222    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
    223     JSValue result = toJS(state, castedThis->globalObject(), impl.item(WTFMove(index)));
     223    JSValue result = toJS<IDLInterface<Node>>(*state, *castedThis->globalObject(), impl.item(WTFMove(index)));
    224224    return JSValue::encode(result);
    225225}
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp

    r208124 r208308  
    512512    UNUSED_PARAM(state);
    513513    auto& impl = thisObject.wrapped();
    514     JSValue result = toJS(&state, thisObject.globalObject(), impl.implementsNode());
     514    JSValue result = toJS<IDLInterface<Node>>(state, *thisObject.globalObject(), impl.implementsNode());
    515515    return result;
    516516}
     
    622622    UNUSED_PARAM(state);
    623623    auto& impl = thisObject.wrapped();
    624     JSValue result = toJS(&state, thisObject.globalObject(), WebCore::TestSupplemental::supplementalNode(impl));
     624    JSValue result = toJS<IDLInterface<Node>>(state, *thisObject.globalObject(), WebCore::TestSupplemental::supplementalNode(impl));
    625625    return result;
    626626}
     
    741741    UNUSED_PARAM(throwScope);
    742742    auto& impl = thisObject.wrapped();
    743     auto nativeValue = JSNode::toWrapped(value);
    744     if (UNLIKELY(!nativeValue)) {
    745         throwAttributeTypeError(state, throwScope, "TestInterface", "implementsNode", "Node");
    746         return false;
    747     }
     743    auto nativeValue = convert<IDLInterface<Node>>(state, value, [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwAttributeTypeError(state, scope, "TestInterface", "implementsNode", "Node"); });
     744    RETURN_IF_EXCEPTION(throwScope, false);
    748745    impl.setImplementsNode(*nativeValue);
    749746    return true;
     
    819816    UNUSED_PARAM(throwScope);
    820817    auto& impl = thisObject.wrapped();
    821     auto nativeValue = JSNode::toWrapped(value);
    822     if (UNLIKELY(!nativeValue)) {
    823         throwAttributeTypeError(state, throwScope, "TestInterface", "supplementalNode", "Node");
    824         return false;
    825     }
     818    auto nativeValue = convert<IDLInterface<Node>>(state, value, [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwAttributeTypeError(state, scope, "TestInterface", "supplementalNode", "Node"); });
     819    RETURN_IF_EXCEPTION(throwScope, false);
    826820    WebCore::TestSupplemental::setSupplementalNode(impl, *nativeValue);
    827821    return true;
     
    875869    auto strArg = convert<IDLDOMString>(*state, state->uncheckedArgument(0), StringConversionConfiguration::Normal);
    876870    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
    877     auto objArg = JSTestObj::toWrapped(state->uncheckedArgument(1));
    878     if (UNLIKELY(!objArg))
    879         return throwArgumentTypeError(*state, throwScope, 1, "objArg", "TestInterface", "implementsMethod2", "TestObj");
    880     JSValue result = toJS(state, castedThis->globalObject(), impl.implementsMethod2(*context, WTFMove(strArg), *objArg, ec));
     871    auto objArg = convert<IDLInterface<TestObj>>(*state, state->uncheckedArgument(1), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 1, "objArg", "TestInterface", "implementsMethod2", "TestObj"); });
     872    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
     873    JSValue result = toJS<IDLInterface<TestObj>>(*state, *castedThis->globalObject(), impl.implementsMethod2(*context, WTFMove(strArg), *objArg, ec));
    881874
    882875    setDOMException(state, throwScope, ec);
     
    955948    auto strArg = convert<IDLDOMString>(*state, state->uncheckedArgument(0), StringConversionConfiguration::Normal);
    956949    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
    957     auto objArg = JSTestObj::toWrapped(state->uncheckedArgument(1));
    958     if (UNLIKELY(!objArg))
    959         return throwArgumentTypeError(*state, throwScope, 1, "objArg", "TestInterface", "supplementalMethod2", "TestObj");
    960     JSValue result = toJS(state, castedThis->globalObject(), WebCore::TestSupplemental::supplementalMethod2(impl, *context, WTFMove(strArg), *objArg, ec));
     950    auto objArg = convert<IDLInterface<TestObj>>(*state, state->uncheckedArgument(1), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 1, "objArg", "TestInterface", "supplementalMethod2", "TestObj"); });
     951    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
     952    JSValue result = toJS<IDLInterface<TestObj>>(*state, *castedThis->globalObject(), WebCore::TestSupplemental::supplementalMethod2(impl, *context, WTFMove(strArg), *objArg, ec));
    961953
    962954    setDOMException(state, throwScope, ec);
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp

    r208212 r208308  
    18601860    UNUSED_PARAM(state);
    18611861    auto& impl = thisObject.wrapped();
    1862     JSValue result = toJS(&state, thisObject.globalObject(), impl.readOnlyTestObjAttr());
     1862    JSValue result = toJS<IDLInterface<TestObj>>(state, *thisObject.globalObject(), impl.readOnlyTestObjAttr());
    18631863    return result;
    18641864}
     
    21312131    UNUSED_PARAM(state);
    21322132    auto& impl = thisObject.wrapped();
    2133     JSValue result = toJS(&state, thisObject.globalObject(), impl.testObjAttr());
     2133    JSValue result = toJS<IDLInterface<TestObj>>(state, *thisObject.globalObject(), impl.testObjAttr());
    21342134    return result;
    21352135}
     
    21472147    UNUSED_PARAM(state);
    21482148    auto& impl = thisObject.wrapped();
    2149     JSValue result = toJS(&state, thisObject.globalObject(), impl.testNullableObjAttr());
     2149    JSValue result = toJS<IDLNullable<IDLInterface<TestObj>>>(state, *thisObject.globalObject(), impl.testNullableObjAttr());
    21502150    return result;
    21512151}
     
    21632163    UNUSED_PARAM(state);
    21642164    auto& impl = thisObject.wrapped();
    2165     JSValue result = toJS(&state, thisObject.globalObject(), impl.lenientTestObjAttr());
     2165    JSValue result = toJS<IDLInterface<TestObj>>(state, *thisObject.globalObject(), impl.lenientTestObjAttr());
    21662166    return result;
    21672167}
     
    22432243    UNUSED_PARAM(state);
    22442244    auto& impl = thisObject.wrapped();
    2245     JSValue result = toJS(&state, thisObject.globalObject(), impl.xmlObjAttr());
     2245    JSValue result = toJS<IDLInterface<TestObj>>(state, *thisObject.globalObject(), impl.xmlObjAttr());
    22462246    return result;
    22472247}
     
    24702470    UNUSED_PARAM(state);
    24712471    auto& impl = thisObject.wrapped();
    2472     JSValue result = toJS(&state, thisObject.globalObject(), impl.typedArrayAttr());
     2472    JSValue result = toJS<IDLInterface<Float32Array>>(state, *thisObject.globalObject(), impl.typedArrayAttr());
    24732473    return result;
    24742474}
     
    26632663        return jsUndefined();
    26642664    auto& impl = thisObject.wrapped();
    2665     JSValue result = toJS(&state, thisObject.globalObject(), impl.withScriptExecutionContextAttribute(*context));
     2665    JSValue result = toJS<IDLInterface<TestObj>>(state, *thisObject.globalObject(), impl.withScriptExecutionContextAttribute(*context));
    26662666    return result;
    26672667}
     
    26802680    ExceptionCode ec = 0;
    26812681    auto& impl = thisObject.wrapped();
    2682     JSValue result = toJS(&state, thisObject.globalObject(), impl.withScriptStateAttributeRaises(state, ec));
     2682    JSValue result = toJS<IDLInterface<TestObj>>(state, *thisObject.globalObject(), impl.withScriptStateAttributeRaises(state, ec));
    26832683    setDOMException(&state, throwScope, ec);
    26842684    return result;
     
    27012701        return jsUndefined();
    27022702    auto& impl = thisObject.wrapped();
    2703     JSValue result = toJS(&state, thisObject.globalObject(), impl.withScriptExecutionContextAttributeRaises(*context, ec));
     2703    JSValue result = toJS<IDLInterface<TestObj>>(state, *thisObject.globalObject(), impl.withScriptExecutionContextAttributeRaises(*context, ec));
    27042704    setDOMException(&state, throwScope, ec);
    27052705    return result;
     
    27212721        return jsUndefined();
    27222722    auto& impl = thisObject.wrapped();
    2723     JSValue result = toJS(&state, thisObject.globalObject(), impl.withScriptExecutionContextAndScriptStateAttribute(state, *context));
     2723    JSValue result = toJS<IDLInterface<TestObj>>(state, *thisObject.globalObject(), impl.withScriptExecutionContextAndScriptStateAttribute(state, *context));
    27242724    return result;
    27252725}
     
    27412741        return jsUndefined();
    27422742    auto& impl = thisObject.wrapped();
    2743     JSValue result = toJS(&state, thisObject.globalObject(), impl.withScriptExecutionContextAndScriptStateAttributeRaises(state, *context, ec));
     2743    JSValue result = toJS<IDLInterface<TestObj>>(state, *thisObject.globalObject(), impl.withScriptExecutionContextAndScriptStateAttributeRaises(state, *context, ec));
    27442744    setDOMException(&state, throwScope, ec);
    27452745    return result;
     
    27612761        return jsUndefined();
    27622762    auto& impl = thisObject.wrapped();
    2763     JSValue result = toJS(&state, thisObject.globalObject(), impl.withScriptExecutionContextAndScriptStateWithSpacesAttribute(state, *context));
     2763    JSValue result = toJS<IDLInterface<TestObj>>(state, *thisObject.globalObject(), impl.withScriptExecutionContextAndScriptStateWithSpacesAttribute(state, *context));
    27642764    return result;
    27652765}
     
    27772777    UNUSED_PARAM(state);
    27782778    auto& impl = thisObject.wrapped();
    2779     JSValue result = toJS(&state, thisObject.globalObject(), impl.withScriptArgumentsAndCallStackAttribute());
     2779    JSValue result = toJS<IDLInterface<TestObj>>(state, *thisObject.globalObject(), impl.withScriptArgumentsAndCallStackAttribute());
    27802780    return result;
    27812781}
     
    29552955    UNUSED_PARAM(state);
    29562956    auto& impl = thisObject.wrapped();
    2957     JSValue result = toJS(&state, thisObject.globalObject(), BindingSecurity::checkSecurityForNode(state, impl.contentDocument()));
     2957    JSValue result = toJS<IDLInterface<Document>>(state, *thisObject.globalObject(), BindingSecurity::checkSecurityForNode(state, impl.contentDocument()));
    29582958    return result;
    29592959}
     
    29712971    UNUSED_PARAM(state);
    29722972    auto& impl = thisObject.wrapped();
    2973     JSValue result = toJS(&state, thisObject.globalObject(), SVGStaticPropertyTearOff<TestObj, SVGPoint>::create(impl, impl.mutablePoint(), &TestObj::updateMutablePoint));
     2973    JSValue result = toJS<IDLInterface<SVGPropertyTearOff<SVGPoint>>>(state, *thisObject.globalObject(), SVGStaticPropertyTearOff<TestObj, SVGPoint>::create(impl, impl.mutablePoint(), &TestObj::updateMutablePoint));
    29742974    return result;
    29752975}
     
    29872987    UNUSED_PARAM(state);
    29882988    auto& impl = thisObject.wrapped();
    2989     JSValue result = toJS(&state, thisObject.globalObject(), SVGPropertyTearOff<SVGPoint>::create(impl.immutablePoint()));
     2989    JSValue result = toJS<IDLInterface<SVGPropertyTearOff<SVGPoint>>>(state, *thisObject.globalObject(), SVGPropertyTearOff<SVGPoint>::create(impl.immutablePoint()));
    29902990    return result;
    29912991}
     
    32453245    UNUSED_PARAM(state);
    32463246    auto& impl = thisObject.wrapped();
    3247     JSValue result = toJS(&state, thisObject.globalObject(), impl.testReadOnlyPromiseAttribute());
     3247    JSValue result = toJS<IDLInterface<Promise>>(state, *thisObject.globalObject(), impl.testReadOnlyPromiseAttribute());
    32483248    return result;
    32493249}
     
    32613261    UNUSED_PARAM(state);
    32623262    auto& impl = thisObject.wrapped();
    3263     JSValue result = toJS(&state, thisObject.globalObject(), impl.putForwardsAttribute());
     3263    JSValue result = toJS<IDLInterface<TestNode>>(state, *thisObject.globalObject(), impl.putForwardsAttribute());
    32643264    return result;
    32653265}
     
    32773277    UNUSED_PARAM(state);
    32783278    auto& impl = thisObject.wrapped();
    3279     JSValue result = toJS(&state, thisObject.globalObject(), impl.putForwardsNullableAttribute());
     3279    JSValue result = toJS<IDLNullable<IDLInterface<TestNode>>>(state, *thisObject.globalObject(), impl.putForwardsNullableAttribute());
    32803280    return result;
    32813281}
     
    35923592    UNUSED_PARAM(throwScope);
    35933593    auto& impl = thisObject.wrapped();
    3594     auto nativeValue = JSTestObj::toWrapped(value);
    3595     if (UNLIKELY(!nativeValue)) {
    3596         throwAttributeTypeError(state, throwScope, "TestObject", "testObjAttr", "TestObj");
    3597         return false;
    3598     }
     3594    auto nativeValue = convert<IDLInterface<TestObj>>(state, value, [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwAttributeTypeError(state, scope, "TestObject", "testObjAttr", "TestObj"); });
     3595    RETURN_IF_EXCEPTION(throwScope, false);
    35993596    impl.setTestObjAttr(*nativeValue);
    36003597    return true;
     
    36143611    UNUSED_PARAM(throwScope);
    36153612    auto& impl = thisObject.wrapped();
    3616     TestObj* nativeValue = nullptr;
    3617     if (!value.isUndefinedOrNull()) {
    3618         nativeValue = JSTestObj::toWrapped(value);
    3619         if (UNLIKELY(!nativeValue)) {
    3620             throwAttributeTypeError(state, throwScope, "TestObject", "testNullableObjAttr", "TestObj");
    3621             return false;
    3622         }
    3623     }
     3613    auto nativeValue = convert<IDLNullable<IDLInterface<TestObj>>>(state, value, [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwAttributeTypeError(state, scope, "TestObject", "testNullableObjAttr", "TestObj"); });
     3614    RETURN_IF_EXCEPTION(throwScope, false);
    36243615    impl.setTestNullableObjAttr(WTFMove(nativeValue));
    36253616    return true;
     
    36393630    UNUSED_PARAM(throwScope);
    36403631    auto& impl = thisObject.wrapped();
    3641     auto nativeValue = JSTestObj::toWrapped(value);
    3642     if (UNLIKELY(!nativeValue)) {
    3643         throwAttributeTypeError(state, throwScope, "TestObject", "lenientTestObjAttr", "TestObj");
    3644         return false;
    3645     }
     3632    auto nativeValue = convert<IDLInterface<TestObj>>(state, value, [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwAttributeTypeError(state, scope, "TestObject", "lenientTestObjAttr", "TestObj"); });
     3633    RETURN_IF_EXCEPTION(throwScope, false);
    36463634    impl.setLenientTestObjAttr(*nativeValue);
    36473635    return true;
     
    37203708    UNUSED_PARAM(throwScope);
    37213709    auto& impl = thisObject.wrapped();
    3722     auto nativeValue = JSTestObj::toWrapped(value);
    3723     if (UNLIKELY(!nativeValue)) {
    3724         throwAttributeTypeError(state, throwScope, "TestObject", "XMLObjAttr", "TestObj");
    3725         return false;
    3726     }
     3710    auto nativeValue = convert<IDLInterface<TestObj>>(state, value, [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwAttributeTypeError(state, scope, "TestObject", "XMLObjAttr", "TestObj"); });
     3711    RETURN_IF_EXCEPTION(throwScope, false);
    37273712    impl.setXMLObjAttr(*nativeValue);
    37283713    return true;
     
    39913976    UNUSED_PARAM(throwScope);
    39923977    auto& impl = thisObject.wrapped();
    3993     auto nativeValue = toUnsharedFloat32Array(value);
     3978    auto nativeValue = convert<IDLInterface<Float32Array>>(state, value, [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwAttributeTypeError(state, scope, "TestObject", "typedArrayAttr", "Float32Array"); });
    39943979    RETURN_IF_EXCEPTION(throwScope, false);
    3995     if (UNLIKELY(!nativeValue)) {
    3996         throwAttributeTypeError(state, throwScope, "TestObject", "typedArrayAttr", "Float32Array");
    3997         return false;
    3998     }
    39993980    impl.setTypedArrayAttr(nativeValue.get());
    40003981    return true;
     
    42184199    UNUSED_PARAM(throwScope);
    42194200    auto& impl = thisObject.wrapped();
    4220     auto nativeValue = JSTestObj::toWrapped(value);
    4221     if (UNLIKELY(!nativeValue)) {
    4222         throwAttributeTypeError(state, throwScope, "TestObject", "withScriptExecutionContextAttribute", "TestObj");
    4223         return false;
    4224     }
     4201    auto nativeValue = convert<IDLInterface<TestObj>>(state, value, [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwAttributeTypeError(state, scope, "TestObject", "withScriptExecutionContextAttribute", "TestObj"); });
     4202    RETURN_IF_EXCEPTION(throwScope, false);
    42254203    auto* context = jsCast<JSDOMGlobalObject*>(state.lexicalGlobalObject())->scriptExecutionContext();
    42264204    if (!context)
     
    42434221    UNUSED_PARAM(throwScope);
    42444222    auto& impl = thisObject.wrapped();
    4245     auto nativeValue = JSTestObj::toWrapped(value);
    4246     if (UNLIKELY(!nativeValue)) {
    4247         throwAttributeTypeError(state, throwScope, "TestObject", "withScriptStateAttributeRaises", "TestObj");
    4248         return false;
    4249     }
     4223    auto nativeValue = convert<IDLInterface<TestObj>>(state, value, [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwAttributeTypeError(state, scope, "TestObject", "withScriptStateAttributeRaises", "TestObj"); });
     4224    RETURN_IF_EXCEPTION(throwScope, false);
    42504225    impl.setWithScriptStateAttributeRaises(state, *nativeValue);
    42514226    return true;
     
    42654240    UNUSED_PARAM(throwScope);
    42664241    auto& impl = thisObject.wrapped();
    4267     auto nativeValue = JSTestObj::toWrapped(value);
    4268     if (UNLIKELY(!nativeValue)) {
    4269         throwAttributeTypeError(state, throwScope, "TestObject", "withScriptExecutionContextAttributeRaises", "TestObj");
    4270         return false;
    4271     }
     4242    auto nativeValue = convert<IDLInterface<TestObj>>(state, value, [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwAttributeTypeError(state, scope, "TestObject", "withScriptExecutionContextAttributeRaises", "TestObj"); });
     4243    RETURN_IF_EXCEPTION(throwScope, false);
    42724244    auto* context = jsCast<JSDOMGlobalObject*>(state.lexicalGlobalObject())->scriptExecutionContext();
    42734245    if (!context)
     
    42904262    UNUSED_PARAM(throwScope);
    42914263    auto& impl = thisObject.wrapped();
    4292     auto nativeValue = JSTestObj::toWrapped(value);
    4293     if (UNLIKELY(!nativeValue)) {
    4294         throwAttributeTypeError(state, throwScope, "TestObject", "withScriptExecutionContextAndScriptStateAttribute", "TestObj");
    4295         return false;
    4296     }
     4264    auto nativeValue = convert<IDLInterface<TestObj>>(state, value, [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwAttributeTypeError(state, scope, "TestObject", "withScriptExecutionContextAndScriptStateAttribute", "TestObj"); });
     4265    RETURN_IF_EXCEPTION(throwScope, false);
    42974266    auto* context = jsCast<JSDOMGlobalObject*>(state.lexicalGlobalObject())->scriptExecutionContext();
    42984267    if (!context)
     
    43154284    UNUSED_PARAM(throwScope);
    43164285    auto& impl = thisObject.wrapped();
    4317     auto nativeValue = JSTestObj::toWrapped(value);
    4318     if (UNLIKELY(!nativeValue)) {
    4319         throwAttributeTypeError(state, throwScope, "TestObject", "withScriptExecutionContextAndScriptStateAttributeRaises", "TestObj");
    4320         return false;
    4321     }
     4286    auto nativeValue = convert<IDLInterface<TestObj>>(state, value, [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwAttributeTypeError(state, scope, "TestObject", "withScriptExecutionContextAndScriptStateAttributeRaises", "TestObj"); });
     4287    RETURN_IF_EXCEPTION(throwScope, false);
    43224288    auto* context = jsCast<JSDOMGlobalObject*>(state.lexicalGlobalObject())->scriptExecutionContext();
    43234289    if (!context)
     
    43404306    UNUSED_PARAM(throwScope);
    43414307    auto& impl = thisObject.wrapped();
    4342     auto nativeValue = JSTestObj::toWrapped(value);
    4343     if (UNLIKELY(!nativeValue)) {
    4344         throwAttributeTypeError(state, throwScope, "TestObject", "withScriptExecutionContextAndScriptStateWithSpacesAttribute", "TestObj");
    4345         return false;
    4346     }
     4308    auto nativeValue = convert<IDLInterface<TestObj>>(state, value, [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwAttributeTypeError(state, scope, "TestObject", "withScriptExecutionContextAndScriptStateWithSpacesAttribute", "TestObj"); });
     4309    RETURN_IF_EXCEPTION(throwScope, false);
    43474310    auto* context = jsCast<JSDOMGlobalObject*>(state.lexicalGlobalObject())->scriptExecutionContext();
    43484311    if (!context)
     
    43654328    UNUSED_PARAM(throwScope);
    43664329    auto& impl = thisObject.wrapped();
    4367     auto nativeValue = JSTestObj::toWrapped(value);
    4368     if (UNLIKELY(!nativeValue)) {
    4369         throwAttributeTypeError(state, throwScope, "TestObject", "withScriptArgumentsAndCallStackAttribute", "TestObj");
    4370         return false;
    4371     }
     4330    auto nativeValue = convert<IDLInterface<TestObj>>(state, value, [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwAttributeTypeError(state, scope, "TestObject", "withScriptArgumentsAndCallStackAttribute", "TestObj"); });
     4331    RETURN_IF_EXCEPTION(throwScope, false);
    43724332    impl.setWithScriptArgumentsAndCallStackAttribute(*nativeValue);
    43734333    return true;
     
    45234483    UNUSED_PARAM(throwScope);
    45244484    auto& impl = thisObject.wrapped();
    4525     SVGPropertyTearOff<SVGPoint>* nativeValue = nullptr;
    4526     if (!value.isUndefinedOrNull()) {
    4527         nativeValue = JSSVGPoint::toWrapped(value);
    4528         if (UNLIKELY(!nativeValue)) {
    4529             throwAttributeTypeError(state, throwScope, "TestObject", "mutablePoint", "SVGPoint");
    4530             return false;
    4531         }
    4532     }
     4485    auto nativeValue = convert<IDLInterface<SVGPropertyTearOff<SVGPoint>>>(state, value, [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwAttributeTypeError(state, scope, "TestObject", "mutablePoint", "SVGPoint"); });
     4486    RETURN_IF_EXCEPTION(throwScope, false);
    45334487    impl.setMutablePoint(WTFMove(nativeValue));
    45344488    return true;
     
    45484502    UNUSED_PARAM(throwScope);
    45494503    auto& impl = thisObject.wrapped();
    4550     SVGPropertyTearOff<SVGPoint>* nativeValue = nullptr;
    4551     if (!value.isUndefinedOrNull()) {
    4552         nativeValue = JSSVGPoint::toWrapped(value);
    4553         if (UNLIKELY(!nativeValue)) {
    4554             throwAttributeTypeError(state, throwScope, "TestObject", "immutablePoint", "SVGPoint");
    4555             return false;
    4556         }
    4557     }
     4504    auto nativeValue = convert<IDLInterface<SVGPropertyTearOff<SVGPoint>>>(state, value, [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwAttributeTypeError(state, scope, "TestObject", "immutablePoint", "SVGPoint"); });
     4505    RETURN_IF_EXCEPTION(throwScope, false);
    45584506    impl.setImmutablePoint(WTFMove(nativeValue));
    45594507    return true;
     
    48884836    auto strArg = convert<IDLDOMString>(*state, state->uncheckedArgument(1), StringConversionConfiguration::Normal);
    48894837    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
    4890     auto objArg = JSTestObj::toWrapped(state->uncheckedArgument(2));
    4891     if (UNLIKELY(!objArg))
    4892         return throwArgumentTypeError(*state, throwScope, 2, "objArg", "TestObject", "voidMethodWithArgs", "TestObj");
     4838    auto objArg = convert<IDLInterface<TestObj>>(*state, state->uncheckedArgument(2), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 2, "objArg", "TestObject", "voidMethodWithArgs", "TestObj"); });
     4839    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
    48934840    impl.voidMethodWithArgs(WTFMove(longArg), WTFMove(strArg), *objArg);
    48944841    return JSValue::encode(jsUndefined());
     
    49294876    auto strArg = convert<IDLDOMString>(*state, state->uncheckedArgument(1), StringConversionConfiguration::Normal);
    49304877    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
    4931     auto objArg = JSTestObj::toWrapped(state->uncheckedArgument(2));
    4932     if (UNLIKELY(!objArg))
    4933         return throwArgumentTypeError(*state, throwScope, 2, "objArg", "TestObject", "byteMethodWithArgs", "TestObj");
     4878    auto objArg = convert<IDLInterface<TestObj>>(*state, state->uncheckedArgument(2), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 2, "objArg", "TestObject", "byteMethodWithArgs", "TestObj"); });
     4879    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
    49344880    JSValue result = toJS<IDLByte>(impl.byteMethodWithArgs(WTFMove(byteArg), WTFMove(strArg), *objArg));
    49354881    return JSValue::encode(result);
     
    49704916    auto strArg = convert<IDLDOMString>(*state, state->uncheckedArgument(1), StringConversionConfiguration::Normal);
    49714917    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
    4972     auto objArg = JSTestObj::toWrapped(state->uncheckedArgument(2));
    4973     if (UNLIKELY(!objArg))
    4974         return throwArgumentTypeError(*state, throwScope, 2, "objArg", "TestObject", "octetMethodWithArgs", "TestObj");
     4918    auto objArg = convert<IDLInterface<TestObj>>(*state, state->uncheckedArgument(2), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 2, "objArg", "TestObject", "octetMethodWithArgs", "TestObj"); });
     4919    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
    49754920    JSValue result = toJS<IDLOctet>(impl.octetMethodWithArgs(WTFMove(octetArg), WTFMove(strArg), *objArg));
    49764921    return JSValue::encode(result);
     
    50114956    auto strArg = convert<IDLDOMString>(*state, state->uncheckedArgument(1), StringConversionConfiguration::Normal);
    50124957    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
    5013     auto objArg = JSTestObj::toWrapped(state->uncheckedArgument(2));
    5014     if (UNLIKELY(!objArg))
    5015         return throwArgumentTypeError(*state, throwScope, 2, "objArg", "TestObject", "longMethodWithArgs", "TestObj");
     4958    auto objArg = convert<IDLInterface<TestObj>>(*state, state->uncheckedArgument(2), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 2, "objArg", "TestObject", "longMethodWithArgs", "TestObj"); });
     4959    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
    50164960    JSValue result = toJS<IDLLong>(impl.longMethodWithArgs(WTFMove(longArg), WTFMove(strArg), *objArg));
    50174961    return JSValue::encode(result);
     
    50304974    UNUSED_PARAM(throwScope);
    50314975    auto& impl = castedThis->wrapped();
    5032     JSValue result = toJS(state, castedThis->globalObject(), impl.objMethod());
     4976    JSValue result = toJS<IDLInterface<TestObj>>(*state, *castedThis->globalObject(), impl.objMethod());
    50334977    return JSValue::encode(result);
    50344978}
     
    50524996    auto strArg = convert<IDLDOMString>(*state, state->uncheckedArgument(1), StringConversionConfiguration::Normal);
    50534997    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
    5054     auto objArg = JSTestObj::toWrapped(state->uncheckedArgument(2));
    5055     if (UNLIKELY(!objArg))
    5056         return throwArgumentTypeError(*state, throwScope, 2, "objArg", "TestObject", "objMethodWithArgs", "TestObj");
    5057     JSValue result = toJS(state, castedThis->globalObject(), impl.objMethodWithArgs(WTFMove(longArg), WTFMove(strArg), *objArg));
     4998    auto objArg = convert<IDLInterface<TestObj>>(*state, state->uncheckedArgument(2), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 2, "objArg", "TestObject", "objMethodWithArgs", "TestObj"); });
     4999    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
     5000    JSValue result = toJS<IDLInterface<TestObj>>(*state, *castedThis->globalObject(), impl.objMethodWithArgs(WTFMove(longArg), WTFMove(strArg), *objArg));
    50585001    return JSValue::encode(result);
    50595002}
     
    52805223    auto strArg = convert<IDLDOMString>(*state, state->uncheckedArgument(0), StringConversionConfiguration::Normal);
    52815224    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
    5282     auto objArg = JSTestObj::toWrapped(state->uncheckedArgument(1));
    5283     if (UNLIKELY(!objArg))
    5284         return throwArgumentTypeError(*state, throwScope, 1, "objArg", "TestObject", "methodThatRequiresAllArgsAndThrows", "TestObj");
    5285     JSValue result = toJS(state, castedThis->globalObject(), impl.methodThatRequiresAllArgsAndThrows(WTFMove(strArg), *objArg, ec));
     5225    auto objArg = convert<IDLInterface<TestObj>>(*state, state->uncheckedArgument(1), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 1, "objArg", "TestObject", "methodThatRequiresAllArgsAndThrows", "TestObj"); });
     5226    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
     5227    JSValue result = toJS<IDLInterface<TestObj>>(*state, *castedThis->globalObject(), impl.methodThatRequiresAllArgsAndThrows(WTFMove(strArg), *objArg, ec));
    52865228
    52875229    setDOMException(state, throwScope, ec);
     
    54335375    UNUSED_PARAM(throwScope);
    54345376    auto& impl = castedThis->wrapped();
    5435     JSValue result = toJS(*state, *castedThis->globalObject(), throwScope, impl.methodWithExceptionReturningObject());
     5377    JSValue result = toJS<IDLInterface<TestObj>>(*state, *castedThis->globalObject(), throwScope, impl.methodWithExceptionReturningObject());
    54365378    return JSValue::encode(result);
    54375379}
     
    56015543    UNUSED_PARAM(throwScope);
    56025544    auto& impl = castedThis->wrapped();
    5603     JSValue result = toJS(state, castedThis->globalObject(), impl.withScriptStateObj(*state));
     5545    JSValue result = toJS<IDLInterface<TestObj>>(*state, *castedThis->globalObject(), impl.withScriptStateObj(*state));
    56045546    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
    56055547    return JSValue::encode(result);
     
    56375579    auto& impl = castedThis->wrapped();
    56385580    ExceptionCode ec = 0;
    5639     JSValue result = toJS(state, castedThis->globalObject(), impl.withScriptStateObjException(*state, ec));
     5581    JSValue result = toJS<IDLInterface<TestObj>>(*state, *castedThis->globalObject(), impl.withScriptStateObjException(*state, ec));
    56405582
    56415583    setDOMException(state, throwScope, ec);
     
    56985640    if (!context)
    56995641        return JSValue::encode(jsUndefined());
    5700     JSValue result = toJS(state, castedThis->globalObject(), impl.withScriptExecutionContextAndScriptStateObjException(*state, *context, ec));
     5642    JSValue result = toJS<IDLInterface<TestObj>>(*state, *castedThis->globalObject(), impl.withScriptExecutionContextAndScriptStateObjException(*state, *context, ec));
    57015643
    57025644    setDOMException(state, throwScope, ec);
     
    57205662    if (!context)
    57215663        return JSValue::encode(jsUndefined());
    5722     JSValue result = toJS(state, castedThis->globalObject(), impl.withScriptExecutionContextAndScriptStateWithSpaces(*state, *context));
     5664    JSValue result = toJS<IDLInterface<TestObj>>(*state, *castedThis->globalObject(), impl.withScriptExecutionContextAndScriptStateWithSpaces(*state, *context));
    57235665    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
    57245666    return JSValue::encode(result);
     
    62886230    UNUSED_PARAM(throwScope);
    62896231    auto& impl = castedThis->wrapped();
    6290     TestObj* obj = nullptr;
    6291     if (!state->argument(0).isUndefinedOrNull()) {
    6292         obj = JSTestObj::toWrapped(state->uncheckedArgument(0));
    6293         if (UNLIKELY(!obj))
    6294             return throwArgumentTypeError(*state, throwScope, 0, "obj", "TestObject", "methodWithOptionalNullableWrapper", "TestObj");
    6295     }
     6232    auto obj = convert<IDLNullable<IDLInterface<TestObj>>>(*state, state->argument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 0, "obj", "TestObject", "methodWithOptionalNullableWrapper", "TestObj"); });
     6233    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
    62966234    impl.methodWithOptionalNullableWrapper(WTFMove(obj));
    62976235    return JSValue::encode(jsUndefined());
     
    63106248    UNUSED_PARAM(throwScope);
    63116249    auto& impl = castedThis->wrapped();
    6312     TestObj* obj = nullptr;
    6313     if (!state->argument(0).isUndefinedOrNull()) {
    6314         obj = JSTestObj::toWrapped(state->uncheckedArgument(0));
    6315         if (UNLIKELY(!obj))
    6316             return throwArgumentTypeError(*state, throwScope, 0, "obj", "TestObject", "methodWithOptionalNullableWrapperIsNull", "TestObj");
    6317     }
     6250    auto obj = convert<IDLNullable<IDLInterface<TestObj>>>(*state, state->argument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 0, "obj", "TestObject", "methodWithOptionalNullableWrapperIsNull", "TestObj"); });
     6251    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
    63186252    impl.methodWithOptionalNullableWrapperIsNull(WTFMove(obj));
    63196253    return JSValue::encode(jsUndefined());
     
    65756509    if (UNLIKELY(state->argumentCount() < 2))
    65766510        return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
    6577     TestObj* objArg = nullptr;
    6578     if (!state->uncheckedArgument(0).isUndefinedOrNull()) {
    6579         objArg = JSTestObj::toWrapped(state->uncheckedArgument(0));
    6580         if (UNLIKELY(!objArg))
    6581             return throwArgumentTypeError(*state, throwScope, 0, "objArg", "TestObject", "overloadedMethod", "TestObj");
    6582     }
     6511    auto objArg = convert<IDLNullable<IDLInterface<TestObj>>>(*state, state->uncheckedArgument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 0, "objArg", "TestObject", "overloadedMethod", "TestObj"); });
     6512    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
    65836513    auto strArg = convert<IDLDOMString>(*state, state->uncheckedArgument(1), StringConversionConfiguration::Normal);
    65846514    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
     
    66016531    if (UNLIKELY(state->argumentCount() < 1))
    66026532        return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
    6603     TestObj* objArg = nullptr;
    6604     if (!state->uncheckedArgument(0).isUndefinedOrNull()) {
    6605         objArg = JSTestObj::toWrapped(state->uncheckedArgument(0));
    6606         if (UNLIKELY(!objArg))
    6607             return throwArgumentTypeError(*state, throwScope, 0, "objArg", "TestObject", "overloadedMethod", "TestObj");
    6608     }
     6533    auto objArg = convert<IDLNullable<IDLInterface<TestObj>>>(*state, state->uncheckedArgument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 0, "objArg", "TestObject", "overloadedMethod", "TestObj"); });
     6534    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
    66096535    auto longArg = state->argument(1).isUndefined() ? Optional<int32_t>() : convert<IDLLong>(*state, state->uncheckedArgument(1), IntegerConversionConfiguration::Normal);
    66106536    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
     
    66886614    if (UNLIKELY(state->argumentCount() < 1))
    66896615        return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
    6690     DOMStringList* listArg = nullptr;
    6691     if (!state->uncheckedArgument(0).isUndefinedOrNull()) {
    6692         listArg = JSDOMStringList::toWrapped(state->uncheckedArgument(0));
    6693         if (UNLIKELY(!listArg))
    6694             return throwArgumentTypeError(*state, throwScope, 0, "listArg", "TestObject", "overloadedMethod", "DOMStringList");
    6695     }
     6616    auto listArg = convert<IDLNullable<IDLInterface<DOMStringList>>>(*state, state->uncheckedArgument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 0, "listArg", "TestObject", "overloadedMethod", "DOMStringList"); });
     6617    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
    66966618    impl.overloadedMethod(WTFMove(listArg));
    66976619    return JSValue::encode(jsUndefined());
     
    67326654    if (UNLIKELY(state->argumentCount() < 1))
    67336655        return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
    6734     auto objArg = JSTestObj::toWrapped(state->uncheckedArgument(0));
    6735     if (UNLIKELY(!objArg))
    6736         return throwArgumentTypeError(*state, throwScope, 0, "objArg", "TestObject", "overloadedMethod", "TestObj");
     6656    auto objArg = convert<IDLInterface<TestObj>>(*state, state->uncheckedArgument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 0, "objArg", "TestObject", "overloadedMethod", "TestObj"); });
     6657    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
    67376658    impl.overloadedMethod(*objArg);
    67386659    return JSValue::encode(jsUndefined());
     
    67536674    if (UNLIKELY(state->argumentCount() < 1))
    67546675        return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
    6755     auto window = JSDOMWindow::toWrapped(state->uncheckedArgument(0));
    6756     if (UNLIKELY(!window))
    6757         return throwArgumentTypeError(*state, throwScope, 0, "window", "TestObject", "overloadedMethod", "DOMWindow");
     6676    auto window = convert<IDLInterface<DOMWindow>>(*state, state->uncheckedArgument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 0, "window", "TestObject", "overloadedMethod", "DOMWindow"); });
     6677    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
    67586678    impl.overloadedMethod(*window);
    67596679    return JSValue::encode(jsUndefined());
     
    69006820    auto strArg = convert<IDLDOMString>(*state, state->uncheckedArgument(0), StringConversionConfiguration::Normal);
    69016821    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
    6902     TestObj* objArg = nullptr;
    6903     if (!state->argument(1).isUndefinedOrNull()) {
    6904         objArg = JSTestObj::toWrapped(state->uncheckedArgument(1));
    6905         if (UNLIKELY(!objArg))
    6906             return throwArgumentTypeError(*state, throwScope, 1, "objArg", "TestObject", "overloadedMethodWithOptionalParameter", "TestObj");
    6907     }
     6822    auto objArg = convert<IDLNullable<IDLInterface<TestObj>>>(*state, state->argument(1), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 1, "objArg", "TestObject", "overloadedMethodWithOptionalParameter", "TestObj"); });
     6823    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
    69086824    impl.overloadedMethodWithOptionalParameter(WTFMove(strArg), WTFMove(objArg));
    69096825    return JSValue::encode(jsUndefined());
     
    69246840    if (UNLIKELY(state->argumentCount() < 1))
    69256841        return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
    6926     TestObj* objArg = nullptr;
    6927     if (!state->uncheckedArgument(0).isUndefinedOrNull()) {
    6928         objArg = JSTestObj::toWrapped(state->uncheckedArgument(0));
    6929         if (UNLIKELY(!objArg))
    6930             return throwArgumentTypeError(*state, throwScope, 0, "objArg", "TestObject", "overloadedMethodWithOptionalParameter", "TestObj");
    6931     }
     6842    auto objArg = convert<IDLNullable<IDLInterface<TestObj>>>(*state, state->uncheckedArgument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 0, "objArg", "TestObject", "overloadedMethodWithOptionalParameter", "TestObj"); });
     6843    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
    69326844    auto longArg = state->argument(1).isUndefined() ? Optional<int32_t>() : convert<IDLLong>(*state, state->uncheckedArgument(1), IntegerConversionConfiguration::Normal);
    69336845    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
     
    70977009    auto objectOrNode = convert<IDLUnion<IDLInterface<TestObj>, IDLInterface<TestNode>>>(*state, state->uncheckedArgument(0));
    70987010    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
    7099     auto object = JSTestObj::toWrapped(state->uncheckedArgument(1));
    7100     if (UNLIKELY(!object))
    7101         return throwArgumentTypeError(*state, throwScope, 1, "object", "TestObject", "overloadedMethodWithNonDistinguishingUnion", "TestObj");
     7011    auto object = convert<IDLInterface<TestObj>>(*state, state->uncheckedArgument(1), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 1, "object", "TestObject", "overloadedMethodWithNonDistinguishingUnion", "TestObj"); });
     7012    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
    71027013    impl.overloadedMethodWithNonDistinguishingUnion(WTFMove(objectOrNode), *object);
    71037014    return JSValue::encode(jsUndefined());
     
    71207031    auto objectOrNode = convert<IDLUnion<IDLInterface<TestObj>, IDLInterface<TestNode>>>(*state, state->uncheckedArgument(0));
    71217032    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
    7122     auto node = JSTestNode::toWrapped(state->uncheckedArgument(1));
    7123     if (UNLIKELY(!node))
    7124         return throwArgumentTypeError(*state, throwScope, 1, "node", "TestObject", "overloadedMethodWithNonDistinguishingUnion", "TestNode");
     7033    auto node = convert<IDLInterface<TestNode>>(*state, state->uncheckedArgument(1), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 1, "node", "TestObject", "overloadedMethodWithNonDistinguishingUnion", "TestNode"); });
     7034    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
    71257035    impl.overloadedMethodWithNonDistinguishingUnion(WTFMove(objectOrNode), *node);
    71267036    return JSValue::encode(jsUndefined());
     
    72787188    if (UNLIKELY(state->argumentCount() < 2))
    72797189        return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
    7280     TestObj* obj = nullptr;
    7281     if (!state->uncheckedArgument(0).isUndefinedOrNull()) {
    7282         obj = JSTestObj::toWrapped(state->uncheckedArgument(0));
    7283         if (UNLIKELY(!obj))
    7284             return throwArgumentTypeError(*state, throwScope, 0, "obj", "TestObject", "overloadWithNullableNonDistinguishingParameter", "TestObj");
    7285     }
    7286     auto node = JSTestNode::toWrapped(state->uncheckedArgument(1));
    7287     if (UNLIKELY(!node))
    7288         return throwArgumentTypeError(*state, throwScope, 1, "node", "TestObject", "overloadWithNullableNonDistinguishingParameter", "TestNode");
     7190    auto obj = convert<IDLNullable<IDLInterface<TestObj>>>(*state, state->uncheckedArgument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 0, "obj", "TestObject", "overloadWithNullableNonDistinguishingParameter", "TestObj"); });
     7191    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
     7192    auto node = convert<IDLInterface<TestNode>>(*state, state->uncheckedArgument(1), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 1, "node", "TestObject", "overloadWithNullableNonDistinguishingParameter", "TestNode"); });
     7193    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
    72897194    impl.overloadWithNullableNonDistinguishingParameter(WTFMove(obj), *node);
    72907195    return JSValue::encode(jsUndefined());
     
    73057210    if (UNLIKELY(state->argumentCount() < 2))
    73067211        return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
    7307     TestNode* node = nullptr;
    7308     if (!state->uncheckedArgument(0).isUndefinedOrNull()) {
    7309         node = JSTestNode::toWrapped(state->uncheckedArgument(0));
    7310         if (UNLIKELY(!node))
    7311             return throwArgumentTypeError(*state, throwScope, 0, "node", "TestObject", "overloadWithNullableNonDistinguishingParameter", "TestNode");
    7312     }
     7212    auto node = convert<IDLNullable<IDLInterface<TestNode>>>(*state, state->uncheckedArgument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 0, "node", "TestObject", "overloadWithNullableNonDistinguishingParameter", "TestNode"); });
     7213    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
    73137214    auto index = convert<IDLLong>(*state, state->uncheckedArgument(1), IntegerConversionConfiguration::Normal);
    73147215    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
     
    75167417        return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
    75177418    ExceptionCode ec = 0;
    7518     auto values = JSDOMStringList::toWrapped(state->uncheckedArgument(0));
    7519     if (UNLIKELY(!values))
    7520         return throwArgumentTypeError(*state, throwScope, 0, "values", "TestObject", "domStringListFunction", "DOMStringList");
    7521     JSValue result = toJS(state, castedThis->globalObject(), impl.domStringListFunction(*values, ec));
     7419    auto values = convert<IDLInterface<DOMStringList>>(*state, state->uncheckedArgument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 0, "values", "TestObject", "domStringListFunction", "DOMStringList"); });
     7420    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
     7421    JSValue result = toJS<IDLInterface<DOMStringList>>(*state, *castedThis->globalObject(), impl.domStringListFunction(*values, ec));
    75227422
    75237423    setDOMException(state, throwScope, ec);
     
    75637463    auto elementId = AtomicString(state->uncheckedArgument(0).toString(state)->toExistingAtomicString(state));
    75647464    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
    7565     JSValue result = toJS(state, castedThis->globalObject(), impl.getElementById(WTFMove(elementId)));
     7465    JSValue result = toJS<IDLNullable<IDLInterface<Element>>>(*state, *castedThis->globalObject(), impl.getElementById(WTFMove(elementId)));
    75667466    return JSValue::encode(result);
    75677467}
     
    75807480    auto& impl = castedThis->wrapped();
    75817481    ExceptionCode ec = 0;
    7582     JSValue result = toJS(state, castedThis->globalObject(), BindingSecurity::checkSecurityForNode(*state, impl.getSVGDocument(ec)));
     7482    JSValue result = toJS<IDLInterface<SVGDocument>>(*state, *castedThis->globalObject(), BindingSecurity::checkSecurityForNode(*state, impl.getSVGDocument(ec)));
    75837483
    75847484    setDOMException(state, throwScope, ec);
     
    76007500    if (UNLIKELY(state->argumentCount() < 1))
    76017501        return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
    7602     auto value = JSTestNode::toWrapped(state->uncheckedArgument(0));
    7603     if (UNLIKELY(!value))
    7604         return throwArgumentTypeError(*state, throwScope, 0, "value", "TestObject", "convert1", "TestNode");
     7502    auto value = convert<IDLInterface<TestNode>>(*state, state->uncheckedArgument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 0, "value", "TestObject", "convert1", "TestNode"); });
     7503    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
    76057504    impl.convert1(*value);
    76067505    return JSValue::encode(jsUndefined());
     
    76217520    if (UNLIKELY(state->argumentCount() < 1))
    76227521        return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
    7623     TestNode* value = nullptr;
    7624     if (!state->uncheckedArgument(0).isUndefinedOrNull()) {
    7625         value = JSTestNode::toWrapped(state->uncheckedArgument(0));
    7626         if (UNLIKELY(!value))
    7627             return throwArgumentTypeError(*state, throwScope, 0, "value", "TestObject", "convert2", "TestNode");
    7628     }
     7522    auto value = convert<IDLNullable<IDLInterface<TestNode>>>(*state, state->uncheckedArgument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 0, "value", "TestObject", "convert2", "TestNode"); });
     7523    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
    76297524    impl.convert2(WTFMove(value));
    76307525    return JSValue::encode(jsUndefined());
     
    76837578    UNUSED_PARAM(throwScope);
    76847579    auto& impl = castedThis->wrapped();
    7685     JSValue result = toJS(state, castedThis->globalObject(), SVGPropertyTearOff<SVGPoint>::create(impl.mutablePointFunction()));
     7580    JSValue result = toJS<IDLInterface<SVGPropertyTearOff<SVGPoint>>>(*state, *castedThis->globalObject(), SVGPropertyTearOff<SVGPoint>::create(impl.mutablePointFunction()));
    76867581    return JSValue::encode(result);
    76877582}
     
    76997594    UNUSED_PARAM(throwScope);
    77007595    auto& impl = castedThis->wrapped();
    7701     JSValue result = toJS(state, castedThis->globalObject(), SVGPropertyTearOff<SVGPoint>::create(impl.immutablePointFunction()));
     7596    JSValue result = toJS<IDLInterface<SVGPropertyTearOff<SVGPoint>>>(*state, *castedThis->globalObject(), SVGPropertyTearOff<SVGPoint>::create(impl.immutablePointFunction()));
    77027597    return JSValue::encode(result);
    77037598}
     
    77777672    if (UNLIKELY(state->argumentCount() < 1))
    77787673        return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
    7779     auto head = JSNode::toWrapped(state->uncheckedArgument(0));
    7780     if (UNLIKELY(!head))
    7781         return throwArgumentTypeError(*state, throwScope, 0, "head", "TestObject", "variadicNodeMethod", "Node");
     7674    auto head = convert<IDLInterface<Node>>(*state, state->uncheckedArgument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 0, "head", "TestObject", "variadicNodeMethod", "Node"); });
     7675    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
    77827676    auto tail = convertVariadicArguments<IDLInterface<Node>>(*state, 1);
    77837677    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
     
    79847878    if (UNLIKELY(state->argumentCount() < 1))
    79857879        return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
    7986     auto request = JSFetchRequest::toWrapped(state->uncheckedArgument(0));
    7987     if (UNLIKELY(!request))
    7988         return throwArgumentTypeError(*state, throwScope, 0, "request", "TestObject", "testPromiseOverloadedFunction", "FetchRequest");
     7880    auto request = convert<IDLInterface<FetchRequest>>(*state, state->uncheckedArgument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 0, "request", "TestObject", "testPromiseOverloadedFunction", "FetchRequest"); });
     7881    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
    79897882    impl.testPromiseOverloadedFunction(*request, WTFMove(promise));
    79907883    return JSValue::encode(jsUndefined());
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp

    r208212 r208308  
    7676    if (UNLIKELY(state->argumentCount() < 1))
    7777        return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
    78     auto arrayBuffer = toUnsharedArrayBuffer(state->uncheckedArgument(0));
    79     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
    80     if (UNLIKELY(!arrayBuffer))
    81         return throwArgumentTypeError(*state, throwScope, 0, "arrayBuffer", "TestOverloadedConstructors", nullptr, "ArrayBuffer");
     78    auto arrayBuffer = convert<IDLInterface<ArrayBuffer>>(*state, state->uncheckedArgument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 0, "arrayBuffer", "TestOverloadedConstructors", nullptr, "ArrayBuffer"); });
     79    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
    8280    auto object = TestOverloadedConstructors::create(*arrayBuffer);
    8381    return JSValue::encode(toJSNewlyCreated(state, castedThis->globalObject(), WTFMove(object)));
     
    9391    if (UNLIKELY(state->argumentCount() < 1))
    9492        return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
    95     auto arrayBufferView = toUnsharedArrayBufferView(state->uncheckedArgument(0));
    96     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
    97     if (UNLIKELY(!arrayBufferView))
    98         return throwArgumentTypeError(*state, throwScope, 0, "arrayBufferView", "TestOverloadedConstructors", nullptr, "ArrayBufferView");
     93    auto arrayBufferView = convert<IDLInterface<ArrayBufferView>>(*state, state->uncheckedArgument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 0, "arrayBufferView", "TestOverloadedConstructors", nullptr, "ArrayBufferView"); });
     94    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
    9995    auto object = TestOverloadedConstructors::create(*arrayBufferView);
    10096    return JSValue::encode(toJSNewlyCreated(state, castedThis->globalObject(), WTFMove(object)));
     
    110106    if (UNLIKELY(state->argumentCount() < 1))
    111107        return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
    112     auto blob = JSBlob::toWrapped(state->uncheckedArgument(0));
    113     if (UNLIKELY(!blob))
    114         return throwArgumentTypeError(*state, throwScope, 0, "blob", "TestOverloadedConstructors", nullptr, "Blob");
     108    auto blob = convert<IDLInterface<Blob>>(*state, state->uncheckedArgument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 0, "blob", "TestOverloadedConstructors", nullptr, "Blob"); });
     109    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
    115110    auto object = TestOverloadedConstructors::create(*blob);
    116111    return JSValue::encode(toJSNewlyCreated(state, castedThis->globalObject(), WTFMove(object)));
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp

    r208124 r208308  
    218218    auto name = convert<IDLDOMString>(*state, state->uncheckedArgument(0), StringConversionConfiguration::Normal);
    219219    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
    220     JSValue result = toJS(state, castedThis->globalObject(), impl.namedItem(WTFMove(name)));
     220    JSValue result = toJS<IDLInterface<Node>>(*state, *castedThis->globalObject(), impl.namedItem(WTFMove(name)));
    221221    return JSValue::encode(result);
    222222}
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerialization.cpp

    r208124 r208308  
    193193    UNUSED_PARAM(state);
    194194    auto& impl = thisObject.wrapped();
    195     JSValue result = toJS(&state, thisObject.globalObject(), impl.thirdUnserializableAttribute());
     195    JSValue result = toJS<IDLInterface<TestNode>>(state, *thisObject.globalObject(), impl.thirdUnserializableAttribute());
    196196    return result;
    197197}
     
    303303    UNUSED_PARAM(throwScope);
    304304    auto& impl = thisObject.wrapped();
    305     auto nativeValue = JSTestNode::toWrapped(value);
    306     if (UNLIKELY(!nativeValue)) {
    307         throwAttributeTypeError(state, throwScope, "TestSerialization", "thirdUnserializableAttribute", "TestNode");
    308         return false;
    309     }
     305    auto nativeValue = convert<IDLInterface<TestNode>>(state, value, [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwAttributeTypeError(state, scope, "TestSerialization", "thirdUnserializableAttribute", "TestNode"); });
     306    RETURN_IF_EXCEPTION(throwScope, false);
    310307    impl.setThirdUnserializableAttribute(*nativeValue);
    311308    return true;
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp

    r208181 r208308  
    687687    UNUSED_PARAM(throwScope);
    688688    auto& impl = castedThis->wrapped();
    689     JSValue result = toJS(state, castedThis->globalObject(), SVGPropertyTearOff<SVGPoint>::create(impl.immutablePointFunction()));
     689    JSValue result = toJS<IDLInterface<SVGPropertyTearOff<SVGPoint>>>(*state, *castedThis->globalObject(), SVGPropertyTearOff<SVGPoint>::create(impl.immutablePointFunction()));
    690690    return JSValue::encode(result);
    691691}
Note: See TracChangeset for help on using the changeset viewer.