<!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>[209153] trunk/Source/WebCore</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/209153">209153</a></dd>
<dt>Author</dt> <dd>weinig@apple.com</dd>
<dt>Date</dt> <dd>2016-11-30 14:10:49 -0800 (Wed, 30 Nov 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>[WebIDL] Add support for more missing / exotic IDLTypes
https://bugs.webkit.org/show_bug.cgi?id=165156

Reviewed by Alex Christensen.

- Adds JSDOMConvert support for WebIDL's 'callback interface' and 'callback function'.
- Adds JSDOMConvert support for WebIDL extensions for SerializedScriptValue, Dictionary, 
  EventListener and XPathNSResolver (moving much of their special casing out of perl and
  into JSDOMConvert).

* DerivedSources.make:
Adds $(WebCore)/testing to the list of available IDL directories to keep internals
compiling.

* Modules/webaudio/WaveShaperNode.cpp:
* Modules/webaudio/WaveShaperNode.h:
Update to take curve by reference.

* bindings/generic/IDLTypes.h:
(WebCore::IDLWrapper):
Add helper type, IDLWrapper, which serves as a base type for all IDLTypes that are
RefCounted.

* bindings/js/JSDOMConvert.h:
(WebCore::convert):
(WebCore::Converter&lt;IDLNullable&lt;T&gt;&gt;::convert):
(WebCore::Converter&lt;IDLCallbackFunction&lt;T&gt;&gt;::convert):
(WebCore::JSConverter&lt;IDLCallbackFunction&lt;T&gt;&gt;::convert):
(WebCore::JSConverter&lt;IDLCallbackFunction&lt;T&gt;&gt;::convertNewlyCreated):
(WebCore::Converter&lt;IDLCallbackInterface&lt;T&gt;&gt;::convert):
(WebCore::JSConverter&lt;IDLCallbackInterface&lt;T&gt;&gt;::convert):
(WebCore::JSConverter&lt;IDLCallbackInterface&lt;T&gt;&gt;::convertNewlyCreated):
(WebCore::Converter&lt;IDLSerializedScriptValue&lt;T&gt;&gt;::convert):
(WebCore::JSConverter&lt;IDLSerializedScriptValue&lt;T&gt;&gt;::convert):
(WebCore::Converter&lt;IDLLegacyDictionary&lt;T&gt;&gt;::convert):
(WebCore::Converter&lt;IDLEventListener&lt;T&gt;&gt;::convert):
(WebCore::Converter&lt;IDLXPathNSResolver&lt;T&gt;&gt;::convert):
(WebCore::JSConverter&lt;IDLXPathNSResolver&lt;T&gt;&gt;::convert):
(WebCore::JSConverter&lt;IDLXPathNSResolver&lt;T&gt;&gt;::convertNewlyCreated):
Add converters for the new types. IDLSerializedScriptValue, IDLLegacyDictionary, IDLEventListener and IDLXPathNSResolver
have been templatized to avoid including their implementation classes everywhere. We can improve this in the future by
splitting JSDOMConvert up into to separate files.

* bindings/scripts/CodeGenerator.pm:
(IsBuiltinType):
(IsInterfaceType):
(IsWrapperType):
(ComputeIsCallbackInterface):
(ComputeIsCallbackFunction):
Add new predicates, IsBuiltinType and IsInterfaceType, and re-work IsWrapperType to determine all types that
have a JS wrapper (and consequently a JS{name}.h file).

* bindings/scripts/CodeGeneratorJS.pm:
(AddToIncludesForIDLType):
Update to add include for EventListener.

(GetArgumentExceptionFunction):
(GetArgumentExceptionThrower):
(GetAttributeExceptionFunction):
(GetAttributeExceptionThrower):
Add support for exceptions for callbacks.

(PassArgumentExpression):
Factor out logic on how to pass arguments to C++.

(GenerateHeader):
Make toWrapped and JSDOMWrapperConverterTraits work with XPathNSResolver.

(GenerateImplementation):
Update to use PassArgumentExpression and pass a global object reference to JSValueToNative.

(GenerateParametersCheck):
Remove special casing for callbacks.

(GenerateCallbackHeaderContent):
(GenerateCallbackImplementationContent):
Simplify toJS functions. State and global object are not necessary.

(GetBaseIDLType):
Add support for new types. Add assertion so that unknown types can't get through.

(ShouldPassArgumentByReference):
Rename from ShouldPassWrapperByReference, and merge in CodeGenerator's ShouldPassWrapperByReference.

(JSValueToNativeDOMConvertNeedsThisObject):
Added. Predicate to determine types that need a this object for conversion.

(JSValueToNativeDOMConvertNeedsGlobalObject):
Added. Predicate to determine types that need a global object for conversion.

(JSValueToNative):
Remove special cases for new types.

(NativeToJSValueDOMConvertNeedsState):
Add SerializedScriptValue and XPathNSResolver.

(NativeToJSValueDOMConvertNeedsGlobalObject):
Add SerializedScriptValue and XPathNSResolver.

(NativeToJSValueUsingReferences):
(NativeToJSValueUsingPointers):
(NativeToJSValue):
Remove unused $statePointer and replace $globalObject with $globalObjectReference. Remove
special cases for new types.

(GenerateConstructorDefinition):
Use PassArgumentExpression.

* bindings/scripts/test/JS/JSTestCallbackFunction.cpp:
* bindings/scripts/test/JS/JSTestCallbackFunction.h:
* bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.cpp:
* bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.h:
* bindings/scripts/test/JS/JSTestCallbackInterface.cpp:
* bindings/scripts/test/JS/JSTestCallbackInterface.h:
* bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
* bindings/scripts/test/JS/JSTestObj.cpp:
* bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
* bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
* bindings/scripts/test/JS/JSTestTypedefs.cpp:
* bindings/scripts/test/TestObj.idl:
* bindings/scripts/test/TestSerializedScriptValueInterface.idl:
Update tests. Remove test for a readonly attribute returning a Promise, which is not supported
yet (this was caught by the assertion added to GetBaseIDLType). Add tests for passing and returning 
SerializedScriptValues from functions.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreDerivedSourcesmake">trunk/Source/WebCore/DerivedSources.make</a></li>
<li><a href="#trunkSourceWebCoreModuleswebaudioWaveShaperNodecpp">trunk/Source/WebCore/Modules/webaudio/WaveShaperNode.cpp</a></li>
<li><a href="#trunkSourceWebCoreModuleswebaudioWaveShaperNodeh">trunk/Source/WebCore/Modules/webaudio/WaveShaperNode.h</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="#trunkSourceWebCorebindingsscriptsCodeGeneratorpm">trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptsCodeGeneratorJSpm">trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestJSJSTestCallbackFunctioncpp">trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunction.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestJSJSTestCallbackFunctionh">trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunction.h</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestJSJSTestCallbackFunctionWithTypedefscpp">trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestJSJSTestCallbackFunctionWithTypedefsh">trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.h</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestJSJSTestCallbackInterfacecpp">trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallbackInterface.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestJSJSTestCallbackInterfaceh">trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallbackInterface.h</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestJSJSTestMediaQueryListListenercpp">trunk/Source/WebCore/bindings/scripts/test/JS/JSTestMediaQueryListListener.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="#trunkSourceWebCorebindingsscriptstestJSJSTestSerializedScriptValueInterfacecpp">trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestJSJSTestTypedefscpp">trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestTestObjidl">trunk/Source/WebCore/bindings/scripts/test/TestObj.idl</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestTestSerializedScriptValueInterfaceidl">trunk/Source/WebCore/bindings/scripts/test/TestSerializedScriptValueInterface.idl</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (209152 => 209153)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-11-30 21:42:40 UTC (rev 209152)
+++ trunk/Source/WebCore/ChangeLog        2016-11-30 22:10:49 UTC (rev 209153)
</span><span class="lines">@@ -1,3 +1,130 @@
</span><ins>+2016-11-29  Sam Weinig  &lt;sam@webkit.org&gt;
+
+        [WebIDL] Add support for more missing / exotic IDLTypes
+        https://bugs.webkit.org/show_bug.cgi?id=165156
+
+        Reviewed by Alex Christensen.
+
+        - Adds JSDOMConvert support for WebIDL's 'callback interface' and 'callback function'.
+        - Adds JSDOMConvert support for WebIDL extensions for SerializedScriptValue, Dictionary, 
+          EventListener and XPathNSResolver (moving much of their special casing out of perl and
+          into JSDOMConvert).
+
+        * DerivedSources.make:
+        Adds $(WebCore)/testing to the list of available IDL directories to keep internals
+        compiling.
+
+        * Modules/webaudio/WaveShaperNode.cpp:
+        * Modules/webaudio/WaveShaperNode.h:
+        Update to take curve by reference.
+
+        * bindings/generic/IDLTypes.h:
+        (WebCore::IDLWrapper):
+        Add helper type, IDLWrapper, which serves as a base type for all IDLTypes that are
+        RefCounted.
+
+        * bindings/js/JSDOMConvert.h:
+        (WebCore::convert):
+        (WebCore::Converter&lt;IDLNullable&lt;T&gt;&gt;::convert):
+        (WebCore::Converter&lt;IDLCallbackFunction&lt;T&gt;&gt;::convert):
+        (WebCore::JSConverter&lt;IDLCallbackFunction&lt;T&gt;&gt;::convert):
+        (WebCore::JSConverter&lt;IDLCallbackFunction&lt;T&gt;&gt;::convertNewlyCreated):
+        (WebCore::Converter&lt;IDLCallbackInterface&lt;T&gt;&gt;::convert):
+        (WebCore::JSConverter&lt;IDLCallbackInterface&lt;T&gt;&gt;::convert):
+        (WebCore::JSConverter&lt;IDLCallbackInterface&lt;T&gt;&gt;::convertNewlyCreated):
+        (WebCore::Converter&lt;IDLSerializedScriptValue&lt;T&gt;&gt;::convert):
+        (WebCore::JSConverter&lt;IDLSerializedScriptValue&lt;T&gt;&gt;::convert):
+        (WebCore::Converter&lt;IDLLegacyDictionary&lt;T&gt;&gt;::convert):
+        (WebCore::Converter&lt;IDLEventListener&lt;T&gt;&gt;::convert):
+        (WebCore::Converter&lt;IDLXPathNSResolver&lt;T&gt;&gt;::convert):
+        (WebCore::JSConverter&lt;IDLXPathNSResolver&lt;T&gt;&gt;::convert):
+        (WebCore::JSConverter&lt;IDLXPathNSResolver&lt;T&gt;&gt;::convertNewlyCreated):
+        Add converters for the new types. IDLSerializedScriptValue, IDLLegacyDictionary, IDLEventListener and IDLXPathNSResolver
+        have been templatized to avoid including their implementation classes everywhere. We can improve this in the future by
+        splitting JSDOMConvert up into to separate files.
+
+        * bindings/scripts/CodeGenerator.pm:
+        (IsBuiltinType):
+        (IsInterfaceType):
+        (IsWrapperType):
+        (ComputeIsCallbackInterface):
+        (ComputeIsCallbackFunction):
+        Add new predicates, IsBuiltinType and IsInterfaceType, and re-work IsWrapperType to determine all types that
+        have a JS wrapper (and consequently a JS{name}.h file).
+
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (AddToIncludesForIDLType):
+        Update to add include for EventListener.
+
+        (GetArgumentExceptionFunction):
+        (GetArgumentExceptionThrower):
+        (GetAttributeExceptionFunction):
+        (GetAttributeExceptionThrower):
+        Add support for exceptions for callbacks.
+
+        (PassArgumentExpression):
+        Factor out logic on how to pass arguments to C++.
+
+        (GenerateHeader):
+        Make toWrapped and JSDOMWrapperConverterTraits work with XPathNSResolver.
+
+        (GenerateImplementation):
+        Update to use PassArgumentExpression and pass a global object reference to JSValueToNative.
+
+        (GenerateParametersCheck):
+        Remove special casing for callbacks.
+
+        (GenerateCallbackHeaderContent):
+        (GenerateCallbackImplementationContent):
+        Simplify toJS functions. State and global object are not necessary.
+
+        (GetBaseIDLType):
+        Add support for new types. Add assertion so that unknown types can't get through.
+
+        (ShouldPassArgumentByReference):
+        Rename from ShouldPassWrapperByReference, and merge in CodeGenerator's ShouldPassWrapperByReference.
+
+        (JSValueToNativeDOMConvertNeedsThisObject):
+        Added. Predicate to determine types that need a this object for conversion.
+
+        (JSValueToNativeDOMConvertNeedsGlobalObject):
+        Added. Predicate to determine types that need a global object for conversion.
+
+        (JSValueToNative):
+        Remove special cases for new types.
+
+        (NativeToJSValueDOMConvertNeedsState):
+        Add SerializedScriptValue and XPathNSResolver.
+
+        (NativeToJSValueDOMConvertNeedsGlobalObject):
+        Add SerializedScriptValue and XPathNSResolver.
+
+        (NativeToJSValueUsingReferences):
+        (NativeToJSValueUsingPointers):
+        (NativeToJSValue):
+        Remove unused $statePointer and replace $globalObject with $globalObjectReference. Remove
+        special cases for new types.
+
+        (GenerateConstructorDefinition):
+        Use PassArgumentExpression.
+
+        * bindings/scripts/test/JS/JSTestCallbackFunction.cpp:
+        * bindings/scripts/test/JS/JSTestCallbackFunction.h:
+        * bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.cpp:
+        * bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.h:
+        * bindings/scripts/test/JS/JSTestCallbackInterface.cpp:
+        * bindings/scripts/test/JS/JSTestCallbackInterface.h:
+        * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
+        * bindings/scripts/test/JS/JSTestObj.cpp:
+        * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
+        * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
+        * bindings/scripts/test/JS/JSTestTypedefs.cpp:
+        * bindings/scripts/test/TestObj.idl:
+        * bindings/scripts/test/TestSerializedScriptValueInterface.idl:
+        Update tests. Remove test for a readonly attribute returning a Promise, which is not supported
+        yet (this was caught by the assertion added to GetBaseIDLType). Add tests for passing and returning 
+        SerializedScriptValues from functions.
+
</ins><span class="cx"> 2016-11-30  Jiewen Tan  &lt;jiewen_tan@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Update SubtleCrypto::verify to match the latest spec
</span></span></pre></div>
<a id="trunkSourceWebCoreDerivedSourcesmake"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/DerivedSources.make (209152 => 209153)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/DerivedSources.make        2016-11-30 21:42:40 UTC (rev 209152)
+++ trunk/Source/WebCore/DerivedSources.make        2016-11-30 22:10:49 UTC (rev 209153)
</span><span class="lines">@@ -1290,6 +1290,7 @@
</span><span class="cx">     $(WebCore)/plugins \
</span><span class="cx">     $(WebCore)/storage \
</span><span class="cx">     $(WebCore)/svg \
</span><ins>+    $(WebCore)/testing \
</ins><span class="cx">     $(WebCore)/workers \
</span><span class="cx">     $(WebCore)/xml
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebaudioWaveShaperNodecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webaudio/WaveShaperNode.cpp (209152 => 209153)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webaudio/WaveShaperNode.cpp        2016-11-30 21:42:40 UTC (rev 209152)
+++ trunk/Source/WebCore/Modules/webaudio/WaveShaperNode.cpp        2016-11-30 22:10:49 UTC (rev 209153)
</span><span class="lines">@@ -41,10 +41,10 @@
</span><span class="cx">     initialize();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WaveShaperNode::setCurve(Float32Array* curve)
</del><ins>+void WaveShaperNode::setCurve(Float32Array&amp; curve)
</ins><span class="cx"> {
</span><span class="cx">     ASSERT(isMainThread()); 
</span><del>-    waveShaperProcessor()-&gt;setCurve(curve);
</del><ins>+    waveShaperProcessor()-&gt;setCurve(&amp;curve);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> Float32Array* WaveShaperNode::curve()
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebaudioWaveShaperNodeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webaudio/WaveShaperNode.h (209152 => 209153)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webaudio/WaveShaperNode.h        2016-11-30 21:42:40 UTC (rev 209152)
+++ trunk/Source/WebCore/Modules/webaudio/WaveShaperNode.h        2016-11-30 22:10:49 UTC (rev 209153)
</span><span class="lines">@@ -38,7 +38,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     // setCurve() is called on the main thread.
</span><del>-    void setCurve(Float32Array*);
</del><ins>+    void setCurve(Float32Array&amp;);
</ins><span class="cx">     Float32Array* curve();
</span><span class="cx"> 
</span><span class="cx">     enum class OverSampleType { None, _2x, _4x };
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsgenericIDLTypesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/generic/IDLTypes.h (209152 => 209153)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/generic/IDLTypes.h        2016-11-30 21:42:40 UTC (rev 209152)
+++ trunk/Source/WebCore/bindings/generic/IDLTypes.h        2016-11-30 22:10:49 UTC (rev 209153)
</span><span class="lines">@@ -38,6 +38,10 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><ins>+class Dictionary;
+class EventListener;
+class XPathNSResolver;
+
</ins><span class="cx"> template &lt;typename Value&gt; class DOMPromise;
</span><span class="cx"> 
</span><span class="cx"> template&lt;typename T&gt;
</span><span class="lines">@@ -92,18 +96,21 @@
</span><span class="cx"> 
</span><span class="cx"> struct IDLObject : IDLUnsupportedType { };
</span><span class="cx"> 
</span><del>-template&lt;typename T&gt; struct IDLInterface : IDLType&lt;RefPtr&lt;T&gt;&gt; {
</del><ins>+template&lt;typename T&gt; struct IDLWrapper : IDLType&lt;RefPtr&lt;T&gt;&gt; {
</ins><span class="cx">     using RawType = T;
</span><ins>+    using NullableType = RefPtr&lt;T&gt;;
</ins><span class="cx"> 
</span><del>-    using NullableType = RefPtr&lt;T&gt;;
-    static std::nullptr_t nullValue() { return nullptr; }
-    static bool isNullValue(const RefPtr&lt;T&gt;&amp; value) { return !value; }
-    template &lt;typename U&gt; static U&amp;&amp; extractValueFromNullable(U&amp;&amp; value) { return std::forward&lt;U&gt;(value); }
</del><ins>+    static inline std::nullptr_t nullValue() { return nullptr; }
+    template&lt;typename U&gt; static inline bool isNullValue(U&amp;&amp; value) { return !value; }
+    template&lt;typename U&gt; static inline U&amp;&amp; extractValueFromNullable(U&amp;&amp; value) { return std::forward&lt;U&gt;(value); }
</ins><span class="cx"> };
</span><span class="cx"> 
</span><ins>+template&lt;typename T&gt; struct IDLInterface : IDLWrapper&lt;T&gt; { };
+template&lt;typename T&gt; struct IDLCallbackInterface : IDLWrapper&lt;T&gt; { };
+template&lt;typename T&gt; struct IDLCallbackFunction : IDLWrapper&lt;T&gt; { };
+
</ins><span class="cx"> template&lt;typename T&gt; struct IDLDictionary : IDLType&lt;T&gt; { };
</span><span class="cx"> template&lt;typename T&gt; struct IDLEnumeration : IDLType&lt;T&gt; { };
</span><del>-template&lt;typename T&gt; struct IDLCallbackFunction : IDLUnsupportedType { };
</del><span class="cx"> 
</span><span class="cx"> template&lt;typename T&gt; struct IDLNullable : IDLType&lt;typename T::NullableType&gt; {
</span><span class="cx">     using InnerType = T;
</span><span class="lines">@@ -143,8 +150,17 @@
</span><span class="cx">     static double extractValueFromNullable(double value) { return value; }
</span><span class="cx"> };
</span><span class="cx"> 
</span><ins>+template&lt;typename T&gt; struct IDLSerializedScriptValue : IDLWrapper&lt;T&gt; { };
+template&lt;typename T&gt; struct IDLLegacyDictionary : IDLType&lt;T&gt; { };
+template&lt;typename T&gt; struct IDLEventListener : IDLWrapper&lt;T&gt; { };
+template&lt;typename T&gt; struct IDLXPathNSResolver : IDLWrapper&lt;T&gt; { };
+
+
+// Non-WebIDL convenience type aliases
+
</ins><span class="cx"> using IDLBufferSource = IDLUnion&lt;IDLInterface&lt;JSC::ArrayBufferView&gt;, IDLInterface&lt;JSC::ArrayBuffer&gt;&gt;;
</span><span class="cx"> 
</span><ins>+
</ins><span class="cx"> // Helper predicates
</span><span class="cx"> 
</span><span class="cx"> template&lt;typename T&gt;
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSDOMConverth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSDOMConvert.h (209152 => 209153)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSDOMConvert.h        2016-11-30 21:42:40 UTC (rev 209152)
+++ trunk/Source/WebCore/bindings/js/JSDOMConvert.h        2016-11-30 22:10:49 UTC (rev 209153)
</span><span class="lines">@@ -45,9 +45,13 @@
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> template&lt;typename T&gt; typename Converter&lt;T&gt;::ReturnType convert(JSC::ExecState&amp;, JSC::JSValue);
</span><ins>+template&lt;typename T&gt; typename Converter&lt;T&gt;::ReturnType convert(JSC::ExecState&amp;, JSC::JSValue, JSC::JSObject&amp;);
+template&lt;typename T&gt; typename Converter&lt;T&gt;::ReturnType convert(JSC::ExecState&amp;, JSC::JSValue, JSDOMGlobalObject&amp;);
</ins><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><span class="cx"> template&lt;typename T, typename ExceptionThrower&gt; typename Converter&lt;T&gt;::ReturnType convert(JSC::ExecState&amp;, JSC::JSValue, ExceptionThrower&amp;&amp;);
</span><ins>+template&lt;typename T, typename ExceptionThrower&gt; typename Converter&lt;T&gt;::ReturnType convert(JSC::ExecState&amp;, JSC::JSValue, JSC::JSObject&amp;, ExceptionThrower&amp;&amp;);
+template&lt;typename T, typename ExceptionThrower&gt; typename Converter&lt;T&gt;::ReturnType convert(JSC::ExecState&amp;, JSC::JSValue, JSDOMGlobalObject&amp;, 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">@@ -62,6 +66,16 @@
</span><span class="cx">     return Converter&lt;T&gt;::convert(state, value);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+template&lt;typename T&gt; inline typename Converter&lt;T&gt;::ReturnType convert(JSC::ExecState&amp; state, JSC::JSValue value, JSC::JSObject&amp; thisObject)
+{
+    return Converter&lt;T&gt;::convert(state, value, thisObject);
+}
+
+template&lt;typename T&gt; inline typename Converter&lt;T&gt;::ReturnType convert(JSC::ExecState&amp; state, JSC::JSValue value, JSDOMGlobalObject&amp; globalObject)
+{
+    return Converter&lt;T&gt;::convert(state, value, globalObject);
+}
+
</ins><span class="cx"> template&lt;typename T&gt; inline typename Converter&lt;T&gt;::ReturnType convert(JSC::ExecState&amp; state, JSC::JSValue value, IntegerConversionConfiguration configuration)
</span><span class="cx"> {
</span><span class="cx">     return Converter&lt;T&gt;::convert(state, value, configuration);
</span><span class="lines">@@ -77,6 +91,16 @@
</span><span class="cx">     return Converter&lt;T&gt;::convert(state, value, std::forward&lt;ExceptionThrower&gt;(exceptionThrower));
</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, JSC::JSObject&amp; thisObject, ExceptionThrower&amp;&amp; exceptionThrower)
+{
+    return Converter&lt;T&gt;::convert(state, value, thisObject, std::forward&lt;ExceptionThrower&gt;(exceptionThrower));
+}
+
+template&lt;typename T, typename ExceptionThrower&gt; inline typename Converter&lt;T&gt;::ReturnType convert(JSC::ExecState&amp; state, JSC::JSValue value, JSDOMGlobalObject&amp; globalObject, ExceptionThrower&amp;&amp; exceptionThrower)
+{
+    return Converter&lt;T&gt;::convert(state, value, globalObject, 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">@@ -221,6 +245,18 @@
</span><span class="cx">             return T::nullValue();
</span><span class="cx">         return Converter&lt;T&gt;::convert(state, value);
</span><span class="cx">     }
</span><ins>+    static ReturnType convert(JSC::ExecState&amp; state, JSC::JSValue value, JSC::JSObject&amp; thisObject)
+    {
+        if (value.isUndefinedOrNull())
+            return T::nullValue();
+        return Converter&lt;T&gt;::convert(state, value, thisObject);
+    }
+    static ReturnType convert(JSC::ExecState&amp; state, JSC::JSValue value, JSDOMGlobalObject&amp; globalObject)
+    {
+        if (value.isUndefinedOrNull())
+            return T::nullValue();
+        return Converter&lt;T&gt;::convert(state, value, globalObject);
+    }
</ins><span class="cx">     static ReturnType convert(JSC::ExecState&amp; state, JSC::JSValue value, IntegerConversionConfiguration configuration)
</span><span class="cx">     {
</span><span class="cx">         if (value.isUndefinedOrNull())
</span><span class="lines">@@ -233,7 +269,6 @@
</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><del>-
</del><span class="cx">     template&lt;typename ExceptionThrower = DefaultExceptionThrower&gt;
</span><span class="cx">     static ReturnType convert(JSC::ExecState&amp; state, JSC::JSValue value, ExceptionThrower&amp;&amp; exceptionThrower)
</span><span class="cx">     {
</span><span class="lines">@@ -241,6 +276,20 @@
</span><span class="cx">             return T::nullValue();
</span><span class="cx">         return Converter&lt;T&gt;::convert(state, value, std::forward&lt;ExceptionThrower&gt;(exceptionThrower));
</span><span class="cx">     }
</span><ins>+    template&lt;typename ExceptionThrower = DefaultExceptionThrower&gt;
+    static ReturnType convert(JSC::ExecState&amp; state, JSC::JSValue value, JSC::JSObject&amp; thisObject, ExceptionThrower&amp;&amp; exceptionThrower)
+    {
+        if (value.isUndefinedOrNull())
+            return T::nullValue();
+        return Converter&lt;T&gt;::convert(state, value, thisObject, std::forward&lt;ExceptionThrower&gt;(exceptionThrower));
+    }
+    template&lt;typename ExceptionThrower = DefaultExceptionThrower&gt;
+    static ReturnType convert(JSC::ExecState&amp; state, JSC::JSValue value, JSDOMGlobalObject&amp; globalObject, ExceptionThrower&amp;&amp; exceptionThrower)
+    {
+        if (value.isUndefinedOrNull())
+            return T::nullValue();
+        return Converter&lt;T&gt;::convert(state, value, globalObject, 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">@@ -1019,6 +1068,78 @@
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> // MARK: -
</span><ins>+// MARK: Callback function type
+
+template&lt;typename T&gt; struct Converter&lt;IDLCallbackFunction&lt;T&gt;&gt; : DefaultConverter&lt;IDLCallbackFunction&lt;T&gt;&gt; {
+    template&lt;typename ExceptionThrower = DefaultExceptionThrower&gt;
+    static RefPtr&lt;T&gt; convert(JSC::ExecState&amp; state, JSC::JSValue value, JSDOMGlobalObject&amp; globalObject, ExceptionThrower&amp;&amp; exceptionThrower = ExceptionThrower())
+    {
+        JSC::VM&amp; vm = state.vm();
+        auto scope = DECLARE_THROW_SCOPE(vm);
+
+        if (!value.isFunction()) {
+            exceptionThrower(state, scope);
+            return nullptr;
+        }
+        
+        return T::create(JSC::asObject(value), &amp;globalObject);
+    }
+};
+
+template&lt;typename T&gt; struct JSConverter&lt;IDLCallbackFunction&lt;T&gt;&gt; {
+    static constexpr bool needsState = false;
+    static constexpr bool needsGlobalObject = false;
+
+    template &lt;typename U&gt;
+    static JSC::JSValue convert(const U&amp; value)
+    {
+        return toJS(Detail::getPtrOrRef(value));
+    }
+
+    template&lt;typename U&gt;
+    static JSC::JSValue convertNewlyCreated(U&amp;&amp; value)
+    {
+        return toJSNewlyCreated(std::forward&lt;U&gt;(value));
+    }
+};
+
+// MARK: -
+// MARK: Callback interface type
+
+template&lt;typename T&gt; struct Converter&lt;IDLCallbackInterface&lt;T&gt;&gt; : DefaultConverter&lt;IDLCallbackInterface&lt;T&gt;&gt; {
+    template&lt;typename ExceptionThrower = DefaultExceptionThrower&gt;
+    static RefPtr&lt;T&gt; convert(JSC::ExecState&amp; state, JSC::JSValue value, JSDOMGlobalObject&amp; globalObject, ExceptionThrower&amp;&amp; exceptionThrower = ExceptionThrower())
+    {
+        JSC::VM&amp; vm = state.vm();
+        auto scope = DECLARE_THROW_SCOPE(vm);
+
+        if (!value.isObject()) {
+            exceptionThrower(state, scope);
+            return nullptr;
+        }
+
+        return T::create(JSC::asObject(value), &amp;globalObject);
+    }
+};
+
+template&lt;typename T&gt; struct JSConverter&lt;IDLCallbackInterface&lt;T&gt;&gt; {
+    static constexpr bool needsState = false;
+    static constexpr bool needsGlobalObject = false;
+
+    template &lt;typename U&gt;
+    static JSC::JSValue convert(const U&amp; value)
+    {
+        return toJS(Detail::getPtrOrRef(value));
+    }
+
+    template&lt;typename U&gt;
+    static JSC::JSValue convertNewlyCreated(U&amp;&amp; value)
+    {
+        return toJSNewlyCreated(std::forward&lt;U&gt;(value));
+    }
+};
+
+// MARK: -
</ins><span class="cx"> // MARK: Union type
</span><span class="cx"> 
</span><span class="cx"> template&lt;typename ReturnType, typename T, bool enabled&gt;
</span><span class="lines">@@ -1292,6 +1413,92 @@
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> // MARK: -
</span><ins>+// MARK: SerializedScriptValue type
+
+template&lt;typename T&gt; struct Converter&lt;IDLSerializedScriptValue&lt;T&gt;&gt; : DefaultConverter&lt;IDLSerializedScriptValue&lt;T&gt;&gt; {
+    static RefPtr&lt;T&gt; convert(JSC::ExecState&amp; state, JSC::JSValue value)
+    {
+        return T::create(state, value);
+    }
+};
+
+template&lt;typename T&gt; struct JSConverter&lt;IDLSerializedScriptValue&lt;T&gt;&gt; {
+    static constexpr bool needsState = true;
+    static constexpr bool needsGlobalObject = true;
+
+    static JSC::JSValue convert(JSC::ExecState&amp; state, JSDOMGlobalObject&amp; globalObject, RefPtr&lt;T&gt; value)
+    {
+        return value ? value-&gt;deserialize(state, &amp;globalObject) : JSC::jsNull();
+    }
+};
+
+// MARK: -
+// MARK: Legacy dictionary type
+
+template&lt;typename T&gt; struct Converter&lt;IDLLegacyDictionary&lt;T&gt;&gt; : DefaultConverter&lt;IDLLegacyDictionary&lt;T&gt;&gt; {
+    using ReturnType = T;
+
+    static ReturnType convert(JSC::ExecState&amp; state, JSC::JSValue value)
+    {
+        return T(&amp;state, value);
+    }
+};
+
+// MARK: -
+// MARK: Event Listener type
+
+template&lt;typename T&gt; struct Converter&lt;IDLEventListener&lt;T&gt;&gt; : DefaultConverter&lt;IDLEventListener&lt;T&gt;&gt; {
+    using ReturnType = RefPtr&lt;T&gt;;
+
+    static ReturnType convert(JSC::ExecState&amp; state, JSC::JSValue value, JSC::JSObject&amp; thisObject)
+    {
+        auto scope = DECLARE_THROW_SCOPE(state.vm());
+
+        auto listener = T::create(value, thisObject, false, currentWorld(&amp;state));
+        if (!listener)
+            throwTypeError(&amp;state, scope);
+    
+        return listener;
+    }
+};
+
+// MARK: -
+// MARK: XPathNSResolver type
+
+template&lt;typename T&gt; struct Converter&lt;IDLXPathNSResolver&lt;T&gt;&gt; : DefaultConverter&lt;IDLXPathNSResolver&lt;T&gt;&gt; {
+    using ReturnType = RefPtr&lt;T&gt;;
+    using WrapperType = typename JSDOMWrapperConverterTraits&lt;T&gt;::WrapperClass;
+
+    template&lt;typename ExceptionThrower = DefaultExceptionThrower&gt;
+    static ReturnType convert(JSC::ExecState&amp; state, JSC::JSValue value, ExceptionThrower&amp;&amp; exceptionThrower = ExceptionThrower())
+    {
+        JSC::VM&amp; vm = state.vm();
+        auto scope = DECLARE_THROW_SCOPE(vm);
+        ReturnType object = WrapperType::toWrapped(state, value);
+        if (UNLIKELY(!object))
+            exceptionThrower(state, scope);
+        return object;
+    }
+};
+
+template&lt;typename T&gt; struct JSConverter&lt;IDLXPathNSResolver&lt;T&gt;&gt; {
+    static constexpr bool needsState = true;
+    static constexpr bool needsGlobalObject = true;
+
+    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));
+    }
+
+    template&lt;typename U&gt;
+    static JSC::JSValue convertNewlyCreated(JSC::ExecState&amp; state, JSDOMGlobalObject&amp; globalObject, U&amp;&amp; value)
+    {
+        return toJSNewlyCreated(&amp;state, &amp;globalObject, std::forward&lt;U&gt;(value));
+    }
+};
+
+// MARK: -
</ins><span class="cx"> // MARK: Support for variadic tail convertions
</span><span class="cx"> 
</span><span class="cx"> namespace Detail {
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptsCodeGeneratorpm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm (209152 => 209153)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm        2016-11-30 21:42:40 UTC (rev 209152)
+++ trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm        2016-11-30 22:10:49 UTC (rev 209153)
</span><span class="lines">@@ -91,12 +91,6 @@
</span><span class="cx">     &quot;Date&quot; =&gt; 1
</span><span class="cx"> );
</span><span class="cx"> 
</span><del>-# WebCore types used directly in IDL files.
-my %webCoreTypeHash = (
-    &quot;Dictionary&quot; =&gt; 1,
-    &quot;SerializedScriptValue&quot; =&gt; 1,
-);
-
</del><span class="cx"> my %dictionaryTypeImplementationNameOverrides = ();
</span><span class="cx"> my %enumTypeImplementationNameOverrides = ();
</span><span class="cx"> 
</span><span class="lines">@@ -855,20 +849,54 @@
</span><span class="cx">     return ($functionName, $contentAttributeName);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-sub IsWrapperType
</del><ins>+sub IsBuiltinType
</ins><span class="cx"> {
</span><span class="cx">     my ($object, $type) = @_;
</span><span class="cx"> 
</span><span class="cx">     assert(&quot;Not a type&quot;) if ref($type) ne &quot;IDLType&quot;;
</span><span class="cx"> 
</span><del>-    return 0 if !$object-&gt;IsRefPtrType($type);
-    return 0 if $object-&gt;IsTypedArrayType($type);
-    return 0 if $type-&gt;name eq &quot;BufferSource&quot;;
-    return 0 if $webCoreTypeHash{$type-&gt;name};
</del><ins>+    return 1 if $object-&gt;IsPrimitiveType($type);
+    return 1 if $object-&gt;IsSequenceOrFrozenArrayType($type);
+    return 1 if $object-&gt;IsRecordType($type);
+    return 1 if $object-&gt;IsStringType($type);
+    return 1 if $object-&gt;IsTypedArrayType($type);
+    return 1 if $type-&gt;isUnion;
+    return 1 if $type-&gt;name eq &quot;any&quot;;
+    return 1 if $type-&gt;name eq &quot;BufferSource&quot;;
+    return 1 if $type-&gt;name eq &quot;Promise&quot;;
+    return 1 if $type-&gt;name eq &quot;XPathNSResolver&quot;;    
+    return 1 if $type-&gt;name eq &quot;EventListener&quot;;    
+    return 1 if $type-&gt;name eq &quot;Dictionary&quot;;    
+    return 1 if $type-&gt;name eq &quot;SerializedScriptValue&quot;;    
</ins><span class="cx"> 
</span><ins>+    return 0;
+}
+
+sub IsInterfaceType
+{
+    my ($object, $type) = @_;
+
+    assert(&quot;Not a type&quot;) if ref($type) ne &quot;IDLType&quot;;
+
+    return 0 if $object-&gt;IsBuiltinType($type);
+    return 0 if $object-&gt;IsDictionaryType($type);
+    return 0 if $object-&gt;IsEnumType($type);
+
</ins><span class="cx">     return 1;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+sub IsWrapperType
+{
+    my ($object, $type) = @_;
+
+    assert(&quot;Not a type&quot;) if ref($type) ne &quot;IDLType&quot;;
+
+    return 1 if $object-&gt;IsInterfaceType($type);
+    return 1 if $type-&gt;name eq &quot;XPathNSResolver&quot;;
+
+    return 0;
+}
+
</ins><span class="cx"> sub GetInterfaceExtendedAttributesFromName
</span><span class="cx"> {
</span><span class="cx">     # FIXME: It's bad to have a function like this that opens another IDL file to answer a question.
</span><span class="lines">@@ -907,7 +935,7 @@
</span><span class="cx"> 
</span><span class="cx">     assert(&quot;Not a type&quot;) if ref($type) ne &quot;IDLType&quot;;
</span><span class="cx"> 
</span><del>-    return 0 unless $object-&gt;IsWrapperType($type);
</del><ins>+    return 0 unless $object-&gt;IsInterfaceType($type);
</ins><span class="cx"> 
</span><span class="cx">     my $typeName = $type-&gt;name;
</span><span class="cx">     my $idlFile = $object-&gt;IDLFileForInterface($typeName) or assert(&quot;Could NOT find IDL file for interface \&quot;$typeName\&quot;!\n&quot;);
</span><span class="lines">@@ -944,7 +972,7 @@
</span><span class="cx"> 
</span><span class="cx">     assert(&quot;Not a type&quot;) if ref($type) ne &quot;IDLType&quot;;
</span><span class="cx"> 
</span><del>-    return 0 unless $object-&gt;IsWrapperType($type);
</del><ins>+    return 0 unless $object-&gt;IsInterfaceType($type);
</ins><span class="cx"> 
</span><span class="cx">     my $typeName = $type-&gt;name;
</span><span class="cx">     my $idlFile = $object-&gt;IDLFileForInterface($typeName) or assert(&quot;Could NOT find IDL file for interface \&quot;$typeName\&quot;!\n&quot;);
</span><span class="lines">@@ -1092,14 +1120,5 @@
</span><span class="cx">     return $found;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-sub ShouldPassWrapperByReference
-{
-    my ($object, $argument) = @_;
</del><span class="cx"> 
</span><del>-    return 0 if $argument-&gt;type-&gt;isNullable;
-    return 0 if !$object-&gt;IsWrapperType($argument-&gt;type) &amp;&amp; !$object-&gt;IsTypedArrayType($argument-&gt;type);
-
-    return 1;
-}
-
</del><span class="cx"> 1;
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptsCodeGeneratorJSpm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (209152 => 209153)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2016-11-30 21:42:40 UTC (rev 209152)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2016-11-30 22:10:49 UTC (rev 209153)
</span><span class="lines">@@ -278,7 +278,6 @@
</span><span class="cx">     return if $codeGenerator-&gt;IsPrimitiveType($type);
</span><span class="cx">     return if $codeGenerator-&gt;IsStringType($type);
</span><span class="cx">     return if $codeGenerator-&gt;IsTypedArrayType($type);
</span><del>-    return if $type-&gt;name eq &quot;BufferSource&quot;;
</del><span class="cx">     return if $type-&gt;name eq &quot;any&quot;;
</span><span class="cx"> 
</span><span class="cx">     if ($type-&gt;isUnion) {
</span><span class="lines">@@ -304,7 +303,7 @@
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if ($codeGenerator-&gt;IsWrapperType($type) || $codeGenerator-&gt;IsExternalDictionaryType($type) || $codeGenerator-&gt;IsExternalEnumType($type)) {
</del><ins>+    if ($codeGenerator-&gt;IsWrapperType($type) || $codeGenerator-&gt;IsExternalDictionaryType($type) || $codeGenerator-&gt;IsExternalEnumType($type) || $type-&gt;name eq &quot;EventListener&quot;) {
</ins><span class="cx">         AddToIncludes(&quot;JS&quot; . $type-&gt;name . &quot;.h&quot;, $includesRef, $conditional);
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="lines">@@ -564,30 +563,73 @@
</span><span class="cx">     return 0;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-sub GetArgumentExceptionThrower
</del><ins>+sub GetArgumentExceptionFunction
</ins><span class="cx"> {
</span><span class="cx">     my ($interface, $argument, $argumentIndex, $quotedFunctionName) = @_;
</span><span class="cx"> 
</span><del>-    return undef if !$codeGenerator-&gt;IsWrapperType($argument-&gt;type) &amp;&amp; !$codeGenerator-&gt;IsTypedArrayType($argument-&gt;type);
-
</del><span class="cx">     my $name = $argument-&gt;name;
</span><span class="cx">     my $visibleInterfaceName = $codeGenerator-&gt;GetVisibleInterfaceName($interface);
</span><span class="cx">     my $typeName = $argument-&gt;type-&gt;name;
</span><del>-    
-    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;
</del><ins>+
+    if ($codeGenerator-&gt;IsCallbackInterface($argument-&gt;type) || $codeGenerator-&gt;IsCallbackFunction($argument-&gt;type)) {
+        # FIXME: We should have specialized messages for callback interfaces vs. callback functions.
+        return &quot;throwArgumentMustBeFunctionError(state, scope, ${argumentIndex}, \&quot;${name}\&quot;, \&quot;${visibleInterfaceName}\&quot;, ${quotedFunctionName});&quot;;
+    }
+
+    if ($codeGenerator-&gt;IsWrapperType($argument-&gt;type) || $codeGenerator-&gt;IsTypedArrayType($argument-&gt;type)) {
+        return &quot;throwArgumentTypeError(state, scope, ${argumentIndex}, \&quot;${name}\&quot;, \&quot;${visibleInterfaceName}\&quot;, ${quotedFunctionName}, \&quot;${typeName}\&quot;);&quot;;
+    }
+
+    return undef;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-sub GetAttributeExceptionThrower
</del><ins>+sub GetArgumentExceptionThrower
</ins><span class="cx"> {
</span><ins>+    my ($interface, $argument, $argumentIndex, $quotedFunctionName) = @_;
+
+    my $functionCall = GetArgumentExceptionFunction($interface, $argument, $argumentIndex, $quotedFunctionName);
+    return &quot;[](JSC::ExecState&amp; state, JSC::ThrowScope&amp; scope) { &quot; . $functionCall . &quot; }&quot; if $functionCall;
+}
+
+sub GetAttributeExceptionFunction
+{
</ins><span class="cx">     my ($interface, $attribute) = @_;
</span><del>-
-    return undef if !$codeGenerator-&gt;IsWrapperType($attribute-&gt;type) &amp;&amp; !$codeGenerator-&gt;IsTypedArrayType($attribute-&gt;type);
</del><span class="cx">     
</span><span class="cx">     my $name = $attribute-&gt;name;
</span><span class="cx">     my $visibleInterfaceName = $codeGenerator-&gt;GetVisibleInterfaceName($interface);
</span><span class="cx">     my $typeName = $attribute-&gt;type-&gt;name;
</span><ins>+
+    if ($codeGenerator-&gt;IsWrapperType($attribute-&gt;type) || $codeGenerator-&gt;IsTypedArrayType($attribute-&gt;type)) {
+        return &quot;throwAttributeTypeError(state, scope, \&quot;${visibleInterfaceName}\&quot;, \&quot;${name}\&quot;, \&quot;${typeName}\&quot;);&quot;;
+    }
+}
+
+sub GetAttributeExceptionThrower
+{
+    my ($interface, $attribute) = @_;
+
+    my $functionCall = GetAttributeExceptionFunction($interface, $attribute);
+    return &quot;[](JSC::ExecState&amp; state, JSC::ThrowScope&amp; scope) { &quot; . $functionCall . &quot; }&quot; if $functionCall;
+
+}
+
+sub PassArgumentExpression
+{
+    my ($name, $context) = @_;
+
+    my $type = $context-&gt;type;
+
+    return &quot;${name}.value()&quot; if $codeGenerator-&gt;IsEnumType($type);
+    return &quot;WTFMove(${name})&quot; if $type-&gt;isNullable;
</ins><span class="cx">     
</span><del>-    return &quot;[](JSC::ExecState&amp; state, JSC::ThrowScope&amp; scope) { throwAttributeTypeError(state, scope, \&quot;${visibleInterfaceName}\&quot;, \&quot;${name}\&quot;, \&quot;${typeName}\&quot;); }&quot;
</del><ins>+    if ($codeGenerator-&gt;IsTypedArrayType($type)) {
+        return &quot;*${name}&quot; if $type-&gt;name eq &quot;ArrayBuffer&quot;;
+        return &quot;${name}.releaseNonNull()&quot;;
+    }
+
+    return &quot;${name}.releaseNonNull()&quot; if $codeGenerator-&gt;IsCallbackInterface($type) || $codeGenerator-&gt;IsCallbackFunction($type);
+    return &quot;*${name}&quot; if $codeGenerator-&gt;IsWrapperType($type);
+    return &quot;WTFMove(${name})&quot;;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> sub GetAttributeGetterName
</span><span class="lines">@@ -1429,13 +1471,15 @@
</span><span class="cx">     # JSValue to implementation type
</span><span class="cx">     if (ShouldGenerateToWrapped($hasParent, $interface)) {
</span><span class="cx">         my $nativeType = GetNativeType($interface, $interface-&gt;type);
</span><del>-        if ($interface-&gt;type-&gt;name eq &quot;XPathNSResolver&quot;) {
-            push(@headerContent, &quot;    static $nativeType toWrapped(JSC::ExecState&amp;, JSC::JSValue);\n&quot;);
-        } else {
-            my $export = &quot;&quot;;
-            $export = &quot;WEBCORE_EXPORT &quot; if $interface-&gt;extendedAttributes-&gt;{ExportToWrappedFunction};
-            push(@headerContent, &quot;    static $export$nativeType toWrapped(JSC::JSValue);\n&quot;);
-        }
</del><ins>+
+        # FIXME: Add extended attribute for this.
+        my @toWrappedArguments = ();
+        push(@toWrappedArguments, &quot;JSC::ExecState&amp;&quot;) if $interface-&gt;type-&gt;name eq &quot;XPathNSResolver&quot;;
+        push(@toWrappedArguments, &quot;JSC::JSValue&quot;);
+
+        my $export = &quot;&quot;;
+        $export = &quot;WEBCORE_EXPORT &quot; if $interface-&gt;extendedAttributes-&gt;{ExportToWrappedFunction};
+        push(@headerContent, &quot;    static $export$nativeType toWrapped(&quot; . join(&quot;, &quot;, @toWrappedArguments) . &quot;);\n&quot;);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     $headerTrailingIncludes{&quot;${className}Custom.h&quot;} = 1 if $interface-&gt;extendedAttributes-&gt;{JSCustomHeader};
</span><span class="lines">@@ -1816,7 +1860,7 @@
</span><span class="cx">     if (NeedsImplementationClass($interface)) {
</span><span class="cx">         push(@headerContent, &quot;template&lt;&gt; struct JSDOMWrapperConverterTraits&lt;${implType}&gt; {\n&quot;);
</span><span class="cx">         push(@headerContent, &quot;    using WrapperClass = ${className};\n&quot;);
</span><del>-        push(@headerContent, &quot;    using ToWrappedReturnType = ${implType}*;\n&quot;);
</del><ins>+        push(@headerContent, &quot;    using ToWrappedReturnType = &quot; . GetNativeType($interface, $interface-&gt;type) . &quot;;\n&quot;);
</ins><span class="cx">         push(@headerContent, &quot;};\n&quot;);
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -3580,9 +3624,10 @@
</span><span class="cx">                     }
</span><span class="cx">                 }
</span><span class="cx"> 
</span><ins>+                my $globalObjectReference = $attribute-&gt;isStatic ? &quot;*jsCast&lt;JSDOMGlobalObject*&gt;(state-&gt;lexicalGlobalObject())&quot; : &quot;*thisObject.globalObject()&quot;;
</ins><span class="cx">                 my $exceptionThrower = GetAttributeExceptionThrower($interface, $attribute);
</span><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;, $exceptionThrower);
</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;, $globalObjectReference, $exceptionThrower);
</ins><span class="cx"> 
</span><span class="cx">                 push(@implContent, &quot;    auto nativeValue = $nativeValue;\n&quot;);
</span><span class="cx">                 push(@implContent, &quot;    RETURN_IF_EXCEPTION(throwScope, false);\n&quot;) if $mayThrowException;
</span><span class="lines">@@ -3594,13 +3639,8 @@
</span><span class="cx"> 
</span><span class="cx">                 my ($functionName, @arguments) = $codeGenerator-&gt;SetterExpression(\%implIncludes, $interfaceName, $attribute);
</span><span class="cx"> 
</span><del>-                if ($codeGenerator-&gt;IsTypedArrayType($type) and not $type-&gt;name eq &quot;ArrayBuffer&quot;) {
-                    push(@arguments, &quot;nativeValue.get()&quot;);
-                } elsif ($codeGenerator-&gt;IsEnumType($type)) {
-                    push(@arguments, &quot;nativeValue.value()&quot;);
-                } else {
-                    push(@arguments, ShouldPassWrapperByReference($attribute, $interface) ? &quot;*nativeValue&quot; : &quot;WTFMove(nativeValue)&quot;);
-                }
</del><ins>+                push(@arguments, PassArgumentExpression(&quot;nativeValue&quot;, $attribute));
+
</ins><span class="cx">                 my $implementedBy = $attribute-&gt;extendedAttributes-&gt;{ImplementedBy};
</span><span class="cx">                 if ($implementedBy) {
</span><span class="cx">                     AddToImplIncludes(&quot;${implementedBy}.h&quot;, $attribute-&gt;extendedAttributes-&gt;{Conditional});
</span><span class="lines">@@ -3840,7 +3880,7 @@
</span><span class="cx">                     my $name = $argument-&gt;name;
</span><span class="cx">                     my $encodedName = &quot;encoded&quot; . $codeGenerator-&gt;WK_ucfirst($name);
</span><span class="cx">                     my $nativeType = GetNativeType($interface, $argument-&gt;type);
</span><del>-                    my $shouldPassByReference = ShouldPassWrapperByReference($argument, $interface);
</del><ins>+                    my $shouldPassByReference = ShouldPassArgumentByReference($argument);
</ins><span class="cx"> 
</span><span class="cx">                     if (!$shouldPassByReference &amp;&amp; ($codeGenerator-&gt;IsWrapperType($type) || $codeGenerator-&gt;IsTypedArrayType($type))) {
</span><span class="cx">                         $implIncludes{&quot;&lt;runtime/Error.h&gt;&quot;} = 1;
</span><span class="lines">@@ -4308,9 +4348,10 @@
</span><span class="cx">     my $functionName;
</span><span class="cx">     my $implementedBy = $function-&gt;extendedAttributes-&gt;{ImplementedBy};
</span><span class="cx">     my $numArguments = @{$function-&gt;arguments};
</span><ins>+    my $conditional = $function-&gt;extendedAttributes-&gt;{Conditional};
</ins><span class="cx"> 
</span><span class="cx">     if ($implementedBy) {
</span><del>-        AddToImplIncludes(&quot;${implementedBy}.h&quot;, $function-&gt;extendedAttributes-&gt;{Conditional});
</del><ins>+        AddToImplIncludes(&quot;${implementedBy}.h&quot;, $conditional);
</ins><span class="cx">         unshift(@arguments, &quot;impl&quot;) if !$function-&gt;isStatic;
</span><span class="cx">         $functionName = &quot;WebCore::${implementedBy}::${functionImplementationName}&quot;;
</span><span class="cx">     } elsif ($function-&gt;isStatic) {
</span><span class="lines">@@ -4328,7 +4369,7 @@
</span><span class="cx">         $quotedFunctionName = &quot;nullptr&quot;;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    $implIncludes{&quot;JSDOMBinding.h&quot;} = 1;
</del><ins>+    AddToImplIncludes(&quot;JSDOMBinding.h&quot;, $conditional);
</ins><span class="cx"> 
</span><span class="cx">     my $argumentIndex = 0;
</span><span class="cx">     foreach my $argument (@{$function-&gt;arguments}) {
</span><span class="lines">@@ -4358,57 +4399,21 @@
</span><span class="cx">         my $name = $argument-&gt;name;
</span><span class="cx">         my $value = $name;
</span><span class="cx"> 
</span><del>-        if ($codeGenerator-&gt;IsCallbackInterface($type) || $codeGenerator-&gt;IsCallbackFunction($type)) {
-            my $callbackClassName = GetCallbackClassName($type-&gt;name);
-            my $typeName = $type-&gt;name;
-            $implIncludes{&quot;$callbackClassName.h&quot;} = 1;
-            if ($argument-&gt;isOptional) {
-                push(@$outputArray, &quot;    RefPtr&lt;$typeName&gt; $name;\n&quot;);
-                push(@$outputArray, &quot;    if (!state-&gt;argument($argumentIndex).isUndefinedOrNull()) {\n&quot;);
-                if ($codeGenerator-&gt;IsCallbackFunction($type)) {
-                    push(@$outputArray, &quot;        if (!state-&gt;uncheckedArgument($argumentIndex).isFunction())\n&quot;);
-                } else {
-                    push(@$outputArray, &quot;        if (!state-&gt;uncheckedArgument($argumentIndex).isObject())\n&quot;);
-                }
-                push(@$outputArray, &quot;            return throwArgumentMustBeFunctionError(*state, throwScope, $argumentIndex, \&quot;$name\&quot;, \&quot;$visibleInterfaceName\&quot;, $quotedFunctionName);\n&quot;);
-                if ($function-&gt;isStatic) {
-                    AddToImplIncludes(&quot;CallbackFunction.h&quot;);
-                    push(@$outputArray, &quot;        $name = createFunctionOnlyCallback&lt;${callbackClassName}&gt;(state, jsCast&lt;JSDOMGlobalObject*&gt;(state-&gt;lexicalGlobalObject()), state-&gt;uncheckedArgument($argumentIndex));\n&quot;);
-                } else {
-                    push(@$outputArray, &quot;        $name = ${callbackClassName}::create(asObject(state-&gt;uncheckedArgument($argumentIndex)), castedThis-&gt;globalObject());\n&quot;);
-                }
-                push(@$outputArray, &quot;    }\n&quot;);
-            } else {
-                die &quot;CallbackInterface does not support Variadic arguments&quot; if $argument-&gt;isVariadic;
-                if ($codeGenerator-&gt;IsCallbackFunction($type)) {
-                    push(@$outputArray, &quot;    if (UNLIKELY(!state-&gt;uncheckedArgument($argumentIndex).isFunction()))\n&quot;);
-                } else {
-                    push(@$outputArray, &quot;    if (UNLIKELY(!state-&gt;uncheckedArgument($argumentIndex).isObject()))\n&quot;);
-                }
-                push(@$outputArray, &quot;        return throwArgumentMustBeFunctionError(*state, throwScope, $argumentIndex, \&quot;$name\&quot;, \&quot;$visibleInterfaceName\&quot;, $quotedFunctionName);\n&quot;);
-                if ($function-&gt;isStatic) {
-                    AddToImplIncludes(&quot;CallbackFunction.h&quot;);
-                    push(@$outputArray, &quot;    auto $name = createFunctionOnlyCallback&lt;${callbackClassName}&gt;(state, jsCast&lt;JSDOMGlobalObject*&gt;(state-&gt;lexicalGlobalObject()), state-&gt;uncheckedArgument($argumentIndex));\n&quot;);
-                } else {
-                    push(@$outputArray, &quot;    auto $name = ${callbackClassName}::create(asObject(state-&gt;uncheckedArgument($argumentIndex)), castedThis-&gt;globalObject());\n&quot;);
-                }
-            }
-            $value = &quot;WTFMove($name)&quot;;
-        } elsif ($argument-&gt;isVariadic) {
-            $implIncludes{&quot;JSDOMConvert.h&quot;} = 1;
-            AddToImplIncludesForIDLType($type, $function-&gt;extendedAttributes-&gt;{Conditional});
</del><ins>+        if ($argument-&gt;isVariadic) {
+            AddToImplIncludes(&quot;JSDOMConvert.h&quot;, $conditional);
+            AddToImplIncludesForIDLType($type, $conditional);
</ins><span class="cx">         
</span><del>-            my $metaType = GetIDLType($interface, $type);
-            push(@$outputArray, &quot;    auto $name = convertVariadicArguments&lt;$metaType&gt;(*state, $argumentIndex);\n&quot;);
</del><ins>+            my $IDLType = GetIDLType($interface, $type);
+
+            push(@$outputArray, &quot;    auto ${name} = convertVariadicArguments&lt;${IDLType}&gt;(*state, ${argumentIndex});\n&quot;);
</ins><span class="cx">             push(@$outputArray, &quot;    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());\n&quot;);
</span><span class="cx"> 
</span><del>-            $value = &quot;WTFMove($name.arguments.value())&quot;;
</del><ins>+            $value = &quot;WTFMove(${name}.arguments.value())&quot;;
</ins><span class="cx"> 
</span><span class="cx">         } elsif ($codeGenerator-&gt;IsEnumType($type)) {
</span><ins>+            AddToImplIncludes(&quot;&lt;runtime/Error.h&gt;&quot;, $conditional);
+
</ins><span class="cx">             my $className = GetEnumerationClassName($type, $interface);
</span><del>-
-            $implIncludes{&quot;&lt;runtime/Error.h&gt;&quot;} = 1;
-
</del><span class="cx">             my $nativeType = $className;
</span><span class="cx">             my $optionalValue = &quot;optionalValue&quot;;
</span><span class="cx">             my $defineOptionalValue = &quot;auto optionalValue&quot;;
</span><span class="lines">@@ -4476,46 +4481,20 @@
</span><span class="cx">                 # Use std::optional&lt;&gt;() for optional arguments that are missing or undefined and that do not have a default value in the IDL.
</span><span class="cx">                 $outer = &quot;state-&gt;$argumentLookupMethod($argumentIndex).isUndefined() ? std::optional&lt;$nativeType&gt;() : &quot;;
</span><span class="cx">                 $inner = &quot;state-&gt;uncheckedArgument($argumentIndex)&quot;;
</span><del>-            } 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;;
</del><span class="cx">             } else {
</span><span class="cx">                 $outer = &quot;&quot;;
</span><span class="cx">                 $inner = &quot;state-&gt;$argumentLookupMethod($argumentIndex)&quot;;
</span><span class="cx">             }
</span><span class="cx"> 
</span><ins>+            my $globalObjectReference = $function-&gt;isStatic ? &quot;*jsCast&lt;JSDOMGlobalObject*&gt;(state-&gt;lexicalGlobalObject())&quot; : &quot;*castedThis-&gt;globalObject()&quot;;
</ins><span class="cx">             my $argumentExceptionThrower = GetArgumentExceptionThrower($interface, $argument, $argumentIndex, $quotedFunctionName);
</span><del>-            my ($nativeValue, $mayThrowException) = JSValueToNative($interface, $argument, $inner, $function-&gt;extendedAttributes-&gt;{Conditional}, &quot;state&quot;, &quot;*state&quot;, &quot;&quot;, $argumentExceptionThrower);
</del><span class="cx"> 
</span><del>-            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;);
-                } else {
-                    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;);
-                }
-            } else {
-                push(@$outputArray, &quot;    auto $name = ${outer}${nativeValue};\n&quot;);
-                push(@$outputArray, &quot;    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());\n&quot;) if $mayThrowException;
-            }
</del><ins>+            my ($nativeValue, $mayThrowException) = JSValueToNative($interface, $argument, $inner, $conditional, &quot;state&quot;, &quot;*state&quot;, &quot;*castedThis&quot;, $globalObjectReference, $argumentExceptionThrower);
</ins><span class="cx"> 
</span><del>-            if (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 {
-                $value = &quot;WTFMove($name)&quot;;
-            }
</del><ins>+            push(@$outputArray, &quot;    auto $name = ${outer}${nativeValue};\n&quot;);
+            push(@$outputArray, &quot;    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());\n&quot;) if $mayThrowException;
+
+            $value = PassArgumentExpression($name, $argument);
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         push(@arguments, $value);
</span><span class="lines">@@ -4721,7 +4700,7 @@
</span><span class="cx">     push(@$contentRef, &quot;\nprivate:\n&quot;);
</span><span class="cx"> 
</span><span class="cx">     # Constructor
</span><del>-    push(@$contentRef, &quot;    $className(JSC::JSObject* callback, JSDOMGlobalObject*);\n\n&quot;);
</del><ins>+    push(@$contentRef, &quot;    ${className}(JSC::JSObject*, JSDOMGlobalObject*);\n\n&quot;);
</ins><span class="cx"> 
</span><span class="cx">     # Private members
</span><span class="cx">     push(@$contentRef, &quot;    ${callbackDataType}* m_data;\n&quot;);
</span><span class="lines">@@ -4728,8 +4707,8 @@
</span><span class="cx">     push(@$contentRef, &quot;};\n\n&quot;);
</span><span class="cx"> 
</span><span class="cx">     # toJS().
</span><del>-    push(@$contentRef, &quot;JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, ${name}&amp;);\n&quot;);
-    push(@$contentRef, &quot;inline JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, ${name}* impl) { return impl ? toJS(state, globalObject, *impl) : JSC::jsNull(); }\n\n&quot;);
</del><ins>+    push(@$contentRef, &quot;JSC::JSValue toJS(${name}&amp;);\n&quot;);
+    push(@$contentRef, &quot;inline JSC::JSValue toJS(${name}* impl) { return impl ? toJS(*impl) : JSC::jsNull(); }\n\n&quot;);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> sub GenerateCallbackImplementationContent
</span><span class="lines">@@ -4870,7 +4849,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     # toJS() implementation.
</span><del>-    push(@$contentRef, &quot;JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, ${name}&amp; impl)\n&quot;);
</del><ins>+    push(@$contentRef, &quot;JSC::JSValue toJS(${name}&amp; impl)\n&quot;);
</ins><span class="cx">     push(@$contentRef, &quot;{\n&quot;);
</span><span class="cx">     push(@$contentRef, &quot;    if (!static_cast&lt;${className}&amp;&gt;(impl).callbackData())\n&quot;);
</span><span class="cx">     push(@$contentRef, &quot;        return jsNull();\n\n&quot;);
</span><span class="lines">@@ -5141,6 +5120,12 @@
</span><span class="cx">         
</span><span class="cx">         # Non-WebIDL extensions
</span><span class="cx">         &quot;Date&quot; =&gt; &quot;IDLDate&quot;,
</span><ins>+        &quot;SerializedScriptValue&quot; =&gt; &quot;IDLSerializedScriptValue&lt;SerializedScriptValue&gt;&quot;,
+        &quot;Dictionary&quot; =&gt; &quot;IDLLegacyDictionary&lt;Dictionary&gt;&quot;,
+        &quot;EventListener&quot; =&gt; &quot;IDLEventListener&lt;JSEventListener&gt;&quot;,
+        &quot;XPathNSResolver&quot; =&gt; &quot;IDLXPathNSResolver&lt;XPathNSResolver&gt;&quot;,
+
+        # Convenience type aliases
</ins><span class="cx">         &quot;BufferSource&quot; =&gt; &quot;IDLBufferSource&quot;,
</span><span class="cx">     );
</span><span class="cx"> 
</span><span class="lines">@@ -5151,6 +5136,10 @@
</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;IDLRecord&lt;&quot; . GetIDLType($interface, @{$type-&gt;subtypes}[0]) . &quot;, &quot; . GetIDLType($interface, @{$type-&gt;subtypes}[1]) . &quot;&gt;&quot; if $codeGenerator-&gt;IsRecordType($type);
</span><span class="cx">     return &quot;IDLUnion&lt;&quot; . join(&quot;, &quot;, GetIDLUnionMemberTypes($interface, $type)) . &quot;&gt;&quot; if $type-&gt;isUnion;
</span><ins>+    return &quot;IDLCallbackFunction&lt;&quot; . GetCallbackClassName($type-&gt;name) . &quot;&gt;&quot; if $codeGenerator-&gt;IsCallbackFunction($type);
+    return &quot;IDLCallbackInterface&lt;&quot; . GetCallbackClassName($type-&gt;name) . &quot;&gt;&quot; if $codeGenerator-&gt;IsCallbackInterface($type);
+
+    assert(&quot;Unknown type '&quot; . $type-&gt;name . &quot;'.\n&quot;) unless $codeGenerator-&gt;IsInterfaceType($type) || $codeGenerator-&gt;IsTypedArrayType($type);
</ins><span class="cx">     return &quot;IDLInterface&lt;&quot; . $type-&gt;name . &quot;&gt;&quot;;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -5213,14 +5202,18 @@
</span><span class="cx">     return GetNativeType($interface, $type);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-sub ShouldPassWrapperByReference
</del><ins>+sub ShouldPassArgumentByReference
</ins><span class="cx"> {
</span><del>-    my ($parameter, $interface) = @_;
</del><ins>+    my ($argument) = @_;
</ins><span class="cx"> 
</span><del>-    return 0 if $codeGenerator-&gt;IsCallbackInterface($parameter-&gt;type) || $codeGenerator-&gt;IsCallbackFunction($parameter-&gt;type);
</del><ins>+    my $type = $argument-&gt;type;
</ins><span class="cx"> 
</span><del>-    my $nativeType = GetNativeType($interface, $parameter-&gt;type);
-    return $codeGenerator-&gt;ShouldPassWrapperByReference($parameter) &amp;&amp; (substr($nativeType, -1) eq '*' || $nativeType =~ /^RefPtr/);
</del><ins>+    return 0 if $type-&gt;isNullable;
+    return 0 if $codeGenerator-&gt;IsCallbackInterface($type);
+    return 0 if $codeGenerator-&gt;IsCallbackFunction($type);
+    return 0 if !$codeGenerator-&gt;IsWrapperType($type) &amp;&amp; !$codeGenerator-&gt;IsTypedArrayType($type);
+
+    return 1;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> sub GetIntegerConversionConfiguration
</span><span class="lines">@@ -5240,6 +5233,23 @@
</span><span class="cx">     return &quot;StringConversionConfiguration::Normal&quot;;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+sub JSValueToNativeDOMConvertNeedsThisObject
+{
+    my $type = shift;
+
+    return 1 if $type-&gt;name eq &quot;EventListener&quot;;
+    return 0;
+}
+
+sub JSValueToNativeDOMConvertNeedsGlobalObject
+{
+    my $type = shift;
+
+    return 1 if $codeGenerator-&gt;IsCallbackInterface($type);
+    return 1 if $codeGenerator-&gt;IsCallbackFunction($type);
+    return 0;
+}
+
</ins><span class="cx"> sub IsValidContextForJSValueToNative
</span><span class="cx"> {
</span><span class="cx">     my $context = shift;
</span><span class="lines">@@ -5251,7 +5261,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, $exceptionThrower) = @_;
</del><ins>+    my ($interface, $context, $value, $conditional, $statePointer, $stateReference, $thisObjectReference, $globalObjectReference, $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">@@ -5269,35 +5279,19 @@
</span><span class="cx">         return (&quot;$value.toString($statePointer)-&gt;toAtomicString($statePointer)&quot;, 1) if $context-&gt;extendedAttributes-&gt;{AtomicString};
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if ($type-&gt;name eq &quot;SerializedScriptValue&quot;) {
-        return (&quot;SerializedScriptValue::create($stateReference, $value)&quot;, 1);
-    }
-
-    if ($type-&gt;name eq &quot;Dictionary&quot;) {
-        return (&quot;Dictionary($statePointer, $value)&quot;, 0);
-    }
-
</del><span class="cx">     if ($codeGenerator-&gt;IsEnumType($type)) {
</span><span class="cx">         return (&quot;parseEnumeration&lt;&quot; . GetEnumerationClassName($type, $interface) . &quot;&gt;($stateReference, $value)&quot;, 1);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    # FIXME: EventListener should be a callback interface.
-    if ($type-&gt;name eq &quot;EventListener&quot;) {
-        return (&quot;JSEventListener::create($value, $thisObjectReference, false, currentWorld($statePointer))&quot;, 0);
-    }
-
-    # FIXME: XPathNSResolver should be a callback interface.
-    if ($type-&gt;name eq &quot;XPathNSResolver&quot;) {
-        return (&quot;JSXPathNSResolver::toWrapped($stateReference, $value)&quot;, 1);
-    }
-
</del><span class="cx">     AddToImplIncludes(&quot;JSDOMConvert.h&quot;);
</span><span class="cx"> 
</span><span class="cx">     my $IDLType = GetIDLType($interface, $type);
</span><span class="cx"> 
</span><span class="cx">     my @conversionArguments = ();
</span><del>-    push(@conversionArguments, &quot;$stateReference&quot;);
-    push(@conversionArguments, &quot;$value&quot;);
</del><ins>+    push(@conversionArguments, $stateReference);
+    push(@conversionArguments, $value);
+    push(@conversionArguments, $thisObjectReference) if JSValueToNativeDOMConvertNeedsThisObject($type);
+    push(@conversionArguments, $globalObjectReference) if JSValueToNativeDOMConvertNeedsGlobalObject($type);
</ins><span class="cx">     push(@conversionArguments, GetIntegerConversionConfiguration($context)) if $codeGenerator-&gt;IsIntegerType($type);
</span><span class="cx">     push(@conversionArguments, GetStringConversionConfiguration($context)) if $codeGenerator-&gt;IsStringType($type);
</span><span class="cx">     push(@conversionArguments, $exceptionThrower) if $exceptionThrower;
</span><span class="lines">@@ -5355,9 +5349,11 @@
</span><span class="cx">     return 1 if $codeGenerator-&gt;IsRecordType($type);
</span><span class="cx">     return 1 if $codeGenerator-&gt;IsStringType($type);
</span><span class="cx">     return 1 if $codeGenerator-&gt;IsEnumType($type);
</span><del>-    return 1 if $codeGenerator-&gt;IsWrapperType($type);
</del><ins>+    return 1 if $codeGenerator-&gt;IsInterfaceType($type);
</ins><span class="cx">     return 1 if $codeGenerator-&gt;IsTypedArrayType($type);
</span><span class="cx">     return 1 if $type-&gt;name eq &quot;Date&quot;;
</span><ins>+    return 1 if $type-&gt;name eq &quot;SerializedScriptValue&quot;;
+    return 1 if $type-&gt;name eq &quot;XPathNSResolver&quot;;
</ins><span class="cx"> 
</span><span class="cx">     return 0;
</span><span class="cx"> }
</span><span class="lines">@@ -5370,8 +5366,10 @@
</span><span class="cx">     return 1 if $type-&gt;isUnion;
</span><span class="cx">     return 1 if $codeGenerator-&gt;IsSequenceOrFrozenArrayType($type);
</span><span class="cx">     return 1 if $codeGenerator-&gt;IsRecordType($type);
</span><del>-    return 1 if $codeGenerator-&gt;IsWrapperType($type);
</del><ins>+    return 1 if $codeGenerator-&gt;IsInterfaceType($type);
</ins><span class="cx">     return 1 if $codeGenerator-&gt;IsTypedArrayType($type);
</span><ins>+    return 1 if $type-&gt;name eq &quot;SerializedScriptValue&quot;;
+    return 1 if $type-&gt;name eq &quot;XPathNSResolver&quot;;
</ins><span class="cx"> 
</span><span class="cx">     return 0;
</span><span class="cx"> }
</span><span class="lines">@@ -5379,12 +5377,11 @@
</span><span class="cx"> sub NativeToJSValueUsingReferences
</span><span class="cx"> {
</span><span class="cx">     my ($context, $inFunctionCall, $interface, $value, $thisValue) = @_;
</span><del>-    my $statePointer = &quot;&amp;state&quot;;
</del><span class="cx">     my $stateReference = &quot;state&quot;;
</span><span class="cx">     my $wrapped = &quot;$thisValue.wrapped()&quot;;
</span><del>-    my $globalObject = $thisValue ? &quot;$thisValue.globalObject()&quot; : &quot;jsCast&lt;JSDOMGlobalObject*&gt;(state.lexicalGlobalObject())&quot;;
</del><ins>+    my $globalObjectReference = $thisValue ? &quot;*$thisValue.globalObject()&quot; : &quot;*jsCast&lt;JSDOMGlobalObject*&gt;(state.lexicalGlobalObject())&quot;;
</ins><span class="cx"> 
</span><del>-    return NativeToJSValue($context, $inFunctionCall, $interface, $value, $statePointer, $stateReference, $wrapped, $globalObject);
</del><ins>+    return NativeToJSValue($context, $inFunctionCall, $interface, $value, $stateReference, $wrapped, $globalObjectReference);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> # FIXME: We should remove NativeToJSValueUsingPointers and combine NativeToJSValueUsingReferences and NativeToJSValue
</span><span class="lines">@@ -5391,12 +5388,11 @@
</span><span class="cx"> sub NativeToJSValueUsingPointers
</span><span class="cx"> {
</span><span class="cx">     my ($context, $inFunctionCall, $interface, $value, $thisValue) = @_;
</span><del>-    my $statePointer = &quot;state&quot;;
</del><span class="cx">     my $stateReference = &quot;*state&quot;;
</span><span class="cx">     my $wrapped = &quot;$thisValue-&gt;wrapped()&quot;;
</span><del>-    my $globalObject = $thisValue ? &quot;$thisValue-&gt;globalObject()&quot; : &quot;jsCast&lt;JSDOMGlobalObject*&gt;(state-&gt;lexicalGlobalObject())&quot;;
</del><ins>+    my $globalObjectReference = $thisValue ? &quot;*$thisValue-&gt;globalObject()&quot; : &quot;*jsCast&lt;JSDOMGlobalObject*&gt;(state-&gt;lexicalGlobalObject())&quot;;
</ins><span class="cx"> 
</span><del>-    return NativeToJSValue($context, $inFunctionCall, $interface, $value, $statePointer, $stateReference, $wrapped, $globalObject);
</del><ins>+    return NativeToJSValue($context, $inFunctionCall, $interface, $value, $stateReference, $wrapped, $globalObjectReference);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> sub IsValidContextForNativeToJSValue
</span><span class="lines">@@ -5408,7 +5404,7 @@
</span><span class="cx"> 
</span><span class="cx"> sub NativeToJSValue
</span><span class="cx"> {
</span><del>-    my ($context, $inFunctionCall, $interface, $value, $statePointer, $stateReference, $wrapped, $globalObject) = @_;
</del><ins>+    my ($context, $inFunctionCall, $interface, $value, $stateReference, $wrapped, $globalObjectReference) = @_;
</ins><span class="cx"> 
</span><span class="cx">     assert(&quot;Invalid context type&quot;) if !IsValidContextForNativeToJSValue($context);
</span><span class="cx"> 
</span><span class="lines">@@ -5427,28 +5423,22 @@
</span><span class="cx">         my $returnType = $context-&gt;extendedAttributes-&gt;{ImplementationReturnType};
</span><span class="cx">         if (defined $returnType and ($returnType eq &quot;IDBKeyPath&quot; or $returnType eq &quot;IDBKey&quot;)) {
</span><span class="cx">             AddToImplIncludes(&quot;IDBBindingUtilities.h&quot;, $conditional);
</span><del>-            return &quot;toJS($stateReference, *$globalObject, $value)&quot;;
</del><ins>+            return &quot;toJS($stateReference, $globalObjectReference, $value)&quot;;
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     AddToImplIncludesForIDLType($type, $conditional);
</span><ins>+    AddToImplIncludes(&quot;JSDOMConvert.h&quot;, $conditional);
</ins><span class="cx"> 
</span><del>-
-    if ($type-&gt;name eq &quot;SerializedScriptValue&quot;) {
-        return &quot;$value ? $value-&gt;deserialize($stateReference, $globalObject) : jsNull()&quot;;
-    }
-
</del><span class="cx">     $value = &quot;BindingSecurity::checkSecurityForNode($stateReference, $value)&quot; if $context-&gt;extendedAttributes-&gt;{CheckSecurityForNode};
</span><span class="cx"> 
</span><del>-    AddToImplIncludes(&quot;JSDOMConvert.h&quot;);
-
</del><span class="cx">     my $IDLType = GetIDLType($interface, $type);
</span><span class="cx"> 
</span><span class="cx">     my @conversionArguments = ();
</span><del>-    push(@conversionArguments, &quot;$stateReference&quot;) if NativeToJSValueDOMConvertNeedsState($type) || $mayThrowException;
-    push(@conversionArguments, &quot;*$globalObject&quot;) if NativeToJSValueDOMConvertNeedsGlobalObject($type);
</del><ins>+    push(@conversionArguments, $stateReference) if NativeToJSValueDOMConvertNeedsState($type) || $mayThrowException;
+    push(@conversionArguments, $globalObjectReference) if NativeToJSValueDOMConvertNeedsGlobalObject($type);
</ins><span class="cx">     push(@conversionArguments, &quot;throwScope&quot;) if $mayThrowException;
</span><del>-    push(@conversionArguments, &quot;$value&quot;);
</del><ins>+    push(@conversionArguments, $value);
</ins><span class="cx"> 
</span><span class="cx">     my $functionName = $context-&gt;extendedAttributes-&gt;{NewObject} ? &quot;toJSNewlyCreated&quot; : &quot;toJS&quot;;
</span><span class="cx"> 
</span><span class="lines">@@ -5892,11 +5882,9 @@
</span><span class="cx">             my $index = 0;
</span><span class="cx">             foreach my $argument (@{$function-&gt;arguments}) {
</span><span class="cx">                 last if $index eq $paramIndex;
</span><del>-                if (ShouldPassWrapperByReference($argument, $interface)) {
-                    push(@constructorArgList, &quot;*&quot; . $argument-&gt;name);
-                } else {
-                    push(@constructorArgList, &quot;WTFMove(&quot; . $argument-&gt;name . &quot;)&quot;);
-                }
</del><ins>+
+                push(@constructorArgList, PassArgumentExpression($argument-&gt;name, $argument));
+
</ins><span class="cx">                 $index++;
</span><span class="cx">             }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestCallbackFunctioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunction.cpp (209152 => 209153)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunction.cpp        2016-11-30 21:42:40 UTC (rev 209152)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunction.cpp        2016-11-30 22:10:49 UTC (rev 209153)
</span><span class="lines">@@ -67,7 +67,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;IDLInterface&lt;Float32Array&gt;&gt;(*state, *m_data-&gt;globalObject(), arrayParam));
</span><del>-    args.append(srzParam ? srzParam-&gt;deserialize(*state, m_data-&gt;globalObject()) : jsNull());
</del><ins>+    args.append(toJS&lt;IDLSerializedScriptValue&lt;SerializedScriptValue&gt;&gt;(*state, *m_data-&gt;globalObject(), srzParam));
</ins><span class="cx">     args.append(toJS&lt;IDLDOMString&gt;(*state, strArg));
</span><span class="cx">     args.append(toJS&lt;IDLBoolean&gt;(boolParam));
</span><span class="cx">     args.append(toJS&lt;IDLLong&gt;(longParam));
</span><span class="lines">@@ -80,7 +80,7 @@
</span><span class="cx">     return !returnedException;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, TestCallbackFunction&amp; impl)
</del><ins>+JSC::JSValue toJS(TestCallbackFunction&amp; impl)
</ins><span class="cx"> {
</span><span class="cx">     if (!static_cast&lt;JSTestCallbackFunction&amp;&gt;(impl).callbackData())
</span><span class="cx">         return jsNull();
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestCallbackFunctionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunction.h (209152 => 209153)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunction.h        2016-11-30 21:42:40 UTC (rev 209152)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunction.h        2016-11-30 22:10:49 UTC (rev 209153)
</span><span class="lines">@@ -45,13 +45,13 @@
</span><span class="cx">     virtual bool handleEvent(RefPtr&lt;Float32Array&gt; arrayParam, RefPtr&lt;SerializedScriptValue&gt;&amp;&amp; srzParam, const String&amp; strArg, bool boolParam, int32_t longParam, TestNode* testNodeParam);
</span><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    JSTestCallbackFunction(JSC::JSObject* callback, JSDOMGlobalObject*);
</del><ins>+    JSTestCallbackFunction(JSC::JSObject*, JSDOMGlobalObject*);
</ins><span class="cx"> 
</span><span class="cx">     JSCallbackDataStrong* m_data;
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, TestCallbackFunction&amp;);
-inline JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestCallbackFunction* impl) { return impl ? toJS(state, globalObject, *impl) : JSC::jsNull(); }
</del><ins>+JSC::JSValue toJS(TestCallbackFunction&amp;);
+inline JSC::JSValue toJS(TestCallbackFunction* impl) { return impl ? toJS(*impl) : JSC::jsNull(); }
</ins><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestCallbackFunctionWithTypedefscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.cpp (209152 => 209153)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.cpp        2016-11-30 21:42:40 UTC (rev 209152)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.cpp        2016-11-30 22:10:49 UTC (rev 209153)
</span><span class="lines">@@ -72,7 +72,7 @@
</span><span class="cx">     return !returnedException;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, TestCallbackFunctionWithTypedefs&amp; impl)
</del><ins>+JSC::JSValue toJS(TestCallbackFunctionWithTypedefs&amp; impl)
</ins><span class="cx"> {
</span><span class="cx">     if (!static_cast&lt;JSTestCallbackFunctionWithTypedefs&amp;&gt;(impl).callbackData())
</span><span class="cx">         return jsNull();
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestCallbackFunctionWithTypedefsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.h (209152 => 209153)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.h        2016-11-30 21:42:40 UTC (rev 209152)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.h        2016-11-30 22:10:49 UTC (rev 209153)
</span><span class="lines">@@ -43,12 +43,12 @@
</span><span class="cx">     virtual bool handleEvent(Vector&lt;int32_t&gt; sequenceArg, int32_t longArg);
</span><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    JSTestCallbackFunctionWithTypedefs(JSC::JSObject* callback, JSDOMGlobalObject*);
</del><ins>+    JSTestCallbackFunctionWithTypedefs(JSC::JSObject*, JSDOMGlobalObject*);
</ins><span class="cx"> 
</span><span class="cx">     JSCallbackDataStrong* m_data;
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, TestCallbackFunctionWithTypedefs&amp;);
-inline JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestCallbackFunctionWithTypedefs* impl) { return impl ? toJS(state, globalObject, *impl) : JSC::jsNull(); }
</del><ins>+JSC::JSValue toJS(TestCallbackFunctionWithTypedefs&amp;);
+inline JSC::JSValue toJS(TestCallbackFunctionWithTypedefs* impl) { return impl ? toJS(*impl) : JSC::jsNull(); }
</ins><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestCallbackInterfacecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallbackInterface.cpp (209152 => 209153)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallbackInterface.cpp        2016-11-30 21:42:40 UTC (rev 209152)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallbackInterface.cpp        2016-11-30 22:10:49 UTC (rev 209153)
</span><span class="lines">@@ -142,7 +142,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(srzParam ? srzParam-&gt;deserialize(*state, m_data-&gt;globalObject()) : jsNull());
</del><ins>+    args.append(toJS&lt;IDLSerializedScriptValue&lt;SerializedScriptValue&gt;&gt;(*state, *m_data-&gt;globalObject(), srzParam));
</ins><span class="cx">     args.append(toJS&lt;IDLDOMString&gt;(*state, strParam));
</span><span class="cx"> 
</span><span class="cx">     NakedPtr&lt;JSC::Exception&gt; returnedException;
</span><span class="lines">@@ -213,7 +213,7 @@
</span><span class="cx">     return !returnedException;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, TestCallbackInterface&amp; impl)
</del><ins>+JSC::JSValue toJS(TestCallbackInterface&amp; impl)
</ins><span class="cx"> {
</span><span class="cx">     if (!static_cast&lt;JSTestCallbackInterface&amp;&gt;(impl).callbackData())
</span><span class="cx">         return jsNull();
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestCallbackInterfaceh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallbackInterface.h (209152 => 209153)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallbackInterface.h        2016-11-30 21:42:40 UTC (rev 209152)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallbackInterface.h        2016-11-30 22:10:49 UTC (rev 209153)
</span><span class="lines">@@ -52,13 +52,13 @@
</span><span class="cx">     virtual bool callbackRequiresThisToPass(int32_t longParam, TestNode* testNodeParam);
</span><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    JSTestCallbackInterface(JSC::JSObject* callback, JSDOMGlobalObject*);
</del><ins>+    JSTestCallbackInterface(JSC::JSObject*, JSDOMGlobalObject*);
</ins><span class="cx"> 
</span><span class="cx">     JSCallbackDataStrong* m_data;
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, TestCallbackInterface&amp;);
-inline JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestCallbackInterface* impl) { return impl ? toJS(state, globalObject, *impl) : JSC::jsNull(); }
</del><ins>+JSC::JSValue toJS(TestCallbackInterface&amp;);
+inline JSC::JSValue toJS(TestCallbackInterface* impl) { return impl ? toJS(*impl) : JSC::jsNull(); }
</ins><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestMediaQueryListListenercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp (209152 => 209153)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp        2016-11-30 21:42:40 UTC (rev 209152)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp        2016-11-30 22:10:49 UTC (rev 209153)
</span><span class="lines">@@ -23,6 +23,7 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;JSDOMBinding.h&quot;
</span><span class="cx"> #include &quot;JSDOMConstructor.h&quot;
</span><ins>+#include &quot;JSDOMConvert.h&quot;
</ins><span class="cx"> #include &quot;JSMediaQueryListListener.h&quot;
</span><span class="cx"> #include &lt;runtime/Error.h&gt;
</span><span class="cx"> #include &lt;runtime/FunctionPrototype.h&gt;
</span><span class="lines">@@ -177,10 +178,9 @@
</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>-    if (UNLIKELY(!state-&gt;uncheckedArgument(0).isFunction()))
-        return throwArgumentMustBeFunctionError(*state, throwScope, 0, &quot;listener&quot;, &quot;TestMediaQueryListListener&quot;, &quot;method&quot;);
-    auto listener = JSMediaQueryListListener::create(asObject(state-&gt;uncheckedArgument(0)), castedThis-&gt;globalObject());
-    impl.method(WTFMove(listener));
</del><ins>+    auto listener = convert&lt;IDLCallbackFunction&lt;JSMediaQueryListListener&gt;&gt;(*state, state-&gt;uncheckedArgument(0), *castedThis-&gt;globalObject(), [](JSC::ExecState&amp; state, JSC::ThrowScope&amp; scope) { throwArgumentMustBeFunctionError(state, scope, 0, &quot;listener&quot;, &quot;TestMediaQueryListListener&quot;, &quot;method&quot;); });
+    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
+    impl.method(listener.releaseNonNull());
</ins><span class="cx">     return JSValue::encode(jsUndefined());
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestObjcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (209152 => 209153)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp        2016-11-30 21:42:40 UTC (rev 209152)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp        2016-11-30 22:10:49 UTC (rev 209153)
</span><span class="lines">@@ -21,7 +21,6 @@
</span><span class="cx"> #include &quot;config.h&quot;
</span><span class="cx"> #include &quot;JSTestObj.h&quot;
</span><span class="cx"> 
</span><del>-#include &quot;CallbackFunction.h&quot;
</del><span class="cx"> #include &quot;Dictionary.h&quot;
</span><span class="cx"> #include &quot;Document.h&quot;
</span><span class="cx"> #include &quot;EventNames.h&quot;
</span><span class="lines">@@ -40,7 +39,6 @@
</span><span class="cx"> #include &quot;JSEventListener.h&quot;
</span><span class="cx"> #include &quot;JSFetchRequest.h&quot;
</span><span class="cx"> #include &quot;JSNode.h&quot;
</span><del>-#include &quot;JSPromise.h&quot;
</del><span class="cx"> #include &quot;JSSVGDocument.h&quot;
</span><span class="cx"> #include &quot;JSSVGPoint.h&quot;
</span><span class="cx"> #include &quot;JSTestCallbackFunction.h&quot;
</span><span class="lines">@@ -1272,7 +1270,6 @@
</span><span class="cx"> JSC::EncodedJSValue jsTestObjAttribute(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
</span><span class="cx"> JSC::EncodedJSValue jsTestObjAttributeWithReservedEnumType(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
</span><span class="cx"> bool setJSTestObjAttributeWithReservedEnumType(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
</span><del>-JSC::EncodedJSValue jsTestObjTestReadOnlyPromiseAttribute(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
</del><span class="cx"> JSC::EncodedJSValue jsTestObjPutForwardsAttribute(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
</span><span class="cx"> bool setJSTestObjPutForwardsAttribute(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
</span><span class="cx"> JSC::EncodedJSValue jsTestObjPutForwardsNullableAttribute(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
</span><span class="lines">@@ -1419,18 +1416,16 @@
</span><span class="cx">     ASSERT(castedThis);
</span><span class="cx">     if (UNLIKELY(state-&gt;argumentCount() &lt; 2))
</span><span class="cx">         return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
</span><del>-    if (UNLIKELY(!state-&gt;uncheckedArgument(0).isObject()))
-        return throwArgumentMustBeFunctionError(*state, throwScope, 0, &quot;testCallback&quot;, &quot;TestObject&quot;, nullptr);
-    auto testCallback = JSTestCallbackInterface::create(asObject(state-&gt;uncheckedArgument(0)), castedThis-&gt;globalObject());
-    if (UNLIKELY(!state-&gt;uncheckedArgument(1).isFunction()))
-        return throwArgumentMustBeFunctionError(*state, throwScope, 1, &quot;testCallbackFunction&quot;, &quot;TestObject&quot;, nullptr);
-    auto testCallbackFunction = JSTestCallbackFunction::create(asObject(state-&gt;uncheckedArgument(1)), castedThis-&gt;globalObject());
</del><ins>+    auto testCallback = convert&lt;IDLCallbackInterface&lt;JSTestCallbackInterface&gt;&gt;(*state, state-&gt;uncheckedArgument(0), *castedThis-&gt;globalObject(), [](JSC::ExecState&amp; state, JSC::ThrowScope&amp; scope) { throwArgumentMustBeFunctionError(state, scope, 0, &quot;testCallback&quot;, &quot;TestObject&quot;, nullptr); });
+    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
+    auto testCallbackFunction = convert&lt;IDLCallbackFunction&lt;JSTestCallbackFunction&gt;&gt;(*state, state-&gt;uncheckedArgument(1), *castedThis-&gt;globalObject(), [](JSC::ExecState&amp; state, JSC::ThrowScope&amp; scope) { throwArgumentMustBeFunctionError(state, scope, 1, &quot;testCallbackFunction&quot;, &quot;TestObject&quot;, nullptr); });
+    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</ins><span class="cx">     ScriptExecutionContext* context = castedThis-&gt;scriptExecutionContext();
</span><span class="cx">     if (UNLIKELY(!context))
</span><span class="cx">         return throwConstructorScriptExecutionContextUnavailableError(*state, throwScope, &quot;TestObject&quot;);
</span><span class="cx">     ASSERT(context-&gt;isDocument());
</span><span class="cx">     auto&amp; document = downcast&lt;Document&gt;(*context);
</span><del>-    auto object = TestObj::create(document, WTFMove(testCallback), WTFMove(testCallbackFunction));
</del><ins>+    auto object = TestObj::create(document, testCallback.releaseNonNull(), testCallbackFunction.releaseNonNull());
</ins><span class="cx">     return JSValue::encode(toJSNewlyCreated(state, castedThis-&gt;globalObject(), WTFMove(object)));
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -1564,7 +1559,6 @@
</span><span class="cx">     { &quot;nullableStringValue&quot;, CustomAccessor, NoIntrinsic, { (intptr_t)static_cast&lt;PropertySlot::GetValueFunc&gt;(jsTestObjNullableStringValue), (intptr_t) static_cast&lt;PutPropertySlot::PutValueFunc&gt;(setJSTestObjNullableStringValue) } },
</span><span class="cx">     { &quot;attribute&quot;, ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast&lt;PropertySlot::GetValueFunc&gt;(jsTestObjAttribute), (intptr_t) static_cast&lt;PutPropertySlot::PutValueFunc&gt;(0) } },
</span><span class="cx">     { &quot;attributeWithReservedEnumType&quot;, CustomAccessor, NoIntrinsic, { (intptr_t)static_cast&lt;PropertySlot::GetValueFunc&gt;(jsTestObjAttributeWithReservedEnumType), (intptr_t) static_cast&lt;PutPropertySlot::PutValueFunc&gt;(setJSTestObjAttributeWithReservedEnumType) } },
</span><del>-    { &quot;testReadOnlyPromiseAttribute&quot;, ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast&lt;PropertySlot::GetValueFunc&gt;(jsTestObjTestReadOnlyPromiseAttribute), (intptr_t) static_cast&lt;PutPropertySlot::PutValueFunc&gt;(0) } },
</del><span class="cx">     { &quot;putForwardsAttribute&quot;, CustomAccessor, NoIntrinsic, { (intptr_t)static_cast&lt;PropertySlot::GetValueFunc&gt;(jsTestObjPutForwardsAttribute), (intptr_t) static_cast&lt;PutPropertySlot::PutValueFunc&gt;(setJSTestObjPutForwardsAttribute) } },
</span><span class="cx">     { &quot;putForwardsNullableAttribute&quot;, CustomAccessor, NoIntrinsic, { (intptr_t)static_cast&lt;PropertySlot::GetValueFunc&gt;(jsTestObjPutForwardsNullableAttribute), (intptr_t) static_cast&lt;PutPropertySlot::PutValueFunc&gt;(setJSTestObjPutForwardsNullableAttribute) } },
</span><span class="cx">     { &quot;stringifierAttribute&quot;, CustomAccessor, NoIntrinsic, { (intptr_t)static_cast&lt;PropertySlot::GetValueFunc&gt;(jsTestObjStringifierAttribute), (intptr_t) static_cast&lt;PutPropertySlot::PutValueFunc&gt;(setJSTestObjStringifierAttribute) } },
</span><span class="lines">@@ -3335,22 +3329,6 @@
</span><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static inline JSValue jsTestObjTestReadOnlyPromiseAttributeGetter(ExecState&amp;, JSTestObj&amp;, ThrowScope&amp; throwScope);
-
-EncodedJSValue jsTestObjTestReadOnlyPromiseAttribute(ExecState* state, EncodedJSValue thisValue, PropertyName)
-{
-    return BindingCaller&lt;JSTestObj&gt;::attribute&lt;jsTestObjTestReadOnlyPromiseAttributeGetter, CastedThisErrorBehavior::RejectPromise&gt;(state, thisValue, &quot;testReadOnlyPromiseAttribute&quot;);
-}
-
-static inline JSValue jsTestObjTestReadOnlyPromiseAttributeGetter(ExecState&amp; state, JSTestObj&amp; thisObject, ThrowScope&amp; throwScope)
-{
-    UNUSED_PARAM(throwScope);
-    UNUSED_PARAM(state);
-    auto&amp; impl = thisObject.wrapped();
-    JSValue result = toJS&lt;IDLInterface&lt;Promise&gt;&gt;(state, *thisObject.globalObject(), impl.testReadOnlyPromiseAttribute());
-    return result;
-}
-
</del><span class="cx"> static inline JSValue jsTestObjPutForwardsAttributeGetter(ExecState&amp;, JSTestObj&amp;, ThrowScope&amp; throwScope);
</span><span class="cx"> 
</span><span class="cx"> EncodedJSValue jsTestObjPutForwardsAttribute(ExecState* state, EncodedJSValue thisValue, PropertyName)
</span><span class="lines">@@ -4194,7 +4172,7 @@
</span><span class="cx">     auto&amp; impl = thisObject.wrapped();
</span><span class="cx">     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;); });
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, false);
</span><del>-    impl.setTypedArrayAttr(nativeValue.get());
</del><ins>+    impl.setTypedArrayAttr(nativeValue.releaseNonNull());
</ins><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -5256,10 +5234,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 resolver = JSXPathNSResolver::toWrapped(*state, state-&gt;uncheckedArgument(0));
</del><ins>+    auto resolver = convert&lt;IDLXPathNSResolver&lt;XPathNSResolver&gt;&gt;(*state, state-&gt;uncheckedArgument(0), [](JSC::ExecState&amp; state, JSC::ThrowScope&amp; scope) { throwArgumentTypeError(state, scope, 0, &quot;resolver&quot;, &quot;TestObject&quot;, &quot;methodWithXPathNSResolverParameter&quot;, &quot;XPathNSResolver&quot;); });
</ins><span class="cx">     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</span><del>-    if (UNLIKELY(!resolver))
-        return throwArgumentTypeError(*state, throwScope, 0, &quot;resolver&quot;, &quot;TestObject&quot;, &quot;methodWithXPathNSResolverParameter&quot;, &quot;XPathNSResolver&quot;);
</del><span class="cx">     impl.methodWithXPathNSResolverParameter(*resolver);
</span><span class="cx">     return JSValue::encode(jsUndefined());
</span><span class="cx"> }
</span><span class="lines">@@ -5562,7 +5538,7 @@
</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 serializedArg = SerializedScriptValue::create(*state, state-&gt;uncheckedArgument(0));
</del><ins>+    auto serializedArg = convert&lt;IDLSerializedScriptValue&lt;SerializedScriptValue&gt;&gt;(*state, state-&gt;uncheckedArgument(0));
</ins><span class="cx">     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</span><span class="cx">     impl.serializedValue(WTFMove(serializedArg));
</span><span class="cx">     return JSValue::encode(jsUndefined());
</span><span class="lines">@@ -5582,8 +5558,10 @@
</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 oo = Dictionary(state, state-&gt;uncheckedArgument(0));
-    auto ooo = Dictionary(state, state-&gt;argument(1));
</del><ins>+    auto oo = convert&lt;IDLLegacyDictionary&lt;Dictionary&gt;&gt;(*state, state-&gt;uncheckedArgument(0));
+    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
+    auto ooo = convert&lt;IDLLegacyDictionary&lt;Dictionary&gt;&gt;(*state, state-&gt;argument(1));
+    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</ins><span class="cx">     impl.optionsObject(WTFMove(oo), WTFMove(ooo));
</span><span class="cx">     return JSValue::encode(jsUndefined());
</span><span class="cx"> }
</span><span class="lines">@@ -5736,12 +5714,11 @@
</span><span class="cx">         return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
</span><span class="cx">     auto type = convert&lt;IDLDOMString&gt;(*state, state-&gt;uncheckedArgument(0), StringConversionConfiguration::Normal);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</span><del>-    auto listener = JSEventListener::create(state-&gt;uncheckedArgument(1), *castedThis, false, currentWorld(state));
-    if (UNLIKELY(!listener))
-        return throwArgumentTypeError(*state, throwScope, 1, &quot;listener&quot;, &quot;TestObject&quot;, &quot;addEventListener&quot;, &quot;EventListener&quot;);
</del><ins>+    auto listener = convert&lt;IDLEventListener&lt;JSEventListener&gt;&gt;(*state, state-&gt;uncheckedArgument(1), *castedThis);
+    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</ins><span class="cx">     auto useCapture = convert&lt;IDLBoolean&gt;(*state, state-&gt;argument(2));
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</span><del>-    impl.addEventListener(WTFMove(type), *listener, WTFMove(useCapture));
</del><ins>+    impl.addEventListener(WTFMove(type), WTFMove(listener), WTFMove(useCapture));
</ins><span class="cx">     return JSValue::encode(jsUndefined());
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -5761,12 +5738,11 @@
</span><span class="cx">         return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
</span><span class="cx">     auto type = convert&lt;IDLDOMString&gt;(*state, state-&gt;uncheckedArgument(0), StringConversionConfiguration::Normal);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</span><del>-    auto listener = JSEventListener::create(state-&gt;uncheckedArgument(1), *castedThis, false, currentWorld(state));
-    if (UNLIKELY(!listener))
-        return throwArgumentTypeError(*state, throwScope, 1, &quot;listener&quot;, &quot;TestObject&quot;, &quot;removeEventListener&quot;, &quot;EventListener&quot;);
</del><ins>+    auto listener = convert&lt;IDLEventListener&lt;JSEventListener&gt;&gt;(*state, state-&gt;uncheckedArgument(1), *castedThis);
+    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</ins><span class="cx">     auto useCapture = convert&lt;IDLBoolean&gt;(*state, state-&gt;argument(2));
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</span><del>-    impl.removeEventListener(WTFMove(type), *listener, WTFMove(useCapture));
</del><ins>+    impl.removeEventListener(WTFMove(type), WTFMove(listener), WTFMove(useCapture));
</ins><span class="cx">     return JSValue::encode(jsUndefined());
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -6505,13 +6481,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>-    RefPtr&lt;XPathNSResolver&gt; resolver = nullptr;
-    if (!state-&gt;argument(0).isUndefinedOrNull()) {
-        resolver = JSXPathNSResolver::toWrapped(*state, state-&gt;uncheckedArgument(0));
-        RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
-        if (UNLIKELY(!resolver))
-            return throwArgumentTypeError(*state, throwScope, 0, &quot;resolver&quot;, &quot;TestObject&quot;, &quot;methodWithOptionalXPathNSResolver&quot;, &quot;XPathNSResolver&quot;);
-    }
</del><ins>+    auto resolver = convert&lt;IDLNullable&lt;IDLXPathNSResolver&lt;XPathNSResolver&gt;&gt;&gt;(*state, state-&gt;argument(0), [](JSC::ExecState&amp; state, JSC::ThrowScope&amp; scope) { throwArgumentTypeError(state, scope, 0, &quot;resolver&quot;, &quot;TestObject&quot;, &quot;methodWithOptionalXPathNSResolver&quot;, &quot;XPathNSResolver&quot;); });
+    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</ins><span class="cx">     impl.methodWithOptionalXPathNSResolver(WTFMove(resolver));
</span><span class="cx">     return JSValue::encode(jsUndefined());
</span><span class="cx"> }
</span><span class="lines">@@ -6548,10 +6519,9 @@
</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>-    if (UNLIKELY(!state-&gt;uncheckedArgument(0).isObject()))
-        return throwArgumentMustBeFunctionError(*state, throwScope, 0, &quot;callback&quot;, &quot;TestObject&quot;, &quot;methodWithCallbackArg&quot;);
-    auto callback = JSTestCallbackInterface::create(asObject(state-&gt;uncheckedArgument(0)), castedThis-&gt;globalObject());
-    impl.methodWithCallbackArg(WTFMove(callback));
</del><ins>+    auto callback = convert&lt;IDLCallbackInterface&lt;JSTestCallbackInterface&gt;&gt;(*state, state-&gt;uncheckedArgument(0), *castedThis-&gt;globalObject(), [](JSC::ExecState&amp; state, JSC::ThrowScope&amp; scope) { throwArgumentMustBeFunctionError(state, scope, 0, &quot;callback&quot;, &quot;TestObject&quot;, &quot;methodWithCallbackArg&quot;); });
+    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
+    impl.methodWithCallbackArg(callback.releaseNonNull());
</ins><span class="cx">     return JSValue::encode(jsUndefined());
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -6571,10 +6541,9 @@
</span><span class="cx">         return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
</span><span class="cx">     auto nonCallback = convert&lt;IDLLong&gt;(*state, state-&gt;uncheckedArgument(0), IntegerConversionConfiguration::Normal);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</span><del>-    if (UNLIKELY(!state-&gt;uncheckedArgument(1).isObject()))
-        return throwArgumentMustBeFunctionError(*state, throwScope, 1, &quot;callback&quot;, &quot;TestObject&quot;, &quot;methodWithNonCallbackArgAndCallbackArg&quot;);
-    auto callback = JSTestCallbackInterface::create(asObject(state-&gt;uncheckedArgument(1)), castedThis-&gt;globalObject());
-    impl.methodWithNonCallbackArgAndCallbackArg(WTFMove(nonCallback), WTFMove(callback));
</del><ins>+    auto callback = convert&lt;IDLCallbackInterface&lt;JSTestCallbackInterface&gt;&gt;(*state, state-&gt;uncheckedArgument(1), *castedThis-&gt;globalObject(), [](JSC::ExecState&amp; state, JSC::ThrowScope&amp; scope) { throwArgumentMustBeFunctionError(state, scope, 1, &quot;callback&quot;, &quot;TestObject&quot;, &quot;methodWithNonCallbackArgAndCallbackArg&quot;); });
+    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
+    impl.methodWithNonCallbackArgAndCallbackArg(WTFMove(nonCallback), callback.releaseNonNull());
</ins><span class="cx">     return JSValue::encode(jsUndefined());
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -6590,12 +6559,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>-    RefPtr&lt;TestCallbackInterface&gt; callback;
-    if (!state-&gt;argument(0).isUndefinedOrNull()) {
-        if (!state-&gt;uncheckedArgument(0).isObject())
-            return throwArgumentMustBeFunctionError(*state, throwScope, 0, &quot;callback&quot;, &quot;TestObject&quot;, &quot;methodWithCallbackAndOptionalArg&quot;);
-        callback = JSTestCallbackInterface::create(asObject(state-&gt;uncheckedArgument(0)), castedThis-&gt;globalObject());
-    }
</del><ins>+    auto callback = convert&lt;IDLNullable&lt;IDLCallbackInterface&lt;JSTestCallbackInterface&gt;&gt;&gt;(*state, state-&gt;argument(0), *castedThis-&gt;globalObject(), [](JSC::ExecState&amp; state, JSC::ThrowScope&amp; scope) { throwArgumentMustBeFunctionError(state, scope, 0, &quot;callback&quot;, &quot;TestObject&quot;, &quot;methodWithCallbackAndOptionalArg&quot;); });
+    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</ins><span class="cx">     impl.methodWithCallbackAndOptionalArg(WTFMove(callback));
</span><span class="cx">     return JSValue::encode(jsUndefined());
</span><span class="cx"> }
</span><span class="lines">@@ -6614,10 +6579,9 @@
</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>-    if (UNLIKELY(!state-&gt;uncheckedArgument(0).isFunction()))
-        return throwArgumentMustBeFunctionError(*state, throwScope, 0, &quot;callback&quot;, &quot;TestObject&quot;, &quot;methodWithCallbackFunctionArg&quot;);
-    auto callback = JSTestCallbackFunction::create(asObject(state-&gt;uncheckedArgument(0)), castedThis-&gt;globalObject());
-    impl.methodWithCallbackFunctionArg(WTFMove(callback));
</del><ins>+    auto callback = convert&lt;IDLCallbackFunction&lt;JSTestCallbackFunction&gt;&gt;(*state, state-&gt;uncheckedArgument(0), *castedThis-&gt;globalObject(), [](JSC::ExecState&amp; state, JSC::ThrowScope&amp; scope) { throwArgumentMustBeFunctionError(state, scope, 0, &quot;callback&quot;, &quot;TestObject&quot;, &quot;methodWithCallbackFunctionArg&quot;); });
+    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
+    impl.methodWithCallbackFunctionArg(callback.releaseNonNull());
</ins><span class="cx">     return JSValue::encode(jsUndefined());
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -6637,10 +6601,9 @@
</span><span class="cx">         return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
</span><span class="cx">     auto nonCallback = convert&lt;IDLLong&gt;(*state, state-&gt;uncheckedArgument(0), IntegerConversionConfiguration::Normal);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</span><del>-    if (UNLIKELY(!state-&gt;uncheckedArgument(1).isFunction()))
-        return throwArgumentMustBeFunctionError(*state, throwScope, 1, &quot;callback&quot;, &quot;TestObject&quot;, &quot;methodWithNonCallbackArgAndCallbackFunctionArg&quot;);
-    auto callback = JSTestCallbackFunction::create(asObject(state-&gt;uncheckedArgument(1)), castedThis-&gt;globalObject());
-    impl.methodWithNonCallbackArgAndCallbackFunctionArg(WTFMove(nonCallback), WTFMove(callback));
</del><ins>+    auto callback = convert&lt;IDLCallbackFunction&lt;JSTestCallbackFunction&gt;&gt;(*state, state-&gt;uncheckedArgument(1), *castedThis-&gt;globalObject(), [](JSC::ExecState&amp; state, JSC::ThrowScope&amp; scope) { throwArgumentMustBeFunctionError(state, scope, 1, &quot;callback&quot;, &quot;TestObject&quot;, &quot;methodWithNonCallbackArgAndCallbackFunctionArg&quot;); });
+    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
+    impl.methodWithNonCallbackArgAndCallbackFunctionArg(WTFMove(nonCallback), callback.releaseNonNull());
</ins><span class="cx">     return JSValue::encode(jsUndefined());
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -6656,12 +6619,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>-    RefPtr&lt;TestCallbackFunction&gt; callback;
-    if (!state-&gt;argument(0).isUndefinedOrNull()) {
-        if (!state-&gt;uncheckedArgument(0).isFunction())
-            return throwArgumentMustBeFunctionError(*state, throwScope, 0, &quot;callback&quot;, &quot;TestObject&quot;, &quot;methodWithCallbackFunctionAndOptionalArg&quot;);
-        callback = JSTestCallbackFunction::create(asObject(state-&gt;uncheckedArgument(0)), castedThis-&gt;globalObject());
-    }
</del><ins>+    auto callback = convert&lt;IDLNullable&lt;IDLCallbackFunction&lt;JSTestCallbackFunction&gt;&gt;&gt;(*state, state-&gt;argument(0), *castedThis-&gt;globalObject(), [](JSC::ExecState&amp; state, JSC::ThrowScope&amp; scope) { throwArgumentMustBeFunctionError(state, scope, 0, &quot;callback&quot;, &quot;TestObject&quot;, &quot;methodWithCallbackFunctionAndOptionalArg&quot;); });
+    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</ins><span class="cx">     impl.methodWithCallbackFunctionAndOptionalArg(WTFMove(callback));
</span><span class="cx">     return JSValue::encode(jsUndefined());
</span><span class="cx"> }
</span><span class="lines">@@ -6671,12 +6630,8 @@
</span><span class="cx">     VM&amp; vm = state-&gt;vm();
</span><span class="cx">     auto throwScope = DECLARE_THROW_SCOPE(vm);
</span><span class="cx">     UNUSED_PARAM(throwScope);
</span><del>-    RefPtr&lt;TestCallbackInterface&gt; callback;
-    if (!state-&gt;argument(0).isUndefinedOrNull()) {
-        if (!state-&gt;uncheckedArgument(0).isObject())
-            return throwArgumentMustBeFunctionError(*state, throwScope, 0, &quot;callback&quot;, &quot;TestObject&quot;, &quot;staticMethodWithCallbackAndOptionalArg&quot;);
-        callback = createFunctionOnlyCallback&lt;JSTestCallbackInterface&gt;(state, jsCast&lt;JSDOMGlobalObject*&gt;(state-&gt;lexicalGlobalObject()), state-&gt;uncheckedArgument(0));
-    }
</del><ins>+    auto callback = convert&lt;IDLNullable&lt;IDLCallbackInterface&lt;JSTestCallbackInterface&gt;&gt;&gt;(*state, state-&gt;argument(0), *jsCast&lt;JSDOMGlobalObject*&gt;(state-&gt;lexicalGlobalObject()), [](JSC::ExecState&amp; state, JSC::ThrowScope&amp; scope) { throwArgumentMustBeFunctionError(state, scope, 0, &quot;callback&quot;, &quot;TestObject&quot;, &quot;staticMethodWithCallbackAndOptionalArg&quot;); });
+    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</ins><span class="cx">     TestObj::staticMethodWithCallbackAndOptionalArg(WTFMove(callback));
</span><span class="cx">     return JSValue::encode(jsUndefined());
</span><span class="cx"> }
</span><span class="lines">@@ -6688,10 +6643,9 @@
</span><span class="cx">     UNUSED_PARAM(throwScope);
</span><span class="cx">     if (UNLIKELY(state-&gt;argumentCount() &lt; 1))
</span><span class="cx">         return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
</span><del>-    if (UNLIKELY(!state-&gt;uncheckedArgument(0).isObject()))
-        return throwArgumentMustBeFunctionError(*state, throwScope, 0, &quot;callback&quot;, &quot;TestObject&quot;, &quot;staticMethodWithCallbackArg&quot;);
-    auto callback = createFunctionOnlyCallback&lt;JSTestCallbackInterface&gt;(state, jsCast&lt;JSDOMGlobalObject*&gt;(state-&gt;lexicalGlobalObject()), state-&gt;uncheckedArgument(0));
-    TestObj::staticMethodWithCallbackArg(WTFMove(callback));
</del><ins>+    auto callback = convert&lt;IDLCallbackInterface&lt;JSTestCallbackInterface&gt;&gt;(*state, state-&gt;uncheckedArgument(0), *jsCast&lt;JSDOMGlobalObject*&gt;(state-&gt;lexicalGlobalObject()), [](JSC::ExecState&amp; state, JSC::ThrowScope&amp; scope) { throwArgumentMustBeFunctionError(state, scope, 0, &quot;callback&quot;, &quot;TestObject&quot;, &quot;staticMethodWithCallbackArg&quot;); });
+    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
+    TestObj::staticMethodWithCallbackArg(callback.releaseNonNull());
</ins><span class="cx">     return JSValue::encode(jsUndefined());
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -6849,10 +6803,9 @@
</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>-    if (UNLIKELY(!state-&gt;uncheckedArgument(0).isObject()))
-        return throwArgumentMustBeFunctionError(*state, throwScope, 0, &quot;callback&quot;, &quot;TestObject&quot;, &quot;overloadedMethod&quot;);
-    auto callback = JSTestCallbackInterface::create(asObject(state-&gt;uncheckedArgument(0)), castedThis-&gt;globalObject());
-    impl.overloadedMethod(WTFMove(callback));
</del><ins>+    auto callback = convert&lt;IDLCallbackInterface&lt;JSTestCallbackInterface&gt;&gt;(*state, state-&gt;uncheckedArgument(0), *castedThis-&gt;globalObject(), [](JSC::ExecState&amp; state, JSC::ThrowScope&amp; scope) { throwArgumentMustBeFunctionError(state, scope, 0, &quot;callback&quot;, &quot;TestObject&quot;, &quot;overloadedMethod&quot;); });
+    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
+    impl.overloadedMethod(callback.releaseNonNull());
</ins><span class="cx">     return JSValue::encode(jsUndefined());
</span><span class="cx"> }
</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 (209152 => 209153)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp        2016-11-30 21:42:40 UTC (rev 209152)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp        2016-11-30 22:10:49 UTC (rev 209153)
</span><span class="lines">@@ -91,7 +91,7 @@
</span><span class="cx">         return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
</span><span class="cx">     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;); });
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</span><del>-    auto object = TestOverloadedConstructors::create(*arrayBufferView);
</del><ins>+    auto object = TestOverloadedConstructors::create(arrayBufferView.releaseNonNull());
</ins><span class="cx">     return JSValue::encode(toJSNewlyCreated(state, castedThis-&gt;globalObject(), WTFMove(object)));
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestSerializedScriptValueInterfacecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp (209152 => 209153)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp        2016-11-30 21:42:40 UTC (rev 209152)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp        2016-11-30 22:10:49 UTC (rev 209153)
</span><span class="lines">@@ -29,6 +29,7 @@
</span><span class="cx"> #include &quot;JSDOMConvert.h&quot;
</span><span class="cx"> #include &quot;JSMessagePort.h&quot;
</span><span class="cx"> #include &quot;SerializedScriptValue.h&quot;
</span><ins>+#include &lt;runtime/Error.h&gt;
</ins><span class="cx"> #include &lt;runtime/FunctionPrototype.h&gt;
</span><span class="cx"> #include &lt;runtime/JSArray.h&gt;
</span><span class="cx"> #include &lt;wtf/GetPtr.h&gt;
</span><span class="lines">@@ -37,6 +38,11 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><ins>+// Functions
+
+JSC::EncodedJSValue JSC_HOST_CALL jsTestSerializedScriptValueInterfacePrototypeFunctionFunction(JSC::ExecState*);
+JSC::EncodedJSValue JSC_HOST_CALL jsTestSerializedScriptValueInterfacePrototypeFunctionFunctionReturning(JSC::ExecState*);
+
</ins><span class="cx"> // Attributes
</span><span class="cx"> 
</span><span class="cx"> JSC::EncodedJSValue jsTestSerializedScriptValueInterfaceValue(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
</span><span class="lines">@@ -101,6 +107,8 @@
</span><span class="cx">     { &quot;cachedValue&quot;, CustomAccessor, NoIntrinsic, { (intptr_t)static_cast&lt;PropertySlot::GetValueFunc&gt;(jsTestSerializedScriptValueInterfaceCachedValue), (intptr_t) static_cast&lt;PutPropertySlot::PutValueFunc&gt;(setJSTestSerializedScriptValueInterfaceCachedValue) } },
</span><span class="cx">     { &quot;ports&quot;, ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast&lt;PropertySlot::GetValueFunc&gt;(jsTestSerializedScriptValueInterfacePorts), (intptr_t) static_cast&lt;PutPropertySlot::PutValueFunc&gt;(0) } },
</span><span class="cx">     { &quot;cachedReadonlyValue&quot;, ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast&lt;PropertySlot::GetValueFunc&gt;(jsTestSerializedScriptValueInterfaceCachedReadonlyValue), (intptr_t) static_cast&lt;PutPropertySlot::PutValueFunc&gt;(0) } },
</span><ins>+    { &quot;function&quot;, JSC::Function, NoIntrinsic, { (intptr_t)static_cast&lt;NativeFunction&gt;(jsTestSerializedScriptValueInterfacePrototypeFunctionFunction), (intptr_t) (1) } },
+    { &quot;functionReturning&quot;, JSC::Function, NoIntrinsic, { (intptr_t)static_cast&lt;NativeFunction&gt;(jsTestSerializedScriptValueInterfacePrototypeFunctionFunctionReturning), (intptr_t) (0) } },
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> const ClassInfo JSTestSerializedScriptValueInterfacePrototype::s_info = { &quot;TestSerializedScriptValueInterfacePrototype&quot;, &amp;Base::s_info, 0, CREATE_METHOD_TABLE(JSTestSerializedScriptValueInterfacePrototype) };
</span><span class="lines">@@ -146,6 +154,11 @@
</span><span class="cx">     return jsDynamicDowncast&lt;JSTestSerializedScriptValueInterface*&gt;(JSValue::decode(thisValue));
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+template&lt;&gt; inline JSTestSerializedScriptValueInterface* BindingCaller&lt;JSTestSerializedScriptValueInterface&gt;::castForOperation(ExecState&amp; state)
+{
+    return jsDynamicDowncast&lt;JSTestSerializedScriptValueInterface*&gt;(state.thisValue());
+}
+
</ins><span class="cx"> static inline JSValue jsTestSerializedScriptValueInterfaceValueGetter(ExecState&amp;, JSTestSerializedScriptValueInterface&amp;, ThrowScope&amp; throwScope);
</span><span class="cx"> 
</span><span class="cx"> EncodedJSValue jsTestSerializedScriptValueInterfaceValue(ExecState* state, EncodedJSValue thisValue, PropertyName)
</span><span class="lines">@@ -158,7 +171,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 = impl.value() ? impl.value()-&gt;deserialize(state, thisObject.globalObject()) : jsNull();
</del><ins>+    JSValue result = toJS&lt;IDLSerializedScriptValue&lt;SerializedScriptValue&gt;&gt;(state, *thisObject.globalObject(), impl.value());
</ins><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -174,7 +187,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 = impl.readonlyValue() ? impl.readonlyValue()-&gt;deserialize(state, thisObject.globalObject()) : jsNull();
</del><ins>+    JSValue result = toJS&lt;IDLSerializedScriptValue&lt;SerializedScriptValue&gt;&gt;(state, *thisObject.globalObject(), impl.readonlyValue());
</ins><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -192,7 +205,7 @@
</span><span class="cx">     if (JSValue cachedValue = thisObject.m_cachedValue.get())
</span><span class="cx">         return cachedValue;
</span><span class="cx">     auto&amp; impl = thisObject.wrapped();
</span><del>-    JSValue result = impl.cachedValue() ? impl.cachedValue()-&gt;deserialize(state, thisObject.globalObject()) : jsNull();
</del><ins>+    JSValue result = toJS&lt;IDLSerializedScriptValue&lt;SerializedScriptValue&gt;&gt;(state, *thisObject.globalObject(), impl.cachedValue());
</ins><span class="cx">     thisObject.m_cachedValue.set(state.vm(), &amp;thisObject, result);
</span><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="lines">@@ -227,7 +240,7 @@
</span><span class="cx">     if (JSValue cachedValue = thisObject.m_cachedReadonlyValue.get())
</span><span class="cx">         return cachedValue;
</span><span class="cx">     auto&amp; impl = thisObject.wrapped();
</span><del>-    JSValue result = impl.cachedReadonlyValue() ? impl.cachedReadonlyValue()-&gt;deserialize(state, thisObject.globalObject()) : jsNull();
</del><ins>+    JSValue result = toJS&lt;IDLSerializedScriptValue&lt;SerializedScriptValue&gt;&gt;(state, *thisObject.globalObject(), impl.cachedReadonlyValue());
</ins><span class="cx">     thisObject.m_cachedReadonlyValue.set(state.vm(), &amp;thisObject, result);
</span><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="lines">@@ -268,7 +281,7 @@
</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 = SerializedScriptValue::create(state, value);
</del><ins>+    auto nativeValue = convert&lt;IDLSerializedScriptValue&lt;SerializedScriptValue&gt;&gt;(state, value);
</ins><span class="cx">     RETURN_IF_EXCEPTION(throwScope, false);
</span><span class="cx">     impl.setValue(WTFMove(nativeValue));
</span><span class="cx">     return true;
</span><span class="lines">@@ -287,7 +300,7 @@
</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 = SerializedScriptValue::create(state, value);
</del><ins>+    auto nativeValue = convert&lt;IDLSerializedScriptValue&lt;SerializedScriptValue&gt;&gt;(state, value);
</ins><span class="cx">     RETURN_IF_EXCEPTION(throwScope, false);
</span><span class="cx">     impl.setCachedValue(WTFMove(nativeValue));
</span><span class="cx">     return true;
</span><span class="lines">@@ -299,6 +312,41 @@
</span><span class="cx">     return getDOMConstructor&lt;JSTestSerializedScriptValueInterfaceConstructor&gt;(vm, *jsCast&lt;const JSDOMGlobalObject*&gt;(globalObject));
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static inline JSC::EncodedJSValue jsTestSerializedScriptValueInterfacePrototypeFunctionFunctionCaller(JSC::ExecState*, JSTestSerializedScriptValueInterface*, JSC::ThrowScope&amp;);
+
+EncodedJSValue JSC_HOST_CALL jsTestSerializedScriptValueInterfacePrototypeFunctionFunction(ExecState* state)
+{
+    return BindingCaller&lt;JSTestSerializedScriptValueInterface&gt;::callOperation&lt;jsTestSerializedScriptValueInterfacePrototypeFunctionFunctionCaller&gt;(state, &quot;function&quot;);
+}
+
+static inline JSC::EncodedJSValue jsTestSerializedScriptValueInterfacePrototypeFunctionFunctionCaller(JSC::ExecState* state, JSTestSerializedScriptValueInterface* castedThis, JSC::ThrowScope&amp; throwScope)
+{
+    UNUSED_PARAM(state);
+    UNUSED_PARAM(throwScope);
+    auto&amp; impl = castedThis-&gt;wrapped();
+    if (UNLIKELY(state-&gt;argumentCount() &lt; 1))
+        return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
+    auto value = convert&lt;IDLSerializedScriptValue&lt;SerializedScriptValue&gt;&gt;(*state, state-&gt;uncheckedArgument(0));
+    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
+    impl.function(WTFMove(value));
+    return JSValue::encode(jsUndefined());
+}
+
+static inline JSC::EncodedJSValue jsTestSerializedScriptValueInterfacePrototypeFunctionFunctionReturningCaller(JSC::ExecState*, JSTestSerializedScriptValueInterface*, JSC::ThrowScope&amp;);
+
+EncodedJSValue JSC_HOST_CALL jsTestSerializedScriptValueInterfacePrototypeFunctionFunctionReturning(ExecState* state)
+{
+    return BindingCaller&lt;JSTestSerializedScriptValueInterface&gt;::callOperation&lt;jsTestSerializedScriptValueInterfacePrototypeFunctionFunctionReturningCaller&gt;(state, &quot;functionReturning&quot;);
+}
+
+static inline JSC::EncodedJSValue jsTestSerializedScriptValueInterfacePrototypeFunctionFunctionReturningCaller(JSC::ExecState* state, JSTestSerializedScriptValueInterface* castedThis, JSC::ThrowScope&amp; throwScope)
+{
+    UNUSED_PARAM(state);
+    UNUSED_PARAM(throwScope);
+    auto&amp; impl = castedThis-&gt;wrapped();
+    return JSValue::encode(toJS&lt;IDLSerializedScriptValue&lt;SerializedScriptValue&gt;&gt;(*state, *castedThis-&gt;globalObject(), impl.functionReturning()));
+}
+
</ins><span class="cx"> void JSTestSerializedScriptValueInterface::visitChildren(JSCell* cell, SlotVisitor&amp; visitor)
</span><span class="cx"> {
</span><span class="cx">     auto* thisObject = jsCast&lt;JSTestSerializedScriptValueInterface*&gt;(cell);
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestTypedefscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp (209152 => 209153)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp        2016-11-30 21:42:40 UTC (rev 209152)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp        2016-11-30 22:10:49 UTC (rev 209153)
</span><span class="lines">@@ -134,13 +134,11 @@
</span><span class="cx">         return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
</span><span class="cx">     auto hello = convert&lt;IDLDOMString&gt;(*state, state-&gt;uncheckedArgument(0), StringConversionConfiguration::Normal);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</span><del>-    if (UNLIKELY(!state-&gt;uncheckedArgument(1).isFunction()))
-        return throwArgumentMustBeFunctionError(*state, throwScope, 1, &quot;testCallbackFunction&quot;, &quot;TestTypedefs&quot;, nullptr);
-    auto testCallbackFunction = JSTestCallbackFunction::create(asObject(state-&gt;uncheckedArgument(1)), castedThis-&gt;globalObject());
-    if (UNLIKELY(!state-&gt;uncheckedArgument(2).isObject()))
-        return throwArgumentMustBeFunctionError(*state, throwScope, 2, &quot;testCallbackInterface&quot;, &quot;TestTypedefs&quot;, nullptr);
-    auto testCallbackInterface = JSTestCallbackInterface::create(asObject(state-&gt;uncheckedArgument(2)), castedThis-&gt;globalObject());
-    auto object = TestTypedefs::create(WTFMove(hello), WTFMove(testCallbackFunction), WTFMove(testCallbackInterface));
</del><ins>+    auto testCallbackFunction = convert&lt;IDLCallbackFunction&lt;JSTestCallbackFunction&gt;&gt;(*state, state-&gt;uncheckedArgument(1), *castedThis-&gt;globalObject(), [](JSC::ExecState&amp; state, JSC::ThrowScope&amp; scope) { throwArgumentMustBeFunctionError(state, scope, 1, &quot;testCallbackFunction&quot;, &quot;TestTypedefs&quot;, nullptr); });
+    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
+    auto testCallbackInterface = convert&lt;IDLCallbackInterface&lt;JSTestCallbackInterface&gt;&gt;(*state, state-&gt;uncheckedArgument(2), *castedThis-&gt;globalObject(), [](JSC::ExecState&amp; state, JSC::ThrowScope&amp; scope) { throwArgumentMustBeFunctionError(state, scope, 2, &quot;testCallbackInterface&quot;, &quot;TestTypedefs&quot;, nullptr); });
+    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
+    auto object = TestTypedefs::create(WTFMove(hello), testCallbackFunction.releaseNonNull(), testCallbackInterface.releaseNonNull());
</ins><span class="cx">     return JSValue::encode(toJSNewlyCreated(state, castedThis-&gt;globalObject(), WTFMove(object)));
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -263,7 +261,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 = impl.immutableSerializedScriptValue() ? impl.immutableSerializedScriptValue()-&gt;deserialize(state, thisObject.globalObject()) : jsNull();
</del><ins>+    JSValue result = toJS&lt;IDLSerializedScriptValue&lt;SerializedScriptValue&gt;&gt;(state, *thisObject.globalObject(), impl.immutableSerializedScriptValue());
</ins><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -400,7 +398,7 @@
</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 = SerializedScriptValue::create(state, value);
</del><ins>+    auto nativeValue = convert&lt;IDLSerializedScriptValue&lt;SerializedScriptValue&gt;&gt;(state, value);
</ins><span class="cx">     RETURN_IF_EXCEPTION(throwScope, false);
</span><span class="cx">     impl.setImmutableSerializedScriptValue(WTFMove(nativeValue));
</span><span class="cx">     return true;
</span><span class="lines">@@ -548,7 +546,7 @@
</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 sequenceArg = convert&lt;IDLSequence&lt;IDLInterface&lt;SerializedScriptValue&gt;&gt;&gt;(*state, state-&gt;uncheckedArgument(0));
</del><ins>+    auto sequenceArg = convert&lt;IDLSequence&lt;IDLSerializedScriptValue&lt;SerializedScriptValue&gt;&gt;&gt;(*state, state-&gt;uncheckedArgument(0));
</ins><span class="cx">     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</span><span class="cx">     return JSValue::encode(toJS&lt;IDLUnsignedLongLong&gt;(impl.methodWithSequenceArg(WTFMove(sequenceArg))));
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestTestObjidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/TestObj.idl (209152 => 209153)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/TestObj.idl        2016-11-30 21:42:40 UTC (rev 209152)
+++ trunk/Source/WebCore/bindings/scripts/test/TestObj.idl        2016-11-30 22:10:49 UTC (rev 209153)
</span><span class="lines">@@ -391,8 +391,9 @@
</span><span class="cx">     attribute _optional                attributeWithReservedEnumType;
</span><span class="cx">     void _any(unrestricted float a, long b);
</span><span class="cx"> 
</span><del>-
-    readonly attribute Promise&lt;void&gt; testReadOnlyPromiseAttribute;
</del><ins>+    // FIXME: Add support for Promise attributes.
+    // readonly attribute Promise&lt;void&gt; testReadOnlyPromiseAttribute;
+    
</ins><span class="cx">     // Promise function
</span><span class="cx">     Promise&lt;void&gt; testPromiseFunction();
</span><span class="cx">     Promise&lt;void&gt; testPromiseFunctionWithFloatArgument(float a);
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestTestSerializedScriptValueInterfaceidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/TestSerializedScriptValueInterface.idl (209152 => 209153)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/TestSerializedScriptValueInterface.idl        2016-11-30 21:42:40 UTC (rev 209152)
+++ trunk/Source/WebCore/bindings/scripts/test/TestSerializedScriptValueInterface.idl        2016-11-30 22:10:49 UTC (rev 209153)
</span><span class="lines">@@ -24,7 +24,7 @@
</span><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> // This IDL file is for testing the bindings code generator and for tracking
</span><del>-// changes in its ouput.
</del><ins>+// changes in its output.
</ins><span class="cx"> [
</span><span class="cx">     Conditional=Condition1|Condition2,
</span><span class="cx"> ] interface TestSerializedScriptValueInterface {
</span><span class="lines">@@ -33,4 +33,6 @@
</span><span class="cx">     [CachedAttribute] attribute SerializedScriptValue cachedValue;
</span><span class="cx">     readonly attribute sequence&lt;MessagePort&gt; ports;
</span><span class="cx">     [CachedAttribute] readonly attribute SerializedScriptValue cachedReadonlyValue;
</span><ins>+    void function(SerializedScriptValue value);
+    SerializedScriptValue functionReturning();
</ins><span class="cx"> };
</span></span></pre>
</div>
</div>

</body>
</html>