<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[208308] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/208308">208308</a></dd>
<dt>Author</dt> <dd>weinig@apple.com</dd>
<dt>Date</dt> <dd>2016-11-02 15:15:14 -0700 (Wed, 02 Nov 2016)</dd>
</dl>

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

Reviewed by Alex Christensen.

Source/JavaScriptCore:

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

Source/WebCore:

- Add the ability to pass an &quot;exception thrower&quot; functor to the convert functions.
  This is only implemented for convert&lt;IDLInterface&lt;T&gt;&gt; and convert&lt;IDLNullable&lt;IDLInterface&lt;T&gt;&gt;&gt;
  for now, but can be extended for more types as necessary to improve exception messages.
- Add support for using toJSNewlyCreated in JSDOMConvert.

* bindings/generic/IDLTypes.h:
(WebCore::IDLString::extractValueFromNullable):
Use forwarding to simplify extraction function.

(WebCore::IDLInterface::nullValue):
Update nullValue to work for both RefPtr&lt;T&gt; and T*.

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

* bindings/js/JSDOMConvert.h:
(WebCore::DefaultExceptionThrower::operator()):
Add a default &quot;exception thrower&quot; which throws a normal type error.

(WebCore::convert):
Add an overload of convert which takes an &quot;exception thrower&quot;.

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

(WebCore::Converter&lt;IDLNullable&lt;T&gt;&gt;::convert):
Fix the return type of Converter&lt;IDLNullable&lt;T&gt;&gt; to be specialized when
T is an IDLInterface. In that case, we want to match the return type of
inner converter.
        
Also add implementation of convert overload that takes an &quot;exception thrower&quot;.

(WebCore::JSConverter&lt;IDLNullable&lt;T&gt;&gt;::convert):
(WebCore::JSConverter&lt;IDLNullable&lt;T&gt;&gt;::convertNewlyCreated):
Reimplement conversion to use forwarding of the value.

(WebCore::Converter&lt;IDLInterface&lt;T&gt;&gt;::convert):
Add support for an &quot;exception thrower&quot;.

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

(WebCore::JSConverter&lt;IDLInterface&lt;T&gt;&gt;::convert):
Re-implement to support more varied input values.

(WebCore::JSConverter&lt;IDLInterface&lt;T&gt;&gt;::convertNewlyCreated):
Added. Forwards to overloaded toJSNewlyCreated functions.

* bindings/scripts/CodeGeneratorJS.pm:
(AddToImplIncludesForIDLType):
Add support for adding the right includes for SerializedScriptValue and Dictionary.

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

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

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

(GetBaseIDLType):
Use new GetIDLInterfaceName helper.

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

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

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

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

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

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

LayoutTests:

* svg/custom/polyline-points-crash-expected.txt:
* svg/dom/SVGLengthList-basics-expected.txt:
* svg/dom/SVGNumberList-basics-expected.txt:
* svg/dom/SVGPointList-basics-expected.txt:
* svg/dom/SVGTransformList-basics-expected.txt:
* svg/dom/SVGTransformList-expected.txt:
Update test results for improved error messages.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestssvgcustompolylinepointscrashexpectedtxt">trunk/LayoutTests/svg/custom/polyline-points-crash-expected.txt</a></li>
<li><a href="#trunkLayoutTestssvgdomSVGLengthListbasicsexpectedtxt">trunk/LayoutTests/svg/dom/SVGLengthList-basics-expected.txt</a></li>
<li><a href="#trunkLayoutTestssvgdomSVGNumberListbasicsexpectedtxt">trunk/LayoutTests/svg/dom/SVGNumberList-basics-expected.txt</a></li>
<li><a href="#trunkLayoutTestssvgdomSVGPointListbasicsexpectedtxt">trunk/LayoutTests/svg/dom/SVGPointList-basics-expected.txt</a></li>
<li><a href="#trunkLayoutTestssvgdomSVGTransformListbasicsexpectedtxt">trunk/LayoutTests/svg/dom/SVGTransformList-basics-expected.txt</a></li>
<li><a href="#trunkLayoutTestssvgdomSVGTransformListexpectedtxt">trunk/LayoutTests/svg/dom/SVGTransformList-expected.txt</a></li>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSArrayBufferh">trunk/Source/JavaScriptCore/runtime/JSArrayBuffer.h</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorebindingsgenericIDLTypesh">trunk/Source/WebCore/bindings/generic/IDLTypes.h</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSDOMConverth">trunk/Source/WebCore/bindings/js/JSDOMConvert.h</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptsCodeGeneratorJSpm">trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestJSJSTestActiveDOMObjectcpp">trunk/Source/WebCore/bindings/scripts/test/JS/JSTestActiveDOMObject.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestJSJSTestCEReactionscpp">trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCEReactions.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestJSJSTestCallbackcpp">trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallback.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestJSJSTestCallbackFunctioncpp">trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunction.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestJSJSTestDOMJITcpp">trunk/Source/WebCore/bindings/scripts/test/JS/JSTestDOMJIT.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestJSJSTestEventTargetcpp">trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestJSJSTestInterfacecpp">trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestJSJSTestObjcpp">trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestJSJSTestOverloadedConstructorscpp">trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestJSJSTestOverrideBuiltinscpp">trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestJSJSTestSerializationcpp">trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerialization.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestJSJSTestTypedefscpp">trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (208307 => 208308)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-11-02 22:12:19 UTC (rev 208307)
+++ trunk/LayoutTests/ChangeLog        2016-11-02 22:15:14 UTC (rev 208308)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2016-11-01  Sam Weinig  &lt;sam@webkit.org&gt;
+
+        [WebIDL] Move interfaces and typed arrays over to JSDOMConvert
+        https://bugs.webkit.org/show_bug.cgi?id=164256
+
+        Reviewed by Alex Christensen.
+
+        * svg/custom/polyline-points-crash-expected.txt:
+        * svg/dom/SVGLengthList-basics-expected.txt:
+        * svg/dom/SVGNumberList-basics-expected.txt:
+        * svg/dom/SVGPointList-basics-expected.txt:
+        * svg/dom/SVGTransformList-basics-expected.txt:
+        * svg/dom/SVGTransformList-expected.txt:
+        Update test results for improved error messages.
+
</ins><span class="cx"> 2016-11-02  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Web Inspector: Include DebuggerAgent in Workers - see, pause, and step through scripts
</span></span></pre></div>
<a id="trunkLayoutTestssvgcustompolylinepointscrashexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/svg/custom/polyline-points-crash-expected.txt (208307 => 208308)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/svg/custom/polyline-points-crash-expected.txt        2016-11-02 22:12:19 UTC (rev 208307)
+++ trunk/LayoutTests/svg/custom/polyline-points-crash-expected.txt        2016-11-02 22:15:14 UTC (rev 208308)
</span><span class="lines">@@ -1,2 +1,2 @@
</span><del>-Caught exception: SVG_WRONG_TYPE_ERR (DOM SVG Exception): An object of the wrong type was passed to an operation.
</del><ins>+Caught exception: TypeError: Argument 1 ('item') to SVGPointList.appendItem must be an instance of SVGPoint
</ins><span class="cx"> PASSED -- WebKit did not crash!
</span></span></pre></div>
<a id="trunkLayoutTestssvgdomSVGLengthListbasicsexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/svg/dom/SVGLengthList-basics-expected.txt (208307 => 208308)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/svg/dom/SVGLengthList-basics-expected.txt        2016-11-02 22:12:19 UTC (rev 208307)
+++ trunk/LayoutTests/svg/dom/SVGLengthList-basics-expected.txt        2016-11-02 22:15:14 UTC (rev 208308)
</span><span class="lines">@@ -15,7 +15,7 @@
</span><span class="cx"> PASS text1.x.baseVal.initialize(30) threw exception TypeError: Argument 1 ('item') to SVGLengthList.initialize must be an instance of SVGLength.
</span><span class="cx"> PASS text1.x.baseVal.initialize('aString') threw exception TypeError: Argument 1 ('item') to SVGLengthList.initialize must be an instance of SVGLength.
</span><span class="cx"> PASS text1.x.baseVal.initialize(text1) threw exception TypeError: Argument 1 ('item') to SVGLengthList.initialize must be an instance of SVGLength.
</span><del>-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..
</del><ins>+PASS text1.x.baseVal.initialize(null) threw exception TypeError: Argument 1 ('item') to SVGLengthList.initialize must be an instance of SVGLength.
</ins><span class="cx"> 
</span><span class="cx"> Test uncommon arguments for getItem()
</span><span class="cx"> PASS text1.x.baseVal.getItem(30) threw exception IndexSizeError (DOM Exception 1): The index is not in the allowed range..
</span><span class="lines">@@ -55,7 +55,7 @@
</span><span class="cx"> PASS text1.x.baseVal.insertItemBefore(30, 0) threw exception TypeError: Argument 1 ('item') to SVGLengthList.insertItemBefore must be an instance of SVGLength.
</span><span class="cx"> PASS text1.x.baseVal.insertItemBefore('aString', 0) threw exception TypeError: Argument 1 ('item') to SVGLengthList.insertItemBefore must be an instance of SVGLength.
</span><span class="cx"> PASS text1.x.baseVal.insertItemBefore(text1, 0) threw exception TypeError: Argument 1 ('item') to SVGLengthList.insertItemBefore must be an instance of SVGLength.
</span><del>-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..
</del><ins>+PASS text1.x.baseVal.insertItemBefore(null, 0) threw exception TypeError: Argument 1 ('item') to SVGLengthList.insertItemBefore must be an instance of SVGLength.
</ins><span class="cx"> 
</span><span class="cx"> Set x='1 2 3 4' for text1
</span><span class="cx"> PASS text1.setAttribute('x', '1 2 3 4') is undefined.
</span><span class="lines">@@ -85,7 +85,7 @@
</span><span class="cx"> PASS text1.x.baseVal.replaceItem(30, 0) threw exception TypeError: Argument 1 ('item') to SVGLengthList.replaceItem must be an instance of SVGLength.
</span><span class="cx"> PASS text1.x.baseVal.replaceItem('aString', 0) threw exception TypeError: Argument 1 ('item') to SVGLengthList.replaceItem must be an instance of SVGLength.
</span><span class="cx"> PASS text1.x.baseVal.replaceItem(text1, 0) threw exception TypeError: Argument 1 ('item') to SVGLengthList.replaceItem must be an instance of SVGLength.
</span><del>-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..
</del><ins>+PASS text1.x.baseVal.replaceItem(null, 0) threw exception TypeError: Argument 1 ('item') to SVGLengthList.replaceItem must be an instance of SVGLength.
</ins><span class="cx"> PASS text1.x.baseVal.replaceItem(text1.x.baseVal.getItem(0), 0) is text1.x.baseVal.getItem(0)
</span><span class="cx"> PASS text1.x.baseVal.numberOfItems is 4
</span><span class="cx"> PASS text1.x.baseVal.getItem(0).value is 1
</span><span class="lines">@@ -153,7 +153,7 @@
</span><span class="cx"> PASS text1.x.baseVal.appendItem(30) threw exception TypeError: Argument 1 ('item') to SVGLengthList.appendItem must be an instance of SVGLength.
</span><span class="cx"> PASS text1.x.baseVal.appendItem('aString') threw exception TypeError: Argument 1 ('item') to SVGLengthList.appendItem must be an instance of SVGLength.
</span><span class="cx"> PASS text1.x.baseVal.appendItem(text1) threw exception TypeError: Argument 1 ('item') to SVGLengthList.appendItem must be an instance of SVGLength.
</span><del>-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..
</del><ins>+PASS text1.x.baseVal.appendItem(null) threw exception TypeError: Argument 1 ('item') to SVGLengthList.appendItem must be an instance of SVGLength.
</ins><span class="cx"> 
</span><span class="cx"> Testing animVal clear throws
</span><span class="cx"> PASS text1.x.animVal.clear() threw exception NoModificationAllowedError (DOM Exception 7): The object can not be modified..
</span></span></pre></div>
<a id="trunkLayoutTestssvgdomSVGNumberListbasicsexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/svg/dom/SVGNumberList-basics-expected.txt (208307 => 208308)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/svg/dom/SVGNumberList-basics-expected.txt        2016-11-02 22:12:19 UTC (rev 208307)
+++ trunk/LayoutTests/svg/dom/SVGNumberList-basics-expected.txt        2016-11-02 22:15:14 UTC (rev 208308)
</span><span class="lines">@@ -12,7 +12,7 @@
</span><span class="cx"> PASS text1.rotate.baseVal.initialize(30) threw exception TypeError: Argument 1 ('item') to SVGNumberList.initialize must be an instance of SVGNumber.
</span><span class="cx"> PASS text1.rotate.baseVal.initialize('aString') threw exception TypeError: Argument 1 ('item') to SVGNumberList.initialize must be an instance of SVGNumber.
</span><span class="cx"> PASS text1.rotate.baseVal.initialize(text1) threw exception TypeError: Argument 1 ('item') to SVGNumberList.initialize must be an instance of SVGNumber.
</span><del>-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..
</del><ins>+PASS text1.rotate.baseVal.initialize(null) threw exception TypeError: Argument 1 ('item') to SVGNumberList.initialize must be an instance of SVGNumber.
</ins><span class="cx"> 
</span><span class="cx"> Test uncommon arguments for getItem()
</span><span class="cx"> PASS text1.rotate.baseVal.getItem(30) threw exception IndexSizeError (DOM Exception 1): The index is not in the allowed range..
</span><span class="lines">@@ -52,7 +52,7 @@
</span><span class="cx"> PASS text1.rotate.baseVal.insertItemBefore(30, 0) threw exception TypeError: Argument 1 ('item') to SVGNumberList.insertItemBefore must be an instance of SVGNumber.
</span><span class="cx"> PASS text1.rotate.baseVal.insertItemBefore('aString', 0) threw exception TypeError: Argument 1 ('item') to SVGNumberList.insertItemBefore must be an instance of SVGNumber.
</span><span class="cx"> PASS text1.rotate.baseVal.insertItemBefore(text1, 0) threw exception TypeError: Argument 1 ('item') to SVGNumberList.insertItemBefore must be an instance of SVGNumber.
</span><del>-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..
</del><ins>+PASS text1.rotate.baseVal.insertItemBefore(null, 0) threw exception TypeError: Argument 1 ('item') to SVGNumberList.insertItemBefore must be an instance of SVGNumber.
</ins><span class="cx"> 
</span><span class="cx"> Set rotate='1 2 3 4' for text1
</span><span class="cx"> PASS text1.setAttribute('rotate', '1 2 3 4') is undefined.
</span><span class="lines">@@ -71,7 +71,7 @@
</span><span class="cx"> PASS text1.rotate.baseVal.replaceItem(30, 0) threw exception TypeError: Argument 1 ('item') to SVGNumberList.replaceItem must be an instance of SVGNumber.
</span><span class="cx"> PASS text1.rotate.baseVal.replaceItem('aString', 0) threw exception TypeError: Argument 1 ('item') to SVGNumberList.replaceItem must be an instance of SVGNumber.
</span><span class="cx"> PASS text1.rotate.baseVal.replaceItem(text1, 0) threw exception TypeError: Argument 1 ('item') to SVGNumberList.replaceItem must be an instance of SVGNumber.
</span><del>-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..
</del><ins>+PASS text1.rotate.baseVal.replaceItem(null, 0) threw exception TypeError: Argument 1 ('item') to SVGNumberList.replaceItem must be an instance of SVGNumber.
</ins><span class="cx"> PASS text1.rotate.baseVal.replaceItem(text1.rotate.baseVal.getItem(0), 0) is text1.rotate.baseVal.getItem(0)
</span><span class="cx"> PASS text1.rotate.baseVal.numberOfItems is 4
</span><span class="cx"> PASS text1.rotate.baseVal.getItem(0).value is 1
</span><span class="lines">@@ -118,7 +118,7 @@
</span><span class="cx"> PASS text1.rotate.baseVal.appendItem(30) threw exception TypeError: Argument 1 ('item') to SVGNumberList.appendItem must be an instance of SVGNumber.
</span><span class="cx"> PASS text1.rotate.baseVal.appendItem('aString') threw exception TypeError: Argument 1 ('item') to SVGNumberList.appendItem must be an instance of SVGNumber.
</span><span class="cx"> PASS text1.rotate.baseVal.appendItem(text1) threw exception TypeError: Argument 1 ('item') to SVGNumberList.appendItem must be an instance of SVGNumber.
</span><del>-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..
</del><ins>+PASS text1.rotate.baseVal.appendItem(null) threw exception TypeError: Argument 1 ('item') to SVGNumberList.appendItem must be an instance of SVGNumber.
</ins><span class="cx"> 
</span><span class="cx"> Testing animVal clear throws
</span><span class="cx"> PASS text1.rotate.animVal.clear() threw exception NoModificationAllowedError (DOM Exception 7): The object can not be modified..
</span></span></pre></div>
<a id="trunkLayoutTestssvgdomSVGPointListbasicsexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/svg/dom/SVGPointList-basics-expected.txt (208307 => 208308)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/svg/dom/SVGPointList-basics-expected.txt        2016-11-02 22:12:19 UTC (rev 208307)
+++ trunk/LayoutTests/svg/dom/SVGPointList-basics-expected.txt        2016-11-02 22:15:14 UTC (rev 208308)
</span><span class="lines">@@ -74,13 +74,13 @@
</span><span class="cx"> PASS poly1.points.insertItemBefore(30, 0) threw exception TypeError: Argument 1 ('item') to SVGPointList.insertItemBefore must be an instance of SVGPoint.
</span><span class="cx"> PASS poly1.points.insertItemBefore('aString', 0) threw exception TypeError: Argument 1 ('item') to SVGPointList.insertItemBefore must be an instance of SVGPoint.
</span><span class="cx"> PASS poly1.points.insertItemBefore(poly1, 0) threw exception TypeError: Argument 1 ('item') to SVGPointList.insertItemBefore must be an instance of SVGPoint.
</span><del>-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..
</del><ins>+PASS poly1.points.insertItemBefore(null, 0) threw exception TypeError: Argument 1 ('item') to SVGPointList.insertItemBefore must be an instance of SVGPoint.
</ins><span class="cx"> 
</span><span class="cx"> Test uncommon arguments for replaceItem()
</span><span class="cx"> PASS poly1.points.replaceItem(30) threw exception TypeError: Not enough arguments.
</span><span class="cx"> PASS poly1.points.replaceItem('aString') threw exception TypeError: Not enough arguments.
</span><span class="cx"> PASS poly1.points.replaceItem(poly1) threw exception TypeError: Not enough arguments.
</span><del>-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..
</del><ins>+PASS poly1.points.replaceItem(null, 0) threw exception TypeError: Argument 1 ('item') to SVGPointList.replaceItem must be an instance of SVGPoint.
</ins><span class="cx"> PASS poly1.points.replaceItem('aString', 0) threw exception TypeError: Argument 1 ('item') to SVGPointList.replaceItem must be an instance of SVGPoint.
</span><span class="cx"> PASS poly1.points.replaceItem(poly1, 0) threw exception TypeError: Argument 1 ('item') to SVGPointList.replaceItem must be an instance of SVGPoint.
</span><span class="cx"> PASS poly1.points.replaceItem(1, 0) threw exception TypeError: Argument 1 ('item') to SVGPointList.replaceItem must be an instance of SVGPoint.
</span><span class="lines">@@ -142,7 +142,7 @@
</span><span class="cx"> PASS poly1.points.appendItem(30) threw exception TypeError: Argument 1 ('item') to SVGPointList.appendItem must be an instance of SVGPoint.
</span><span class="cx"> PASS poly1.points.appendItem('aString') threw exception TypeError: Argument 1 ('item') to SVGPointList.appendItem must be an instance of SVGPoint.
</span><span class="cx"> PASS poly1.points.appendItem(poly1) threw exception TypeError: Argument 1 ('item') to SVGPointList.appendItem must be an instance of SVGPoint.
</span><del>-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..
</del><ins>+PASS poly1.points.appendItem(null) threw exception TypeError: Argument 1 ('item') to SVGPointList.appendItem must be an instance of SVGPoint.
</ins><span class="cx"> PASS dumpPoint(poly1.points.appendItem(point)) is &quot;x=200 y=100&quot;
</span><span class="cx"> PASS poly1.points.numberOfItems is 2
</span><span class="cx"> PASS dumpPoint(poly1.points.getItem(0)) is &quot;x=0 y=100&quot;
</span></span></pre></div>
<a id="trunkLayoutTestssvgdomSVGTransformListbasicsexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/svg/dom/SVGTransformList-basics-expected.txt (208307 => 208308)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/svg/dom/SVGTransformList-basics-expected.txt        2016-11-02 22:12:19 UTC (rev 208307)
+++ trunk/LayoutTests/svg/dom/SVGTransformList-basics-expected.txt        2016-11-02 22:15:14 UTC (rev 208308)
</span><span class="lines">@@ -13,7 +13,7 @@
</span><span class="cx"> PASS circle1.transform.baseVal.initialize(30) threw exception TypeError: Argument 1 ('item') to SVGTransformList.initialize must be an instance of SVGTransform.
</span><span class="cx"> PASS circle1.transform.baseVal.initialize('aString') threw exception TypeError: Argument 1 ('item') to SVGTransformList.initialize must be an instance of SVGTransform.
</span><span class="cx"> PASS circle1.transform.baseVal.initialize(circle1) threw exception TypeError: Argument 1 ('item') to SVGTransformList.initialize must be an instance of SVGTransform.
</span><del>-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..
</del><ins>+PASS circle1.transform.baseVal.initialize(null) threw exception TypeError: Argument 1 ('item') to SVGTransformList.initialize must be an instance of SVGTransform.
</ins><span class="cx"> 
</span><span class="cx"> Test uncommon arguments for getItem()
</span><span class="cx"> PASS circle1.transform.baseVal.getItem(30) threw exception IndexSizeError (DOM Exception 1): The index is not in the allowed range..
</span><span class="lines">@@ -49,7 +49,7 @@
</span><span class="cx"> PASS circle1.transform.baseVal.insertItemBefore(30, 0) threw exception TypeError: Argument 1 ('item') to SVGTransformList.insertItemBefore must be an instance of SVGTransform.
</span><span class="cx"> PASS circle1.transform.baseVal.insertItemBefore('aString', 0) threw exception TypeError: Argument 1 ('item') to SVGTransformList.insertItemBefore must be an instance of SVGTransform.
</span><span class="cx"> PASS circle1.transform.baseVal.insertItemBefore(circle1, 0) threw exception TypeError: Argument 1 ('item') to SVGTransformList.insertItemBefore must be an instance of SVGTransform.
</span><del>-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..
</del><ins>+PASS circle1.transform.baseVal.insertItemBefore(null, 0) threw exception TypeError: Argument 1 ('item') to SVGTransformList.insertItemBefore must be an instance of SVGTransform.
</ins><span class="cx"> 
</span><span class="cx"> Test overlapping edge cases for removeItem()
</span><span class="cx"> PASS circle1.setAttribute('transform', 'scale(2 2) translate(10 10)') is undefined.
</span><span class="lines">@@ -75,7 +75,7 @@
</span><span class="cx"> PASS circle1.transform.baseVal.replaceItem(30, 0) threw exception TypeError: Argument 1 ('item') to SVGTransformList.replaceItem must be an instance of SVGTransform.
</span><span class="cx"> PASS circle1.transform.baseVal.replaceItem('aString', 0) threw exception TypeError: Argument 1 ('item') to SVGTransformList.replaceItem must be an instance of SVGTransform.
</span><span class="cx"> PASS circle1.transform.baseVal.replaceItem(circle1, 0) threw exception TypeError: Argument 1 ('item') to SVGTransformList.replaceItem must be an instance of SVGTransform.
</span><del>-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..
</del><ins>+PASS circle1.transform.baseVal.replaceItem(null, 0) threw exception TypeError: Argument 1 ('item') to SVGTransformList.replaceItem must be an instance of SVGTransform.
</ins><span class="cx"> PASS circle1.transform.baseVal.replaceItem(circle1.transform.baseVal.getItem(0), 0) is circle1.transform.baseVal.getItem(0)
</span><span class="cx"> PASS circle1.transform.baseVal.numberOfItems is 4
</span><span class="cx"> PASS dumpTransform(circle1.transform.baseVal.getItem(0)) is &quot;type=SVG_TRANSFORM_ROTATE matrix=[0.0 1.0 -1.0 0.0 0.0 0.0]&quot;
</span><span class="lines">@@ -126,7 +126,7 @@
</span><span class="cx"> PASS circle1.transform.baseVal.appendItem(30) threw exception TypeError: Argument 1 ('item') to SVGTransformList.appendItem must be an instance of SVGTransform.
</span><span class="cx"> PASS circle1.transform.baseVal.appendItem('aString') threw exception TypeError: Argument 1 ('item') to SVGTransformList.appendItem must be an instance of SVGTransform.
</span><span class="cx"> PASS circle1.transform.baseVal.appendItem(circle1) threw exception TypeError: Argument 1 ('item') to SVGTransformList.appendItem must be an instance of SVGTransform.
</span><del>-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..
</del><ins>+PASS circle1.transform.baseVal.appendItem(null) threw exception TypeError: Argument 1 ('item') to SVGTransformList.appendItem must be an instance of SVGTransform.
</ins><span class="cx"> 
</span><span class="cx"> Testing animVal clear throws
</span><span class="cx"> PASS circle1.transform.animVal.clear() threw exception NoModificationAllowedError (DOM Exception 7): The object can not be modified..
</span></span></pre></div>
<a id="trunkLayoutTestssvgdomSVGTransformListexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/svg/dom/SVGTransformList-expected.txt (208307 => 208308)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/svg/dom/SVGTransformList-expected.txt        2016-11-02 22:12:19 UTC (rev 208307)
+++ trunk/LayoutTests/svg/dom/SVGTransformList-expected.txt        2016-11-02 22:15:14 UTC (rev 208308)
</span><span class="lines">@@ -11,8 +11,8 @@
</span><span class="cx"> PASS transform.createSVGTransformFromMatrix('aString') threw exception TypeError: Argument 1 ('matrix') to SVGTransformList.createSVGTransformFromMatrix must be an instance of SVGMatrix.
</span><span class="cx"> PASS transform.createSVGTransformFromMatrix(1) threw exception TypeError: Argument 1 ('matrix') to SVGTransformList.createSVGTransformFromMatrix must be an instance of SVGMatrix.
</span><span class="cx"> PASS transform.createSVGTransformFromMatrix(true) threw exception TypeError: Argument 1 ('matrix') to SVGTransformList.createSVGTransformFromMatrix must be an instance of SVGMatrix.
</span><del>-PASS transform.createSVGTransformFromMatrix(undefined) threw exception TypeMismatchError (DOM Exception 17): The type of an object was incompatible with the expected type of the parameter associated to the object..
-PASS transform.createSVGTransformFromMatrix(null) threw exception TypeMismatchError (DOM Exception 17): The type of an object was incompatible with the expected type of the parameter associated to the object..
</del><ins>+PASS transform.createSVGTransformFromMatrix(undefined) threw exception TypeError: Argument 1 ('matrix') to SVGTransformList.createSVGTransformFromMatrix must be an instance of SVGMatrix.
+PASS transform.createSVGTransformFromMatrix(null) threw exception TypeError: Argument 1 ('matrix') to SVGTransformList.createSVGTransformFromMatrix must be an instance of SVGMatrix.
</ins><span class="cx"> PASS successfullyParsed is true
</span><span class="cx"> 
</span><span class="cx"> TEST COMPLETE
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (208307 => 208308)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2016-11-02 22:12:19 UTC (rev 208307)
+++ trunk/Source/JavaScriptCore/ChangeLog        2016-11-02 22:15:14 UTC (rev 208308)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2016-11-01  Sam Weinig  &lt;sam@webkit.org&gt;
+
+        [WebIDL] Move interfaces and typed arrays over to JSDOMConvert
+        https://bugs.webkit.org/show_bug.cgi?id=164256
+
+        Reviewed by Alex Christensen.
+
+        * runtime/JSArrayBuffer.h:
+        (JSC::JSArrayBuffer::toWrapped):
+        Change return type to ArrayBuffer* to match WebCore's expectation.
+
</ins><span class="cx"> 2016-11-02  Filip Pizlo  &lt;fpizlo@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         The GC should be in a thread
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSArrayBufferh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSArrayBuffer.h (208307 => 208308)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSArrayBuffer.h        2016-11-02 22:12:19 UTC (rev 208307)
+++ trunk/Source/JavaScriptCore/runtime/JSArrayBuffer.h        2016-11-02 22:15:14 UTC (rev 208308)
</span><span class="lines">@@ -53,7 +53,7 @@
</span><span class="cx">     DECLARE_EXPORT_INFO;
</span><span class="cx">     
</span><span class="cx">     // This is the default DOM unwrapping. It calls toUnsharedArrayBuffer().
</span><del>-    static RefPtr&lt;ArrayBuffer&gt; toWrapped(JSValue);
</del><ins>+    static ArrayBuffer* toWrapped(JSValue);
</ins><span class="cx">     
</span><span class="cx"> protected:
</span><span class="cx"> 
</span><span class="lines">@@ -85,7 +85,7 @@
</span><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-inline RefPtr&lt;ArrayBuffer&gt; JSArrayBuffer::toWrapped(JSValue value)
</del><ins>+inline ArrayBuffer* JSArrayBuffer::toWrapped(JSValue value)
</ins><span class="cx"> {
</span><span class="cx">     return toUnsharedArrayBuffer(value);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (208307 => 208308)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-11-02 22:12:19 UTC (rev 208307)
+++ trunk/Source/WebCore/ChangeLog        2016-11-02 22:15:14 UTC (rev 208308)
</span><span class="lines">@@ -1,3 +1,115 @@
</span><ins>+2016-11-01  Sam Weinig  &lt;sam@webkit.org&gt;
+
+        [WebIDL] Move interfaces and typed arrays over to JSDOMConvert
+        https://bugs.webkit.org/show_bug.cgi?id=164256
+
+        Reviewed by Alex Christensen.
+
+        - Add the ability to pass an &quot;exception thrower&quot; functor to the convert functions.
+          This is only implemented for convert&lt;IDLInterface&lt;T&gt;&gt; and convert&lt;IDLNullable&lt;IDLInterface&lt;T&gt;&gt;&gt;
+          for now, but can be extended for more types as necessary to improve exception messages.
+        - Add support for using toJSNewlyCreated in JSDOMConvert.
+
+        * bindings/generic/IDLTypes.h:
+        (WebCore::IDLString::extractValueFromNullable):
+        Use forwarding to simplify extraction function.
+
+        (WebCore::IDLInterface::nullValue):
+        Update nullValue to work for both RefPtr&lt;T&gt; and T*.
+
+        (WebCore::IDLInterface::extractValueFromNullable):
+        Use forwarding to simplify extraction function.
+
+        * bindings/js/JSDOMConvert.h:
+        (WebCore::DefaultExceptionThrower::operator()):
+        Add a default &quot;exception thrower&quot; which throws a normal type error.
+
+        (WebCore::convert):
+        Add an overload of convert which takes an &quot;exception thrower&quot;.
+
+        (WebCore::toJSNewlyCreated):
+        Add new overloaded function toJSNewlyCreated, matching the toJS overload set,
+        which will return &quot;newly created&quot; values. This only works for types that implement
+        a toJSNewlyCreated function for themselves.
+
+        (WebCore::Converter&lt;IDLNullable&lt;T&gt;&gt;::convert):
+        Fix the return type of Converter&lt;IDLNullable&lt;T&gt;&gt; to be specialized when
+        T is an IDLInterface. In that case, we want to match the return type of
+        inner converter.
+        
+        Also add implementation of convert overload that takes an &quot;exception thrower&quot;.
+
+        (WebCore::JSConverter&lt;IDLNullable&lt;T&gt;&gt;::convert):
+        (WebCore::JSConverter&lt;IDLNullable&lt;T&gt;&gt;::convertNewlyCreated):
+        Reimplement conversion to use forwarding of the value.
+
+        (WebCore::Converter&lt;IDLInterface&lt;T&gt;&gt;::convert):
+        Add support for an &quot;exception thrower&quot;.
+
+        (WebCore::Detail::getPtrOrRef):
+        Add helper functions that extract either a pointer or reference, depending on the type,
+        and const_casts it allowing the value to be used with toJS functions.
+
+        (WebCore::JSConverter&lt;IDLInterface&lt;T&gt;&gt;::convert):
+        Re-implement to support more varied input values.
+
+        (WebCore::JSConverter&lt;IDLInterface&lt;T&gt;&gt;::convertNewlyCreated):
+        Added. Forwards to overloaded toJSNewlyCreated functions.
+
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (AddToImplIncludesForIDLType):
+        Add support for adding the right includes for SerializedScriptValue and Dictionary.
+
+        (GetArgumentExceptionThrower):
+        (GetAttributeExceptionThrower):
+        Add helpers to generate &quot;exception thrower&quot; lambdas for wrappers and typed arrays
+        being passed to setters and functions.
+
+        (GenerateParametersCheck):
+        Move around special cases so it is clear that it's not wrappers and typed arrays that
+        need specialization here, it is now just EventListener and XPathNSResolver.
+
+        (GetIDLInterfaceName):
+        Add helper to get the InterfaceName for use in IDLInterface template.
+
+        (GetBaseIDLType):
+        Use new GetIDLInterfaceName helper.
+
+        (IsValidContextForJSValueToNative):
+        Remove IDLOperation as a valid context. It is not.
+
+        (JSValueToNative):
+        Move JSDOMConvert based conversion to the bottom, to show that everything above it
+        is a special case that should be fixed. I have used explicit c-style if-statements
+        to make it clear what the types of the exceptional cases are.
+
+        (NativeToJSValueDOMConvertNeedsState):
+        (NativeToJSValueDOMConvertNeedsGlobalObject):
+        Add wrapper types and typed arrays to the list needing state and globalObject.
+
+        (NativeToJSValue):
+        Move JSDOMConvert based conversion to the bottom, to show that everything above it
+        is a special case that should be fixed. I have used explicit c-style if-statements
+        to make it clear what the types of the exceptional cases are.
+
+        (JSValueToNativeIsHandledByDOMConvert): Deleted.
+        (NativeToJSValueIsHandledByDOMConvert): Deleted.
+        Remove predicates protecting use of JSDOMConvert now that it is the default.
+
+        * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
+        * bindings/scripts/test/JS/JSTestCEReactions.cpp:
+        * bindings/scripts/test/JS/JSTestCallback.cpp:
+        * bindings/scripts/test/JS/JSTestCallbackFunction.cpp:
+        * bindings/scripts/test/JS/JSTestDOMJIT.cpp:
+        * bindings/scripts/test/JS/JSTestEventTarget.cpp:
+        * bindings/scripts/test/JS/JSTestInterface.cpp:
+        * bindings/scripts/test/JS/JSTestObj.cpp:
+        * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
+        * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
+        * bindings/scripts/test/JS/JSTestSerialization.cpp:
+        * bindings/scripts/test/JS/JSTestTypedefs.cpp:
+        Update test results.
+
</ins><span class="cx"> 2016-11-02  David Kilzer  &lt;ddkilzer@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Bug 164333: Add logging for &quot;WebKit encountered an internal error&quot; messages due to Network process crashes
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsgenericIDLTypesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/generic/IDLTypes.h (208307 => 208308)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/generic/IDLTypes.h        2016-11-02 22:12:19 UTC (rev 208307)
+++ trunk/Source/WebCore/bindings/generic/IDLTypes.h        2016-11-02 22:15:14 UTC (rev 208308)
</span><span class="lines">@@ -83,7 +83,7 @@
</span><span class="cx">     using NullableType = String;
</span><span class="cx">     static String nullValue() { return String(); }
</span><span class="cx">     static bool isNullValue(const String&amp; value) { return value.isNull(); }
</span><del>-    static const String&amp; extractValueFromNullable(const String&amp; value) { return value; }
</del><ins>+    template &lt;typename U&gt; static U&amp;&amp; extractValueFromNullable(U&amp;&amp; value) { return std::forward&lt;U&gt;(value); }
</ins><span class="cx"> };
</span><span class="cx"> struct IDLDOMString : IDLString { };
</span><span class="cx"> struct IDLByteString : IDLUnsupportedType { };
</span><span class="lines">@@ -95,9 +95,9 @@
</span><span class="cx">     using RawType = T;
</span><span class="cx"> 
</span><span class="cx">     using NullableType = RefPtr&lt;T&gt;;
</span><del>-    static RefPtr&lt;T&gt; nullValue() { return nullptr; }
</del><ins>+    static std::nullptr_t nullValue() { return nullptr; }
</ins><span class="cx">     static bool isNullValue(const RefPtr&lt;T&gt;&amp; value) { return !value; }
</span><del>-    static const RefPtr&lt;T&gt;&amp; extractValueFromNullable(const RefPtr&lt;T&gt;&amp; value) { return value; }
</del><ins>+    template &lt;typename U&gt; static U&amp;&amp; extractValueFromNullable(U&amp;&amp; value) { return std::forward&lt;U&gt;(value); }
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> template&lt;typename T&gt; struct IDLDictionary : IDLType&lt;T&gt; { };
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSDOMConverth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSDOMConvert.h (208307 => 208308)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSDOMConvert.h        2016-11-02 22:12:19 UTC (rev 208307)
+++ trunk/Source/WebCore/bindings/js/JSDOMConvert.h        2016-11-02 22:15:14 UTC (rev 208308)
</span><span class="lines">@@ -37,9 +37,17 @@
</span><span class="cx"> enum class IntegerConversionConfiguration { Normal, EnforceRange, Clamp };
</span><span class="cx"> enum class StringConversionConfiguration { Normal, TreatNullAsEmptyString };
</span><span class="cx"> 
</span><ins>+struct DefaultExceptionThrower {
+    void operator()(JSC::ExecState&amp; state, JSC::ThrowScope&amp; scope)
+    {
+        throwTypeError(&amp;state, scope);
+    }
+};
+
</ins><span class="cx"> template&lt;typename T&gt; typename Converter&lt;T&gt;::ReturnType convert(JSC::ExecState&amp;, JSC::JSValue);
</span><span class="cx"> template&lt;typename T&gt; typename Converter&lt;T&gt;::ReturnType convert(JSC::ExecState&amp;, JSC::JSValue, IntegerConversionConfiguration);
</span><span class="cx"> template&lt;typename T&gt; typename Converter&lt;T&gt;::ReturnType convert(JSC::ExecState&amp;, JSC::JSValue, StringConversionConfiguration);
</span><ins>+template&lt;typename T, typename ExceptionThrower&gt; typename Converter&lt;T&gt;::ReturnType convert(JSC::ExecState&amp;, JSC::JSValue, ExceptionThrower&amp;&amp;);
</ins><span class="cx"> 
</span><span class="cx"> // Specialized by generated code for IDL dictionary conversion.
</span><span class="cx"> template&lt;typename T&gt; T convertDictionary(JSC::ExecState&amp;, JSC::JSValue);
</span><span class="lines">@@ -64,6 +72,11 @@
</span><span class="cx">     return Converter&lt;T&gt;::convert(state, value, configuration);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+template&lt;typename T, typename ExceptionThrower&gt; inline typename Converter&lt;T&gt;::ReturnType convert(JSC::ExecState&amp; state, JSC::JSValue value, ExceptionThrower&amp;&amp; exceptionThrower)
+{
+    return Converter&lt;T&gt;::convert(state, value, std::forward&lt;ExceptionThrower&gt;(exceptionThrower));
+}
+
</ins><span class="cx"> // Conversion from Implementation -&gt; JSValue
</span><span class="cx"> template&lt;typename T&gt; struct JSConverter;
</span><span class="cx"> 
</span><span class="lines">@@ -72,6 +85,8 @@
</span><span class="cx"> template&lt;typename T, typename U&gt; inline JSC::JSValue toJS(JSC::ExecState&amp;, JSDOMGlobalObject&amp;, U&amp;&amp;);
</span><span class="cx"> template&lt;typename T, typename U&gt; inline JSC::JSValue toJS(JSC::ExecState&amp;, JSC::ThrowScope&amp;, ExceptionOr&lt;U&gt;&amp;&amp;);
</span><span class="cx"> template&lt;typename T, typename U&gt; inline JSC::JSValue toJS(JSC::ExecState&amp;, JSDOMGlobalObject&amp;, JSC::ThrowScope&amp;, ExceptionOr&lt;U&gt;&amp;&amp;);
</span><ins>+template&lt;typename T, typename U&gt; inline JSC::JSValue toJSNewlyCreated(JSC::ExecState&amp;, JSDOMGlobalObject&amp;, U&amp;&amp;);
+template&lt;typename T, typename U&gt; inline JSC::JSValue toJSNewlyCreated(JSC::ExecState&amp;, JSDOMGlobalObject&amp;, JSC::ThrowScope&amp;, ExceptionOr&lt;U&gt;&amp;&amp;);
</ins><span class="cx"> 
</span><span class="cx"> // Specialized by generated code for IDL enumeration conversion.
</span><span class="cx"> template&lt;typename T&gt; JSC::JSString* convertEnumerationToJS(JSC::ExecState&amp;, T);
</span><span class="lines">@@ -149,7 +164,22 @@
</span><span class="cx">     return toJS&lt;T&gt;(state, globalObject, value.releaseReturnValue());
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+template&lt;typename T, typename U&gt; inline JSC::JSValue toJSNewlyCreated(JSC::ExecState&amp; state, JSDOMGlobalObject&amp; globalObject, U&amp;&amp; value)
+{
+    return JSConverter&lt;T&gt;::convertNewlyCreated(state, globalObject, std::forward&lt;U&gt;(value));
+}
</ins><span class="cx"> 
</span><ins>+template&lt;typename T, typename U&gt; inline JSC::JSValue toJSNewlyCreated(JSC::ExecState&amp; state, JSDOMGlobalObject&amp; globalObject, JSC::ThrowScope&amp; throwScope, ExceptionOr&lt;U&gt;&amp;&amp; value)
+{
+    if (UNLIKELY(value.hasException())) {
+        propagateException(state, throwScope, value.releaseException());
+        return { };
+    }
+
+    return toJSNewlyCreated&lt;T&gt;(state, globalObject, value.releaseReturnValue());
+}
+
+
</ins><span class="cx"> template&lt;typename T&gt; struct DefaultConverter {
</span><span class="cx">     using ReturnType = typename T::ImplementationType;
</span><span class="cx"> };
</span><span class="lines">@@ -157,8 +187,23 @@
</span><span class="cx"> // MARK: -
</span><span class="cx"> // MARK: Nullable type
</span><span class="cx"> 
</span><ins>+namespace Detail {
+    template&lt;typename IDLType&gt;
+    struct NullableConversionType;
+
+    template&lt;typename IDLType&gt; 
+    struct NullableConversionType {
+        using Type = typename IDLNullable&lt;IDLType&gt;::ImplementationType;
+    };
+
+    template&lt;typename T&gt;
+    struct NullableConversionType&lt;IDLInterface&lt;T&gt;&gt; {
+        using Type = typename Converter&lt;IDLInterface&lt;T&gt;&gt;::ReturnType;
+    };
+}
+
</ins><span class="cx"> template&lt;typename T&gt; struct Converter&lt;IDLNullable&lt;T&gt;&gt; : DefaultConverter&lt;IDLNullable&lt;T&gt;&gt; {
</span><del>-    using ReturnType = typename IDLNullable&lt;T&gt;::ImplementationType;
</del><ins>+    using ReturnType = typename Detail::NullableConversionType&lt;T&gt;::Type;
</ins><span class="cx">     
</span><span class="cx">     // 1. If Type(V) is not Object, and the conversion to an IDL value is being performed
</span><span class="cx">     // due to V being assigned to an attribute whose type is a nullable callback function
</span><span class="lines">@@ -188,6 +233,14 @@
</span><span class="cx">             return T::nullValue();
</span><span class="cx">         return Converter&lt;T&gt;::convert(state, value, configuration);
</span><span class="cx">     }
</span><ins>+
+    template&lt;typename ExceptionThrower = DefaultExceptionThrower&gt;
+    static ReturnType convert(JSC::ExecState&amp; state, JSC::JSValue value, ExceptionThrower&amp;&amp; exceptionThrower)
+    {
+        if (value.isUndefinedOrNull())
+            return T::nullValue();
+        return Converter&lt;T&gt;::convert(state, value, std::forward&lt;ExceptionThrower&gt;(exceptionThrower));
+    }
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> template&lt;typename T&gt; struct JSConverter&lt;IDLNullable&lt;T&gt;&gt; {
</span><span class="lines">@@ -196,24 +249,35 @@
</span><span class="cx">     static constexpr bool needsState = JSConverter&lt;T&gt;::needsState;
</span><span class="cx">     static constexpr bool needsGlobalObject = JSConverter&lt;T&gt;::needsGlobalObject;
</span><span class="cx"> 
</span><del>-    static JSC::JSValue convert(const ImplementationType&amp; value)
</del><ins>+    template&lt;typename U&gt;
+    static JSC::JSValue convert(U&amp;&amp; value)
</ins><span class="cx">     {
</span><span class="cx">         if (T::isNullValue(value))
</span><span class="cx">             return JSC::jsNull();
</span><span class="cx">         return JSConverter&lt;T&gt;::convert(T::extractValueFromNullable(value));
</span><span class="cx">     }
</span><del>-    static JSC::JSValue convert(JSC::ExecState&amp; state, const ImplementationType&amp; value)
</del><ins>+    template&lt;typename U&gt;
+    static JSC::JSValue convert(JSC::ExecState&amp; state, U&amp;&amp; value)
</ins><span class="cx">     {
</span><span class="cx">         if (T::isNullValue(value))
</span><span class="cx">             return JSC::jsNull();
</span><span class="cx">         return JSConverter&lt;T&gt;::convert(state, T::extractValueFromNullable(value));
</span><span class="cx">     }
</span><del>-    static JSC::JSValue convert(JSC::ExecState&amp; state, JSDOMGlobalObject&amp; globalObject, const ImplementationType&amp; value)
</del><ins>+    template&lt;typename U&gt;
+    static JSC::JSValue convert(JSC::ExecState&amp; state, JSDOMGlobalObject&amp; globalObject, U&amp;&amp; value)
</ins><span class="cx">     {
</span><span class="cx">         if (T::isNullValue(value))
</span><span class="cx">             return JSC::jsNull();
</span><span class="cx">         return JSConverter&lt;T&gt;::convert(state, globalObject, T::extractValueFromNullable(value));
</span><span class="cx">     }
</span><ins>+
+    template&lt;typename U&gt;
+    static JSC::JSValue convertNewlyCreated(JSC::ExecState&amp; state, JSDOMGlobalObject&amp; globalObject, U&amp;&amp; value)
+    {
+        if (T::isNullValue(value))
+            return JSC::jsNull();
+        return JSConverter&lt;T&gt;::convert(state, globalObject, T::extractValueFromNullable(value));
+    }
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> // MARK: -
</span><span class="lines">@@ -261,25 +325,41 @@
</span><span class="cx">     using ReturnType = typename JSDOMWrapperConverterTraits&lt;T&gt;::ToWrappedReturnType;
</span><span class="cx">     using WrapperType = typename JSDOMWrapperConverterTraits&lt;T&gt;::WrapperClass;
</span><span class="cx"> 
</span><del>-    static ReturnType convert(JSC::ExecState&amp; state, JSC::JSValue value)
</del><ins>+    template&lt;typename ExceptionThrower = DefaultExceptionThrower&gt;
+    static ReturnType convert(JSC::ExecState&amp; state, JSC::JSValue value, ExceptionThrower&amp;&amp; exceptionThrower = ExceptionThrower())
</ins><span class="cx">     {
</span><span class="cx">         JSC::VM&amp; vm = state.vm();
</span><span class="cx">         auto scope = DECLARE_THROW_SCOPE(vm);
</span><span class="cx">         ReturnType object = WrapperType::toWrapped(value);
</span><del>-        if (!object)
-            throwTypeError(&amp;state, scope);
</del><ins>+        if (UNLIKELY(!object))
+            exceptionThrower(state, scope);
</ins><span class="cx">         return object;
</span><span class="cx">     }
</span><span class="cx"> };
</span><span class="cx"> 
</span><ins>+namespace Detail {
+
+template &lt;typename T&gt; inline T* getPtrOrRef(const T* p) { return const_cast&lt;T*&gt;(p); }
+template &lt;typename T&gt; inline T&amp; getPtrOrRef(const T&amp; p) { return const_cast&lt;T&amp;&gt;(p); }
+template &lt;typename T&gt; inline T* getPtrOrRef(const RefPtr&lt;T&gt;&amp; p) { return const_cast&lt;T*&gt;(p.get()); }
+template &lt;typename T&gt; inline T&amp; getPtrOrRef(const Ref&lt;T&gt;&amp; p) { return const_cast&lt;T&amp;&gt;(p.get()); }
+
+}
+
</ins><span class="cx"> template&lt;typename T&gt; struct JSConverter&lt;IDLInterface&lt;T&gt;&gt; {
</span><span class="cx">     static constexpr bool needsState = true;
</span><span class="cx">     static constexpr bool needsGlobalObject = true;
</span><span class="cx"> 
</span><ins>+    template &lt;typename U&gt;
+    static JSC::JSValue convert(JSC::ExecState&amp; state, JSDOMGlobalObject&amp; globalObject, const U&amp; value)
+    {
+        return toJS(&amp;state, &amp;globalObject, Detail::getPtrOrRef(value));
+    }
+
</ins><span class="cx">     template&lt;typename U&gt;
</span><del>-    static JSC::JSValue convert(JSC::ExecState&amp; exec, JSDOMGlobalObject&amp; globalObject, const U&amp; value)
</del><ins>+    static JSC::JSValue convertNewlyCreated(JSC::ExecState&amp; state, JSDOMGlobalObject&amp; globalObject, U&amp;&amp; value)
</ins><span class="cx">     {
</span><del>-        return toJS(&amp;exec, &amp;globalObject, WTF::getPtr(value));
</del><ins>+        return toJSNewlyCreated(&amp;state, &amp;globalObject, std::forward&lt;U&gt;(value));
</ins><span class="cx">     }
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptsCodeGeneratorJSpm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (208307 => 208308)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2016-11-02 22:12:19 UTC (rev 208307)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2016-11-02 22:15:14 UTC (rev 208308)
</span><span class="lines">@@ -288,6 +288,16 @@
</span><span class="cx">         AddToImplIncludes(&quot;JS&quot; . $type-&gt;name . &quot;.h&quot;, $conditional);
</span><span class="cx">         return;
</span><span class="cx">     }
</span><ins>+    
+    if ($type-&gt;name eq &quot;SerializedScriptValue&quot;) {
+        AddToImplIncludes(&quot;SerializedScriptValue.h&quot;, $conditional);
+        return;
+    }
+
+    if ($type-&gt;name eq &quot;Dictionary&quot;) {
+        AddToImplIncludes(&quot;Dictionary.h&quot;, $conditional);
+        return;
+    }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> sub AddToImplIncludes
</span><span class="lines">@@ -533,6 +543,32 @@
</span><span class="cx">     return 0;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+sub GetArgumentExceptionThrower
+{
+    my ($interface, $argument, $argumentIndex, $quotedFunctionName) = @_;
+
+    return undef if !$codeGenerator-&gt;IsWrapperType($argument-&gt;type) &amp;&amp; !$codeGenerator-&gt;IsTypedArrayType($argument-&gt;type);
+
+    my $name = $argument-&gt;name;
+    my $visibleInterfaceName = $codeGenerator-&gt;GetVisibleInterfaceName($interface);
+    my $typeName = $argument-&gt;type-&gt;name;
+    
+    return &quot;[](JSC::ExecState&amp; state, JSC::ThrowScope&amp; scope) { throwArgumentTypeError(state, scope, ${argumentIndex}, \&quot;${name}\&quot;, \&quot;${visibleInterfaceName}\&quot;, ${quotedFunctionName}, \&quot;${typeName}\&quot;); }&quot;
+}
+
+sub GetAttributeExceptionThrower
+{
+    my ($interface, $attribute) = @_;
+
+    return undef if !$codeGenerator-&gt;IsWrapperType($attribute-&gt;type) &amp;&amp; !$codeGenerator-&gt;IsTypedArrayType($attribute-&gt;type);
+    
+    my $name = $attribute-&gt;name;
+    my $visibleInterfaceName = $codeGenerator-&gt;GetVisibleInterfaceName($interface);
+    my $typeName = $attribute-&gt;type-&gt;name;
+    
+    return &quot;[](JSC::ExecState&amp; state, JSC::ThrowScope&amp; scope) { throwAttributeTypeError(state, scope, \&quot;${visibleInterfaceName}\&quot;, \&quot;${name}\&quot;, \&quot;${typeName}\&quot;); }&quot;
+}
+
</ins><span class="cx"> sub GetAttributeGetterName
</span><span class="cx"> {
</span><span class="cx">     my ($interface, $className, $attribute) = @_;
</span><span class="lines">@@ -3276,12 +3312,7 @@
</span><span class="cx">                     unshift(@arguments, @callWithArgs);
</span><span class="cx">                     my $jsType = NativeToJSValueUsingReferences($attribute, 0, $interface, &quot;${functionName}(&quot; . join(&quot;, &quot;, @arguments) . &quot;)&quot;, &quot;thisObject&quot;);
</span><span class="cx">                     push(@implContent, &quot;    auto&amp; impl = thisObject.wrapped();\n&quot;) if !$attribute-&gt;isStatic;
</span><del>-                    if ($codeGenerator-&gt;IsSVGAnimatedType($type)) {
-                        push(@implContent, &quot;    auto obj = $jsType;\n&quot;);
-                        push(@implContent, &quot;    JSValue result = toJS(&amp;state, thisObject.globalObject(), obj.get());\n&quot;);
-                    } else {
-                        push(@implContent, &quot;    JSValue result = $jsType;\n&quot;);
-                    }
</del><ins>+                    push(@implContent, &quot;    JSValue result = $jsType;\n&quot;);
</ins><span class="cx">                 }
</span><span class="cx"> 
</span><span class="cx">                 push(@implContent, &quot;    thisObject.m_&quot; . $attribute-&gt;name . &quot;.set(state.vm(), &amp;thisObject, result);\n&quot;) if $attribute-&gt;extendedAttributes-&gt;{CachedAttribute};
</span><span class="lines">@@ -3540,37 +3571,18 @@
</span><span class="cx"> 
</span><span class="cx">                 push(@implContent, &quot;    ExceptionCode ec = 0;\n&quot;) if $setterMayThrowLegacyException;
</span><span class="cx"> 
</span><del>-                my $shouldPassByReference = ShouldPassWrapperByReference($attribute, $interface);
</del><ins>+                my $exceptionThrower = GetAttributeExceptionThrower($interface, $attribute);
</ins><span class="cx"> 
</span><del>-                my ($nativeValue, $mayThrowException) = JSValueToNative($interface, $attribute, &quot;value&quot;, $attribute-&gt;extendedAttributes-&gt;{Conditional}, &quot;&amp;state&quot;, &quot;state&quot;, &quot;thisObject&quot;);
-                if (!$shouldPassByReference &amp;&amp; ($codeGenerator-&gt;IsWrapperType($type) || $codeGenerator-&gt;IsTypedArrayType($type))) {
-                    $implIncludes{&quot;&lt;runtime/Error.h&gt;&quot;} = 1;
-                    push(@implContent, &quot;    &quot; . GetNativeType($interface, $attribute-&gt;type) . &quot; nativeValue = nullptr;\n&quot;);
-                    push(@implContent, &quot;    if (!value.isUndefinedOrNull()) {\n&quot;);
-                    push(@implContent, &quot;        nativeValue = $nativeValue;\n&quot;);
-                    push(@implContent, &quot;        RETURN_IF_EXCEPTION(throwScope, false);\n&quot;) if $mayThrowException;
-                    push(@implContent, &quot;        if (UNLIKELY(!nativeValue)) {\n&quot;);
-                    push(@implContent, &quot;            throwAttributeTypeError(state, throwScope, \&quot;$visibleInterfaceName\&quot;, \&quot;$name\&quot;, \&quot;&quot; . $type-&gt;name . &quot;\&quot;);\n&quot;);
-                    push(@implContent, &quot;            return false;\n&quot;);
-                    push(@implContent, &quot;        }\n&quot;);
-                    push(@implContent, &quot;    }\n&quot;);
-                } else {
-                    push(@implContent, &quot;    auto nativeValue = $nativeValue;\n&quot;);
-                    push(@implContent, &quot;    RETURN_IF_EXCEPTION(throwScope, false);\n&quot;) if $mayThrowException;
-                }
</del><ins>+                my ($nativeValue, $mayThrowException) = JSValueToNative($interface, $attribute, &quot;value&quot;, $attribute-&gt;extendedAttributes-&gt;{Conditional}, &quot;&amp;state&quot;, &quot;state&quot;, &quot;thisObject&quot;, $exceptionThrower);
</ins><span class="cx"> 
</span><ins>+                push(@implContent, &quot;    auto nativeValue = $nativeValue;\n&quot;);
+                push(@implContent, &quot;    RETURN_IF_EXCEPTION(throwScope, false);\n&quot;) if $mayThrowException;
+
</ins><span class="cx">                 if ($codeGenerator-&gt;IsEnumType($type)) {
</span><span class="cx">                     push (@implContent, &quot;    if (UNLIKELY(!nativeValue))\n&quot;);
</span><span class="cx">                     push (@implContent, &quot;        return false;\n&quot;);
</span><span class="cx">                 }
</span><span class="cx"> 
</span><del>-                if ($shouldPassByReference) {
-                    push(@implContent, &quot;    if (UNLIKELY(!nativeValue)) {\n&quot;);
-                    push(@implContent, &quot;        throwAttributeTypeError(state, throwScope, \&quot;$visibleInterfaceName\&quot;, \&quot;$name\&quot;, \&quot;&quot; . $type-&gt;name . &quot;\&quot;);\n&quot;);
-                    push(@implContent, &quot;        return false;\n&quot;);
-                    push(@implContent, &quot;    }\n&quot;);
-                }
-
</del><span class="cx">                 if ($svgPropertyOrListPropertyType) {
</span><span class="cx">                     if ($svgPropertyType) {
</span><span class="cx">                         push(@implContent, &quot;    if (impl.isReadOnly()) {\n&quot;);
</span><span class="lines">@@ -3607,7 +3619,7 @@
</span><span class="cx">                     } elsif ($codeGenerator-&gt;IsEnumType($type)) {
</span><span class="cx">                         push(@arguments, &quot;nativeValue.value()&quot;);
</span><span class="cx">                     } else {
</span><del>-                        push(@arguments, $shouldPassByReference ? &quot;*nativeValue&quot; : &quot;WTFMove(nativeValue)&quot;);
</del><ins>+                        push(@arguments, ShouldPassWrapperByReference($attribute, $interface) ? &quot;*nativeValue&quot; : &quot;WTFMove(nativeValue)&quot;);
</ins><span class="cx">                     }
</span><span class="cx">                     my $implementedBy = $attribute-&gt;extendedAttributes-&gt;{ImplementedBy};
</span><span class="cx">                     if ($implementedBy) {
</span><span class="lines">@@ -4412,68 +4424,73 @@
</span><span class="cx">             my $inner;
</span><span class="cx">             my $nativeType = GetNativeType($interface, $argument-&gt;type);
</span><span class="cx">             my $isTearOff = $codeGenerator-&gt;IsSVGTypeNeedingTearOff($type) &amp;&amp; $interfaceName !~ /List$/;
</span><del>-            my $shouldPassByReference = $isTearOff || ShouldPassWrapperByReference($argument, $interface);
</del><span class="cx"> 
</span><span class="cx">             die &quot;Variadic argument is already handled here&quot; if $argument-&gt;isVariadic;
</span><span class="cx">             my $argumentLookupMethod = $argument-&gt;isOptional ? &quot;argument&quot; : &quot;uncheckedArgument&quot;;
</span><span class="cx"> 
</span><del>-            if (!$shouldPassByReference &amp;&amp; ($codeGenerator-&gt;IsWrapperType($type) || $codeGenerator-&gt;IsTypedArrayType($type))) {
-                $implIncludes{&quot;&lt;runtime/Error.h&gt;&quot;} = 1;
-                my $checkedArgument = &quot;state-&gt;$argumentLookupMethod($argumentIndex)&quot;;
-                my $uncheckedArgument = &quot;state-&gt;uncheckedArgument($argumentIndex)&quot;;
-                my ($nativeValue, $mayThrowException) = JSValueToNative($interface, $argument, $uncheckedArgument, $function-&gt;extendedAttributes-&gt;{Conditional});
-                push(@$outputArray, &quot;    $nativeType $name = nullptr;\n&quot;);
-                push(@$outputArray, &quot;    if (!$checkedArgument.isUndefinedOrNull()) {\n&quot;);
-                push(@$outputArray, &quot;        $name = $nativeValue;\n&quot;);
-                push(@$outputArray, &quot;        RETURN_IF_EXCEPTION(throwScope, encodedJSValue());\n&quot;) if $mayThrowException;
-                push(@$outputArray, &quot;        if (UNLIKELY(!$name))\n&quot;);
-                push(@$outputArray, &quot;            return throwArgumentTypeError(*state, throwScope, $argumentIndex, \&quot;$name\&quot;, \&quot;$visibleInterfaceName\&quot;, $quotedFunctionName, \&quot;&quot; . $type-&gt;name . &quot;\&quot;);\n&quot;);
-                push(@$outputArray, &quot;    }\n&quot;);
-                $value = &quot;WTFMove($name)&quot;;
-            } else {
-                if ($argument-&gt;isOptional &amp;&amp; defined($argument-&gt;default) &amp;&amp; !WillConvertUndefinedToDefaultParameterValue($type, $argument-&gt;default)) {
-                    my $defaultValue = $argument-&gt;default;
</del><ins>+            if ($argument-&gt;isOptional &amp;&amp; defined($argument-&gt;default) &amp;&amp; !WillConvertUndefinedToDefaultParameterValue($type, $argument-&gt;default)) {
+                my $defaultValue = $argument-&gt;default;
</ins><span class="cx"> 
</span><del>-                    # String-related optimizations.
-                    if ($codeGenerator-&gt;IsStringType($type)) {
-                        my $useAtomicString = $argument-&gt;extendedAttributes-&gt;{AtomicString};
-                        if ($defaultValue eq &quot;null&quot;) {
-                            $defaultValue = $useAtomicString ? &quot;nullAtom&quot; : &quot;String()&quot;;
-                        } elsif ($defaultValue eq &quot;\&quot;\&quot;&quot;) {
-                            $defaultValue = $useAtomicString ? &quot;emptyAtom&quot; : &quot;emptyString()&quot;;
-                        } else {
-                            $defaultValue = $useAtomicString ? &quot;AtomicString($defaultValue, AtomicString::ConstructFromLiteral)&quot; : &quot;ASCIILiteral($defaultValue)&quot;;
-                        }
</del><ins>+                # String-related optimizations.
+                if ($codeGenerator-&gt;IsStringType($type)) {
+                    my $useAtomicString = $argument-&gt;extendedAttributes-&gt;{AtomicString};
+                    if ($defaultValue eq &quot;null&quot;) {
+                        $defaultValue = $useAtomicString ? &quot;nullAtom&quot; : &quot;String()&quot;;
+                    } elsif ($defaultValue eq &quot;\&quot;\&quot;&quot;) {
+                        $defaultValue = $useAtomicString ? &quot;emptyAtom&quot; : &quot;emptyString()&quot;;
</ins><span class="cx">                     } else {
</span><del>-                        $defaultValue = GenerateDefaultValue($interface, $argument-&gt;type, $argument-&gt;default);
</del><ins>+                        $defaultValue = $useAtomicString ? &quot;AtomicString($defaultValue, AtomicString::ConstructFromLiteral)&quot; : &quot;ASCIILiteral($defaultValue)&quot;;
</ins><span class="cx">                     }
</span><ins>+                } else {
+                    $defaultValue = GenerateDefaultValue($interface, $argument-&gt;type, $argument-&gt;default);
+                }
</ins><span class="cx"> 
</span><del>-                    $outer = &quot;state-&gt;$argumentLookupMethod($argumentIndex).isUndefined() ? $defaultValue : &quot;;
-                    $inner = &quot;state-&gt;uncheckedArgument($argumentIndex)&quot;;
-                } elsif ($argument-&gt;isOptional &amp;&amp; !defined($argument-&gt;default)) {
-                    # Use WTF::Optional&lt;&gt;() for optional arguments that are missing or undefined and that do not have a default value in the IDL.
-                    $outer = &quot;state-&gt;$argumentLookupMethod($argumentIndex).isUndefined() ? Optional&lt;$nativeType&gt;() : &quot;;
-                    $inner = &quot;state-&gt;uncheckedArgument($argumentIndex)&quot;;
</del><ins>+                $outer = &quot;state-&gt;$argumentLookupMethod($argumentIndex).isUndefined() ? $defaultValue : &quot;;
+                $inner = &quot;state-&gt;uncheckedArgument($argumentIndex)&quot;;
+            } elsif ($argument-&gt;isOptional &amp;&amp; !defined($argument-&gt;default)) {
+                # Use WTF::Optional&lt;&gt;() for optional arguments that are missing or undefined and that do not have a default value in the IDL.
+                $outer = &quot;state-&gt;$argumentLookupMethod($argumentIndex).isUndefined() ? Optional&lt;$nativeType&gt;() : &quot;;
+                $inner = &quot;state-&gt;uncheckedArgument($argumentIndex)&quot;;
+            } elsif (($argument-&gt;type-&gt;name eq &quot;EventListener&quot; || $argument-&gt;type-&gt;name eq &quot;XPathNSResolver&quot;) &amp;&amp; ($argument-&gt;isOptional || $type-&gt;isNullable)) {
+                $outer = &quot;&quot;;
+                $inner = &quot;state-&gt;uncheckedArgument($argumentIndex)&quot;;
+            } else {
+                $outer = &quot;&quot;;
+                $inner = &quot;state-&gt;$argumentLookupMethod($argumentIndex)&quot;;
+            }
+
+            my $argumentExceptionThrower = GetArgumentExceptionThrower($interface, $argument, $argumentIndex, $quotedFunctionName);
+            my ($nativeValue, $mayThrowException) = JSValueToNative($interface, $argument, $inner, $function-&gt;extendedAttributes-&gt;{Conditional}, &quot;state&quot;, &quot;*state&quot;, &quot;&quot;, $argumentExceptionThrower);
+
+            if ($argument-&gt;type-&gt;name eq &quot;EventListener&quot; || $argument-&gt;type-&gt;name eq &quot;XPathNSResolver&quot;) {
+                if ($argument-&gt;isOptional || $type-&gt;isNullable) {
+                    push(@$outputArray, &quot;    $nativeType $name = nullptr;\n&quot;);
+                    push(@$outputArray, &quot;    if (!state-&gt;$argumentLookupMethod($argumentIndex).isUndefinedOrNull()) {\n&quot;);
+                    push(@$outputArray, &quot;        $name = $nativeValue;\n&quot;);
+                    push(@$outputArray, &quot;        RETURN_IF_EXCEPTION(throwScope, encodedJSValue());\n&quot;) if $mayThrowException;
+                    push(@$outputArray, &quot;        if (UNLIKELY(!$name))\n&quot;);
+                    push(@$outputArray, &quot;            return throwArgumentTypeError(*state, throwScope, $argumentIndex, \&quot;$name\&quot;, \&quot;$visibleInterfaceName\&quot;, $quotedFunctionName, \&quot;&quot; . $type-&gt;name . &quot;\&quot;);\n&quot;);
+                    push(@$outputArray, &quot;    }\n&quot;);
</ins><span class="cx">                 } else {
</span><del>-                    $outer = &quot;&quot;;
-                    $inner = &quot;state-&gt;$argumentLookupMethod($argumentIndex)&quot;;
</del><ins>+                    push(@$outputArray, &quot;    auto $name = $nativeValue;\n&quot;);
+                    push(@$outputArray, &quot;    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());\n&quot;) if $mayThrowException;
+                    push(@$outputArray, &quot;    if (UNLIKELY(!$name))\n&quot;);
+                    push(@$outputArray, &quot;        return throwArgumentTypeError(*state, throwScope, $argumentIndex, \&quot;$name\&quot;, \&quot;$visibleInterfaceName\&quot;, $quotedFunctionName, \&quot;&quot; . $type-&gt;name . &quot;\&quot;);\n&quot;);
</ins><span class="cx">                 }
</span><del>-
-                my ($nativeValue, $mayThrowException) = JSValueToNative($interface, $argument, $inner, $function-&gt;extendedAttributes-&gt;{Conditional});
</del><ins>+            } else {
</ins><span class="cx">                 push(@$outputArray, &quot;    auto $name = ${outer}${nativeValue};\n&quot;);
</span><del>-                $value = &quot;WTFMove($name)&quot;;
</del><span class="cx">                 push(@$outputArray, &quot;    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());\n&quot;) if $mayThrowException;
</span><span class="cx">             }
</span><span class="cx"> 
</span><del>-            if ($shouldPassByReference) {
-                push(@$outputArray, &quot;    if (UNLIKELY(!$name))\n&quot;);
-                push(@$outputArray, &quot;        return throwArgumentTypeError(*state, throwScope, $argumentIndex, \&quot;$name\&quot;, \&quot;$visibleInterfaceName\&quot;, $quotedFunctionName, \&quot;&quot; . $type-&gt;name . &quot;\&quot;);\n&quot;);
-                $value = $isTearOff ? &quot;$name-&gt;propertyReference()&quot; : &quot;*$name&quot;;
-            }
-
-            if ($codeGenerator-&gt;IsTypedArrayType($type) and $type-&gt;name ne &quot;ArrayBuffer&quot;) {
-               $value = $shouldPassByReference ? &quot;$name.releaseNonNull()&quot; : &quot;WTFMove($name)&quot;;
-            } elsif ($codeGenerator-&gt;IsDictionaryType($type)) {
</del><ins>+            if ($isTearOff) {
+                $value = &quot;$name-&gt;propertyReference()&quot;;
+            } elsif (ShouldPassWrapperByReference($argument, $interface)) {
+                if ($codeGenerator-&gt;IsTypedArrayType($type) and $type-&gt;name ne &quot;ArrayBuffer&quot;) {
+                    $value = &quot;$name.releaseNonNull()&quot;;
+                } else {
+                    $value = &quot;*$name&quot;;
+                }
+            } else {
</ins><span class="cx">                 $value = &quot;WTFMove($name)&quot;;
</span><span class="cx">             }
</span><span class="cx">         }
</span><span class="lines">@@ -5068,6 +5085,14 @@
</span><span class="cx">     return @idlUnionMemberTypes;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+sub GetIDLInterfaceName
+{
+    my ($type) = @_;
+
+    return $codeGenerator-&gt;GetSVGTypeNeedingTearOff($type) if $codeGenerator-&gt;IsSVGTypeNeedingTearOff($type);
+    return $type-&gt;name;
+}
+
</ins><span class="cx"> sub GetBaseIDLType
</span><span class="cx"> {
</span><span class="cx">     my ($interface, $type) = @_;
</span><span class="lines">@@ -5102,7 +5127,7 @@
</span><span class="cx">     return &quot;IDLSequence&lt;&quot; . GetIDLType($interface, @{$type-&gt;subtypes}[0]) . &quot;&gt;&quot; if $codeGenerator-&gt;IsSequenceType($type);
</span><span class="cx">     return &quot;IDLFrozenArray&lt;&quot; . GetIDLType($interface, @{$type-&gt;subtypes}[0]) . &quot;&gt;&quot; if $codeGenerator-&gt;IsFrozenArrayType($type);
</span><span class="cx">     return &quot;IDLUnion&lt;&quot; . join(&quot;, &quot;, GetIDLUnionMemberTypes($interface, $type)) . &quot;&gt;&quot; if $type-&gt;isUnion;
</span><del>-    return &quot;IDLInterface&lt;&quot; . $type-&gt;name . &quot;&gt;&quot;;
</del><ins>+    return &quot;IDLInterface&lt;&quot; . GetIDLInterfaceName($type) . &quot;&gt;&quot;;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> sub GetIDLType
</span><span class="lines">@@ -5234,30 +5259,11 @@
</span><span class="cx">     return &quot;StringConversionConfiguration::Normal&quot;;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-sub JSValueToNativeIsHandledByDOMConvert
-{
-    my ($type, $context) = @_;
-
-    return 0 if $type-&gt;name eq &quot;DOMString&quot; &amp;&amp; ($context-&gt;extendedAttributes-&gt;{RequiresExistingAtomicString} || $context-&gt;extendedAttributes-&gt;{AtomicString});
-
-    return 1 if $type-&gt;isUnion;
-    return 1 if $type-&gt;name eq &quot;any&quot;;
-    return 1 if $type-&gt;name eq &quot;boolean&quot;;
-    return 1 if $type-&gt;name eq &quot;Date&quot;;
-    return 1 if $type-&gt;name eq &quot;BufferSource&quot;;
-    return 1 if $codeGenerator-&gt;IsIntegerType($type);
-    return 1 if $codeGenerator-&gt;IsFloatingPointType($type);
-    return 1 if $codeGenerator-&gt;IsSequenceOrFrozenArrayType($type);
-    return 1 if $codeGenerator-&gt;IsDictionaryType($type);
-    return 1 if $codeGenerator-&gt;IsStringType($type);
-    return 0;
-}
-
</del><span class="cx"> sub IsValidContextForJSValueToNative
</span><span class="cx"> {
</span><span class="cx">     my $context = shift;
</span><span class="cx">     
</span><del>-    return ref($context) eq &quot;IDLAttribute&quot; || ref($context) eq &quot;IDLOperation&quot; || ref($context) eq &quot;IDLArgument&quot;;
</del><ins>+    return ref($context) eq &quot;IDLAttribute&quot; || ref($context) eq &quot;IDLArgument&quot;;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> # Returns (convertString, mayThrowException).
</span><span class="lines">@@ -5264,7 +5270,7 @@
</span><span class="cx"> 
</span><span class="cx"> sub JSValueToNative
</span><span class="cx"> {
</span><del>-    my ($interface, $context, $value, $conditional, $statePointer, $stateReference, $thisObjectReference) = @_;
</del><ins>+    my ($interface, $context, $value, $conditional, $statePointer, $stateReference, $thisObjectReference, $exceptionThrower) = @_;
</ins><span class="cx"> 
</span><span class="cx">     assert(&quot;Invalid context type&quot;) if !IsValidContextForJSValueToNative($context);
</span><span class="cx"> 
</span><span class="lines">@@ -5275,65 +5281,47 @@
</span><span class="cx">     $stateReference = &quot;*state&quot; unless $stateReference;
</span><span class="cx">     $thisObjectReference = &quot;*castedThis&quot; unless $thisObjectReference;
</span><span class="cx"> 
</span><del>-    if (JSValueToNativeIsHandledByDOMConvert($type, $context)) {
-        AddToImplIncludes(&quot;JSDOMConvert.h&quot;);
-        AddToImplIncludesForIDLType($type, $conditional);
</del><ins>+    AddToImplIncludesForIDLType($type, $conditional);
</ins><span class="cx"> 
</span><del>-        my $IDLType = GetIDLType($interface, $type);
-
-        my @conversionArguments = ();
-        push(@conversionArguments, &quot;$stateReference&quot;);
-        push(@conversionArguments, &quot;$value&quot;);
-        push(@conversionArguments, GetIntegerConversionConfiguration($context)) if $codeGenerator-&gt;IsIntegerType($type);
-        push(@conversionArguments, GetStringConversionConfiguration($context)) if $codeGenerator-&gt;IsStringType($type);
-
-        return (&quot;convert&lt;$IDLType&gt;(&quot; . join(&quot;, &quot;, @conversionArguments) . &quot;)&quot;, 1);
-    }
-
</del><span class="cx">     if ($type-&gt;name eq &quot;DOMString&quot;) {
</span><span class="cx">         return (&quot;AtomicString($value.toString($statePointer)-&gt;toExistingAtomicString($statePointer))&quot;, 1) if $context-&gt;extendedAttributes-&gt;{RequiresExistingAtomicString};
</span><span class="cx">         return (&quot;$value.toString($statePointer)-&gt;toAtomicString($statePointer)&quot;, 1) if $context-&gt;extendedAttributes-&gt;{AtomicString};
</span><del>-        assert(&quot;Unhandled string conversion.&quot;);
</del><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if ($type-&gt;name eq &quot;SerializedScriptValue&quot;) {
</span><del>-        AddToImplIncludes(&quot;SerializedScriptValue.h&quot;, $conditional);
</del><span class="cx">         return (&quot;SerializedScriptValue::create($stateReference, $value)&quot;, 1);
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if ($type-&gt;name eq &quot;Dictionary&quot;) {
</span><del>-        AddToImplIncludes(&quot;Dictionary.h&quot;, $conditional);
</del><span class="cx">         return (&quot;Dictionary($statePointer, $value)&quot;, 0);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    AddToImplIncludesForIDLType($type, $conditional);
</del><ins>+    if ($codeGenerator-&gt;IsEnumType($type)) {
+        return (&quot;parseEnumeration&lt;&quot; . GetEnumerationClassName($type, $interface) . &quot;&gt;($stateReference, $value)&quot;, 1);
+    }
</ins><span class="cx"> 
</span><del>-    return (&quot;toUnshared@{[$type-&gt;name]}($value)&quot;, 1) if $codeGenerator-&gt;IsTypedArrayType($type);
-    return (&quot;parseEnumeration&lt;&quot; . GetEnumerationClassName($type, $interface) . &quot;&gt;($stateReference, $value)&quot;, 1) if $codeGenerator-&gt;IsEnumType($type);
-
</del><span class="cx">     # FIXME: EventListener should be a callback interface.
</span><del>-    return &quot;JSEventListener::create($value, $thisObjectReference, false, currentWorld($statePointer))&quot; if $type-&gt;name eq &quot;EventListener&quot;;
</del><ins>+    if ($type-&gt;name eq &quot;EventListener&quot;) {
+        return (&quot;JSEventListener::create($value, $thisObjectReference, false, currentWorld($statePointer))&quot;, 0);
+    }
</ins><span class="cx"> 
</span><del>-    my $extendedAttributes = $codeGenerator-&gt;GetInterfaceExtendedAttributesFromName($type-&gt;name);
-    return (&quot;JS&quot; . $type-&gt;name . &quot;::toWrapped($stateReference, $value)&quot;, 1) if $type-&gt;name eq &quot;XPathNSResolver&quot;;
-    return (&quot;JS&quot; . $type-&gt;name . &quot;::toWrapped($value)&quot;, 0);
-}
</del><ins>+    # FIXME: XPathNSResolver should be a callback interface.
+    if ($type-&gt;name eq &quot;XPathNSResolver&quot;) {
+        return (&quot;JSXPathNSResolver::toWrapped($stateReference, $value)&quot;, 1);
+    }
</ins><span class="cx"> 
</span><del>-sub NativeToJSValueIsHandledByDOMConvert
-{
-    my ($type) = @_;
-    
-    return 1 if $type-&gt;name eq &quot;any&quot;;
-    return 1 if $type-&gt;name eq &quot;boolean&quot;;
-    return 1 if $type-&gt;name eq &quot;Date&quot;;
-    return 1 if $codeGenerator-&gt;IsIntegerType($type);
-    return 1 if $codeGenerator-&gt;IsFloatingPointType($type);
-    return 1 if $codeGenerator-&gt;IsStringType($type);
-    return 1 if $codeGenerator-&gt;IsEnumType($type);
-    return 1 if $codeGenerator-&gt;IsSequenceOrFrozenArrayType($type);
-    return 1 if $type-&gt;isUnion;
</del><ins>+    AddToImplIncludes(&quot;JSDOMConvert.h&quot;);
</ins><span class="cx"> 
</span><del>-    return 0;
</del><ins>+    my $IDLType = GetIDLType($interface, $type);
+
+    my @conversionArguments = ();
+    push(@conversionArguments, &quot;$stateReference&quot;);
+    push(@conversionArguments, &quot;$value&quot;);
+    push(@conversionArguments, GetIntegerConversionConfiguration($context)) if $codeGenerator-&gt;IsIntegerType($type);
+    push(@conversionArguments, GetStringConversionConfiguration($context)) if $codeGenerator-&gt;IsStringType($type);
+    push(@conversionArguments, $exceptionThrower) if $exceptionThrower;
+
+    return (&quot;convert&lt;$IDLType&gt;(&quot; . join(&quot;, &quot;, @conversionArguments) . &quot;)&quot;, 1);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> sub NativeToJSValueDOMConvertNeedsState
</span><span class="lines">@@ -5345,6 +5333,8 @@
</span><span class="cx">     return 1 if $codeGenerator-&gt;IsSequenceOrFrozenArrayType($type);
</span><span class="cx">     return 1 if $codeGenerator-&gt;IsStringType($type);
</span><span class="cx">     return 1 if $codeGenerator-&gt;IsEnumType($type);
</span><ins>+    return 1 if $codeGenerator-&gt;IsWrapperType($type);
+    return 1 if $codeGenerator-&gt;IsTypedArrayType($type);
</ins><span class="cx">     return 1 if $type-&gt;name eq &quot;Date&quot;;
</span><span class="cx"> 
</span><span class="cx">     return 0;
</span><span class="lines">@@ -5357,6 +5347,8 @@
</span><span class="cx">     # FIXME: This should actually check if all the sub-objects of the union need the global object.
</span><span class="cx">     return 1 if $type-&gt;isUnion;
</span><span class="cx">     return 1 if $codeGenerator-&gt;IsSequenceOrFrozenArrayType($type);
</span><ins>+    return 1 if $codeGenerator-&gt;IsWrapperType($type);
+    return 1 if $codeGenerator-&gt;IsTypedArrayType($type);
</ins><span class="cx"> 
</span><span class="cx">     return 0;
</span><span class="cx"> }
</span><span class="lines">@@ -5416,72 +5408,63 @@
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (NativeToJSValueIsHandledByDOMConvert($type)) {
-        AddToImplIncludes(&quot;JSDOMConvert.h&quot;);
-        AddToImplIncludesForIDLType($type, $conditional);
</del><ins>+    AddToImplIncludesForIDLType($type, $conditional);
</ins><span class="cx"> 
</span><del>-        my $IDLType = GetIDLType($interface, $type);
</del><span class="cx"> 
</span><del>-        my @conversionArguments = ();
-        push(@conversionArguments, &quot;$stateReference&quot;) if NativeToJSValueDOMConvertNeedsState($type) || $mayThrowException;
-        push(@conversionArguments, &quot;*$globalObject&quot;) if NativeToJSValueDOMConvertNeedsGlobalObject($type);
-        push(@conversionArguments, &quot;throwScope&quot;) if $mayThrowException;
-        push(@conversionArguments, &quot;$value&quot;);
-
-        return &quot;toJS&lt;$IDLType&gt;(&quot; . join(&quot;, &quot;, @conversionArguments) . &quot;)&quot;;
-    }
-
</del><span class="cx">     if ($type-&gt;name eq &quot;SerializedScriptValue&quot;) {
</span><del>-        AddToImplIncludes(&quot;SerializedScriptValue.h&quot;, $conditional);
</del><span class="cx">         return &quot;$value ? $value-&gt;deserialize($stateReference, $globalObject) : jsNull()&quot;;
</span><span class="cx">     }
</span><ins>+    
+    if ($codeGenerator-&gt;IsWrapperType($type) &amp;&amp; !$codeGenerator-&gt;IsSVGAnimatedType($type)) {
+        if ($codeGenerator-&gt;IsSVGAnimatedType($interface-&gt;type) or ($interface-&gt;type-&gt;name eq &quot;SVGViewSpec&quot; and $type-&gt;name eq &quot;SVGTransformList&quot;)) {
+            # Convert from abstract RefPtr&lt;ListProperty&gt; to real type, so the right toJS() method can be invoked.
+            $value = &quot;static_cast&lt;&quot; . GetNativeType($interface, $type) . &quot;&gt;($value.get())&quot;;
+        } elsif ($interface-&gt;type-&gt;name eq &quot;SVGViewSpec&quot;) {
+            # Convert from abstract SVGProperty to real type, so the right toJS() method can be invoked.
+            $value = &quot;static_cast&lt;&quot; . GetNativeType($interface, $type) . &quot;&gt;($value)&quot;;
+        } elsif ($codeGenerator-&gt;IsSVGTypeNeedingTearOff($type) and not $interface-&gt;type-&gt;name =~ /List$/) {
+            my $tearOffType = $codeGenerator-&gt;GetSVGTypeNeedingTearOff($type);
+            if ($codeGenerator-&gt;IsSVGTypeWithWritablePropertiesNeedingTearOff($type) and !$inFunctionCall and not defined $context-&gt;extendedAttributes-&gt;{Immutable}) {
+                my $getter = $value;
+                $getter =~ s/impl\.//;
+                $getter =~ s/impl-&gt;//;
+                $getter =~ s/\(\)//;
+                my $updateMethod = &quot;&amp;&quot; . $interface-&gt;type-&gt;name . &quot;::update&quot; . $codeGenerator-&gt;WK_ucfirst($getter);
</ins><span class="cx"> 
</span><del>-    AddToImplIncludesForIDLType($type, $conditional);
-
-    return $value if $codeGenerator-&gt;IsSVGAnimatedType($type);
-
-    if ($codeGenerator-&gt;IsSVGAnimatedType($interface-&gt;type) or ($interface-&gt;type-&gt;name eq &quot;SVGViewSpec&quot; and $type-&gt;name eq &quot;SVGTransformList&quot;)) {
-        # Convert from abstract RefPtr&lt;ListProperty&gt; to real type, so the right toJS() method can be invoked.
-        $value = &quot;static_cast&lt;&quot; . GetNativeType($interface, $type) . &quot;&gt;($value.get())&quot;;
-    } elsif ($interface-&gt;type-&gt;name eq &quot;SVGViewSpec&quot;) {
-        # Convert from abstract SVGProperty to real type, so the right toJS() method can be invoked.
-        $value = &quot;static_cast&lt;&quot; . GetNativeType($interface, $type) . &quot;&gt;($value)&quot;;
-    } elsif ($codeGenerator-&gt;IsSVGTypeNeedingTearOff($type) and not $interface-&gt;type-&gt;name =~ /List$/) {
-        my $tearOffType = $codeGenerator-&gt;GetSVGTypeNeedingTearOff($type);
-        if ($codeGenerator-&gt;IsSVGTypeWithWritablePropertiesNeedingTearOff($type) and !$inFunctionCall and not defined $context-&gt;extendedAttributes-&gt;{Immutable}) {
-            my $getter = $value;
-            $getter =~ s/impl\.//;
-            $getter =~ s/impl-&gt;//;
-            $getter =~ s/\(\)//;
-            my $updateMethod = &quot;&amp;&quot; . $interface-&gt;type-&gt;name . &quot;::update&quot; . $codeGenerator-&gt;WK_ucfirst($getter);
-
-            my $selfIsTearOffType = $codeGenerator-&gt;IsSVGTypeNeedingTearOff($interface-&gt;type);
-            if ($selfIsTearOffType) {
-                # FIXME: Why SVGMatrix specifically?
-                AddToImplIncludes(&quot;SVGMatrixTearOff.h&quot;, $conditional);
-                $value = &quot;SVGMatrixTearOff::create($wrapped, $value)&quot;;
-            } else {
-                AddToImplIncludes(&quot;SVGStaticPropertyTearOff.h&quot;, $conditional);
-                my $interfaceName = $interface-&gt;type-&gt;name;
-                $tearOffType =~ s/SVGPropertyTearOff&lt;/SVGStaticPropertyTearOff&lt;$interfaceName, /;
-                $value = &quot;${tearOffType}::create(impl, $value, $updateMethod)&quot;;
</del><ins>+                my $selfIsTearOffType = $codeGenerator-&gt;IsSVGTypeNeedingTearOff($interface-&gt;type);
+                if ($selfIsTearOffType) {
+                    # FIXME: Why SVGMatrix specifically?
+                    AddToImplIncludes(&quot;SVGMatrixTearOff.h&quot;, $conditional);
+                    $value = &quot;SVGMatrixTearOff::create($wrapped, $value)&quot;;
+                } else {
+                    AddToImplIncludes(&quot;SVGStaticPropertyTearOff.h&quot;, $conditional);
+                    my $interfaceName = $interface-&gt;type-&gt;name;
+                    $tearOffType =~ s/SVGPropertyTearOff&lt;/SVGStaticPropertyTearOff&lt;$interfaceName, /;
+                    $value = &quot;${tearOffType}::create(impl, $value, $updateMethod)&quot;;
+                }
+            } elsif ($tearOffType =~ /SVGStaticListPropertyTearOff/) {
+                $value = &quot;${tearOffType}::create(impl, $value)&quot;;
+            } elsif (not $tearOffType =~ /SVG(Point|PathSeg)List/) {
+                $value = &quot;${tearOffType}::create($value)&quot;;
</ins><span class="cx">             }
</span><del>-        } elsif ($tearOffType =~ /SVGStaticListPropertyTearOff/) {
-            $value = &quot;${tearOffType}::create(impl, $value)&quot;;
-        } elsif (not $tearOffType =~ /SVG(Point|PathSeg)List/) {
-            $value = &quot;${tearOffType}::create($value)&quot;;
</del><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     $value = &quot;BindingSecurity::checkSecurityForNode($stateReference, $value)&quot; if $context-&gt;extendedAttributes-&gt;{CheckSecurityForNode};
</span><span class="cx"> 
</span><del>-    my $functionName = &quot;toJS&quot;;
-    $functionName = &quot;toJSNewlyCreated&quot; if $context-&gt;extendedAttributes-&gt;{NewObject};
</del><ins>+    AddToImplIncludes(&quot;JSDOMConvert.h&quot;);
</ins><span class="cx"> 
</span><del>-    my $arguments = &quot;$statePointer, $globalObject, $value&quot;;
-    $arguments = &quot;$stateReference, *$globalObject, throwScope, $value&quot; if $mayThrowException;
</del><ins>+    my $IDLType = GetIDLType($interface, $type);
</ins><span class="cx"> 
</span><del>-    return &quot;$functionName($arguments)&quot;;
</del><ins>+    my @conversionArguments = ();
+    push(@conversionArguments, &quot;$stateReference&quot;) if NativeToJSValueDOMConvertNeedsState($type) || $mayThrowException;
+    push(@conversionArguments, &quot;*$globalObject&quot;) if NativeToJSValueDOMConvertNeedsGlobalObject($type);
+    push(@conversionArguments, &quot;throwScope&quot;) if $mayThrowException;
+    push(@conversionArguments, &quot;$value&quot;);
+
+    my $functionName = $context-&gt;extendedAttributes-&gt;{NewObject} ? &quot;toJSNewlyCreated&quot; : &quot;toJS&quot;;
+
+    return &quot;${functionName}&lt;${IDLType}&gt;(&quot; . join(&quot;, &quot;, @conversionArguments) . &quot;)&quot;;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> sub ceilingToPowerOf2
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestActiveDOMObjectcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestActiveDOMObject.cpp (208307 => 208308)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestActiveDOMObject.cpp        2016-11-02 22:12:19 UTC (rev 208307)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestActiveDOMObject.cpp        2016-11-02 22:15:14 UTC (rev 208308)
</span><span class="lines">@@ -214,9 +214,8 @@
</span><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     if (UNLIKELY(state-&gt;argumentCount() &lt; 1))
</span><span class="cx">         return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
</span><del>-    auto nextChild = JSNode::toWrapped(state-&gt;uncheckedArgument(0));
-    if (UNLIKELY(!nextChild))
-        return throwArgumentTypeError(*state, throwScope, 0, &quot;nextChild&quot;, &quot;TestActiveDOMObject&quot;, &quot;excitingFunction&quot;, &quot;Node&quot;);
</del><ins>+    auto nextChild = convert&lt;IDLInterface&lt;Node&gt;&gt;(*state, state-&gt;uncheckedArgument(0), [](JSC::ExecState&amp; state, JSC::ThrowScope&amp; scope) { throwArgumentTypeError(state, scope, 0, &quot;nextChild&quot;, &quot;TestActiveDOMObject&quot;, &quot;excitingFunction&quot;, &quot;Node&quot;); });
+    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</ins><span class="cx">     impl.excitingFunction(*nextChild);
</span><span class="cx">     return JSValue::encode(jsUndefined());
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestCEReactionscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCEReactions.cpp (208307 => 208308)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCEReactions.cpp        2016-11-02 22:12:19 UTC (rev 208307)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCEReactions.cpp        2016-11-02 22:15:14 UTC (rev 208308)
</span><span class="lines">@@ -189,7 +189,7 @@
</span><span class="cx">     UNUSED_PARAM(throwScope);
</span><span class="cx">     UNUSED_PARAM(state);
</span><span class="cx">     auto&amp; impl = thisObject.wrapped();
</span><del>-    JSValue result = toJS(&amp;state, thisObject.globalObject(), impl.stringifierAttribute());
</del><ins>+    JSValue result = toJS&lt;IDLInterface&lt;TestCEReactionsStringifier&gt;&gt;(state, *thisObject.globalObject(), impl.stringifierAttribute());
</ins><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestCallbackcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallback.cpp (208307 => 208308)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallback.cpp        2016-11-02 22:12:19 UTC (rev 208307)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallback.cpp        2016-11-02 22:15:14 UTC (rev 208308)
</span><span class="lines">@@ -125,7 +125,7 @@
</span><span class="cx"> 
</span><span class="cx">     ExecState* state = m_data-&gt;globalObject()-&gt;globalExec();
</span><span class="cx">     MarkedArgumentBuffer args;
</span><del>-    args.append(toJS(state, m_data-&gt;globalObject(), arrayParam));
</del><ins>+    args.append(toJS&lt;IDLInterface&lt;Float32Array&gt;&gt;(*state, *m_data-&gt;globalObject(), arrayParam));
</ins><span class="cx"> 
</span><span class="cx">     NakedPtr&lt;JSC::Exception&gt; returnedException;
</span><span class="cx">     m_data-&gt;invokeCallback(args, JSCallbackData::CallbackType::Object, Identifier::fromString(state, &quot;callbackWithArrayParam&quot;), returnedException);
</span><span class="lines">@@ -166,7 +166,7 @@
</span><span class="cx"> 
</span><span class="cx">     ExecState* state = m_data-&gt;globalObject()-&gt;globalExec();
</span><span class="cx">     MarkedArgumentBuffer args;
</span><del>-    args.append(toJS(state, m_data-&gt;globalObject(), listParam));
</del><ins>+    args.append(toJS&lt;IDLInterface&lt;DOMStringList&gt;&gt;(*state, *m_data-&gt;globalObject(), listParam));
</ins><span class="cx"> 
</span><span class="cx">     NakedPtr&lt;JSC::Exception&gt; returnedException;
</span><span class="cx">     m_data-&gt;invokeCallback(args, JSCallbackData::CallbackType::Object, Identifier::fromString(state, &quot;callbackWithStringList&quot;), returnedException);
</span><span class="lines">@@ -207,7 +207,7 @@
</span><span class="cx">     ExecState* state = m_data-&gt;globalObject()-&gt;globalExec();
</span><span class="cx">     MarkedArgumentBuffer args;
</span><span class="cx">     args.append(toJS&lt;IDLLong&gt;(longParam));
</span><del>-    args.append(toJS(state, m_data-&gt;globalObject(), testNodeParam));
</del><ins>+    args.append(toJS&lt;IDLInterface&lt;TestNode&gt;&gt;(*state, *m_data-&gt;globalObject(), testNodeParam));
</ins><span class="cx"> 
</span><span class="cx">     NakedPtr&lt;JSC::Exception&gt; returnedException;
</span><span class="cx">     m_data-&gt;invokeCallback(args, JSCallbackData::CallbackType::Object, Identifier::fromString(state, &quot;callbackRequiresThisToPass&quot;), returnedException);
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestCallbackFunctioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunction.cpp (208307 => 208308)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunction.cpp        2016-11-02 22:12:19 UTC (rev 208307)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunction.cpp        2016-11-02 22:15:14 UTC (rev 208308)
</span><span class="lines">@@ -90,7 +90,7 @@
</span><span class="cx"> 
</span><span class="cx">     ExecState* state = m_data-&gt;globalObject()-&gt;globalExec();
</span><span class="cx">     MarkedArgumentBuffer args;
</span><del>-    args.append(toJS(state, m_data-&gt;globalObject(), arrayParam));
</del><ins>+    args.append(toJS&lt;IDLInterface&lt;Float32Array&gt;&gt;(*state, *m_data-&gt;globalObject(), arrayParam));
</ins><span class="cx"> 
</span><span class="cx">     NakedPtr&lt;JSC::Exception&gt; returnedException;
</span><span class="cx">     UNUSED_PARAM(state);
</span><span class="lines">@@ -133,7 +133,7 @@
</span><span class="cx"> 
</span><span class="cx">     ExecState* state = m_data-&gt;globalObject()-&gt;globalExec();
</span><span class="cx">     MarkedArgumentBuffer args;
</span><del>-    args.append(toJS(state, m_data-&gt;globalObject(), listParam));
</del><ins>+    args.append(toJS&lt;IDLInterface&lt;DOMStringList&gt;&gt;(*state, *m_data-&gt;globalObject(), listParam));
</ins><span class="cx"> 
</span><span class="cx">     NakedPtr&lt;JSC::Exception&gt; returnedException;
</span><span class="cx">     UNUSED_PARAM(state);
</span><span class="lines">@@ -176,7 +176,7 @@
</span><span class="cx">     ExecState* state = m_data-&gt;globalObject()-&gt;globalExec();
</span><span class="cx">     MarkedArgumentBuffer args;
</span><span class="cx">     args.append(toJS&lt;IDLLong&gt;(longParam));
</span><del>-    args.append(toJS(state, m_data-&gt;globalObject(), testNodeParam));
</del><ins>+    args.append(toJS&lt;IDLInterface&lt;TestNode&gt;&gt;(*state, *m_data-&gt;globalObject(), testNodeParam));
</ins><span class="cx"> 
</span><span class="cx">     NakedPtr&lt;JSC::Exception&gt; returnedException;
</span><span class="cx">     UNUSED_PARAM(state);
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestDOMJITcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestDOMJIT.cpp (208307 => 208308)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestDOMJIT.cpp        2016-11-02 22:12:19 UTC (rev 208307)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestDOMJIT.cpp        2016-11-02 22:15:14 UTC (rev 208308)
</span><span class="lines">@@ -602,7 +602,7 @@
</span><span class="cx">     UNUSED_PARAM(throwScope);
</span><span class="cx">     UNUSED_PARAM(state);
</span><span class="cx">     auto&amp; impl = thisObject.wrapped();
</span><del>-    JSValue result = toJS(&amp;state, thisObject.globalObject(), impl.byteStringAttr());
</del><ins>+    JSValue result = toJS&lt;IDLByteString&gt;(state, *thisObject.globalObject(), impl.byteStringAttr());
</ins><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -656,7 +656,7 @@
</span><span class="cx">     UNUSED_PARAM(throwScope);
</span><span class="cx">     UNUSED_PARAM(state);
</span><span class="cx">     auto&amp; impl = thisObject.wrapped();
</span><del>-    JSValue result = toJS(&amp;state, thisObject.globalObject(), impl.nodeAttr());
</del><ins>+    JSValue result = toJS&lt;IDLInterface&lt;Node&gt;&gt;(state, *thisObject.globalObject(), impl.nodeAttr());
</ins><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -1061,7 +1061,7 @@
</span><span class="cx">     UNUSED_PARAM(throwScope);
</span><span class="cx">     UNUSED_PARAM(state);
</span><span class="cx">     auto&amp; impl = thisObject.wrapped();
</span><del>-    JSValue result = toJS(&amp;state, thisObject.globalObject(), impl.byteStringNullableAttr());
</del><ins>+    JSValue result = toJS&lt;IDLNullable&lt;IDLByteString&gt;&gt;(state, *thisObject.globalObject(), impl.byteStringNullableAttr());
</ins><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -1115,7 +1115,7 @@
</span><span class="cx">     UNUSED_PARAM(throwScope);
</span><span class="cx">     UNUSED_PARAM(state);
</span><span class="cx">     auto&amp; impl = thisObject.wrapped();
</span><del>-    JSValue result = toJS(&amp;state, thisObject.globalObject(), impl.nodeNullableAttr());
</del><ins>+    JSValue result = toJS&lt;IDLNullable&lt;IDLInterface&lt;Node&gt;&gt;&gt;(state, *thisObject.globalObject(), impl.nodeNullableAttr());
</ins><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestEventTargetcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.cpp (208307 => 208308)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.cpp        2016-11-02 22:12:19 UTC (rev 208307)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.cpp        2016-11-02 22:15:14 UTC (rev 208308)
</span><span class="lines">@@ -220,7 +220,7 @@
</span><span class="cx">         return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
</span><span class="cx">     auto index = convert&lt;IDLUnsignedLong&gt;(*state, state-&gt;uncheckedArgument(0), IntegerConversionConfiguration::Normal);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</span><del>-    JSValue result = toJS(state, castedThis-&gt;globalObject(), impl.item(WTFMove(index)));
</del><ins>+    JSValue result = toJS&lt;IDLInterface&lt;Node&gt;&gt;(*state, *castedThis-&gt;globalObject(), impl.item(WTFMove(index)));
</ins><span class="cx">     return JSValue::encode(result);
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestInterfacecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp (208307 => 208308)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp        2016-11-02 22:12:19 UTC (rev 208307)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp        2016-11-02 22:15:14 UTC (rev 208308)
</span><span class="lines">@@ -511,7 +511,7 @@
</span><span class="cx">     UNUSED_PARAM(throwScope);
</span><span class="cx">     UNUSED_PARAM(state);
</span><span class="cx">     auto&amp; impl = thisObject.wrapped();
</span><del>-    JSValue result = toJS(&amp;state, thisObject.globalObject(), impl.implementsNode());
</del><ins>+    JSValue result = toJS&lt;IDLInterface&lt;Node&gt;&gt;(state, *thisObject.globalObject(), impl.implementsNode());
</ins><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -621,7 +621,7 @@
</span><span class="cx">     UNUSED_PARAM(throwScope);
</span><span class="cx">     UNUSED_PARAM(state);
</span><span class="cx">     auto&amp; impl = thisObject.wrapped();
</span><del>-    JSValue result = toJS(&amp;state, thisObject.globalObject(), WebCore::TestSupplemental::supplementalNode(impl));
</del><ins>+    JSValue result = toJS&lt;IDLInterface&lt;Node&gt;&gt;(state, *thisObject.globalObject(), WebCore::TestSupplemental::supplementalNode(impl));
</ins><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -740,11 +740,8 @@
</span><span class="cx">     UNUSED_PARAM(state);
</span><span class="cx">     UNUSED_PARAM(throwScope);
</span><span class="cx">     auto&amp; impl = thisObject.wrapped();
</span><del>-    auto nativeValue = JSNode::toWrapped(value);
-    if (UNLIKELY(!nativeValue)) {
-        throwAttributeTypeError(state, throwScope, &quot;TestInterface&quot;, &quot;implementsNode&quot;, &quot;Node&quot;);
-        return false;
-    }
</del><ins>+    auto nativeValue = convert&lt;IDLInterface&lt;Node&gt;&gt;(state, value, [](JSC::ExecState&amp; state, JSC::ThrowScope&amp; scope) { throwAttributeTypeError(state, scope, &quot;TestInterface&quot;, &quot;implementsNode&quot;, &quot;Node&quot;); });
+    RETURN_IF_EXCEPTION(throwScope, false);
</ins><span class="cx">     impl.setImplementsNode(*nativeValue);
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="lines">@@ -818,11 +815,8 @@
</span><span class="cx">     UNUSED_PARAM(state);
</span><span class="cx">     UNUSED_PARAM(throwScope);
</span><span class="cx">     auto&amp; impl = thisObject.wrapped();
</span><del>-    auto nativeValue = JSNode::toWrapped(value);
-    if (UNLIKELY(!nativeValue)) {
-        throwAttributeTypeError(state, throwScope, &quot;TestInterface&quot;, &quot;supplementalNode&quot;, &quot;Node&quot;);
-        return false;
-    }
</del><ins>+    auto nativeValue = convert&lt;IDLInterface&lt;Node&gt;&gt;(state, value, [](JSC::ExecState&amp; state, JSC::ThrowScope&amp; scope) { throwAttributeTypeError(state, scope, &quot;TestInterface&quot;, &quot;supplementalNode&quot;, &quot;Node&quot;); });
+    RETURN_IF_EXCEPTION(throwScope, false);
</ins><span class="cx">     WebCore::TestSupplemental::setSupplementalNode(impl, *nativeValue);
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="lines">@@ -874,10 +868,9 @@
</span><span class="cx">         return JSValue::encode(jsUndefined());
</span><span class="cx">     auto strArg = convert&lt;IDLDOMString&gt;(*state, state-&gt;uncheckedArgument(0), StringConversionConfiguration::Normal);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</span><del>-    auto objArg = JSTestObj::toWrapped(state-&gt;uncheckedArgument(1));
-    if (UNLIKELY(!objArg))
-        return throwArgumentTypeError(*state, throwScope, 1, &quot;objArg&quot;, &quot;TestInterface&quot;, &quot;implementsMethod2&quot;, &quot;TestObj&quot;);
-    JSValue result = toJS(state, castedThis-&gt;globalObject(), impl.implementsMethod2(*context, WTFMove(strArg), *objArg, ec));
</del><ins>+    auto objArg = convert&lt;IDLInterface&lt;TestObj&gt;&gt;(*state, state-&gt;uncheckedArgument(1), [](JSC::ExecState&amp; state, JSC::ThrowScope&amp; scope) { throwArgumentTypeError(state, scope, 1, &quot;objArg&quot;, &quot;TestInterface&quot;, &quot;implementsMethod2&quot;, &quot;TestObj&quot;); });
+    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
+    JSValue result = toJS&lt;IDLInterface&lt;TestObj&gt;&gt;(*state, *castedThis-&gt;globalObject(), impl.implementsMethod2(*context, WTFMove(strArg), *objArg, ec));
</ins><span class="cx"> 
</span><span class="cx">     setDOMException(state, throwScope, ec);
</span><span class="cx">     return JSValue::encode(result);
</span><span class="lines">@@ -954,10 +947,9 @@
</span><span class="cx">         return JSValue::encode(jsUndefined());
</span><span class="cx">     auto strArg = convert&lt;IDLDOMString&gt;(*state, state-&gt;uncheckedArgument(0), StringConversionConfiguration::Normal);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</span><del>-    auto objArg = JSTestObj::toWrapped(state-&gt;uncheckedArgument(1));
-    if (UNLIKELY(!objArg))
-        return throwArgumentTypeError(*state, throwScope, 1, &quot;objArg&quot;, &quot;TestInterface&quot;, &quot;supplementalMethod2&quot;, &quot;TestObj&quot;);
-    JSValue result = toJS(state, castedThis-&gt;globalObject(), WebCore::TestSupplemental::supplementalMethod2(impl, *context, WTFMove(strArg), *objArg, ec));
</del><ins>+    auto objArg = convert&lt;IDLInterface&lt;TestObj&gt;&gt;(*state, state-&gt;uncheckedArgument(1), [](JSC::ExecState&amp; state, JSC::ThrowScope&amp; scope) { throwArgumentTypeError(state, scope, 1, &quot;objArg&quot;, &quot;TestInterface&quot;, &quot;supplementalMethod2&quot;, &quot;TestObj&quot;); });
+    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
+    JSValue result = toJS&lt;IDLInterface&lt;TestObj&gt;&gt;(*state, *castedThis-&gt;globalObject(), WebCore::TestSupplemental::supplementalMethod2(impl, *context, WTFMove(strArg), *objArg, ec));
</ins><span class="cx"> 
</span><span class="cx">     setDOMException(state, throwScope, ec);
</span><span class="cx">     return JSValue::encode(result);
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestObjcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (208307 => 208308)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp        2016-11-02 22:12:19 UTC (rev 208307)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp        2016-11-02 22:15:14 UTC (rev 208308)
</span><span class="lines">@@ -1859,7 +1859,7 @@
</span><span class="cx">     UNUSED_PARAM(throwScope);
</span><span class="cx">     UNUSED_PARAM(state);
</span><span class="cx">     auto&amp; impl = thisObject.wrapped();
</span><del>-    JSValue result = toJS(&amp;state, thisObject.globalObject(), impl.readOnlyTestObjAttr());
</del><ins>+    JSValue result = toJS&lt;IDLInterface&lt;TestObj&gt;&gt;(state, *thisObject.globalObject(), impl.readOnlyTestObjAttr());
</ins><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -2130,7 +2130,7 @@
</span><span class="cx">     UNUSED_PARAM(throwScope);
</span><span class="cx">     UNUSED_PARAM(state);
</span><span class="cx">     auto&amp; impl = thisObject.wrapped();
</span><del>-    JSValue result = toJS(&amp;state, thisObject.globalObject(), impl.testObjAttr());
</del><ins>+    JSValue result = toJS&lt;IDLInterface&lt;TestObj&gt;&gt;(state, *thisObject.globalObject(), impl.testObjAttr());
</ins><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -2146,7 +2146,7 @@
</span><span class="cx">     UNUSED_PARAM(throwScope);
</span><span class="cx">     UNUSED_PARAM(state);
</span><span class="cx">     auto&amp; impl = thisObject.wrapped();
</span><del>-    JSValue result = toJS(&amp;state, thisObject.globalObject(), impl.testNullableObjAttr());
</del><ins>+    JSValue result = toJS&lt;IDLNullable&lt;IDLInterface&lt;TestObj&gt;&gt;&gt;(state, *thisObject.globalObject(), impl.testNullableObjAttr());
</ins><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -2162,7 +2162,7 @@
</span><span class="cx">     UNUSED_PARAM(throwScope);
</span><span class="cx">     UNUSED_PARAM(state);
</span><span class="cx">     auto&amp; impl = thisObject.wrapped();
</span><del>-    JSValue result = toJS(&amp;state, thisObject.globalObject(), impl.lenientTestObjAttr());
</del><ins>+    JSValue result = toJS&lt;IDLInterface&lt;TestObj&gt;&gt;(state, *thisObject.globalObject(), impl.lenientTestObjAttr());
</ins><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -2242,7 +2242,7 @@
</span><span class="cx">     UNUSED_PARAM(throwScope);
</span><span class="cx">     UNUSED_PARAM(state);
</span><span class="cx">     auto&amp; impl = thisObject.wrapped();
</span><del>-    JSValue result = toJS(&amp;state, thisObject.globalObject(), impl.xmlObjAttr());
</del><ins>+    JSValue result = toJS&lt;IDLInterface&lt;TestObj&gt;&gt;(state, *thisObject.globalObject(), impl.xmlObjAttr());
</ins><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -2469,7 +2469,7 @@
</span><span class="cx">     UNUSED_PARAM(throwScope);
</span><span class="cx">     UNUSED_PARAM(state);
</span><span class="cx">     auto&amp; impl = thisObject.wrapped();
</span><del>-    JSValue result = toJS(&amp;state, thisObject.globalObject(), impl.typedArrayAttr());
</del><ins>+    JSValue result = toJS&lt;IDLInterface&lt;Float32Array&gt;&gt;(state, *thisObject.globalObject(), impl.typedArrayAttr());
</ins><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -2662,7 +2662,7 @@
</span><span class="cx">     if (!context)
</span><span class="cx">         return jsUndefined();
</span><span class="cx">     auto&amp; impl = thisObject.wrapped();
</span><del>-    JSValue result = toJS(&amp;state, thisObject.globalObject(), impl.withScriptExecutionContextAttribute(*context));
</del><ins>+    JSValue result = toJS&lt;IDLInterface&lt;TestObj&gt;&gt;(state, *thisObject.globalObject(), impl.withScriptExecutionContextAttribute(*context));
</ins><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -2679,7 +2679,7 @@
</span><span class="cx">     UNUSED_PARAM(state);
</span><span class="cx">     ExceptionCode ec = 0;
</span><span class="cx">     auto&amp; impl = thisObject.wrapped();
</span><del>-    JSValue result = toJS(&amp;state, thisObject.globalObject(), impl.withScriptStateAttributeRaises(state, ec));
</del><ins>+    JSValue result = toJS&lt;IDLInterface&lt;TestObj&gt;&gt;(state, *thisObject.globalObject(), impl.withScriptStateAttributeRaises(state, ec));
</ins><span class="cx">     setDOMException(&amp;state, throwScope, ec);
</span><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="lines">@@ -2700,7 +2700,7 @@
</span><span class="cx">     if (!context)
</span><span class="cx">         return jsUndefined();
</span><span class="cx">     auto&amp; impl = thisObject.wrapped();
</span><del>-    JSValue result = toJS(&amp;state, thisObject.globalObject(), impl.withScriptExecutionContextAttributeRaises(*context, ec));
</del><ins>+    JSValue result = toJS&lt;IDLInterface&lt;TestObj&gt;&gt;(state, *thisObject.globalObject(), impl.withScriptExecutionContextAttributeRaises(*context, ec));
</ins><span class="cx">     setDOMException(&amp;state, throwScope, ec);
</span><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="lines">@@ -2720,7 +2720,7 @@
</span><span class="cx">     if (!context)
</span><span class="cx">         return jsUndefined();
</span><span class="cx">     auto&amp; impl = thisObject.wrapped();
</span><del>-    JSValue result = toJS(&amp;state, thisObject.globalObject(), impl.withScriptExecutionContextAndScriptStateAttribute(state, *context));
</del><ins>+    JSValue result = toJS&lt;IDLInterface&lt;TestObj&gt;&gt;(state, *thisObject.globalObject(), impl.withScriptExecutionContextAndScriptStateAttribute(state, *context));
</ins><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -2740,7 +2740,7 @@
</span><span class="cx">     if (!context)
</span><span class="cx">         return jsUndefined();
</span><span class="cx">     auto&amp; impl = thisObject.wrapped();
</span><del>-    JSValue result = toJS(&amp;state, thisObject.globalObject(), impl.withScriptExecutionContextAndScriptStateAttributeRaises(state, *context, ec));
</del><ins>+    JSValue result = toJS&lt;IDLInterface&lt;TestObj&gt;&gt;(state, *thisObject.globalObject(), impl.withScriptExecutionContextAndScriptStateAttributeRaises(state, *context, ec));
</ins><span class="cx">     setDOMException(&amp;state, throwScope, ec);
</span><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="lines">@@ -2760,7 +2760,7 @@
</span><span class="cx">     if (!context)
</span><span class="cx">         return jsUndefined();
</span><span class="cx">     auto&amp; impl = thisObject.wrapped();
</span><del>-    JSValue result = toJS(&amp;state, thisObject.globalObject(), impl.withScriptExecutionContextAndScriptStateWithSpacesAttribute(state, *context));
</del><ins>+    JSValue result = toJS&lt;IDLInterface&lt;TestObj&gt;&gt;(state, *thisObject.globalObject(), impl.withScriptExecutionContextAndScriptStateWithSpacesAttribute(state, *context));
</ins><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -2776,7 +2776,7 @@
</span><span class="cx">     UNUSED_PARAM(throwScope);
</span><span class="cx">     UNUSED_PARAM(state);
</span><span class="cx">     auto&amp; impl = thisObject.wrapped();
</span><del>-    JSValue result = toJS(&amp;state, thisObject.globalObject(), impl.withScriptArgumentsAndCallStackAttribute());
</del><ins>+    JSValue result = toJS&lt;IDLInterface&lt;TestObj&gt;&gt;(state, *thisObject.globalObject(), impl.withScriptArgumentsAndCallStackAttribute());
</ins><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -2954,7 +2954,7 @@
</span><span class="cx">     UNUSED_PARAM(throwScope);
</span><span class="cx">     UNUSED_PARAM(state);
</span><span class="cx">     auto&amp; impl = thisObject.wrapped();
</span><del>-    JSValue result = toJS(&amp;state, thisObject.globalObject(), BindingSecurity::checkSecurityForNode(state, impl.contentDocument()));
</del><ins>+    JSValue result = toJS&lt;IDLInterface&lt;Document&gt;&gt;(state, *thisObject.globalObject(), BindingSecurity::checkSecurityForNode(state, impl.contentDocument()));
</ins><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -2970,7 +2970,7 @@
</span><span class="cx">     UNUSED_PARAM(throwScope);
</span><span class="cx">     UNUSED_PARAM(state);
</span><span class="cx">     auto&amp; impl = thisObject.wrapped();
</span><del>-    JSValue result = toJS(&amp;state, thisObject.globalObject(), SVGStaticPropertyTearOff&lt;TestObj, SVGPoint&gt;::create(impl, impl.mutablePoint(), &amp;TestObj::updateMutablePoint));
</del><ins>+    JSValue result = toJS&lt;IDLInterface&lt;SVGPropertyTearOff&lt;SVGPoint&gt;&gt;&gt;(state, *thisObject.globalObject(), SVGStaticPropertyTearOff&lt;TestObj, SVGPoint&gt;::create(impl, impl.mutablePoint(), &amp;TestObj::updateMutablePoint));
</ins><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -2986,7 +2986,7 @@
</span><span class="cx">     UNUSED_PARAM(throwScope);
</span><span class="cx">     UNUSED_PARAM(state);
</span><span class="cx">     auto&amp; impl = thisObject.wrapped();
</span><del>-    JSValue result = toJS(&amp;state, thisObject.globalObject(), SVGPropertyTearOff&lt;SVGPoint&gt;::create(impl.immutablePoint()));
</del><ins>+    JSValue result = toJS&lt;IDLInterface&lt;SVGPropertyTearOff&lt;SVGPoint&gt;&gt;&gt;(state, *thisObject.globalObject(), SVGPropertyTearOff&lt;SVGPoint&gt;::create(impl.immutablePoint()));
</ins><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -3244,7 +3244,7 @@
</span><span class="cx">     UNUSED_PARAM(throwScope);
</span><span class="cx">     UNUSED_PARAM(state);
</span><span class="cx">     auto&amp; impl = thisObject.wrapped();
</span><del>-    JSValue result = toJS(&amp;state, thisObject.globalObject(), impl.testReadOnlyPromiseAttribute());
</del><ins>+    JSValue result = toJS&lt;IDLInterface&lt;Promise&gt;&gt;(state, *thisObject.globalObject(), impl.testReadOnlyPromiseAttribute());
</ins><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -3260,7 +3260,7 @@
</span><span class="cx">     UNUSED_PARAM(throwScope);
</span><span class="cx">     UNUSED_PARAM(state);
</span><span class="cx">     auto&amp; impl = thisObject.wrapped();
</span><del>-    JSValue result = toJS(&amp;state, thisObject.globalObject(), impl.putForwardsAttribute());
</del><ins>+    JSValue result = toJS&lt;IDLInterface&lt;TestNode&gt;&gt;(state, *thisObject.globalObject(), impl.putForwardsAttribute());
</ins><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -3276,7 +3276,7 @@
</span><span class="cx">     UNUSED_PARAM(throwScope);
</span><span class="cx">     UNUSED_PARAM(state);
</span><span class="cx">     auto&amp; impl = thisObject.wrapped();
</span><del>-    JSValue result = toJS(&amp;state, thisObject.globalObject(), impl.putForwardsNullableAttribute());
</del><ins>+    JSValue result = toJS&lt;IDLNullable&lt;IDLInterface&lt;TestNode&gt;&gt;&gt;(state, *thisObject.globalObject(), impl.putForwardsNullableAttribute());
</ins><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -3591,11 +3591,8 @@
</span><span class="cx">     UNUSED_PARAM(state);
</span><span class="cx">     UNUSED_PARAM(throwScope);
</span><span class="cx">     auto&amp; impl = thisObject.wrapped();
</span><del>-    auto nativeValue = JSTestObj::toWrapped(value);
-    if (UNLIKELY(!nativeValue)) {
-        throwAttributeTypeError(state, throwScope, &quot;TestObject&quot;, &quot;testObjAttr&quot;, &quot;TestObj&quot;);
-        return false;
-    }
</del><ins>+    auto nativeValue = convert&lt;IDLInterface&lt;TestObj&gt;&gt;(state, value, [](JSC::ExecState&amp; state, JSC::ThrowScope&amp; scope) { throwAttributeTypeError(state, scope, &quot;TestObject&quot;, &quot;testObjAttr&quot;, &quot;TestObj&quot;); });
+    RETURN_IF_EXCEPTION(throwScope, false);
</ins><span class="cx">     impl.setTestObjAttr(*nativeValue);
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="lines">@@ -3613,14 +3610,8 @@
</span><span class="cx">     UNUSED_PARAM(state);
</span><span class="cx">     UNUSED_PARAM(throwScope);
</span><span class="cx">     auto&amp; impl = thisObject.wrapped();
</span><del>-    TestObj* nativeValue = nullptr;
-    if (!value.isUndefinedOrNull()) {
-        nativeValue = JSTestObj::toWrapped(value);
-        if (UNLIKELY(!nativeValue)) {
-            throwAttributeTypeError(state, throwScope, &quot;TestObject&quot;, &quot;testNullableObjAttr&quot;, &quot;TestObj&quot;);
-            return false;
-        }
-    }
</del><ins>+    auto nativeValue = convert&lt;IDLNullable&lt;IDLInterface&lt;TestObj&gt;&gt;&gt;(state, value, [](JSC::ExecState&amp; state, JSC::ThrowScope&amp; scope) { throwAttributeTypeError(state, scope, &quot;TestObject&quot;, &quot;testNullableObjAttr&quot;, &quot;TestObj&quot;); });
+    RETURN_IF_EXCEPTION(throwScope, false);
</ins><span class="cx">     impl.setTestNullableObjAttr(WTFMove(nativeValue));
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="lines">@@ -3638,11 +3629,8 @@
</span><span class="cx">     UNUSED_PARAM(state);
</span><span class="cx">     UNUSED_PARAM(throwScope);
</span><span class="cx">     auto&amp; impl = thisObject.wrapped();
</span><del>-    auto nativeValue = JSTestObj::toWrapped(value);
-    if (UNLIKELY(!nativeValue)) {
-        throwAttributeTypeError(state, throwScope, &quot;TestObject&quot;, &quot;lenientTestObjAttr&quot;, &quot;TestObj&quot;);
-        return false;
-    }
</del><ins>+    auto nativeValue = convert&lt;IDLInterface&lt;TestObj&gt;&gt;(state, value, [](JSC::ExecState&amp; state, JSC::ThrowScope&amp; scope) { throwAttributeTypeError(state, scope, &quot;TestObject&quot;, &quot;lenientTestObjAttr&quot;, &quot;TestObj&quot;); });
+    RETURN_IF_EXCEPTION(throwScope, false);
</ins><span class="cx">     impl.setLenientTestObjAttr(*nativeValue);
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="lines">@@ -3719,11 +3707,8 @@
</span><span class="cx">     UNUSED_PARAM(state);
</span><span class="cx">     UNUSED_PARAM(throwScope);
</span><span class="cx">     auto&amp; impl = thisObject.wrapped();
</span><del>-    auto nativeValue = JSTestObj::toWrapped(value);
-    if (UNLIKELY(!nativeValue)) {
-        throwAttributeTypeError(state, throwScope, &quot;TestObject&quot;, &quot;XMLObjAttr&quot;, &quot;TestObj&quot;);
-        return false;
-    }
</del><ins>+    auto nativeValue = convert&lt;IDLInterface&lt;TestObj&gt;&gt;(state, value, [](JSC::ExecState&amp; state, JSC::ThrowScope&amp; scope) { throwAttributeTypeError(state, scope, &quot;TestObject&quot;, &quot;XMLObjAttr&quot;, &quot;TestObj&quot;); });
+    RETURN_IF_EXCEPTION(throwScope, false);
</ins><span class="cx">     impl.setXMLObjAttr(*nativeValue);
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="lines">@@ -3990,12 +3975,8 @@
</span><span class="cx">     UNUSED_PARAM(state);
</span><span class="cx">     UNUSED_PARAM(throwScope);
</span><span class="cx">     auto&amp; impl = thisObject.wrapped();
</span><del>-    auto nativeValue = toUnsharedFloat32Array(value);
</del><ins>+    auto nativeValue = convert&lt;IDLInterface&lt;Float32Array&gt;&gt;(state, value, [](JSC::ExecState&amp; state, JSC::ThrowScope&amp; scope) { throwAttributeTypeError(state, scope, &quot;TestObject&quot;, &quot;typedArrayAttr&quot;, &quot;Float32Array&quot;); });
</ins><span class="cx">     RETURN_IF_EXCEPTION(throwScope, false);
</span><del>-    if (UNLIKELY(!nativeValue)) {
-        throwAttributeTypeError(state, throwScope, &quot;TestObject&quot;, &quot;typedArrayAttr&quot;, &quot;Float32Array&quot;);
-        return false;
-    }
</del><span class="cx">     impl.setTypedArrayAttr(nativeValue.get());
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="lines">@@ -4217,11 +4198,8 @@
</span><span class="cx">     UNUSED_PARAM(state);
</span><span class="cx">     UNUSED_PARAM(throwScope);
</span><span class="cx">     auto&amp; impl = thisObject.wrapped();
</span><del>-    auto nativeValue = JSTestObj::toWrapped(value);
-    if (UNLIKELY(!nativeValue)) {
-        throwAttributeTypeError(state, throwScope, &quot;TestObject&quot;, &quot;withScriptExecutionContextAttribute&quot;, &quot;TestObj&quot;);
-        return false;
-    }
</del><ins>+    auto nativeValue = convert&lt;IDLInterface&lt;TestObj&gt;&gt;(state, value, [](JSC::ExecState&amp; state, JSC::ThrowScope&amp; scope) { throwAttributeTypeError(state, scope, &quot;TestObject&quot;, &quot;withScriptExecutionContextAttribute&quot;, &quot;TestObj&quot;); });
+    RETURN_IF_EXCEPTION(throwScope, false);
</ins><span class="cx">     auto* context = jsCast&lt;JSDOMGlobalObject*&gt;(state.lexicalGlobalObject())-&gt;scriptExecutionContext();
</span><span class="cx">     if (!context)
</span><span class="cx">         return false;
</span><span class="lines">@@ -4242,11 +4220,8 @@
</span><span class="cx">     UNUSED_PARAM(state);
</span><span class="cx">     UNUSED_PARAM(throwScope);
</span><span class="cx">     auto&amp; impl = thisObject.wrapped();
</span><del>-    auto nativeValue = JSTestObj::toWrapped(value);
-    if (UNLIKELY(!nativeValue)) {
-        throwAttributeTypeError(state, throwScope, &quot;TestObject&quot;, &quot;withScriptStateAttributeRaises&quot;, &quot;TestObj&quot;);
-        return false;
-    }
</del><ins>+    auto nativeValue = convert&lt;IDLInterface&lt;TestObj&gt;&gt;(state, value, [](JSC::ExecState&amp; state, JSC::ThrowScope&amp; scope) { throwAttributeTypeError(state, scope, &quot;TestObject&quot;, &quot;withScriptStateAttributeRaises&quot;, &quot;TestObj&quot;); });
+    RETURN_IF_EXCEPTION(throwScope, false);
</ins><span class="cx">     impl.setWithScriptStateAttributeRaises(state, *nativeValue);
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="lines">@@ -4264,11 +4239,8 @@
</span><span class="cx">     UNUSED_PARAM(state);
</span><span class="cx">     UNUSED_PARAM(throwScope);
</span><span class="cx">     auto&amp; impl = thisObject.wrapped();
</span><del>-    auto nativeValue = JSTestObj::toWrapped(value);
-    if (UNLIKELY(!nativeValue)) {
-        throwAttributeTypeError(state, throwScope, &quot;TestObject&quot;, &quot;withScriptExecutionContextAttributeRaises&quot;, &quot;TestObj&quot;);
-        return false;
-    }
</del><ins>+    auto nativeValue = convert&lt;IDLInterface&lt;TestObj&gt;&gt;(state, value, [](JSC::ExecState&amp; state, JSC::ThrowScope&amp; scope) { throwAttributeTypeError(state, scope, &quot;TestObject&quot;, &quot;withScriptExecutionContextAttributeRaises&quot;, &quot;TestObj&quot;); });
+    RETURN_IF_EXCEPTION(throwScope, false);
</ins><span class="cx">     auto* context = jsCast&lt;JSDOMGlobalObject*&gt;(state.lexicalGlobalObject())-&gt;scriptExecutionContext();
</span><span class="cx">     if (!context)
</span><span class="cx">         return false;
</span><span class="lines">@@ -4289,11 +4261,8 @@
</span><span class="cx">     UNUSED_PARAM(state);
</span><span class="cx">     UNUSED_PARAM(throwScope);
</span><span class="cx">     auto&amp; impl = thisObject.wrapped();
</span><del>-    auto nativeValue = JSTestObj::toWrapped(value);
-    if (UNLIKELY(!nativeValue)) {
-        throwAttributeTypeError(state, throwScope, &quot;TestObject&quot;, &quot;withScriptExecutionContextAndScriptStateAttribute&quot;, &quot;TestObj&quot;);
-        return false;
-    }
</del><ins>+    auto nativeValue = convert&lt;IDLInterface&lt;TestObj&gt;&gt;(state, value, [](JSC::ExecState&amp; state, JSC::ThrowScope&amp; scope) { throwAttributeTypeError(state, scope, &quot;TestObject&quot;, &quot;withScriptExecutionContextAndScriptStateAttribute&quot;, &quot;TestObj&quot;); });
+    RETURN_IF_EXCEPTION(throwScope, false);
</ins><span class="cx">     auto* context = jsCast&lt;JSDOMGlobalObject*&gt;(state.lexicalGlobalObject())-&gt;scriptExecutionContext();
</span><span class="cx">     if (!context)
</span><span class="cx">         return false;
</span><span class="lines">@@ -4314,11 +4283,8 @@
</span><span class="cx">     UNUSED_PARAM(state);
</span><span class="cx">     UNUSED_PARAM(throwScope);
</span><span class="cx">     auto&amp; impl = thisObject.wrapped();
</span><del>-    auto nativeValue = JSTestObj::toWrapped(value);
-    if (UNLIKELY(!nativeValue)) {
-        throwAttributeTypeError(state, throwScope, &quot;TestObject&quot;, &quot;withScriptExecutionContextAndScriptStateAttributeRaises&quot;, &quot;TestObj&quot;);
-        return false;
-    }
</del><ins>+    auto nativeValue = convert&lt;IDLInterface&lt;TestObj&gt;&gt;(state, value, [](JSC::ExecState&amp; state, JSC::ThrowScope&amp; scope) { throwAttributeTypeError(state, scope, &quot;TestObject&quot;, &quot;withScriptExecutionContextAndScriptStateAttributeRaises&quot;, &quot;TestObj&quot;); });
+    RETURN_IF_EXCEPTION(throwScope, false);
</ins><span class="cx">     auto* context = jsCast&lt;JSDOMGlobalObject*&gt;(state.lexicalGlobalObject())-&gt;scriptExecutionContext();
</span><span class="cx">     if (!context)
</span><span class="cx">         return false;
</span><span class="lines">@@ -4339,11 +4305,8 @@
</span><span class="cx">     UNUSED_PARAM(state);
</span><span class="cx">     UNUSED_PARAM(throwScope);
</span><span class="cx">     auto&amp; impl = thisObject.wrapped();
</span><del>-    auto nativeValue = JSTestObj::toWrapped(value);
-    if (UNLIKELY(!nativeValue)) {
-        throwAttributeTypeError(state, throwScope, &quot;TestObject&quot;, &quot;withScriptExecutionContextAndScriptStateWithSpacesAttribute&quot;, &quot;TestObj&quot;);
-        return false;
-    }
</del><ins>+    auto nativeValue = convert&lt;IDLInterface&lt;TestObj&gt;&gt;(state, value, [](JSC::ExecState&amp; state, JSC::ThrowScope&amp; scope) { throwAttributeTypeError(state, scope, &quot;TestObject&quot;, &quot;withScriptExecutionContextAndScriptStateWithSpacesAttribute&quot;, &quot;TestObj&quot;); });
+    RETURN_IF_EXCEPTION(throwScope, false);
</ins><span class="cx">     auto* context = jsCast&lt;JSDOMGlobalObject*&gt;(state.lexicalGlobalObject())-&gt;scriptExecutionContext();
</span><span class="cx">     if (!context)
</span><span class="cx">         return false;
</span><span class="lines">@@ -4364,11 +4327,8 @@
</span><span class="cx">     UNUSED_PARAM(state);
</span><span class="cx">     UNUSED_PARAM(throwScope);
</span><span class="cx">     auto&amp; impl = thisObject.wrapped();
</span><del>-    auto nativeValue = JSTestObj::toWrapped(value);
-    if (UNLIKELY(!nativeValue)) {
-        throwAttributeTypeError(state, throwScope, &quot;TestObject&quot;, &quot;withScriptArgumentsAndCallStackAttribute&quot;, &quot;TestObj&quot;);
-        return false;
-    }
</del><ins>+    auto nativeValue = convert&lt;IDLInterface&lt;TestObj&gt;&gt;(state, value, [](JSC::ExecState&amp; state, JSC::ThrowScope&amp; scope) { throwAttributeTypeError(state, scope, &quot;TestObject&quot;, &quot;withScriptArgumentsAndCallStackAttribute&quot;, &quot;TestObj&quot;); });
+    RETURN_IF_EXCEPTION(throwScope, false);
</ins><span class="cx">     impl.setWithScriptArgumentsAndCallStackAttribute(*nativeValue);
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="lines">@@ -4522,14 +4482,8 @@
</span><span class="cx">     UNUSED_PARAM(state);
</span><span class="cx">     UNUSED_PARAM(throwScope);
</span><span class="cx">     auto&amp; impl = thisObject.wrapped();
</span><del>-    SVGPropertyTearOff&lt;SVGPoint&gt;* nativeValue = nullptr;
-    if (!value.isUndefinedOrNull()) {
-        nativeValue = JSSVGPoint::toWrapped(value);
-        if (UNLIKELY(!nativeValue)) {
-            throwAttributeTypeError(state, throwScope, &quot;TestObject&quot;, &quot;mutablePoint&quot;, &quot;SVGPoint&quot;);
-            return false;
-        }
-    }
</del><ins>+    auto nativeValue = convert&lt;IDLInterface&lt;SVGPropertyTearOff&lt;SVGPoint&gt;&gt;&gt;(state, value, [](JSC::ExecState&amp; state, JSC::ThrowScope&amp; scope) { throwAttributeTypeError(state, scope, &quot;TestObject&quot;, &quot;mutablePoint&quot;, &quot;SVGPoint&quot;); });
+    RETURN_IF_EXCEPTION(throwScope, false);
</ins><span class="cx">     impl.setMutablePoint(WTFMove(nativeValue));
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="lines">@@ -4547,14 +4501,8 @@
</span><span class="cx">     UNUSED_PARAM(state);
</span><span class="cx">     UNUSED_PARAM(throwScope);
</span><span class="cx">     auto&amp; impl = thisObject.wrapped();
</span><del>-    SVGPropertyTearOff&lt;SVGPoint&gt;* nativeValue = nullptr;
-    if (!value.isUndefinedOrNull()) {
-        nativeValue = JSSVGPoint::toWrapped(value);
-        if (UNLIKELY(!nativeValue)) {
-            throwAttributeTypeError(state, throwScope, &quot;TestObject&quot;, &quot;immutablePoint&quot;, &quot;SVGPoint&quot;);
-            return false;
-        }
-    }
</del><ins>+    auto nativeValue = convert&lt;IDLInterface&lt;SVGPropertyTearOff&lt;SVGPoint&gt;&gt;&gt;(state, value, [](JSC::ExecState&amp; state, JSC::ThrowScope&amp; scope) { throwAttributeTypeError(state, scope, &quot;TestObject&quot;, &quot;immutablePoint&quot;, &quot;SVGPoint&quot;); });
+    RETURN_IF_EXCEPTION(throwScope, false);
</ins><span class="cx">     impl.setImmutablePoint(WTFMove(nativeValue));
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="lines">@@ -4887,9 +4835,8 @@
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</span><span class="cx">     auto strArg = convert&lt;IDLDOMString&gt;(*state, state-&gt;uncheckedArgument(1), StringConversionConfiguration::Normal);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</span><del>-    auto objArg = JSTestObj::toWrapped(state-&gt;uncheckedArgument(2));
-    if (UNLIKELY(!objArg))
-        return throwArgumentTypeError(*state, throwScope, 2, &quot;objArg&quot;, &quot;TestObject&quot;, &quot;voidMethodWithArgs&quot;, &quot;TestObj&quot;);
</del><ins>+    auto objArg = convert&lt;IDLInterface&lt;TestObj&gt;&gt;(*state, state-&gt;uncheckedArgument(2), [](JSC::ExecState&amp; state, JSC::ThrowScope&amp; scope) { throwArgumentTypeError(state, scope, 2, &quot;objArg&quot;, &quot;TestObject&quot;, &quot;voidMethodWithArgs&quot;, &quot;TestObj&quot;); });
+    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</ins><span class="cx">     impl.voidMethodWithArgs(WTFMove(longArg), WTFMove(strArg), *objArg);
</span><span class="cx">     return JSValue::encode(jsUndefined());
</span><span class="cx"> }
</span><span class="lines">@@ -4928,9 +4875,8 @@
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</span><span class="cx">     auto strArg = convert&lt;IDLDOMString&gt;(*state, state-&gt;uncheckedArgument(1), StringConversionConfiguration::Normal);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</span><del>-    auto objArg = JSTestObj::toWrapped(state-&gt;uncheckedArgument(2));
-    if (UNLIKELY(!objArg))
-        return throwArgumentTypeError(*state, throwScope, 2, &quot;objArg&quot;, &quot;TestObject&quot;, &quot;byteMethodWithArgs&quot;, &quot;TestObj&quot;);
</del><ins>+    auto objArg = convert&lt;IDLInterface&lt;TestObj&gt;&gt;(*state, state-&gt;uncheckedArgument(2), [](JSC::ExecState&amp; state, JSC::ThrowScope&amp; scope) { throwArgumentTypeError(state, scope, 2, &quot;objArg&quot;, &quot;TestObject&quot;, &quot;byteMethodWithArgs&quot;, &quot;TestObj&quot;); });
+    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</ins><span class="cx">     JSValue result = toJS&lt;IDLByte&gt;(impl.byteMethodWithArgs(WTFMove(byteArg), WTFMove(strArg), *objArg));
</span><span class="cx">     return JSValue::encode(result);
</span><span class="cx"> }
</span><span class="lines">@@ -4969,9 +4915,8 @@
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</span><span class="cx">     auto strArg = convert&lt;IDLDOMString&gt;(*state, state-&gt;uncheckedArgument(1), StringConversionConfiguration::Normal);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</span><del>-    auto objArg = JSTestObj::toWrapped(state-&gt;uncheckedArgument(2));
-    if (UNLIKELY(!objArg))
-        return throwArgumentTypeError(*state, throwScope, 2, &quot;objArg&quot;, &quot;TestObject&quot;, &quot;octetMethodWithArgs&quot;, &quot;TestObj&quot;);
</del><ins>+    auto objArg = convert&lt;IDLInterface&lt;TestObj&gt;&gt;(*state, state-&gt;uncheckedArgument(2), [](JSC::ExecState&amp; state, JSC::ThrowScope&amp; scope) { throwArgumentTypeError(state, scope, 2, &quot;objArg&quot;, &quot;TestObject&quot;, &quot;octetMethodWithArgs&quot;, &quot;TestObj&quot;); });
+    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</ins><span class="cx">     JSValue result = toJS&lt;IDLOctet&gt;(impl.octetMethodWithArgs(WTFMove(octetArg), WTFMove(strArg), *objArg));
</span><span class="cx">     return JSValue::encode(result);
</span><span class="cx"> }
</span><span class="lines">@@ -5010,9 +4955,8 @@
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</span><span class="cx">     auto strArg = convert&lt;IDLDOMString&gt;(*state, state-&gt;uncheckedArgument(1), StringConversionConfiguration::Normal);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</span><del>-    auto objArg = JSTestObj::toWrapped(state-&gt;uncheckedArgument(2));
-    if (UNLIKELY(!objArg))
-        return throwArgumentTypeError(*state, throwScope, 2, &quot;objArg&quot;, &quot;TestObject&quot;, &quot;longMethodWithArgs&quot;, &quot;TestObj&quot;);
</del><ins>+    auto objArg = convert&lt;IDLInterface&lt;TestObj&gt;&gt;(*state, state-&gt;uncheckedArgument(2), [](JSC::ExecState&amp; state, JSC::ThrowScope&amp; scope) { throwArgumentTypeError(state, scope, 2, &quot;objArg&quot;, &quot;TestObject&quot;, &quot;longMethodWithArgs&quot;, &quot;TestObj&quot;); });
+    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</ins><span class="cx">     JSValue result = toJS&lt;IDLLong&gt;(impl.longMethodWithArgs(WTFMove(longArg), WTFMove(strArg), *objArg));
</span><span class="cx">     return JSValue::encode(result);
</span><span class="cx"> }
</span><span class="lines">@@ -5029,7 +4973,7 @@
</span><span class="cx">     UNUSED_PARAM(state);
</span><span class="cx">     UNUSED_PARAM(throwScope);
</span><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><del>-    JSValue result = toJS(state, castedThis-&gt;globalObject(), impl.objMethod());
</del><ins>+    JSValue result = toJS&lt;IDLInterface&lt;TestObj&gt;&gt;(*state, *castedThis-&gt;globalObject(), impl.objMethod());
</ins><span class="cx">     return JSValue::encode(result);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -5051,10 +4995,9 @@
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</span><span class="cx">     auto strArg = convert&lt;IDLDOMString&gt;(*state, state-&gt;uncheckedArgument(1), StringConversionConfiguration::Normal);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</span><del>-    auto objArg = JSTestObj::toWrapped(state-&gt;uncheckedArgument(2));
-    if (UNLIKELY(!objArg))
-        return throwArgumentTypeError(*state, throwScope, 2, &quot;objArg&quot;, &quot;TestObject&quot;, &quot;objMethodWithArgs&quot;, &quot;TestObj&quot;);
-    JSValue result = toJS(state, castedThis-&gt;globalObject(), impl.objMethodWithArgs(WTFMove(longArg), WTFMove(strArg), *objArg));
</del><ins>+    auto objArg = convert&lt;IDLInterface&lt;TestObj&gt;&gt;(*state, state-&gt;uncheckedArgument(2), [](JSC::ExecState&amp; state, JSC::ThrowScope&amp; scope) { throwArgumentTypeError(state, scope, 2, &quot;objArg&quot;, &quot;TestObject&quot;, &quot;objMethodWithArgs&quot;, &quot;TestObj&quot;); });
+    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
+    JSValue result = toJS&lt;IDLInterface&lt;TestObj&gt;&gt;(*state, *castedThis-&gt;globalObject(), impl.objMethodWithArgs(WTFMove(longArg), WTFMove(strArg), *objArg));
</ins><span class="cx">     return JSValue::encode(result);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -5279,10 +5222,9 @@
</span><span class="cx">     ExceptionCode ec = 0;
</span><span class="cx">     auto strArg = convert&lt;IDLDOMString&gt;(*state, state-&gt;uncheckedArgument(0), StringConversionConfiguration::Normal);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</span><del>-    auto objArg = JSTestObj::toWrapped(state-&gt;uncheckedArgument(1));
-    if (UNLIKELY(!objArg))
-        return throwArgumentTypeError(*state, throwScope, 1, &quot;objArg&quot;, &quot;TestObject&quot;, &quot;methodThatRequiresAllArgsAndThrows&quot;, &quot;TestObj&quot;);
-    JSValue result = toJS(state, castedThis-&gt;globalObject(), impl.methodThatRequiresAllArgsAndThrows(WTFMove(strArg), *objArg, ec));
</del><ins>+    auto objArg = convert&lt;IDLInterface&lt;TestObj&gt;&gt;(*state, state-&gt;uncheckedArgument(1), [](JSC::ExecState&amp; state, JSC::ThrowScope&amp; scope) { throwArgumentTypeError(state, scope, 1, &quot;objArg&quot;, &quot;TestObject&quot;, &quot;methodThatRequiresAllArgsAndThrows&quot;, &quot;TestObj&quot;); });
+    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
+    JSValue result = toJS&lt;IDLInterface&lt;TestObj&gt;&gt;(*state, *castedThis-&gt;globalObject(), impl.methodThatRequiresAllArgsAndThrows(WTFMove(strArg), *objArg, ec));
</ins><span class="cx"> 
</span><span class="cx">     setDOMException(state, throwScope, ec);
</span><span class="cx">     return JSValue::encode(result);
</span><span class="lines">@@ -5432,7 +5374,7 @@
</span><span class="cx">     UNUSED_PARAM(state);
</span><span class="cx">     UNUSED_PARAM(throwScope);
</span><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><del>-    JSValue result = toJS(*state, *castedThis-&gt;globalObject(), throwScope, impl.methodWithExceptionReturningObject());
</del><ins>+    JSValue result = toJS&lt;IDLInterface&lt;TestObj&gt;&gt;(*state, *castedThis-&gt;globalObject(), throwScope, impl.methodWithExceptionReturningObject());
</ins><span class="cx">     return JSValue::encode(result);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -5600,7 +5542,7 @@
</span><span class="cx">     UNUSED_PARAM(state);
</span><span class="cx">     UNUSED_PARAM(throwScope);
</span><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><del>-    JSValue result = toJS(state, castedThis-&gt;globalObject(), impl.withScriptStateObj(*state));
</del><ins>+    JSValue result = toJS&lt;IDLInterface&lt;TestObj&gt;&gt;(*state, *castedThis-&gt;globalObject(), impl.withScriptStateObj(*state));
</ins><span class="cx">     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</span><span class="cx">     return JSValue::encode(result);
</span><span class="cx"> }
</span><span class="lines">@@ -5636,7 +5578,7 @@
</span><span class="cx">     UNUSED_PARAM(throwScope);
</span><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     ExceptionCode ec = 0;
</span><del>-    JSValue result = toJS(state, castedThis-&gt;globalObject(), impl.withScriptStateObjException(*state, ec));
</del><ins>+    JSValue result = toJS&lt;IDLInterface&lt;TestObj&gt;&gt;(*state, *castedThis-&gt;globalObject(), impl.withScriptStateObjException(*state, ec));
</ins><span class="cx"> 
</span><span class="cx">     setDOMException(state, throwScope, ec);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</span><span class="lines">@@ -5697,7 +5639,7 @@
</span><span class="cx">     auto* context = jsCast&lt;JSDOMGlobalObject*&gt;(state-&gt;lexicalGlobalObject())-&gt;scriptExecutionContext();
</span><span class="cx">     if (!context)
</span><span class="cx">         return JSValue::encode(jsUndefined());
</span><del>-    JSValue result = toJS(state, castedThis-&gt;globalObject(), impl.withScriptExecutionContextAndScriptStateObjException(*state, *context, ec));
</del><ins>+    JSValue result = toJS&lt;IDLInterface&lt;TestObj&gt;&gt;(*state, *castedThis-&gt;globalObject(), impl.withScriptExecutionContextAndScriptStateObjException(*state, *context, ec));
</ins><span class="cx"> 
</span><span class="cx">     setDOMException(state, throwScope, ec);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</span><span class="lines">@@ -5719,7 +5661,7 @@
</span><span class="cx">     auto* context = jsCast&lt;JSDOMGlobalObject*&gt;(state-&gt;lexicalGlobalObject())-&gt;scriptExecutionContext();
</span><span class="cx">     if (!context)
</span><span class="cx">         return JSValue::encode(jsUndefined());
</span><del>-    JSValue result = toJS(state, castedThis-&gt;globalObject(), impl.withScriptExecutionContextAndScriptStateWithSpaces(*state, *context));
</del><ins>+    JSValue result = toJS&lt;IDLInterface&lt;TestObj&gt;&gt;(*state, *castedThis-&gt;globalObject(), impl.withScriptExecutionContextAndScriptStateWithSpaces(*state, *context));
</ins><span class="cx">     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</span><span class="cx">     return JSValue::encode(result);
</span><span class="cx"> }
</span><span class="lines">@@ -6287,12 +6229,8 @@
</span><span class="cx">     UNUSED_PARAM(state);
</span><span class="cx">     UNUSED_PARAM(throwScope);
</span><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><del>-    TestObj* obj = nullptr;
-    if (!state-&gt;argument(0).isUndefinedOrNull()) {
-        obj = JSTestObj::toWrapped(state-&gt;uncheckedArgument(0));
-        if (UNLIKELY(!obj))
-            return throwArgumentTypeError(*state, throwScope, 0, &quot;obj&quot;, &quot;TestObject&quot;, &quot;methodWithOptionalNullableWrapper&quot;, &quot;TestObj&quot;);
-    }
</del><ins>+    auto obj = convert&lt;IDLNullable&lt;IDLInterface&lt;TestObj&gt;&gt;&gt;(*state, state-&gt;argument(0), [](JSC::ExecState&amp; state, JSC::ThrowScope&amp; scope) { throwArgumentTypeError(state, scope, 0, &quot;obj&quot;, &quot;TestObject&quot;, &quot;methodWithOptionalNullableWrapper&quot;, &quot;TestObj&quot;); });
+    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</ins><span class="cx">     impl.methodWithOptionalNullableWrapper(WTFMove(obj));
</span><span class="cx">     return JSValue::encode(jsUndefined());
</span><span class="cx"> }
</span><span class="lines">@@ -6309,12 +6247,8 @@
</span><span class="cx">     UNUSED_PARAM(state);
</span><span class="cx">     UNUSED_PARAM(throwScope);
</span><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><del>-    TestObj* obj = nullptr;
-    if (!state-&gt;argument(0).isUndefinedOrNull()) {
-        obj = JSTestObj::toWrapped(state-&gt;uncheckedArgument(0));
-        if (UNLIKELY(!obj))
-            return throwArgumentTypeError(*state, throwScope, 0, &quot;obj&quot;, &quot;TestObject&quot;, &quot;methodWithOptionalNullableWrapperIsNull&quot;, &quot;TestObj&quot;);
-    }
</del><ins>+    auto obj = convert&lt;IDLNullable&lt;IDLInterface&lt;TestObj&gt;&gt;&gt;(*state, state-&gt;argument(0), [](JSC::ExecState&amp; state, JSC::ThrowScope&amp; scope) { throwArgumentTypeError(state, scope, 0, &quot;obj&quot;, &quot;TestObject&quot;, &quot;methodWithOptionalNullableWrapperIsNull&quot;, &quot;TestObj&quot;); });
+    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</ins><span class="cx">     impl.methodWithOptionalNullableWrapperIsNull(WTFMove(obj));
</span><span class="cx">     return JSValue::encode(jsUndefined());
</span><span class="cx"> }
</span><span class="lines">@@ -6574,12 +6508,8 @@
</span><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     if (UNLIKELY(state-&gt;argumentCount() &lt; 2))
</span><span class="cx">         return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
</span><del>-    TestObj* objArg = nullptr;
-    if (!state-&gt;uncheckedArgument(0).isUndefinedOrNull()) {
-        objArg = JSTestObj::toWrapped(state-&gt;uncheckedArgument(0));
-        if (UNLIKELY(!objArg))
-            return throwArgumentTypeError(*state, throwScope, 0, &quot;objArg&quot;, &quot;TestObject&quot;, &quot;overloadedMethod&quot;, &quot;TestObj&quot;);
-    }
</del><ins>+    auto objArg = convert&lt;IDLNullable&lt;IDLInterface&lt;TestObj&gt;&gt;&gt;(*state, state-&gt;uncheckedArgument(0), [](JSC::ExecState&amp; state, JSC::ThrowScope&amp; scope) { throwArgumentTypeError(state, scope, 0, &quot;objArg&quot;, &quot;TestObject&quot;, &quot;overloadedMethod&quot;, &quot;TestObj&quot;); });
+    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</ins><span class="cx">     auto strArg = convert&lt;IDLDOMString&gt;(*state, state-&gt;uncheckedArgument(1), StringConversionConfiguration::Normal);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</span><span class="cx">     impl.overloadedMethod(WTFMove(objArg), WTFMove(strArg));
</span><span class="lines">@@ -6600,12 +6530,8 @@
</span><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     if (UNLIKELY(state-&gt;argumentCount() &lt; 1))
</span><span class="cx">         return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
</span><del>-    TestObj* objArg = nullptr;
-    if (!state-&gt;uncheckedArgument(0).isUndefinedOrNull()) {
-        objArg = JSTestObj::toWrapped(state-&gt;uncheckedArgument(0));
-        if (UNLIKELY(!objArg))
-            return throwArgumentTypeError(*state, throwScope, 0, &quot;objArg&quot;, &quot;TestObject&quot;, &quot;overloadedMethod&quot;, &quot;TestObj&quot;);
-    }
</del><ins>+    auto objArg = convert&lt;IDLNullable&lt;IDLInterface&lt;TestObj&gt;&gt;&gt;(*state, state-&gt;uncheckedArgument(0), [](JSC::ExecState&amp; state, JSC::ThrowScope&amp; scope) { throwArgumentTypeError(state, scope, 0, &quot;objArg&quot;, &quot;TestObject&quot;, &quot;overloadedMethod&quot;, &quot;TestObj&quot;); });
+    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</ins><span class="cx">     auto longArg = state-&gt;argument(1).isUndefined() ? Optional&lt;int32_t&gt;() : convert&lt;IDLLong&gt;(*state, state-&gt;uncheckedArgument(1), IntegerConversionConfiguration::Normal);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</span><span class="cx">     impl.overloadedMethod(WTFMove(objArg), WTFMove(longArg));
</span><span class="lines">@@ -6687,12 +6613,8 @@
</span><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     if (UNLIKELY(state-&gt;argumentCount() &lt; 1))
</span><span class="cx">         return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
</span><del>-    DOMStringList* listArg = nullptr;
-    if (!state-&gt;uncheckedArgument(0).isUndefinedOrNull()) {
-        listArg = JSDOMStringList::toWrapped(state-&gt;uncheckedArgument(0));
-        if (UNLIKELY(!listArg))
-            return throwArgumentTypeError(*state, throwScope, 0, &quot;listArg&quot;, &quot;TestObject&quot;, &quot;overloadedMethod&quot;, &quot;DOMStringList&quot;);
-    }
</del><ins>+    auto listArg = convert&lt;IDLNullable&lt;IDLInterface&lt;DOMStringList&gt;&gt;&gt;(*state, state-&gt;uncheckedArgument(0), [](JSC::ExecState&amp; state, JSC::ThrowScope&amp; scope) { throwArgumentTypeError(state, scope, 0, &quot;listArg&quot;, &quot;TestObject&quot;, &quot;overloadedMethod&quot;, &quot;DOMStringList&quot;); });
+    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</ins><span class="cx">     impl.overloadedMethod(WTFMove(listArg));
</span><span class="cx">     return JSValue::encode(jsUndefined());
</span><span class="cx"> }
</span><span class="lines">@@ -6731,9 +6653,8 @@
</span><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     if (UNLIKELY(state-&gt;argumentCount() &lt; 1))
</span><span class="cx">         return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
</span><del>-    auto objArg = JSTestObj::toWrapped(state-&gt;uncheckedArgument(0));
-    if (UNLIKELY(!objArg))
-        return throwArgumentTypeError(*state, throwScope, 0, &quot;objArg&quot;, &quot;TestObject&quot;, &quot;overloadedMethod&quot;, &quot;TestObj&quot;);
</del><ins>+    auto objArg = convert&lt;IDLInterface&lt;TestObj&gt;&gt;(*state, state-&gt;uncheckedArgument(0), [](JSC::ExecState&amp; state, JSC::ThrowScope&amp; scope) { throwArgumentTypeError(state, scope, 0, &quot;objArg&quot;, &quot;TestObject&quot;, &quot;overloadedMethod&quot;, &quot;TestObj&quot;); });
+    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</ins><span class="cx">     impl.overloadedMethod(*objArg);
</span><span class="cx">     return JSValue::encode(jsUndefined());
</span><span class="cx"> }
</span><span class="lines">@@ -6752,9 +6673,8 @@
</span><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     if (UNLIKELY(state-&gt;argumentCount() &lt; 1))
</span><span class="cx">         return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
</span><del>-    auto window = JSDOMWindow::toWrapped(state-&gt;uncheckedArgument(0));
-    if (UNLIKELY(!window))
-        return throwArgumentTypeError(*state, throwScope, 0, &quot;window&quot;, &quot;TestObject&quot;, &quot;overloadedMethod&quot;, &quot;DOMWindow&quot;);
</del><ins>+    auto window = convert&lt;IDLInterface&lt;DOMWindow&gt;&gt;(*state, state-&gt;uncheckedArgument(0), [](JSC::ExecState&amp; state, JSC::ThrowScope&amp; scope) { throwArgumentTypeError(state, scope, 0, &quot;window&quot;, &quot;TestObject&quot;, &quot;overloadedMethod&quot;, &quot;DOMWindow&quot;); });
+    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</ins><span class="cx">     impl.overloadedMethod(*window);
</span><span class="cx">     return JSValue::encode(jsUndefined());
</span><span class="cx"> }
</span><span class="lines">@@ -6899,12 +6819,8 @@
</span><span class="cx">         return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
</span><span class="cx">     auto strArg = convert&lt;IDLDOMString&gt;(*state, state-&gt;uncheckedArgument(0), StringConversionConfiguration::Normal);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</span><del>-    TestObj* objArg = nullptr;
-    if (!state-&gt;argument(1).isUndefinedOrNull()) {
-        objArg = JSTestObj::toWrapped(state-&gt;uncheckedArgument(1));
-        if (UNLIKELY(!objArg))
-            return throwArgumentTypeError(*state, throwScope, 1, &quot;objArg&quot;, &quot;TestObject&quot;, &quot;overloadedMethodWithOptionalParameter&quot;, &quot;TestObj&quot;);
-    }
</del><ins>+    auto objArg = convert&lt;IDLNullable&lt;IDLInterface&lt;TestObj&gt;&gt;&gt;(*state, state-&gt;argument(1), [](JSC::ExecState&amp; state, JSC::ThrowScope&amp; scope) { throwArgumentTypeError(state, scope, 1, &quot;objArg&quot;, &quot;TestObject&quot;, &quot;overloadedMethodWithOptionalParameter&quot;, &quot;TestObj&quot;); });
+    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</ins><span class="cx">     impl.overloadedMethodWithOptionalParameter(WTFMove(strArg), WTFMove(objArg));
</span><span class="cx">     return JSValue::encode(jsUndefined());
</span><span class="cx"> }
</span><span class="lines">@@ -6923,12 +6839,8 @@
</span><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     if (UNLIKELY(state-&gt;argumentCount() &lt; 1))
</span><span class="cx">         return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
</span><del>-    TestObj* objArg = nullptr;
-    if (!state-&gt;uncheckedArgument(0).isUndefinedOrNull()) {
-        objArg = JSTestObj::toWrapped(state-&gt;uncheckedArgument(0));
-        if (UNLIKELY(!objArg))
-            return throwArgumentTypeError(*state, throwScope, 0, &quot;objArg&quot;, &quot;TestObject&quot;, &quot;overloadedMethodWithOptionalParameter&quot;, &quot;TestObj&quot;);
-    }
</del><ins>+    auto objArg = convert&lt;IDLNullable&lt;IDLInterface&lt;TestObj&gt;&gt;&gt;(*state, state-&gt;uncheckedArgument(0), [](JSC::ExecState&amp; state, JSC::ThrowScope&amp; scope) { throwArgumentTypeError(state, scope, 0, &quot;objArg&quot;, &quot;TestObject&quot;, &quot;overloadedMethodWithOptionalParameter&quot;, &quot;TestObj&quot;); });
+    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</ins><span class="cx">     auto longArg = state-&gt;argument(1).isUndefined() ? Optional&lt;int32_t&gt;() : convert&lt;IDLLong&gt;(*state, state-&gt;uncheckedArgument(1), IntegerConversionConfiguration::Normal);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</span><span class="cx">     impl.overloadedMethodWithOptionalParameter(WTFMove(objArg), WTFMove(longArg));
</span><span class="lines">@@ -7096,9 +7008,8 @@
</span><span class="cx">         return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
</span><span class="cx">     auto objectOrNode = convert&lt;IDLUnion&lt;IDLInterface&lt;TestObj&gt;, IDLInterface&lt;TestNode&gt;&gt;&gt;(*state, state-&gt;uncheckedArgument(0));
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</span><del>-    auto object = JSTestObj::toWrapped(state-&gt;uncheckedArgument(1));
-    if (UNLIKELY(!object))
-        return throwArgumentTypeError(*state, throwScope, 1, &quot;object&quot;, &quot;TestObject&quot;, &quot;overloadedMethodWithNonDistinguishingUnion&quot;, &quot;TestObj&quot;);
</del><ins>+    auto object = convert&lt;IDLInterface&lt;TestObj&gt;&gt;(*state, state-&gt;uncheckedArgument(1), [](JSC::ExecState&amp; state, JSC::ThrowScope&amp; scope) { throwArgumentTypeError(state, scope, 1, &quot;object&quot;, &quot;TestObject&quot;, &quot;overloadedMethodWithNonDistinguishingUnion&quot;, &quot;TestObj&quot;); });
+    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</ins><span class="cx">     impl.overloadedMethodWithNonDistinguishingUnion(WTFMove(objectOrNode), *object);
</span><span class="cx">     return JSValue::encode(jsUndefined());
</span><span class="cx"> }
</span><span class="lines">@@ -7119,9 +7030,8 @@
</span><span class="cx">         return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
</span><span class="cx">     auto objectOrNode = convert&lt;IDLUnion&lt;IDLInterface&lt;TestObj&gt;, IDLInterface&lt;TestNode&gt;&gt;&gt;(*state, state-&gt;uncheckedArgument(0));
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</span><del>-    auto node = JSTestNode::toWrapped(state-&gt;uncheckedArgument(1));
-    if (UNLIKELY(!node))
-        return throwArgumentTypeError(*state, throwScope, 1, &quot;node&quot;, &quot;TestObject&quot;, &quot;overloadedMethodWithNonDistinguishingUnion&quot;, &quot;TestNode&quot;);
</del><ins>+    auto node = convert&lt;IDLInterface&lt;TestNode&gt;&gt;(*state, state-&gt;uncheckedArgument(1), [](JSC::ExecState&amp; state, JSC::ThrowScope&amp; scope) { throwArgumentTypeError(state, scope, 1, &quot;node&quot;, &quot;TestObject&quot;, &quot;overloadedMethodWithNonDistinguishingUnion&quot;, &quot;TestNode&quot;); });
+    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</ins><span class="cx">     impl.overloadedMethodWithNonDistinguishingUnion(WTFMove(objectOrNode), *node);
</span><span class="cx">     return JSValue::encode(jsUndefined());
</span><span class="cx"> }
</span><span class="lines">@@ -7277,15 +7187,10 @@
</span><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     if (UNLIKELY(state-&gt;argumentCount() &lt; 2))
</span><span class="cx">         return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
</span><del>-    TestObj* obj = nullptr;
-    if (!state-&gt;uncheckedArgument(0).isUndefinedOrNull()) {
-        obj = JSTestObj::toWrapped(state-&gt;uncheckedArgument(0));
-        if (UNLIKELY(!obj))
-            return throwArgumentTypeError(*state, throwScope, 0, &quot;obj&quot;, &quot;TestObject&quot;, &quot;overloadWithNullableNonDistinguishingParameter&quot;, &quot;TestObj&quot;);
-    }
-    auto node = JSTestNode::toWrapped(state-&gt;uncheckedArgument(1));
-    if (UNLIKELY(!node))
-        return throwArgumentTypeError(*state, throwScope, 1, &quot;node&quot;, &quot;TestObject&quot;, &quot;overloadWithNullableNonDistinguishingParameter&quot;, &quot;TestNode&quot;);
</del><ins>+    auto obj = convert&lt;IDLNullable&lt;IDLInterface&lt;TestObj&gt;&gt;&gt;(*state, state-&gt;uncheckedArgument(0), [](JSC::ExecState&amp; state, JSC::ThrowScope&amp; scope) { throwArgumentTypeError(state, scope, 0, &quot;obj&quot;, &quot;TestObject&quot;, &quot;overloadWithNullableNonDistinguishingParameter&quot;, &quot;TestObj&quot;); });
+    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
+    auto node = convert&lt;IDLInterface&lt;TestNode&gt;&gt;(*state, state-&gt;uncheckedArgument(1), [](JSC::ExecState&amp; state, JSC::ThrowScope&amp; scope) { throwArgumentTypeError(state, scope, 1, &quot;node&quot;, &quot;TestObject&quot;, &quot;overloadWithNullableNonDistinguishingParameter&quot;, &quot;TestNode&quot;); });
+    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</ins><span class="cx">     impl.overloadWithNullableNonDistinguishingParameter(WTFMove(obj), *node);
</span><span class="cx">     return JSValue::encode(jsUndefined());
</span><span class="cx"> }
</span><span class="lines">@@ -7304,12 +7209,8 @@
</span><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     if (UNLIKELY(state-&gt;argumentCount() &lt; 2))
</span><span class="cx">         return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
</span><del>-    TestNode* node = nullptr;
-    if (!state-&gt;uncheckedArgument(0).isUndefinedOrNull()) {
-        node = JSTestNode::toWrapped(state-&gt;uncheckedArgument(0));
-        if (UNLIKELY(!node))
-            return throwArgumentTypeError(*state, throwScope, 0, &quot;node&quot;, &quot;TestObject&quot;, &quot;overloadWithNullableNonDistinguishingParameter&quot;, &quot;TestNode&quot;);
-    }
</del><ins>+    auto node = convert&lt;IDLNullable&lt;IDLInterface&lt;TestNode&gt;&gt;&gt;(*state, state-&gt;uncheckedArgument(0), [](JSC::ExecState&amp; state, JSC::ThrowScope&amp; scope) { throwArgumentTypeError(state, scope, 0, &quot;node&quot;, &quot;TestObject&quot;, &quot;overloadWithNullableNonDistinguishingParameter&quot;, &quot;TestNode&quot;); });
+    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</ins><span class="cx">     auto index = convert&lt;IDLLong&gt;(*state, state-&gt;uncheckedArgument(1), IntegerConversionConfiguration::Normal);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</span><span class="cx">     impl.overloadWithNullableNonDistinguishingParameter(WTFMove(node), WTFMove(index));
</span><span class="lines">@@ -7515,10 +7416,9 @@
</span><span class="cx">     if (UNLIKELY(state-&gt;argumentCount() &lt; 1))
</span><span class="cx">         return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
</span><span class="cx">     ExceptionCode ec = 0;
</span><del>-    auto values = JSDOMStringList::toWrapped(state-&gt;uncheckedArgument(0));
-    if (UNLIKELY(!values))
-        return throwArgumentTypeError(*state, throwScope, 0, &quot;values&quot;, &quot;TestObject&quot;, &quot;domStringListFunction&quot;, &quot;DOMStringList&quot;);
-    JSValue result = toJS(state, castedThis-&gt;globalObject(), impl.domStringListFunction(*values, ec));
</del><ins>+    auto values = convert&lt;IDLInterface&lt;DOMStringList&gt;&gt;(*state, state-&gt;uncheckedArgument(0), [](JSC::ExecState&amp; state, JSC::ThrowScope&amp; scope) { throwArgumentTypeError(state, scope, 0, &quot;values&quot;, &quot;TestObject&quot;, &quot;domStringListFunction&quot;, &quot;DOMStringList&quot;); });
+    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
+    JSValue result = toJS&lt;IDLInterface&lt;DOMStringList&gt;&gt;(*state, *castedThis-&gt;globalObject(), impl.domStringListFunction(*values, ec));
</ins><span class="cx"> 
</span><span class="cx">     setDOMException(state, throwScope, ec);
</span><span class="cx">     return JSValue::encode(result);
</span><span class="lines">@@ -7562,7 +7462,7 @@
</span><span class="cx">         return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
</span><span class="cx">     auto elementId = AtomicString(state-&gt;uncheckedArgument(0).toString(state)-&gt;toExistingAtomicString(state));
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</span><del>-    JSValue result = toJS(state, castedThis-&gt;globalObject(), impl.getElementById(WTFMove(elementId)));
</del><ins>+    JSValue result = toJS&lt;IDLNullable&lt;IDLInterface&lt;Element&gt;&gt;&gt;(*state, *castedThis-&gt;globalObject(), impl.getElementById(WTFMove(elementId)));
</ins><span class="cx">     return JSValue::encode(result);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -7579,7 +7479,7 @@
</span><span class="cx">     UNUSED_PARAM(throwScope);
</span><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     ExceptionCode ec = 0;
</span><del>-    JSValue result = toJS(state, castedThis-&gt;globalObject(), BindingSecurity::checkSecurityForNode(*state, impl.getSVGDocument(ec)));
</del><ins>+    JSValue result = toJS&lt;IDLInterface&lt;SVGDocument&gt;&gt;(*state, *castedThis-&gt;globalObject(), BindingSecurity::checkSecurityForNode(*state, impl.getSVGDocument(ec)));
</ins><span class="cx"> 
</span><span class="cx">     setDOMException(state, throwScope, ec);
</span><span class="cx">     return JSValue::encode(result);
</span><span class="lines">@@ -7599,9 +7499,8 @@
</span><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     if (UNLIKELY(state-&gt;argumentCount() &lt; 1))
</span><span class="cx">         return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
</span><del>-    auto value = JSTestNode::toWrapped(state-&gt;uncheckedArgument(0));
-    if (UNLIKELY(!value))
-        return throwArgumentTypeError(*state, throwScope, 0, &quot;value&quot;, &quot;TestObject&quot;, &quot;convert1&quot;, &quot;TestNode&quot;);
</del><ins>+    auto value = convert&lt;IDLInterface&lt;TestNode&gt;&gt;(*state, state-&gt;uncheckedArgument(0), [](JSC::ExecState&amp; state, JSC::ThrowScope&amp; scope) { throwArgumentTypeError(state, scope, 0, &quot;value&quot;, &quot;TestObject&quot;, &quot;convert1&quot;, &quot;TestNode&quot;); });
+    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</ins><span class="cx">     impl.convert1(*value);
</span><span class="cx">     return JSValue::encode(jsUndefined());
</span><span class="cx"> }
</span><span class="lines">@@ -7620,12 +7519,8 @@
</span><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     if (UNLIKELY(state-&gt;argumentCount() &lt; 1))
</span><span class="cx">         return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
</span><del>-    TestNode* value = nullptr;
-    if (!state-&gt;uncheckedArgument(0).isUndefinedOrNull()) {
-        value = JSTestNode::toWrapped(state-&gt;uncheckedArgument(0));
-        if (UNLIKELY(!value))
-            return throwArgumentTypeError(*state, throwScope, 0, &quot;value&quot;, &quot;TestObject&quot;, &quot;convert2&quot;, &quot;TestNode&quot;);
-    }
</del><ins>+    auto value = convert&lt;IDLNullable&lt;IDLInterface&lt;TestNode&gt;&gt;&gt;(*state, state-&gt;uncheckedArgument(0), [](JSC::ExecState&amp; state, JSC::ThrowScope&amp; scope) { throwArgumentTypeError(state, scope, 0, &quot;value&quot;, &quot;TestObject&quot;, &quot;convert2&quot;, &quot;TestNode&quot;); });
+    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</ins><span class="cx">     impl.convert2(WTFMove(value));
</span><span class="cx">     return JSValue::encode(jsUndefined());
</span><span class="cx"> }
</span><span class="lines">@@ -7682,7 +7577,7 @@
</span><span class="cx">     UNUSED_PARAM(state);
</span><span class="cx">     UNUSED_PARAM(throwScope);
</span><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><del>-    JSValue result = toJS(state, castedThis-&gt;globalObject(), SVGPropertyTearOff&lt;SVGPoint&gt;::create(impl.mutablePointFunction()));
</del><ins>+    JSValue result = toJS&lt;IDLInterface&lt;SVGPropertyTearOff&lt;SVGPoint&gt;&gt;&gt;(*state, *castedThis-&gt;globalObject(), SVGPropertyTearOff&lt;SVGPoint&gt;::create(impl.mutablePointFunction()));
</ins><span class="cx">     return JSValue::encode(result);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -7698,7 +7593,7 @@
</span><span class="cx">     UNUSED_PARAM(state);
</span><span class="cx">     UNUSED_PARAM(throwScope);
</span><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><del>-    JSValue result = toJS(state, castedThis-&gt;globalObject(), SVGPropertyTearOff&lt;SVGPoint&gt;::create(impl.immutablePointFunction()));
</del><ins>+    JSValue result = toJS&lt;IDLInterface&lt;SVGPropertyTearOff&lt;SVGPoint&gt;&gt;&gt;(*state, *castedThis-&gt;globalObject(), SVGPropertyTearOff&lt;SVGPoint&gt;::create(impl.immutablePointFunction()));
</ins><span class="cx">     return JSValue::encode(result);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -7776,9 +7671,8 @@
</span><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     if (UNLIKELY(state-&gt;argumentCount() &lt; 1))
</span><span class="cx">         return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
</span><del>-    auto head = JSNode::toWrapped(state-&gt;uncheckedArgument(0));
-    if (UNLIKELY(!head))
-        return throwArgumentTypeError(*state, throwScope, 0, &quot;head&quot;, &quot;TestObject&quot;, &quot;variadicNodeMethod&quot;, &quot;Node&quot;);
</del><ins>+    auto head = convert&lt;IDLInterface&lt;Node&gt;&gt;(*state, state-&gt;uncheckedArgument(0), [](JSC::ExecState&amp; state, JSC::ThrowScope&amp; scope) { throwArgumentTypeError(state, scope, 0, &quot;head&quot;, &quot;TestObject&quot;, &quot;variadicNodeMethod&quot;, &quot;Node&quot;); });
+    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</ins><span class="cx">     auto tail = convertVariadicArguments&lt;IDLInterface&lt;Node&gt;&gt;(*state, 1);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</span><span class="cx">     impl.variadicNodeMethod(*head, WTFMove(tail.arguments.value()));
</span><span class="lines">@@ -7983,9 +7877,8 @@
</span><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     if (UNLIKELY(state-&gt;argumentCount() &lt; 1))
</span><span class="cx">         return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
</span><del>-    auto request = JSFetchRequest::toWrapped(state-&gt;uncheckedArgument(0));
-    if (UNLIKELY(!request))
-        return throwArgumentTypeError(*state, throwScope, 0, &quot;request&quot;, &quot;TestObject&quot;, &quot;testPromiseOverloadedFunction&quot;, &quot;FetchRequest&quot;);
</del><ins>+    auto request = convert&lt;IDLInterface&lt;FetchRequest&gt;&gt;(*state, state-&gt;uncheckedArgument(0), [](JSC::ExecState&amp; state, JSC::ThrowScope&amp; scope) { throwArgumentTypeError(state, scope, 0, &quot;request&quot;, &quot;TestObject&quot;, &quot;testPromiseOverloadedFunction&quot;, &quot;FetchRequest&quot;); });
+    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</ins><span class="cx">     impl.testPromiseOverloadedFunction(*request, WTFMove(promise));
</span><span class="cx">     return JSValue::encode(jsUndefined());
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestOverloadedConstructorscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp (208307 => 208308)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp        2016-11-02 22:12:19 UTC (rev 208307)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp        2016-11-02 22:15:14 UTC (rev 208308)
</span><span class="lines">@@ -75,10 +75,8 @@
</span><span class="cx">     ASSERT(castedThis);
</span><span class="cx">     if (UNLIKELY(state-&gt;argumentCount() &lt; 1))
</span><span class="cx">         return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
</span><del>-    auto arrayBuffer = toUnsharedArrayBuffer(state-&gt;uncheckedArgument(0));
</del><ins>+    auto arrayBuffer = convert&lt;IDLInterface&lt;ArrayBuffer&gt;&gt;(*state, state-&gt;uncheckedArgument(0), [](JSC::ExecState&amp; state, JSC::ThrowScope&amp; scope) { throwArgumentTypeError(state, scope, 0, &quot;arrayBuffer&quot;, &quot;TestOverloadedConstructors&quot;, nullptr, &quot;ArrayBuffer&quot;); });
</ins><span class="cx">     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</span><del>-    if (UNLIKELY(!arrayBuffer))
-        return throwArgumentTypeError(*state, throwScope, 0, &quot;arrayBuffer&quot;, &quot;TestOverloadedConstructors&quot;, nullptr, &quot;ArrayBuffer&quot;);
</del><span class="cx">     auto object = TestOverloadedConstructors::create(*arrayBuffer);
</span><span class="cx">     return JSValue::encode(toJSNewlyCreated(state, castedThis-&gt;globalObject(), WTFMove(object)));
</span><span class="cx"> }
</span><span class="lines">@@ -92,10 +90,8 @@
</span><span class="cx">     ASSERT(castedThis);
</span><span class="cx">     if (UNLIKELY(state-&gt;argumentCount() &lt; 1))
</span><span class="cx">         return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
</span><del>-    auto arrayBufferView = toUnsharedArrayBufferView(state-&gt;uncheckedArgument(0));
</del><ins>+    auto arrayBufferView = convert&lt;IDLInterface&lt;ArrayBufferView&gt;&gt;(*state, state-&gt;uncheckedArgument(0), [](JSC::ExecState&amp; state, JSC::ThrowScope&amp; scope) { throwArgumentTypeError(state, scope, 0, &quot;arrayBufferView&quot;, &quot;TestOverloadedConstructors&quot;, nullptr, &quot;ArrayBufferView&quot;); });
</ins><span class="cx">     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</span><del>-    if (UNLIKELY(!arrayBufferView))
-        return throwArgumentTypeError(*state, throwScope, 0, &quot;arrayBufferView&quot;, &quot;TestOverloadedConstructors&quot;, nullptr, &quot;ArrayBufferView&quot;);
</del><span class="cx">     auto object = TestOverloadedConstructors::create(*arrayBufferView);
</span><span class="cx">     return JSValue::encode(toJSNewlyCreated(state, castedThis-&gt;globalObject(), WTFMove(object)));
</span><span class="cx"> }
</span><span class="lines">@@ -109,9 +105,8 @@
</span><span class="cx">     ASSERT(castedThis);
</span><span class="cx">     if (UNLIKELY(state-&gt;argumentCount() &lt; 1))
</span><span class="cx">         return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
</span><del>-    auto blob = JSBlob::toWrapped(state-&gt;uncheckedArgument(0));
-    if (UNLIKELY(!blob))
-        return throwArgumentTypeError(*state, throwScope, 0, &quot;blob&quot;, &quot;TestOverloadedConstructors&quot;, nullptr, &quot;Blob&quot;);
</del><ins>+    auto blob = convert&lt;IDLInterface&lt;Blob&gt;&gt;(*state, state-&gt;uncheckedArgument(0), [](JSC::ExecState&amp; state, JSC::ThrowScope&amp; scope) { throwArgumentTypeError(state, scope, 0, &quot;blob&quot;, &quot;TestOverloadedConstructors&quot;, nullptr, &quot;Blob&quot;); });
+    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</ins><span class="cx">     auto object = TestOverloadedConstructors::create(*blob);
</span><span class="cx">     return JSValue::encode(toJSNewlyCreated(state, castedThis-&gt;globalObject(), WTFMove(object)));
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestOverrideBuiltinscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp (208307 => 208308)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp        2016-11-02 22:12:19 UTC (rev 208307)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp        2016-11-02 22:15:14 UTC (rev 208308)
</span><span class="lines">@@ -217,7 +217,7 @@
</span><span class="cx">         return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
</span><span class="cx">     auto name = convert&lt;IDLDOMString&gt;(*state, state-&gt;uncheckedArgument(0), StringConversionConfiguration::Normal);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</span><del>-    JSValue result = toJS(state, castedThis-&gt;globalObject(), impl.namedItem(WTFMove(name)));
</del><ins>+    JSValue result = toJS&lt;IDLInterface&lt;Node&gt;&gt;(*state, *castedThis-&gt;globalObject(), impl.namedItem(WTFMove(name)));
</ins><span class="cx">     return JSValue::encode(result);
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestSerializationcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerialization.cpp (208307 => 208308)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerialization.cpp        2016-11-02 22:12:19 UTC (rev 208307)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerialization.cpp        2016-11-02 22:15:14 UTC (rev 208308)
</span><span class="lines">@@ -192,7 +192,7 @@
</span><span class="cx">     UNUSED_PARAM(throwScope);
</span><span class="cx">     UNUSED_PARAM(state);
</span><span class="cx">     auto&amp; impl = thisObject.wrapped();
</span><del>-    JSValue result = toJS(&amp;state, thisObject.globalObject(), impl.thirdUnserializableAttribute());
</del><ins>+    JSValue result = toJS&lt;IDLInterface&lt;TestNode&gt;&gt;(state, *thisObject.globalObject(), impl.thirdUnserializableAttribute());
</ins><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -302,11 +302,8 @@
</span><span class="cx">     UNUSED_PARAM(state);
</span><span class="cx">     UNUSED_PARAM(throwScope);
</span><span class="cx">     auto&amp; impl = thisObject.wrapped();
</span><del>-    auto nativeValue = JSTestNode::toWrapped(value);
-    if (UNLIKELY(!nativeValue)) {
-        throwAttributeTypeError(state, throwScope, &quot;TestSerialization&quot;, &quot;thirdUnserializableAttribute&quot;, &quot;TestNode&quot;);
-        return false;
-    }
</del><ins>+    auto nativeValue = convert&lt;IDLInterface&lt;TestNode&gt;&gt;(state, value, [](JSC::ExecState&amp; state, JSC::ThrowScope&amp; scope) { throwAttributeTypeError(state, scope, &quot;TestSerialization&quot;, &quot;thirdUnserializableAttribute&quot;, &quot;TestNode&quot;); });
+    RETURN_IF_EXCEPTION(throwScope, false);
</ins><span class="cx">     impl.setThirdUnserializableAttribute(*nativeValue);
</span><span class="cx">     return true;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestTypedefscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp (208307 => 208308)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp        2016-11-02 22:12:19 UTC (rev 208307)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp        2016-11-02 22:15:14 UTC (rev 208308)
</span><span class="lines">@@ -686,7 +686,7 @@
</span><span class="cx">     UNUSED_PARAM(state);
</span><span class="cx">     UNUSED_PARAM(throwScope);
</span><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><del>-    JSValue result = toJS(state, castedThis-&gt;globalObject(), SVGPropertyTearOff&lt;SVGPoint&gt;::create(impl.immutablePointFunction()));
</del><ins>+    JSValue result = toJS&lt;IDLInterface&lt;SVGPropertyTearOff&lt;SVGPoint&gt;&gt;&gt;(*state, *castedThis-&gt;globalObject(), SVGPropertyTearOff&lt;SVGPoint&gt;::create(impl.immutablePointFunction()));
</ins><span class="cx">     return JSValue::encode(result);
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>