Changeset 208308 in webkit
- Timestamp:
- Nov 2, 2016 3:15:14 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 25 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r208304 r208308 1 2016-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 1 16 2016-11-02 Joseph Pecoraro <pecoraro@apple.com> 2 17 -
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.1 Caught exception: TypeError: Argument 1 ('item') to SVGPointList.appendItem must be an instance of SVGPoint 2 2 PASSED -- WebKit did not crash! -
trunk/LayoutTests/svg/dom/SVGLengthList-basics-expected.txt
r203333 r208308 16 16 PASS text1.x.baseVal.initialize('aString') threw exception TypeError: Argument 1 ('item') to SVGLengthList.initialize must be an instance of SVGLength. 17 17 PASS 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..18 PASS text1.x.baseVal.initialize(null) threw exception TypeError: Argument 1 ('item') to SVGLengthList.initialize must be an instance of SVGLength. 19 19 20 20 Test uncommon arguments for getItem() … … 56 56 PASS text1.x.baseVal.insertItemBefore('aString', 0) threw exception TypeError: Argument 1 ('item') to SVGLengthList.insertItemBefore must be an instance of SVGLength. 57 57 PASS 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..58 PASS text1.x.baseVal.insertItemBefore(null, 0) threw exception TypeError: Argument 1 ('item') to SVGLengthList.insertItemBefore must be an instance of SVGLength. 59 59 60 60 Set x='1 2 3 4' for text1 … … 86 86 PASS text1.x.baseVal.replaceItem('aString', 0) threw exception TypeError: Argument 1 ('item') to SVGLengthList.replaceItem must be an instance of SVGLength. 87 87 PASS 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..88 PASS text1.x.baseVal.replaceItem(null, 0) threw exception TypeError: Argument 1 ('item') to SVGLengthList.replaceItem must be an instance of SVGLength. 89 89 PASS text1.x.baseVal.replaceItem(text1.x.baseVal.getItem(0), 0) is text1.x.baseVal.getItem(0) 90 90 PASS text1.x.baseVal.numberOfItems is 4 … … 154 154 PASS text1.x.baseVal.appendItem('aString') threw exception TypeError: Argument 1 ('item') to SVGLengthList.appendItem must be an instance of SVGLength. 155 155 PASS 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..156 PASS text1.x.baseVal.appendItem(null) threw exception TypeError: Argument 1 ('item') to SVGLengthList.appendItem must be an instance of SVGLength. 157 157 158 158 Testing animVal clear throws -
trunk/LayoutTests/svg/dom/SVGNumberList-basics-expected.txt
r203333 r208308 13 13 PASS text1.rotate.baseVal.initialize('aString') threw exception TypeError: Argument 1 ('item') to SVGNumberList.initialize must be an instance of SVGNumber. 14 14 PASS 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..15 PASS text1.rotate.baseVal.initialize(null) threw exception TypeError: Argument 1 ('item') to SVGNumberList.initialize must be an instance of SVGNumber. 16 16 17 17 Test uncommon arguments for getItem() … … 53 53 PASS text1.rotate.baseVal.insertItemBefore('aString', 0) threw exception TypeError: Argument 1 ('item') to SVGNumberList.insertItemBefore must be an instance of SVGNumber. 54 54 PASS 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..55 PASS text1.rotate.baseVal.insertItemBefore(null, 0) threw exception TypeError: Argument 1 ('item') to SVGNumberList.insertItemBefore must be an instance of SVGNumber. 56 56 57 57 Set rotate='1 2 3 4' for text1 … … 72 72 PASS text1.rotate.baseVal.replaceItem('aString', 0) threw exception TypeError: Argument 1 ('item') to SVGNumberList.replaceItem must be an instance of SVGNumber. 73 73 PASS 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..74 PASS text1.rotate.baseVal.replaceItem(null, 0) threw exception TypeError: Argument 1 ('item') to SVGNumberList.replaceItem must be an instance of SVGNumber. 75 75 PASS text1.rotate.baseVal.replaceItem(text1.rotate.baseVal.getItem(0), 0) is text1.rotate.baseVal.getItem(0) 76 76 PASS text1.rotate.baseVal.numberOfItems is 4 … … 119 119 PASS text1.rotate.baseVal.appendItem('aString') threw exception TypeError: Argument 1 ('item') to SVGNumberList.appendItem must be an instance of SVGNumber. 120 120 PASS 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..121 PASS text1.rotate.baseVal.appendItem(null) threw exception TypeError: Argument 1 ('item') to SVGNumberList.appendItem must be an instance of SVGNumber. 122 122 123 123 Testing animVal clear throws -
trunk/LayoutTests/svg/dom/SVGPointList-basics-expected.txt
r203333 r208308 75 75 PASS poly1.points.insertItemBefore('aString', 0) threw exception TypeError: Argument 1 ('item') to SVGPointList.insertItemBefore must be an instance of SVGPoint. 76 76 PASS 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..77 PASS poly1.points.insertItemBefore(null, 0) threw exception TypeError: Argument 1 ('item') to SVGPointList.insertItemBefore must be an instance of SVGPoint. 78 78 79 79 Test uncommon arguments for replaceItem() … … 81 81 PASS poly1.points.replaceItem('aString') threw exception TypeError: Not enough arguments. 82 82 PASS 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..83 PASS poly1.points.replaceItem(null, 0) threw exception TypeError: Argument 1 ('item') to SVGPointList.replaceItem must be an instance of SVGPoint. 84 84 PASS poly1.points.replaceItem('aString', 0) threw exception TypeError: Argument 1 ('item') to SVGPointList.replaceItem must be an instance of SVGPoint. 85 85 PASS poly1.points.replaceItem(poly1, 0) threw exception TypeError: Argument 1 ('item') to SVGPointList.replaceItem must be an instance of SVGPoint. … … 143 143 PASS poly1.points.appendItem('aString') threw exception TypeError: Argument 1 ('item') to SVGPointList.appendItem must be an instance of SVGPoint. 144 144 PASS 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..145 PASS poly1.points.appendItem(null) threw exception TypeError: Argument 1 ('item') to SVGPointList.appendItem must be an instance of SVGPoint. 146 146 PASS dumpPoint(poly1.points.appendItem(point)) is "x=200 y=100" 147 147 PASS poly1.points.numberOfItems is 2 -
trunk/LayoutTests/svg/dom/SVGTransformList-basics-expected.txt
r203333 r208308 14 14 PASS circle1.transform.baseVal.initialize('aString') threw exception TypeError: Argument 1 ('item') to SVGTransformList.initialize must be an instance of SVGTransform. 15 15 PASS 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..16 PASS circle1.transform.baseVal.initialize(null) threw exception TypeError: Argument 1 ('item') to SVGTransformList.initialize must be an instance of SVGTransform. 17 17 18 18 Test uncommon arguments for getItem() … … 50 50 PASS circle1.transform.baseVal.insertItemBefore('aString', 0) threw exception TypeError: Argument 1 ('item') to SVGTransformList.insertItemBefore must be an instance of SVGTransform. 51 51 PASS 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..52 PASS circle1.transform.baseVal.insertItemBefore(null, 0) threw exception TypeError: Argument 1 ('item') to SVGTransformList.insertItemBefore must be an instance of SVGTransform. 53 53 54 54 Test overlapping edge cases for removeItem() … … 76 76 PASS circle1.transform.baseVal.replaceItem('aString', 0) threw exception TypeError: Argument 1 ('item') to SVGTransformList.replaceItem must be an instance of SVGTransform. 77 77 PASS 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..78 PASS circle1.transform.baseVal.replaceItem(null, 0) threw exception TypeError: Argument 1 ('item') to SVGTransformList.replaceItem must be an instance of SVGTransform. 79 79 PASS circle1.transform.baseVal.replaceItem(circle1.transform.baseVal.getItem(0), 0) is circle1.transform.baseVal.getItem(0) 80 80 PASS circle1.transform.baseVal.numberOfItems is 4 … … 127 127 PASS circle1.transform.baseVal.appendItem('aString') threw exception TypeError: Argument 1 ('item') to SVGTransformList.appendItem must be an instance of SVGTransform. 128 128 PASS 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..129 PASS circle1.transform.baseVal.appendItem(null) threw exception TypeError: Argument 1 ('item') to SVGTransformList.appendItem must be an instance of SVGTransform. 130 130 131 131 Testing animVal clear throws -
trunk/LayoutTests/svg/dom/SVGTransformList-expected.txt
r203333 r208308 12 12 PASS transform.createSVGTransformFromMatrix(1) threw exception TypeError: Argument 1 ('matrix') to SVGTransformList.createSVGTransformFromMatrix must be an instance of SVGMatrix. 13 13 PASS 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 Type MismatchError (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 Type MismatchError (DOM Exception 17): The type of an object was incompatible with the expected type of the parameter associated to the object..14 PASS transform.createSVGTransformFromMatrix(undefined) threw exception TypeError: Argument 1 ('matrix') to SVGTransformList.createSVGTransformFromMatrix must be an instance of SVGMatrix. 15 PASS transform.createSVGTransformFromMatrix(null) threw exception TypeError: Argument 1 ('matrix') to SVGTransformList.createSVGTransformFromMatrix must be an instance of SVGMatrix. 16 16 PASS successfullyParsed is true 17 17 -
trunk/Source/JavaScriptCore/ChangeLog
r208306 r208308 1 2016-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 1 12 2016-11-02 Filip Pizlo <fpizlo@apple.com> 2 13 -
trunk/Source/JavaScriptCore/runtime/JSArrayBuffer.h
r208209 r208308 54 54 55 55 // This is the default DOM unwrapping. It calls toUnsharedArrayBuffer(). 56 static RefPtr<ArrayBuffer>toWrapped(JSValue);56 static ArrayBuffer* toWrapped(JSValue); 57 57 58 58 protected: … … 86 86 } 87 87 88 inline RefPtr<ArrayBuffer>JSArrayBuffer::toWrapped(JSValue value)88 inline ArrayBuffer* JSArrayBuffer::toWrapped(JSValue value) 89 89 { 90 90 return toUnsharedArrayBuffer(value); -
trunk/Source/WebCore/ChangeLog
r208307 r208308 1 2016-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 1 113 2016-11-02 David Kilzer <ddkilzer@apple.com> 2 114 -
trunk/Source/WebCore/bindings/generic/IDLTypes.h
r208002 r208308 84 84 static String nullValue() { return String(); } 85 85 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); } 87 87 }; 88 88 struct IDLDOMString : IDLString { }; … … 96 96 97 97 using NullableType = RefPtr<T>; 98 static RefPtr<T>nullValue() { return nullptr; }98 static std::nullptr_t nullValue() { return nullptr; } 99 99 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); } 101 101 }; 102 102 -
trunk/Source/WebCore/bindings/js/JSDOMConvert.h
r208002 r208308 38 38 enum class StringConversionConfiguration { Normal, TreatNullAsEmptyString }; 39 39 40 struct DefaultExceptionThrower { 41 void operator()(JSC::ExecState& state, JSC::ThrowScope& scope) 42 { 43 throwTypeError(&state, scope); 44 } 45 }; 46 40 47 template<typename T> typename Converter<T>::ReturnType convert(JSC::ExecState&, JSC::JSValue); 41 48 template<typename T> typename Converter<T>::ReturnType convert(JSC::ExecState&, JSC::JSValue, IntegerConversionConfiguration); 42 49 template<typename T> typename Converter<T>::ReturnType convert(JSC::ExecState&, JSC::JSValue, StringConversionConfiguration); 50 template<typename T, typename ExceptionThrower> typename Converter<T>::ReturnType convert(JSC::ExecState&, JSC::JSValue, ExceptionThrower&&); 43 51 44 52 // Specialized by generated code for IDL dictionary conversion. … … 63 71 { 64 72 return Converter<T>::convert(state, value, configuration); 73 } 74 75 template<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)); 65 78 } 66 79 … … 73 86 template<typename T, typename U> inline JSC::JSValue toJS(JSC::ExecState&, JSC::ThrowScope&, ExceptionOr<U>&&); 74 87 template<typename T, typename U> inline JSC::JSValue toJS(JSC::ExecState&, JSDOMGlobalObject&, JSC::ThrowScope&, ExceptionOr<U>&&); 88 template<typename T, typename U> inline JSC::JSValue toJSNewlyCreated(JSC::ExecState&, JSDOMGlobalObject&, U&&); 89 template<typename T, typename U> inline JSC::JSValue toJSNewlyCreated(JSC::ExecState&, JSDOMGlobalObject&, JSC::ThrowScope&, ExceptionOr<U>&&); 75 90 76 91 // Specialized by generated code for IDL enumeration conversion. … … 150 165 } 151 166 167 template<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 172 template<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 152 182 153 183 template<typename T> struct DefaultConverter { … … 158 188 // MARK: Nullable type 159 189 190 namespace 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 160 205 template<typename T> struct Converter<IDLNullable<T>> : DefaultConverter<IDLNullable<T>> { 161 using ReturnType = typename IDLNullable<T>::ImplementationType;206 using ReturnType = typename Detail::NullableConversionType<T>::Type; 162 207 163 208 // 1. If Type(V) is not Object, and the conversion to an IDL value is being performed … … 189 234 return Converter<T>::convert(state, value, configuration); 190 235 } 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 } 191 244 }; 192 245 … … 197 250 static constexpr bool needsGlobalObject = JSConverter<T>::needsGlobalObject; 198 251 199 static JSC::JSValue convert(const ImplementationType& value) 252 template<typename U> 253 static JSC::JSValue convert(U&& value) 200 254 { 201 255 if (T::isNullValue(value)) … … 203 257 return JSConverter<T>::convert(T::extractValueFromNullable(value)); 204 258 } 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) 206 261 { 207 262 if (T::isNullValue(value)) … … 209 264 return JSConverter<T>::convert(state, T::extractValueFromNullable(value)); 210 265 } 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) 212 276 { 213 277 if (T::isNullValue(value)) … … 262 326 using WrapperType = typename JSDOMWrapperConverterTraits<T>::WrapperClass; 263 327 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()) 265 330 { 266 331 JSC::VM& vm = state.vm(); 267 332 auto scope = DECLARE_THROW_SCOPE(vm); 268 333 ReturnType object = WrapperType::toWrapped(value); 269 if ( !object)270 throwTypeError(&state, scope);334 if (UNLIKELY(!object)) 335 exceptionThrower(state, scope); 271 336 return object; 272 337 } 273 338 }; 339 340 namespace Detail { 341 342 template <typename T> inline T* getPtrOrRef(const T* p) { return const_cast<T*>(p); } 343 template <typename T> inline T& getPtrOrRef(const T& p) { return const_cast<T&>(p); } 344 template <typename T> inline T* getPtrOrRef(const RefPtr<T>& p) { return const_cast<T*>(p.get()); } 345 template <typename T> inline T& getPtrOrRef(const Ref<T>& p) { return const_cast<T&>(p.get()); } 346 347 } 274 348 275 349 template<typename T> struct JSConverter<IDLInterface<T>> { … … 277 351 static constexpr bool needsGlobalObject = true; 278 352 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 279 359 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)); 283 363 } 284 364 }; -
trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
r208256 r208308 289 289 return; 290 290 } 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 } 291 301 } 292 302 … … 532 542 return 1 if not $interface->extendedAttributes->{CustomToJSObject}; 533 543 return 0; 544 } 545 546 sub 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 559 sub 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}\"); }" 534 570 } 535 571 … … 3277 3313 my $jsType = NativeToJSValueUsingReferences($attribute, 0, $interface, "${functionName}(" . join(", ", @arguments) . ")", "thisObject"); 3278 3314 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"); 3285 3316 } 3286 3317 … … 3541 3572 push(@implContent, " ExceptionCode ec = 0;\n") if $setterMayThrowLegacyException; 3542 3573 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; 3561 3580 3562 3581 if ($codeGenerator->IsEnumType($type)) { 3563 3582 push (@implContent, " if (UNLIKELY(!nativeValue))\n"); 3564 3583 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");3572 3584 } 3573 3585 … … 3608 3620 push(@arguments, "nativeValue.value()"); 3609 3621 } else { 3610 push(@arguments, $shouldPassByReference? "*nativeValue" : "WTFMove(nativeValue)");3622 push(@arguments, ShouldPassWrapperByReference($attribute, $interface) ? "*nativeValue" : "WTFMove(nativeValue)"); 3611 3623 } 3612 3624 my $implementedBy = $attribute->extendedAttributes->{ImplementedBy}; … … 4413 4425 my $nativeType = GetNativeType($interface, $argument->type); 4414 4426 my $isTearOff = $codeGenerator->IsSVGTypeNeedingTearOff($type) && $interfaceName !~ /List$/; 4415 my $shouldPassByReference = $isTearOff || ShouldPassWrapperByReference($argument, $interface);4416 4427 4417 4428 die "Variadic argument is already handled here" if $argument->isVariadic; 4418 4429 my $argumentLookupMethod = $argument->isOptional ? "argument" : "uncheckedArgument"; 4419 4430 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)"; 4433 4457 } 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"); 4457 4474 } 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"); 4460 4479 } 4461 4462 my ($nativeValue, $mayThrowException) = JSValueToNative($interface, $argument, $inner, $function->extendedAttributes->{Conditional}); 4480 } else { 4463 4481 push(@$outputArray, " auto $name = ${outer}${nativeValue};\n"); 4464 $value = "WTFMove($name)";4465 4482 push(@$outputArray, " RETURN_IF_EXCEPTION(throwScope, encodedJSValue());\n") if $mayThrowException; 4466 4483 } 4467 4484 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 } els if ($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 { 4477 4494 $value = "WTFMove($name)"; 4478 4495 } … … 5069 5086 } 5070 5087 5088 sub GetIDLInterfaceName 5089 { 5090 my ($type) = @_; 5091 5092 return $codeGenerator->GetSVGTypeNeedingTearOff($type) if $codeGenerator->IsSVGTypeNeedingTearOff($type); 5093 return $type->name; 5094 } 5095 5071 5096 sub GetBaseIDLType 5072 5097 { … … 5103 5128 return "IDLFrozenArray<" . GetIDLType($interface, @{$type->subtypes}[0]) . ">" if $codeGenerator->IsFrozenArrayType($type); 5104 5129 return "IDLUnion<" . join(", ", GetIDLUnionMemberTypes($interface, $type)) . ">" if $type->isUnion; 5105 return "IDLInterface<" . $type->name. ">";5130 return "IDLInterface<" . GetIDLInterfaceName($type) . ">"; 5106 5131 } 5107 5132 … … 5235 5260 } 5236 5261 5237 sub JSValueToNativeIsHandledByDOMConvert5238 {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 5256 5262 sub IsValidContextForJSValueToNative 5257 5263 { 5258 5264 my $context = shift; 5259 5265 5260 return ref($context) eq "IDLAttribute" || ref($context) eq "IDL Operation" || ref($context) eq "IDLArgument";5266 return ref($context) eq "IDLAttribute" || ref($context) eq "IDLArgument"; 5261 5267 } 5262 5268 … … 5265 5271 sub JSValueToNative 5266 5272 { 5267 my ($interface, $context, $value, $conditional, $statePointer, $stateReference, $thisObjectReference ) = @_;5273 my ($interface, $context, $value, $conditional, $statePointer, $stateReference, $thisObjectReference, $exceptionThrower) = @_; 5268 5274 5269 5275 assert("Invalid context type") if !IsValidContextForJSValueToNative($context); … … 5276 5282 $thisObjectReference = "*castedThis" unless $thisObjectReference; 5277 5283 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); 5292 5285 5293 5286 if ($type->name eq "DOMString") { 5294 5287 return ("AtomicString($value.toString($statePointer)->toExistingAtomicString($statePointer))", 1) if $context->extendedAttributes->{RequiresExistingAtomicString}; 5295 5288 return ("$value.toString($statePointer)->toAtomicString($statePointer)", 1) if $context->extendedAttributes->{AtomicString}; 5296 assert("Unhandled string conversion.");5297 5289 } 5298 5290 5299 5291 if ($type->name eq "SerializedScriptValue") { 5300 AddToImplIncludes("SerializedScriptValue.h", $conditional);5301 5292 return ("SerializedScriptValue::create($stateReference, $value)", 1); 5302 5293 } 5303 5294 5304 5295 if ($type->name eq "Dictionary") { 5305 AddToImplIncludes("Dictionary.h", $conditional);5306 5296 return ("Dictionary($statePointer, $value)", 0); 5307 5297 } 5308 5298 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 } 5313 5302 5314 5303 # 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); 5337 5325 } 5338 5326 … … 5346 5334 return 1 if $codeGenerator->IsStringType($type); 5347 5335 return 1 if $codeGenerator->IsEnumType($type); 5336 return 1 if $codeGenerator->IsWrapperType($type); 5337 return 1 if $codeGenerator->IsTypedArrayType($type); 5348 5338 return 1 if $type->name eq "Date"; 5349 5339 … … 5358 5348 return 1 if $type->isUnion; 5359 5349 return 1 if $codeGenerator->IsSequenceOrFrozenArrayType($type); 5350 return 1 if $codeGenerator->IsWrapperType($type); 5351 return 1 if $codeGenerator->IsTypedArrayType($type); 5360 5352 5361 5353 return 0; … … 5417 5409 } 5418 5410 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 5433 5413 5434 5414 if ($type->name eq "SerializedScriptValue") { 5435 AddToImplIncludes("SerializedScriptValue.h", $conditional);5436 5415 return "$value ? $value->deserialize($stateReference, $globalObject) : jsNull()"; 5437 5416 } 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 } 5473 5450 } 5474 5451 } … … 5476 5453 $value = "BindingSecurity::checkSecurityForNode($stateReference, $value)" if $context->extendedAttributes->{CheckSecurityForNode}; 5477 5454 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) . ")"; 5485 5468 } 5486 5469 -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestActiveDOMObject.cpp
r208124 r208308 215 215 if (UNLIKELY(state->argumentCount() < 1)) 216 216 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()); 220 219 impl.excitingFunction(*nextChild); 221 220 return JSValue::encode(jsUndefined()); -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCEReactions.cpp
r208256 r208308 190 190 UNUSED_PARAM(state); 191 191 auto& impl = thisObject.wrapped(); 192 JSValue result = toJS (&state,thisObject.globalObject(), impl.stringifierAttribute());192 JSValue result = toJS<IDLInterface<TestCEReactionsStringifier>>(state, *thisObject.globalObject(), impl.stringifierAttribute()); 193 193 return result; 194 194 } -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallback.cpp
r207737 r208308 126 126 ExecState* state = m_data->globalObject()->globalExec(); 127 127 MarkedArgumentBuffer args; 128 args.append(toJS (state,m_data->globalObject(), arrayParam));128 args.append(toJS<IDLInterface<Float32Array>>(*state, *m_data->globalObject(), arrayParam)); 129 129 130 130 NakedPtr<JSC::Exception> returnedException; … … 167 167 ExecState* state = m_data->globalObject()->globalExec(); 168 168 MarkedArgumentBuffer args; 169 args.append(toJS (state,m_data->globalObject(), listParam));169 args.append(toJS<IDLInterface<DOMStringList>>(*state, *m_data->globalObject(), listParam)); 170 170 171 171 NakedPtr<JSC::Exception> returnedException; … … 208 208 MarkedArgumentBuffer args; 209 209 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)); 211 211 212 212 NakedPtr<JSC::Exception> returnedException; -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunction.cpp
r207737 r208308 91 91 ExecState* state = m_data->globalObject()->globalExec(); 92 92 MarkedArgumentBuffer args; 93 args.append(toJS (state,m_data->globalObject(), arrayParam));93 args.append(toJS<IDLInterface<Float32Array>>(*state, *m_data->globalObject(), arrayParam)); 94 94 95 95 NakedPtr<JSC::Exception> returnedException; … … 134 134 ExecState* state = m_data->globalObject()->globalExec(); 135 135 MarkedArgumentBuffer args; 136 args.append(toJS (state,m_data->globalObject(), listParam));136 args.append(toJS<IDLInterface<DOMStringList>>(*state, *m_data->globalObject(), listParam)); 137 137 138 138 NakedPtr<JSC::Exception> returnedException; … … 177 177 MarkedArgumentBuffer args; 178 178 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)); 180 180 181 181 NakedPtr<JSC::Exception> returnedException; -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestDOMJIT.cpp
r208124 r208308 603 603 UNUSED_PARAM(state); 604 604 auto& impl = thisObject.wrapped(); 605 JSValue result = toJS (&state,thisObject.globalObject(), impl.byteStringAttr());605 JSValue result = toJS<IDLByteString>(state, *thisObject.globalObject(), impl.byteStringAttr()); 606 606 return result; 607 607 } … … 657 657 UNUSED_PARAM(state); 658 658 auto& impl = thisObject.wrapped(); 659 JSValue result = toJS (&state,thisObject.globalObject(), impl.nodeAttr());659 JSValue result = toJS<IDLInterface<Node>>(state, *thisObject.globalObject(), impl.nodeAttr()); 660 660 return result; 661 661 } … … 1062 1062 UNUSED_PARAM(state); 1063 1063 auto& impl = thisObject.wrapped(); 1064 JSValue result = toJS (&state,thisObject.globalObject(), impl.byteStringNullableAttr());1064 JSValue result = toJS<IDLNullable<IDLByteString>>(state, *thisObject.globalObject(), impl.byteStringNullableAttr()); 1065 1065 return result; 1066 1066 } … … 1116 1116 UNUSED_PARAM(state); 1117 1117 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()); 1119 1119 return result; 1120 1120 } -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.cpp
r208124 r208308 221 221 auto index = convert<IDLUnsignedLong>(*state, state->uncheckedArgument(0), IntegerConversionConfiguration::Normal); 222 222 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))); 224 224 return JSValue::encode(result); 225 225 } -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp
r208124 r208308 512 512 UNUSED_PARAM(state); 513 513 auto& impl = thisObject.wrapped(); 514 JSValue result = toJS (&state,thisObject.globalObject(), impl.implementsNode());514 JSValue result = toJS<IDLInterface<Node>>(state, *thisObject.globalObject(), impl.implementsNode()); 515 515 return result; 516 516 } … … 622 622 UNUSED_PARAM(state); 623 623 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)); 625 625 return result; 626 626 } … … 741 741 UNUSED_PARAM(throwScope); 742 742 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); 748 745 impl.setImplementsNode(*nativeValue); 749 746 return true; … … 819 816 UNUSED_PARAM(throwScope); 820 817 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); 826 820 WebCore::TestSupplemental::setSupplementalNode(impl, *nativeValue); 827 821 return true; … … 875 869 auto strArg = convert<IDLDOMString>(*state, state->uncheckedArgument(0), StringConversionConfiguration::Normal); 876 870 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)); 881 874 882 875 setDOMException(state, throwScope, ec); … … 955 948 auto strArg = convert<IDLDOMString>(*state, state->uncheckedArgument(0), StringConversionConfiguration::Normal); 956 949 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)); 961 953 962 954 setDOMException(state, throwScope, ec); -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
r208212 r208308 1860 1860 UNUSED_PARAM(state); 1861 1861 auto& impl = thisObject.wrapped(); 1862 JSValue result = toJS (&state,thisObject.globalObject(), impl.readOnlyTestObjAttr());1862 JSValue result = toJS<IDLInterface<TestObj>>(state, *thisObject.globalObject(), impl.readOnlyTestObjAttr()); 1863 1863 return result; 1864 1864 } … … 2131 2131 UNUSED_PARAM(state); 2132 2132 auto& impl = thisObject.wrapped(); 2133 JSValue result = toJS (&state,thisObject.globalObject(), impl.testObjAttr());2133 JSValue result = toJS<IDLInterface<TestObj>>(state, *thisObject.globalObject(), impl.testObjAttr()); 2134 2134 return result; 2135 2135 } … … 2147 2147 UNUSED_PARAM(state); 2148 2148 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()); 2150 2150 return result; 2151 2151 } … … 2163 2163 UNUSED_PARAM(state); 2164 2164 auto& impl = thisObject.wrapped(); 2165 JSValue result = toJS (&state,thisObject.globalObject(), impl.lenientTestObjAttr());2165 JSValue result = toJS<IDLInterface<TestObj>>(state, *thisObject.globalObject(), impl.lenientTestObjAttr()); 2166 2166 return result; 2167 2167 } … … 2243 2243 UNUSED_PARAM(state); 2244 2244 auto& impl = thisObject.wrapped(); 2245 JSValue result = toJS (&state,thisObject.globalObject(), impl.xmlObjAttr());2245 JSValue result = toJS<IDLInterface<TestObj>>(state, *thisObject.globalObject(), impl.xmlObjAttr()); 2246 2246 return result; 2247 2247 } … … 2470 2470 UNUSED_PARAM(state); 2471 2471 auto& impl = thisObject.wrapped(); 2472 JSValue result = toJS (&state,thisObject.globalObject(), impl.typedArrayAttr());2472 JSValue result = toJS<IDLInterface<Float32Array>>(state, *thisObject.globalObject(), impl.typedArrayAttr()); 2473 2473 return result; 2474 2474 } … … 2663 2663 return jsUndefined(); 2664 2664 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)); 2666 2666 return result; 2667 2667 } … … 2680 2680 ExceptionCode ec = 0; 2681 2681 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)); 2683 2683 setDOMException(&state, throwScope, ec); 2684 2684 return result; … … 2701 2701 return jsUndefined(); 2702 2702 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)); 2704 2704 setDOMException(&state, throwScope, ec); 2705 2705 return result; … … 2721 2721 return jsUndefined(); 2722 2722 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)); 2724 2724 return result; 2725 2725 } … … 2741 2741 return jsUndefined(); 2742 2742 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)); 2744 2744 setDOMException(&state, throwScope, ec); 2745 2745 return result; … … 2761 2761 return jsUndefined(); 2762 2762 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)); 2764 2764 return result; 2765 2765 } … … 2777 2777 UNUSED_PARAM(state); 2778 2778 auto& impl = thisObject.wrapped(); 2779 JSValue result = toJS (&state,thisObject.globalObject(), impl.withScriptArgumentsAndCallStackAttribute());2779 JSValue result = toJS<IDLInterface<TestObj>>(state, *thisObject.globalObject(), impl.withScriptArgumentsAndCallStackAttribute()); 2780 2780 return result; 2781 2781 } … … 2955 2955 UNUSED_PARAM(state); 2956 2956 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())); 2958 2958 return result; 2959 2959 } … … 2971 2971 UNUSED_PARAM(state); 2972 2972 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)); 2974 2974 return result; 2975 2975 } … … 2987 2987 UNUSED_PARAM(state); 2988 2988 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())); 2990 2990 return result; 2991 2991 } … … 3245 3245 UNUSED_PARAM(state); 3246 3246 auto& impl = thisObject.wrapped(); 3247 JSValue result = toJS (&state,thisObject.globalObject(), impl.testReadOnlyPromiseAttribute());3247 JSValue result = toJS<IDLInterface<Promise>>(state, *thisObject.globalObject(), impl.testReadOnlyPromiseAttribute()); 3248 3248 return result; 3249 3249 } … … 3261 3261 UNUSED_PARAM(state); 3262 3262 auto& impl = thisObject.wrapped(); 3263 JSValue result = toJS (&state,thisObject.globalObject(), impl.putForwardsAttribute());3263 JSValue result = toJS<IDLInterface<TestNode>>(state, *thisObject.globalObject(), impl.putForwardsAttribute()); 3264 3264 return result; 3265 3265 } … … 3277 3277 UNUSED_PARAM(state); 3278 3278 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()); 3280 3280 return result; 3281 3281 } … … 3592 3592 UNUSED_PARAM(throwScope); 3593 3593 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); 3599 3596 impl.setTestObjAttr(*nativeValue); 3600 3597 return true; … … 3614 3611 UNUSED_PARAM(throwScope); 3615 3612 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); 3624 3615 impl.setTestNullableObjAttr(WTFMove(nativeValue)); 3625 3616 return true; … … 3639 3630 UNUSED_PARAM(throwScope); 3640 3631 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); 3646 3634 impl.setLenientTestObjAttr(*nativeValue); 3647 3635 return true; … … 3720 3708 UNUSED_PARAM(throwScope); 3721 3709 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); 3727 3712 impl.setXMLObjAttr(*nativeValue); 3728 3713 return true; … … 3991 3976 UNUSED_PARAM(throwScope); 3992 3977 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"); }); 3994 3979 RETURN_IF_EXCEPTION(throwScope, false); 3995 if (UNLIKELY(!nativeValue)) {3996 throwAttributeTypeError(state, throwScope, "TestObject", "typedArrayAttr", "Float32Array");3997 return false;3998 }3999 3980 impl.setTypedArrayAttr(nativeValue.get()); 4000 3981 return true; … … 4218 4199 UNUSED_PARAM(throwScope); 4219 4200 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); 4225 4203 auto* context = jsCast<JSDOMGlobalObject*>(state.lexicalGlobalObject())->scriptExecutionContext(); 4226 4204 if (!context) … … 4243 4221 UNUSED_PARAM(throwScope); 4244 4222 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); 4250 4225 impl.setWithScriptStateAttributeRaises(state, *nativeValue); 4251 4226 return true; … … 4265 4240 UNUSED_PARAM(throwScope); 4266 4241 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); 4272 4244 auto* context = jsCast<JSDOMGlobalObject*>(state.lexicalGlobalObject())->scriptExecutionContext(); 4273 4245 if (!context) … … 4290 4262 UNUSED_PARAM(throwScope); 4291 4263 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); 4297 4266 auto* context = jsCast<JSDOMGlobalObject*>(state.lexicalGlobalObject())->scriptExecutionContext(); 4298 4267 if (!context) … … 4315 4284 UNUSED_PARAM(throwScope); 4316 4285 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); 4322 4288 auto* context = jsCast<JSDOMGlobalObject*>(state.lexicalGlobalObject())->scriptExecutionContext(); 4323 4289 if (!context) … … 4340 4306 UNUSED_PARAM(throwScope); 4341 4307 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); 4347 4310 auto* context = jsCast<JSDOMGlobalObject*>(state.lexicalGlobalObject())->scriptExecutionContext(); 4348 4311 if (!context) … … 4365 4328 UNUSED_PARAM(throwScope); 4366 4329 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); 4372 4332 impl.setWithScriptArgumentsAndCallStackAttribute(*nativeValue); 4373 4333 return true; … … 4523 4483 UNUSED_PARAM(throwScope); 4524 4484 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); 4533 4487 impl.setMutablePoint(WTFMove(nativeValue)); 4534 4488 return true; … … 4548 4502 UNUSED_PARAM(throwScope); 4549 4503 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); 4558 4506 impl.setImmutablePoint(WTFMove(nativeValue)); 4559 4507 return true; … … 4888 4836 auto strArg = convert<IDLDOMString>(*state, state->uncheckedArgument(1), StringConversionConfiguration::Normal); 4889 4837 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()); 4893 4840 impl.voidMethodWithArgs(WTFMove(longArg), WTFMove(strArg), *objArg); 4894 4841 return JSValue::encode(jsUndefined()); … … 4929 4876 auto strArg = convert<IDLDOMString>(*state, state->uncheckedArgument(1), StringConversionConfiguration::Normal); 4930 4877 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()); 4934 4880 JSValue result = toJS<IDLByte>(impl.byteMethodWithArgs(WTFMove(byteArg), WTFMove(strArg), *objArg)); 4935 4881 return JSValue::encode(result); … … 4970 4916 auto strArg = convert<IDLDOMString>(*state, state->uncheckedArgument(1), StringConversionConfiguration::Normal); 4971 4917 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()); 4975 4920 JSValue result = toJS<IDLOctet>(impl.octetMethodWithArgs(WTFMove(octetArg), WTFMove(strArg), *objArg)); 4976 4921 return JSValue::encode(result); … … 5011 4956 auto strArg = convert<IDLDOMString>(*state, state->uncheckedArgument(1), StringConversionConfiguration::Normal); 5012 4957 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()); 5016 4960 JSValue result = toJS<IDLLong>(impl.longMethodWithArgs(WTFMove(longArg), WTFMove(strArg), *objArg)); 5017 4961 return JSValue::encode(result); … … 5030 4974 UNUSED_PARAM(throwScope); 5031 4975 auto& impl = castedThis->wrapped(); 5032 JSValue result = toJS (state,castedThis->globalObject(), impl.objMethod());4976 JSValue result = toJS<IDLInterface<TestObj>>(*state, *castedThis->globalObject(), impl.objMethod()); 5033 4977 return JSValue::encode(result); 5034 4978 } … … 5052 4996 auto strArg = convert<IDLDOMString>(*state, state->uncheckedArgument(1), StringConversionConfiguration::Normal); 5053 4997 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)); 5058 5001 return JSValue::encode(result); 5059 5002 } … … 5280 5223 auto strArg = convert<IDLDOMString>(*state, state->uncheckedArgument(0), StringConversionConfiguration::Normal); 5281 5224 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)); 5286 5228 5287 5229 setDOMException(state, throwScope, ec); … … 5433 5375 UNUSED_PARAM(throwScope); 5434 5376 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()); 5436 5378 return JSValue::encode(result); 5437 5379 } … … 5601 5543 UNUSED_PARAM(throwScope); 5602 5544 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)); 5604 5546 RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); 5605 5547 return JSValue::encode(result); … … 5637 5579 auto& impl = castedThis->wrapped(); 5638 5580 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)); 5640 5582 5641 5583 setDOMException(state, throwScope, ec); … … 5698 5640 if (!context) 5699 5641 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)); 5701 5643 5702 5644 setDOMException(state, throwScope, ec); … … 5720 5662 if (!context) 5721 5663 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)); 5723 5665 RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); 5724 5666 return JSValue::encode(result); … … 6288 6230 UNUSED_PARAM(throwScope); 6289 6231 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()); 6296 6234 impl.methodWithOptionalNullableWrapper(WTFMove(obj)); 6297 6235 return JSValue::encode(jsUndefined()); … … 6310 6248 UNUSED_PARAM(throwScope); 6311 6249 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()); 6318 6252 impl.methodWithOptionalNullableWrapperIsNull(WTFMove(obj)); 6319 6253 return JSValue::encode(jsUndefined()); … … 6575 6509 if (UNLIKELY(state->argumentCount() < 2)) 6576 6510 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()); 6583 6513 auto strArg = convert<IDLDOMString>(*state, state->uncheckedArgument(1), StringConversionConfiguration::Normal); 6584 6514 RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); … … 6601 6531 if (UNLIKELY(state->argumentCount() < 1)) 6602 6532 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()); 6609 6535 auto longArg = state->argument(1).isUndefined() ? Optional<int32_t>() : convert<IDLLong>(*state, state->uncheckedArgument(1), IntegerConversionConfiguration::Normal); 6610 6536 RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); … … 6688 6614 if (UNLIKELY(state->argumentCount() < 1)) 6689 6615 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()); 6696 6618 impl.overloadedMethod(WTFMove(listArg)); 6697 6619 return JSValue::encode(jsUndefined()); … … 6732 6654 if (UNLIKELY(state->argumentCount() < 1)) 6733 6655 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()); 6737 6658 impl.overloadedMethod(*objArg); 6738 6659 return JSValue::encode(jsUndefined()); … … 6753 6674 if (UNLIKELY(state->argumentCount() < 1)) 6754 6675 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()); 6758 6678 impl.overloadedMethod(*window); 6759 6679 return JSValue::encode(jsUndefined()); … … 6900 6820 auto strArg = convert<IDLDOMString>(*state, state->uncheckedArgument(0), StringConversionConfiguration::Normal); 6901 6821 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()); 6908 6824 impl.overloadedMethodWithOptionalParameter(WTFMove(strArg), WTFMove(objArg)); 6909 6825 return JSValue::encode(jsUndefined()); … … 6924 6840 if (UNLIKELY(state->argumentCount() < 1)) 6925 6841 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()); 6932 6844 auto longArg = state->argument(1).isUndefined() ? Optional<int32_t>() : convert<IDLLong>(*state, state->uncheckedArgument(1), IntegerConversionConfiguration::Normal); 6933 6845 RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); … … 7097 7009 auto objectOrNode = convert<IDLUnion<IDLInterface<TestObj>, IDLInterface<TestNode>>>(*state, state->uncheckedArgument(0)); 7098 7010 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()); 7102 7013 impl.overloadedMethodWithNonDistinguishingUnion(WTFMove(objectOrNode), *object); 7103 7014 return JSValue::encode(jsUndefined()); … … 7120 7031 auto objectOrNode = convert<IDLUnion<IDLInterface<TestObj>, IDLInterface<TestNode>>>(*state, state->uncheckedArgument(0)); 7121 7032 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()); 7125 7035 impl.overloadedMethodWithNonDistinguishingUnion(WTFMove(objectOrNode), *node); 7126 7036 return JSValue::encode(jsUndefined()); … … 7278 7188 if (UNLIKELY(state->argumentCount() < 2)) 7279 7189 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()); 7289 7194 impl.overloadWithNullableNonDistinguishingParameter(WTFMove(obj), *node); 7290 7195 return JSValue::encode(jsUndefined()); … … 7305 7210 if (UNLIKELY(state->argumentCount() < 2)) 7306 7211 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()); 7313 7214 auto index = convert<IDLLong>(*state, state->uncheckedArgument(1), IntegerConversionConfiguration::Normal); 7314 7215 RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); … … 7516 7417 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); 7517 7418 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)); 7522 7422 7523 7423 setDOMException(state, throwScope, ec); … … 7563 7463 auto elementId = AtomicString(state->uncheckedArgument(0).toString(state)->toExistingAtomicString(state)); 7564 7464 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))); 7566 7466 return JSValue::encode(result); 7567 7467 } … … 7580 7480 auto& impl = castedThis->wrapped(); 7581 7481 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))); 7583 7483 7584 7484 setDOMException(state, throwScope, ec); … … 7600 7500 if (UNLIKELY(state->argumentCount() < 1)) 7601 7501 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()); 7605 7504 impl.convert1(*value); 7606 7505 return JSValue::encode(jsUndefined()); … … 7621 7520 if (UNLIKELY(state->argumentCount() < 1)) 7622 7521 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()); 7629 7524 impl.convert2(WTFMove(value)); 7630 7525 return JSValue::encode(jsUndefined()); … … 7683 7578 UNUSED_PARAM(throwScope); 7684 7579 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())); 7686 7581 return JSValue::encode(result); 7687 7582 } … … 7699 7594 UNUSED_PARAM(throwScope); 7700 7595 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())); 7702 7597 return JSValue::encode(result); 7703 7598 } … … 7777 7672 if (UNLIKELY(state->argumentCount() < 1)) 7778 7673 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()); 7782 7676 auto tail = convertVariadicArguments<IDLInterface<Node>>(*state, 1); 7783 7677 RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); … … 7984 7878 if (UNLIKELY(state->argumentCount() < 1)) 7985 7879 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()); 7989 7882 impl.testPromiseOverloadedFunction(*request, WTFMove(promise)); 7990 7883 return JSValue::encode(jsUndefined()); -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp
r208212 r208308 76 76 if (UNLIKELY(state->argumentCount() < 1)) 77 77 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()); 82 80 auto object = TestOverloadedConstructors::create(*arrayBuffer); 83 81 return JSValue::encode(toJSNewlyCreated(state, castedThis->globalObject(), WTFMove(object))); … … 93 91 if (UNLIKELY(state->argumentCount() < 1)) 94 92 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()); 99 95 auto object = TestOverloadedConstructors::create(*arrayBufferView); 100 96 return JSValue::encode(toJSNewlyCreated(state, castedThis->globalObject(), WTFMove(object))); … … 110 106 if (UNLIKELY(state->argumentCount() < 1)) 111 107 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()); 115 110 auto object = TestOverloadedConstructors::create(*blob); 116 111 return JSValue::encode(toJSNewlyCreated(state, castedThis->globalObject(), WTFMove(object))); -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp
r208124 r208308 218 218 auto name = convert<IDLDOMString>(*state, state->uncheckedArgument(0), StringConversionConfiguration::Normal); 219 219 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))); 221 221 return JSValue::encode(result); 222 222 } -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerialization.cpp
r208124 r208308 193 193 UNUSED_PARAM(state); 194 194 auto& impl = thisObject.wrapped(); 195 JSValue result = toJS (&state,thisObject.globalObject(), impl.thirdUnserializableAttribute());195 JSValue result = toJS<IDLInterface<TestNode>>(state, *thisObject.globalObject(), impl.thirdUnserializableAttribute()); 196 196 return result; 197 197 } … … 303 303 UNUSED_PARAM(throwScope); 304 304 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); 310 307 impl.setThirdUnserializableAttribute(*nativeValue); 311 308 return true; -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp
r208181 r208308 687 687 UNUSED_PARAM(throwScope); 688 688 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())); 690 690 return JSValue::encode(result); 691 691 }
Note: See TracChangeset
for help on using the changeset viewer.