<!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>[203941] trunk</title>
</head>
<body>

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

<h3>Log Message</h3>
<pre>[WebIDL] Enable strict type checking for operations' nullable parameters of wrapper types
https://bugs.webkit.org/show_bug.cgi?id=160374

Reviewed by Youenn Fablet.

LayoutTests/imported/w3c:

Rebaseline W3C test now that one more check is passing.

* web-platform-tests/dom/nodes/DOMImplementation-createDocument-expected.txt:

Source/WebCore:

Enable strict type checking for operations' nullable parameters of
wrapper types to comply with the Web IDL specification:
- http://heycam.github.io/webidl/#es-nullable-type
- http://heycam.github.io/webidl/#es-interface

For such parameters, if the JS passes a value that is not null /
undefined and does not have the expected wrapper type, then we now
throw a TypeError instead of silently converting the value to null.

This behavior is consistent with Chrome and Firefox. It also helps
identify bugs in JavaScript code.

No new tests, rebaselined existing tests.

* bindings/scripts/CodeGeneratorJS.pm:
(GenerateParametersCheck):
* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::jsTestObjPrototypeFunctionMethodWithOptionalNullableWrapper):
(WebCore::jsTestObjPrototypeFunctionMethodWithOptionalNullableWrapperIsNull):
(WebCore::jsTestObjPrototypeFunctionMethodWithOptionalXPathNSResolver):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod1):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod2):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod6):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithOptionalParameter1):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithOptionalParameter2):
(WebCore::jsTestObjPrototypeFunctionConvert2):
(WebCore::jsTestObjPrototypeFunctionStrictFunctionWithSequence):
(WebCore::jsTestObjPrototypeFunctionConditionalMethod3): Deleted.
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod5): Deleted.
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod): Deleted.
(WebCore::jsTestObjPrototypeFunctionOrange): Deleted.

LayoutTests:

Update / rebaseline existing tests to reflect behavior change. Also fix
several bugs in tests that became obvious now that we throw.

* editing/execCommand/indent-pre-expected.txt:
* editing/execCommand/indent-pre.html:
* editing/selection/4895428-2.html:
* editing/selection/move-by-word-visually-null-box.html:
* fast/dom/DOMImplementation/detached-doctype.html:
* fast/dom/MutationObserver/observe-attributes.html:
* fast/dom/Node/contains-method-expected.txt:
* fast/dom/Node/script-tests/contains-method.js:
* fast/dom/Window/webkitConvertPoint.html:
* fast/dom/adopt-node-crash-2.html:
* fast/dom/incompatible-operations-expected.txt:
* fast/dom/incompatible-operations.html:
* fast/events/selectstart-by-arrow-keys.html:
* fast/images/image-copy-memory-usage.html:
* fast/xsl/xslt-processor-expected.txt:
* http/tests/misc/webtiming-cross-origin-and-back1.html:
* platform/mac/fast/dom/Window/webkitConvertPoint-expected.txt:
* svg/custom/unicode-in-tspan-multi-svg-crash.html:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestseditingexecCommandindentpreexpectedtxt">trunk/LayoutTests/editing/execCommand/indent-pre-expected.txt</a></li>
<li><a href="#trunkLayoutTestseditingexecCommandindentprehtml">trunk/LayoutTests/editing/execCommand/indent-pre.html</a></li>
<li><a href="#trunkLayoutTestseditingselection48954282html">trunk/LayoutTests/editing/selection/4895428-2.html</a></li>
<li><a href="#trunkLayoutTestseditingselectionmovebywordvisuallynullboxhtml">trunk/LayoutTests/editing/selection/move-by-word-visually-null-box.html</a></li>
<li><a href="#trunkLayoutTestsfastdomDOMImplementationdetacheddoctypehtml">trunk/LayoutTests/fast/dom/DOMImplementation/detached-doctype.html</a></li>
<li><a href="#trunkLayoutTestsfastdomMutationObserverobserveattributeshtml">trunk/LayoutTests/fast/dom/MutationObserver/observe-attributes.html</a></li>
<li><a href="#trunkLayoutTestsfastdomNodecontainsmethodexpectedtxt">trunk/LayoutTests/fast/dom/Node/contains-method-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomNodescripttestscontainsmethodjs">trunk/LayoutTests/fast/dom/Node/script-tests/contains-method.js</a></li>
<li><a href="#trunkLayoutTestsfastdomWindowwebkitConvertPointhtml">trunk/LayoutTests/fast/dom/Window/webkitConvertPoint.html</a></li>
<li><a href="#trunkLayoutTestsfastdomadoptnodecrash2html">trunk/LayoutTests/fast/dom/adopt-node-crash-2.html</a></li>
<li><a href="#trunkLayoutTestsfastdomincompatibleoperationsexpectedtxt">trunk/LayoutTests/fast/dom/incompatible-operations-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomincompatibleoperationshtml">trunk/LayoutTests/fast/dom/incompatible-operations.html</a></li>
<li><a href="#trunkLayoutTestsfasteventsselectstartbyarrowkeyshtml">trunk/LayoutTests/fast/events/selectstart-by-arrow-keys.html</a></li>
<li><a href="#trunkLayoutTestsfastimagesimagecopymemoryusagehtml">trunk/LayoutTests/fast/images/image-copy-memory-usage.html</a></li>
<li><a href="#trunkLayoutTestsfastxslxsltprocessorexpectedtxt">trunk/LayoutTests/fast/xsl/xslt-processor-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestsmiscwebtimingcrossoriginandback1html">trunk/LayoutTests/http/tests/misc/webtiming-cross-origin-and-back1.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cChangeLog">trunk/LayoutTests/imported/w3c/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsdomnodesDOMImplementationcreateDocumentexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/DOMImplementation-createDocument-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformmacfastdomWindowwebkitConvertPointexpectedtxt">trunk/LayoutTests/platform/mac/fast/dom/Window/webkitConvertPoint-expected.txt</a></li>
<li><a href="#trunkLayoutTestssvgcustomunicodeintspanmultisvgcrashhtml">trunk/LayoutTests/svg/custom/unicode-in-tspan-multi-svg-crash.html</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptsCodeGeneratorJSpm">trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestJSJSTestObjcpp">trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (203940 => 203941)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-07-30 06:39:37 UTC (rev 203940)
+++ trunk/LayoutTests/ChangeLog        2016-07-30 08:35:06 UTC (rev 203941)
</span><span class="lines">@@ -1,3 +1,32 @@
</span><ins>+2016-07-30  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        [WebIDL] Enable strict type checking for operations' nullable parameters of wrapper types
+        https://bugs.webkit.org/show_bug.cgi?id=160374
+
+        Reviewed by Youenn Fablet.
+
+        Update / rebaseline existing tests to reflect behavior change. Also fix
+        several bugs in tests that became obvious now that we throw.
+
+        * editing/execCommand/indent-pre-expected.txt:
+        * editing/execCommand/indent-pre.html:
+        * editing/selection/4895428-2.html:
+        * editing/selection/move-by-word-visually-null-box.html:
+        * fast/dom/DOMImplementation/detached-doctype.html:
+        * fast/dom/MutationObserver/observe-attributes.html:
+        * fast/dom/Node/contains-method-expected.txt:
+        * fast/dom/Node/script-tests/contains-method.js:
+        * fast/dom/Window/webkitConvertPoint.html:
+        * fast/dom/adopt-node-crash-2.html:
+        * fast/dom/incompatible-operations-expected.txt:
+        * fast/dom/incompatible-operations.html:
+        * fast/events/selectstart-by-arrow-keys.html:
+        * fast/images/image-copy-memory-usage.html:
+        * fast/xsl/xslt-processor-expected.txt:
+        * http/tests/misc/webtiming-cross-origin-and-back1.html:
+        * platform/mac/fast/dom/Window/webkitConvertPoint-expected.txt:
+        * svg/custom/unicode-in-tspan-multi-svg-crash.html:
+
</ins><span class="cx"> 2016-07-29  Chris Dumez  &lt;cdumez@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Window's named properties should be exposed on a WindowProperties object in its prototype
</span></span></pre></div>
<a id="trunkLayoutTestseditingexecCommandindentpreexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/editing/execCommand/indent-pre-expected.txt (203940 => 203941)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/editing/execCommand/indent-pre-expected.txt        2016-07-30 06:39:37 UTC (rev 203940)
+++ trunk/LayoutTests/editing/execCommand/indent-pre-expected.txt        2016-07-30 08:35:06 UTC (rev 203941)
</span><span class="lines">@@ -102,7 +102,7 @@
</span><span class="cx">     var textNode = node.firstChild;
</span><span class="cx">     if (textNode.nodeType != Node.TEXT_NODE)
</span><span class="cx">         throw &quot;Wrong node type: &quot; + textNode;
</span><del>-    execSetSelectionCommand(textNode, 0, 0);
</del><ins>+    execSetSelectionCommand(textNode, 0, null);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> function verifyTextSelection(startNode, startOffset, endNode, endOffset)
</span></span></pre></div>
<a id="trunkLayoutTestseditingexecCommandindentprehtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/editing/execCommand/indent-pre.html (203940 => 203941)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/editing/execCommand/indent-pre.html        2016-07-30 06:39:37 UTC (rev 203940)
+++ trunk/LayoutTests/editing/execCommand/indent-pre.html        2016-07-30 08:35:06 UTC (rev 203941)
</span><span class="lines">@@ -30,7 +30,7 @@
</span><span class="cx">     var textNode = node.firstChild;
</span><span class="cx">     if (textNode.nodeType != Node.TEXT_NODE)
</span><span class="cx">         throw &quot;Wrong node type: &quot; + textNode;
</span><del>-    execSetSelectionCommand(textNode, 0, 0);
</del><ins>+    execSetSelectionCommand(textNode, 0, null);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> function verifyTextSelection(startNode, startOffset, endNode, endOffset)
</span></span></pre></div>
<a id="trunkLayoutTestseditingselection48954282html"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/editing/selection/4895428-2.html (203940 => 203941)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/editing/selection/4895428-2.html        2016-07-30 06:39:37 UTC (rev 203940)
+++ trunk/LayoutTests/editing/selection/4895428-2.html        2016-07-30 08:35:06 UTC (rev 203941)
</span><span class="lines">@@ -18,7 +18,7 @@
</span><span class="cx">     if (!window.testRunner)
</span><span class="cx">         return;
</span><span class="cx">     var cell = document.getElementById(&quot;cell&quot;);
</span><del>-    cell.addEventListener(handleBlur, &quot;DOMBlurEvent&quot;);
</del><ins>+    cell.addEventListener(&quot;DOMBlurEvent&quot;, handleBlur);
</ins><span class="cx">     var div = document.getElementById(&quot;div&quot;);
</span><span class="cx">     div.focus();
</span><span class="cx">     document.execCommand(&quot;SelectAll&quot;);
</span></span></pre></div>
<a id="trunkLayoutTestseditingselectionmovebywordvisuallynullboxhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/editing/selection/move-by-word-visually-null-box.html (203940 => 203941)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/editing/selection/move-by-word-visually-null-box.html        2016-07-30 06:39:37 UTC (rev 203940)
+++ trunk/LayoutTests/editing/selection/move-by-word-visually-null-box.html        2016-07-30 08:35:06 UTC (rev 203941)
</span><span class="lines">@@ -9,7 +9,7 @@
</span><span class="cx"> 
</span><span class="cx">         // Test NULL VisiblePosition.
</span><span class="cx">         var selection = getSelection();
</span><del>-        selection.setPosition(0, 0);
</del><ins>+        selection.setPosition(null, 0);
</ins><span class="cx">         selection.modify(&quot;move&quot;, &quot;right&quot;, &quot;-webkit-visual-word&quot;);
</span><span class="cx">         document.body.innerHTML = &quot;Crash test passed&quot;;
</span><span class="cx">     } finally {
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomDOMImplementationdetacheddoctypehtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dom/DOMImplementation/detached-doctype.html (203940 => 203941)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/DOMImplementation/detached-doctype.html        2016-07-30 06:39:37 UTC (rev 203940)
+++ trunk/LayoutTests/fast/dom/DOMImplementation/detached-doctype.html        2016-07-30 08:35:06 UTC (rev 203941)
</span><span class="lines">@@ -14,7 +14,7 @@
</span><span class="cx">     testRunner.dumpAsText();
</span><span class="cx"> 
</span><span class="cx"> var o = document.implementation.createDocumentType('x', null, null);
</span><del>-var doc = document.implementation.createDocument(&quot;doc&quot;, null, 0);
</del><ins>+var doc = document.implementation.createDocument(&quot;doc&quot;, null, null);
</ins><span class="cx"> for (i in o) {
</span><span class="cx">     try { o[i]; } catch (e) {}
</span><span class="cx">     try { o[i](); } catch (e) {}
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomMutationObserverobserveattributeshtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dom/MutationObserver/observe-attributes.html (203940 => 203941)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/MutationObserver/observe-attributes.html        2016-07-30 06:39:37 UTC (rev 203940)
+++ trunk/LayoutTests/fast/dom/MutationObserver/observe-attributes.html        2016-07-30 08:35:06 UTC (rev 203941)
</span><span class="lines">@@ -595,7 +595,7 @@
</span><span class="cx">     function start() {
</span><span class="cx">         debug('Testing that attributeFilter respects case with non-HTML elements.');
</span><span class="cx"> 
</span><del>-        svgDoc = document.implementation.createDocument('http://www.w3.org/2000/svg', 'svg', 'svg');
</del><ins>+        svgDoc = document.implementation.createDocument('http://www.w3.org/2000/svg', 'svg', null);
</ins><span class="cx">         mutations = null;
</span><span class="cx">         observer = new MutationObserver(function(m) {
</span><span class="cx">             mutations = m;
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomNodecontainsmethodexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dom/Node/contains-method-expected.txt (203940 => 203941)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/Node/contains-method-expected.txt        2016-07-30 06:39:37 UTC (rev 203940)
+++ trunk/LayoutTests/fast/dom/Node/contains-method-expected.txt        2016-07-30 08:35:06 UTC (rev 203941)
</span><span class="lines">@@ -12,7 +12,7 @@
</span><span class="cx"> PASS document.contains(document) is true
</span><span class="cx"> PASS test1.contains(test1) is true
</span><span class="cx"> PASS test1TextChild.contains(test1TextChild) is true
</span><del>-PASS test1.contains(123) is false
</del><ins>+PASS test1.contains(123) threw exception TypeError: Argument 1 ('other') to Node.contains must be an instance of Node.
</ins><span class="cx"> PASS test1.contains(null) is false
</span><span class="cx"> PASS document.contains(iframe) is false
</span><span class="cx"> PASS iframe.contains(iframe) is true
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomNodescripttestscontainsmethodjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dom/Node/script-tests/contains-method.js (203940 => 203941)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/Node/script-tests/contains-method.js        2016-07-30 06:39:37 UTC (rev 203940)
+++ trunk/LayoutTests/fast/dom/Node/script-tests/contains-method.js        2016-07-30 08:35:06 UTC (rev 203941)
</span><span class="lines">@@ -14,7 +14,7 @@
</span><span class="cx"> shouldBeTrue(&quot;document.contains(document)&quot;);
</span><span class="cx"> shouldBeTrue(&quot;test1.contains(test1)&quot;);
</span><span class="cx"> shouldBeTrue(&quot;test1TextChild.contains(test1TextChild)&quot;);
</span><del>-shouldBeFalse(&quot;test1.contains(123)&quot;);
</del><ins>+shouldThrow(&quot;test1.contains(123)&quot;);
</ins><span class="cx"> shouldBeFalse(&quot;test1.contains(null)&quot;);
</span><span class="cx"> 
</span><span class="cx"> // Cross document tests
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomWindowwebkitConvertPointhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dom/Window/webkitConvertPoint.html (203940 => 203941)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/Window/webkitConvertPoint.html        2016-07-30 06:39:37 UTC (rev 203940)
+++ trunk/LayoutTests/fast/dom/Window/webkitConvertPoint.html        2016-07-30 08:35:06 UTC (rev 203941)
</span><span class="lines">@@ -113,12 +113,7 @@
</span><span class="cx">             description(&quot;This test exercises the webkitConvertPointFromNodeToPage() function&quot;);
</span><span class="cx">             
</span><span class="cx">             debug(&quot;Test parameter passing - should not crash&quot;);
</span><del>-            var point = webkitConvertPointFromNodeToPage(new WebKitPoint(0, 0));
-            if (point == null)
-                testPassed(&quot;Missing parameter test&quot;);
-            else
-                testFailed(&quot;Missing parameter test&quot;);
-            debug(&quot;Test did not crash and therefore was successful&quot;);
</del><ins>+            shouldThrow(&quot;webkitConvertPointFromNodeToPage(new WebKitPoint(0, 0))&quot;);
</ins><span class="cx">             debug(&quot;&quot;);
</span><span class="cx">             point = webkitConvertPointFromNodeToPage(null, new WebKitPoint(0, 0));
</span><span class="cx">             if (point == null)
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomadoptnodecrash2html"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dom/adopt-node-crash-2.html (203940 => 203941)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/adopt-node-crash-2.html        2016-07-30 06:39:37 UTC (rev 203940)
+++ trunk/LayoutTests/fast/dom/adopt-node-crash-2.html        2016-07-30 08:35:06 UTC (rev 203941)
</span><span class="lines">@@ -25,6 +25,8 @@
</span><span class="cx">     if (window.testRunner)
</span><span class="cx">         testRunner.notifyDone();
</span><span class="cx"> }
</span><del>-document.addEventListener(&quot;DOMContentLoaded&quot;, setTimeout(&quot;doit()&quot;, 1), false);
</del><ins>+document.addEventListener(&quot;DOMContentLoaded&quot;, function() {
+    setTimeout(&quot;doit()&quot;, 1);
+}, false);
</ins><span class="cx"> &lt;/script&gt;
</span><span class="cx"> &lt;/html&gt;
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomincompatibleoperationsexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dom/incompatible-operations-expected.txt (203940 => 203941)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/incompatible-operations-expected.txt        2016-07-30 06:39:37 UTC (rev 203940)
+++ trunk/LayoutTests/fast/dom/incompatible-operations-expected.txt        2016-07-30 08:35:06 UTC (rev 203941)
</span><span class="lines">@@ -6,8 +6,8 @@
</span><span class="cx"> PASS aNode.appendChild(aDOMImplementation) threw exception TypeError: Argument 1 ('node') to Node.appendChild must be an instance of Node.
</span><span class="cx"> PASS aNode.appendChild('knort') threw exception TypeError: Argument 1 ('node') to Node.appendChild must be an instance of Node.
</span><span class="cx"> PASS aNode.appendChild(void 0) threw exception TypeError: Argument 1 ('node') to Node.appendChild must be an instance of Node.
</span><del>-PASS aNode.isSameNode(aDOMImplementation) is false
-PASS aNode.isSameNode('foo') is false
</del><ins>+PASS aNode.isSameNode(aDOMImplementation) threw exception TypeError: Argument 1 ('other') to Node.isSameNode must be an instance of Node.
+PASS aNode.isSameNode('foo') threw exception TypeError: Argument 1 ('other') to Node.isSameNode must be an instance of Node.
</ins><span class="cx"> PASS aNode.isSameNode(void 0) is false
</span><span class="cx"> PASS aNode.lookupPrefix(aDOMImplementation) is null
</span><span class="cx"> PASS aNode.lookupPrefix(void 0) is null
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomincompatibleoperationshtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dom/incompatible-operations.html (203940 => 203941)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/incompatible-operations.html        2016-07-30 06:39:37 UTC (rev 203940)
+++ trunk/LayoutTests/fast/dom/incompatible-operations.html        2016-07-30 08:35:06 UTC (rev 203941)
</span><span class="lines">@@ -34,8 +34,8 @@
</span><span class="cx"> 
</span><span class="cx"> shouldThrow(&quot;aNode.appendChild(void 0)&quot;);
</span><span class="cx"> 
</span><del>-shouldBeFalse(&quot;aNode.isSameNode(aDOMImplementation)&quot;);
-shouldBeFalse(&quot;aNode.isSameNode('foo')&quot;);
</del><ins>+shouldThrow(&quot;aNode.isSameNode(aDOMImplementation)&quot;);
+shouldThrow(&quot;aNode.isSameNode('foo')&quot;);
</ins><span class="cx"> shouldBeFalse(&quot;aNode.isSameNode(void 0)&quot;);
</span><span class="cx"> shouldBe(&quot;aNode.lookupPrefix(aDOMImplementation)&quot;, &quot;null&quot;);
</span><span class="cx"> shouldBe(&quot;aNode.lookupPrefix(void 0)&quot;, &quot;null&quot;);
</span></span></pre></div>
<a id="trunkLayoutTestsfasteventsselectstartbyarrowkeyshtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/events/selectstart-by-arrow-keys.html (203940 => 203941)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/events/selectstart-by-arrow-keys.html        2016-07-30 06:39:37 UTC (rev 203940)
+++ trunk/LayoutTests/fast/events/selectstart-by-arrow-keys.html        2016-07-30 08:35:06 UTC (rev 203941)
</span><span class="lines">@@ -39,7 +39,7 @@
</span><span class="cx"> 
</span><span class="cx">     // On Mac, home/end doesn't move caret so manually select &quot; World&quot;.
</span><span class="cx">     if (navigator.platform.indexOf('Mac') == 0)
</span><del>-        window.getSelection().setBaseAndExtent(div.firstChild, div.textContent.indexOf('World'), div.textContent.length);
</del><ins>+        window.getSelection().setBaseAndExtent(div.firstChild, div.textContent.indexOf('World'));
</ins><span class="cx"> 
</span><span class="cx">     eventSender.keyDown(&quot;leftArrow&quot;);
</span><span class="cx">     logResult('Check (Left arrow)', 1);
</span></span></pre></div>
<a id="trunkLayoutTestsfastimagesimagecopymemoryusagehtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/images/image-copy-memory-usage.html (203940 => 203941)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/images/image-copy-memory-usage.html        2016-07-30 06:39:37 UTC (rev 203940)
+++ trunk/LayoutTests/fast/images/image-copy-memory-usage.html        2016-07-30 08:35:06 UTC (rev 203941)
</span><span class="lines">@@ -41,7 +41,7 @@
</span><span class="cx">                             // Add a listener for clipboard copy events which will then check how much memory was used to perform
</span><span class="cx">                             // the copy and also finish the test. setTimeout() is used with a zero delay in order to cause this to
</span><span class="cx">                             // run after the copy is finished.
</span><del>-                            document.getElementById(&quot;animationFrame&quot;).contentWindow.document.addEventListener(&quot;copy&quot;,
</del><ins>+                            document.getElementById(&quot;animationFrame&quot;).contentWindow.document.addEventListener(&quot;copy&quot;, function() {
</ins><span class="cx">                                 setTimeout(
</span><span class="cx">                                         function()
</span><span class="cx">                                     {
</span><span class="lines">@@ -50,7 +50,7 @@
</span><span class="cx">                                         shouldBeTrue(&quot;changeInCommittedVMBytes &lt; 200000000&quot;);
</span><span class="cx">                                         window.finishJSTest();
</span><span class="cx">                                     },
</span><del>-                                    0),
</del><ins>+                                    0) },
</ins><span class="cx">                                 false);
</span><span class="cx"> 
</span><span class="cx">                             // Exit if execCommand(&quot;copy&quot;) is not supported since that is needed to automatically copy the animation
</span></span></pre></div>
<a id="trunkLayoutTestsfastxslxsltprocessorexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/xsl/xslt-processor-expected.txt (203940 => 203941)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/xsl/xslt-processor-expected.txt        2016-07-30 06:39:37 UTC (rev 203940)
+++ trunk/LayoutTests/fast/xsl/xslt-processor-expected.txt        2016-07-30 08:35:06 UTC (rev 203941)
</span><span class="lines">@@ -60,7 +60,7 @@
</span><span class="cx"> 2.2 fragment with undefined output document:
</span><span class="cx"> Success
</span><span class="cx"> 2.3 use non-DOMDocument output parameter:
</span><del>-****Failure**** (expected exception, instead got result: &quot;null&quot;)
</del><ins>+Success
</ins><span class="cx"> 2.4 transform to same fragment twice:
</span><span class="cx"> Success
</span><span class="cx"> 2.5 transformed fragment containing only text:
</span></span></pre></div>
<a id="trunkLayoutTestshttptestsmiscwebtimingcrossoriginandback1html"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/http/tests/misc/webtiming-cross-origin-and-back1.html (203940 => 203941)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/misc/webtiming-cross-origin-and-back1.html        2016-07-30 06:39:37 UTC (rev 203940)
+++ trunk/LayoutTests/http/tests/misc/webtiming-cross-origin-and-back1.html        2016-07-30 08:35:06 UTC (rev 203941)
</span><span class="lines">@@ -7,7 +7,9 @@
</span><span class="cx"> function doRedirect() {
</span><span class="cx">     window.location = &quot;http://127.0.0.1:8000/misc/resources/webtiming-cross-origin-and-back-redirect1.php&quot;;
</span><span class="cx"> }
</span><del>-addEventListener(&quot;load&quot;, setTimeout(doRedirect, 0));
</del><ins>+addEventListener(&quot;load&quot;, function() {
+    setTimeout(doRedirect, 0);
+});
</ins><span class="cx"> &lt;/script&gt;
</span><span class="cx"> &lt;/head&gt;
</span><span class="cx"> &lt;body&gt;
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/ChangeLog (203940 => 203941)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/ChangeLog        2016-07-30 06:39:37 UTC (rev 203940)
+++ trunk/LayoutTests/imported/w3c/ChangeLog        2016-07-30 08:35:06 UTC (rev 203941)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2016-07-30  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        [WebIDL] Enable strict type checking for operations' nullable parameters of wrapper types
+        https://bugs.webkit.org/show_bug.cgi?id=160374
+
+        Reviewed by Youenn Fablet.
+
+        Rebaseline W3C test now that one more check is passing.
+
+        * web-platform-tests/dom/nodes/DOMImplementation-createDocument-expected.txt:
+
</ins><span class="cx"> 2016-07-29  Chris Dumez  &lt;cdumez@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Window's named properties should be exposed on a WindowProperties object in its prototype
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsdomnodesDOMImplementationcreateDocumentexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/DOMImplementation-createDocument-expected.txt (203940 => 203941)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/DOMImplementation-createDocument-expected.txt        2016-07-30 06:39:37 UTC (rev 203940)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/DOMImplementation-createDocument-expected.txt        2016-07-30 08:35:06 UTC (rev 203941)
</span><span class="lines">@@ -267,7 +267,7 @@
</span><span class="cx"> PASS createDocument test 154: &quot;foo:&quot;,&quot;xmlfoo:bar&quot;,null,null 
</span><span class="cx"> PASS createDocument test 154: metadata for &quot;foo:&quot;,&quot;xmlfoo:bar&quot;,null 
</span><span class="cx"> PASS createDocument test 154: characterSet aliases for &quot;foo:&quot;,&quot;xmlfoo:bar&quot;,null 
</span><del>-FAIL createDocument test 155: null,null,false,object &quot;TypeError&quot; assert_throws: function &quot;function () { document.implementation.createDocument(name...&quot; did not throw
</del><ins>+PASS createDocument test 155: null,null,false,object &quot;TypeError&quot; 
</ins><span class="cx"> PASS createDocument test 156: null,null,null,null 
</span><span class="cx"> PASS createDocument test 156: metadata for null,null,null 
</span><span class="cx"> PASS createDocument test 156: characterSet aliases for null,null,null 
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacfastdomWindowwebkitConvertPointexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac/fast/dom/Window/webkitConvertPoint-expected.txt (203940 => 203941)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/fast/dom/Window/webkitConvertPoint-expected.txt        2016-07-30 06:39:37 UTC (rev 203940)
+++ trunk/LayoutTests/platform/mac/fast/dom/Window/webkitConvertPoint-expected.txt        2016-07-30 08:35:06 UTC (rev 203941)
</span><span class="lines">@@ -27,8 +27,7 @@
</span><span class="cx"> On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
</span><span class="cx"> 
</span><span class="cx"> Test parameter passing - should not crash
</span><del>-PASS Missing parameter test
-Test did not crash and therefore was successful
</del><ins>+PASS webkitConvertPointFromNodeToPage(new WebKitPoint(0, 0)) threw exception TypeError: Argument 1 ('node') to Window.webkitConvertPointFromNodeToPage must be an instance of Node.
</ins><span class="cx"> 
</span><span class="cx"> PASS null parameter test a
</span><span class="cx"> Test did not crash and therefore was successful
</span></span></pre></div>
<a id="trunkLayoutTestssvgcustomunicodeintspanmultisvgcrashhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/svg/custom/unicode-in-tspan-multi-svg-crash.html (203940 => 203941)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/svg/custom/unicode-in-tspan-multi-svg-crash.html        2016-07-30 06:39:37 UTC (rev 203940)
+++ trunk/LayoutTests/svg/custom/unicode-in-tspan-multi-svg-crash.html        2016-07-30 08:35:06 UTC (rev 203941)
</span><span class="lines">@@ -14,7 +14,7 @@
</span><span class="cx">       document.designMode='on';
</span><span class="cx">       filterInFirstRoot = document.getElementById('filterInFirstRoot');
</span><span class="cx">       useElement = document.getElementById('useElement');
</span><del>-      window.getSelection().setBaseAndExtent(filterInFirstRoot, useElement, 5);
</del><ins>+      window.getSelection().setBaseAndExtent(filterInFirstRoot, 0);
</ins><span class="cx">       document.execCommand('ForwardDelete');
</span><span class="cx">       document.designMode='off';
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (203940 => 203941)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-07-30 06:39:37 UTC (rev 203940)
+++ trunk/Source/WebCore/ChangeLog        2016-07-30 08:35:06 UTC (rev 203941)
</span><span class="lines">@@ -1,3 +1,42 @@
</span><ins>+2016-07-30  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        [WebIDL] Enable strict type checking for operations' nullable parameters of wrapper types
+        https://bugs.webkit.org/show_bug.cgi?id=160374
+
+        Reviewed by Youenn Fablet.
+
+        Enable strict type checking for operations' nullable parameters of
+        wrapper types to comply with the Web IDL specification:
+        - http://heycam.github.io/webidl/#es-nullable-type
+        - http://heycam.github.io/webidl/#es-interface
+
+        For such parameters, if the JS passes a value that is not null /
+        undefined and does not have the expected wrapper type, then we now
+        throw a TypeError instead of silently converting the value to null.
+
+        This behavior is consistent with Chrome and Firefox. It also helps
+        identify bugs in JavaScript code.
+
+        No new tests, rebaselined existing tests.
+
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (GenerateParametersCheck):
+        * bindings/scripts/test/JS/JSTestObj.cpp:
+        (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalNullableWrapper):
+        (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalNullableWrapperIsNull):
+        (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalXPathNSResolver):
+        (WebCore::jsTestObjPrototypeFunctionOverloadedMethod1):
+        (WebCore::jsTestObjPrototypeFunctionOverloadedMethod2):
+        (WebCore::jsTestObjPrototypeFunctionOverloadedMethod6):
+        (WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithOptionalParameter1):
+        (WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithOptionalParameter2):
+        (WebCore::jsTestObjPrototypeFunctionConvert2):
+        (WebCore::jsTestObjPrototypeFunctionStrictFunctionWithSequence):
+        (WebCore::jsTestObjPrototypeFunctionConditionalMethod3): Deleted.
+        (WebCore::jsTestObjPrototypeFunctionOverloadedMethod5): Deleted.
+        (WebCore::jsTestObjPrototypeFunctionOverloadedMethod): Deleted.
+        (WebCore::jsTestObjPrototypeFunctionOrange): Deleted.
+
</ins><span class="cx"> 2016-07-29  Chris Dumez  &lt;cdumez@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Window's named properties should be exposed on a WindowProperties object in its prototype
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptsCodeGeneratorJSpm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (203940 => 203941)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2016-07-30 06:39:37 UTC (rev 203940)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2016-07-30 08:35:06 UTC (rev 203941)
</span><span class="lines">@@ -3750,7 +3750,7 @@
</span><span class="cx">             my $isTearOff = $codeGenerator-&gt;IsSVGTypeNeedingTearOff($type) &amp;&amp; $interfaceName !~ /List$/;
</span><span class="cx">             my $shouldPassByReference = $isTearOff || ShouldPassWrapperByReference($parameter, $interface);
</span><span class="cx"> 
</span><del>-            if ($function-&gt;signature-&gt;extendedAttributes-&gt;{&quot;StrictTypeChecking&quot;} &amp;&amp; !$shouldPassByReference &amp;&amp; $codeGenerator-&gt;IsWrapperType($type)) {
</del><ins>+            if (!$shouldPassByReference &amp;&amp; $codeGenerator-&gt;IsWrapperType($type)) {
</ins><span class="cx">                 $implIncludes{&quot;&lt;runtime/Error.h&gt;&quot;} = 1;
</span><span class="cx">                 my $checkedArgument = &quot;state-&gt;argument($argumentIndex)&quot;;
</span><span class="cx">                 my $uncheckedArgument = &quot;state-&gt;uncheckedArgument($argumentIndex)&quot;;
</span><span class="lines">@@ -3759,12 +3759,13 @@
</span><span class="cx">                 push(@$outputArray, &quot;    if (!$checkedArgument.isUndefinedOrNull()) {\n&quot;);
</span><span class="cx">                 push(@$outputArray, &quot;        $name = $nativeValue;\n&quot;);
</span><span class="cx">                 if ($mayThrowException) {
</span><del>-                    push(@$outputArray, &quot;    if (UNLIKELY(state-&gt;hadException()))\n&quot;);
-                    push(@$outputArray, &quot;        return JSValue::encode(jsUndefined());\n&quot;);
</del><ins>+                    push(@$outputArray, &quot;        if (UNLIKELY(state-&gt;hadException()))\n&quot;);
+                    push(@$outputArray, &quot;            return JSValue::encode(jsUndefined());\n&quot;);
</ins><span class="cx">                 }
</span><span class="cx">                 push(@$outputArray, &quot;        if (UNLIKELY(!$name))\n&quot;);
</span><span class="cx">                 push(@$outputArray, &quot;            return throwArgumentTypeError(*state, $argumentIndex, \&quot;$name\&quot;, \&quot;$visibleInterfaceName\&quot;, $quotedFunctionName, \&quot;$type\&quot;);\n&quot;);
</span><span class="cx">                 push(@$outputArray, &quot;    }\n&quot;);
</span><ins>+                $value = &quot;WTFMove($name)&quot;;
</ins><span class="cx">             } else {
</span><span class="cx">                 if ($parameter-&gt;isOptional &amp;&amp; defined($parameter-&gt;default) &amp;&amp; !WillConvertUndefinedToDefaultParameterValue($type, $parameter-&gt;default)) {
</span><span class="cx">                     my $defaultValue = $parameter-&gt;default;
</span><span class="lines">@@ -4295,6 +4296,7 @@
</span><span class="cx">     &quot;DOMTimeStamp&quot; =&gt; &quot;DOMTimeStamp&quot;,
</span><span class="cx">     &quot;Date&quot; =&gt; &quot;double&quot;,
</span><span class="cx">     &quot;Dictionary&quot; =&gt; &quot;Dictionary&quot;,
</span><ins>+    &quot;EventListener&quot; =&gt; &quot;RefPtr&lt;EventListener&gt;&quot;,
</ins><span class="cx">     &quot;SerializedScriptValue&quot; =&gt; &quot;RefPtr&lt;SerializedScriptValue&gt;&quot;,
</span><span class="cx">     &quot;XPathNSResolver&quot; =&gt; &quot;RefPtr&lt;XPathNSResolver&gt;&quot;,
</span><span class="cx">     &quot;any&quot; =&gt; &quot;JSC::JSValue&quot;,
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestObjcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (203940 => 203941)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp        2016-07-30 06:39:37 UTC (rev 203940)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp        2016-07-30 08:35:06 UTC (rev 203941)
</span><span class="lines">@@ -5028,7 +5028,12 @@
</span><span class="cx">         return throwThisTypeError(*state, &quot;TestObject&quot;, &quot;methodWithOptionalNullableWrapper&quot;);
</span><span class="cx">     ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
</span><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><del>-    auto obj = JSTestObj::toWrapped(state-&gt;argument(0));
</del><ins>+    TestObj* obj = nullptr;
+    if (!state-&gt;argument(0).isUndefinedOrNull()) {
+        obj = JSTestObj::toWrapped(state-&gt;uncheckedArgument(0));
+        if (UNLIKELY(!obj))
+            return throwArgumentTypeError(*state, 0, &quot;obj&quot;, &quot;TestObject&quot;, &quot;methodWithOptionalNullableWrapper&quot;, &quot;TestObj&quot;);
+    }
</ins><span class="cx">     impl.methodWithOptionalNullableWrapper(WTFMove(obj));
</span><span class="cx">     return JSValue::encode(jsUndefined());
</span><span class="cx"> }
</span><span class="lines">@@ -5041,7 +5046,12 @@
</span><span class="cx">         return throwThisTypeError(*state, &quot;TestObject&quot;, &quot;methodWithOptionalNullableWrapperIsNull&quot;);
</span><span class="cx">     ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
</span><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><del>-    auto obj = JSTestObj::toWrapped(state-&gt;argument(0));
</del><ins>+    TestObj* obj = nullptr;
+    if (!state-&gt;argument(0).isUndefinedOrNull()) {
+        obj = JSTestObj::toWrapped(state-&gt;uncheckedArgument(0));
+        if (UNLIKELY(!obj))
+            return throwArgumentTypeError(*state, 0, &quot;obj&quot;, &quot;TestObject&quot;, &quot;methodWithOptionalNullableWrapperIsNull&quot;, &quot;TestObj&quot;);
+    }
</ins><span class="cx">     impl.methodWithOptionalNullableWrapperIsNull(WTFMove(obj));
</span><span class="cx">     return JSValue::encode(jsUndefined());
</span><span class="cx"> }
</span><span class="lines">@@ -5054,9 +5064,14 @@
</span><span class="cx">         return throwThisTypeError(*state, &quot;TestObject&quot;, &quot;methodWithOptionalXPathNSResolver&quot;);
</span><span class="cx">     ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
</span><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><del>-    auto resolver = JSXPathNSResolver::toWrapped(*state, state-&gt;argument(0));
-    if (UNLIKELY(state-&gt;hadException()))
-        return JSValue::encode(jsUndefined());
</del><ins>+    RefPtr&lt;XPathNSResolver&gt; resolver = nullptr;
+    if (!state-&gt;argument(0).isUndefinedOrNull()) {
+        resolver = JSXPathNSResolver::toWrapped(*state, state-&gt;uncheckedArgument(0));
+        if (UNLIKELY(state-&gt;hadException()))
+            return JSValue::encode(jsUndefined());
+        if (UNLIKELY(!resolver))
+            return throwArgumentTypeError(*state, 0, &quot;resolver&quot;, &quot;TestObject&quot;, &quot;methodWithOptionalXPathNSResolver&quot;, &quot;XPathNSResolver&quot;);
+    }
</ins><span class="cx">     impl.methodWithOptionalXPathNSResolver(WTFMove(resolver));
</span><span class="cx">     return JSValue::encode(jsUndefined());
</span><span class="cx"> }
</span><span class="lines">@@ -5249,7 +5264,12 @@
</span><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     if (UNLIKELY(state-&gt;argumentCount() &lt; 2))
</span><span class="cx">         return throwVMError(state, createNotEnoughArgumentsError(state));
</span><del>-    auto objArg = JSTestObj::toWrapped(state-&gt;argument(0));
</del><ins>+    TestObj* objArg = nullptr;
+    if (!state-&gt;argument(0).isUndefinedOrNull()) {
+        objArg = JSTestObj::toWrapped(state-&gt;uncheckedArgument(0));
+        if (UNLIKELY(!objArg))
+            return throwArgumentTypeError(*state, 0, &quot;objArg&quot;, &quot;TestObject&quot;, &quot;overloadedMethod&quot;, &quot;TestObj&quot;);
+    }
</ins><span class="cx">     auto strArg = state-&gt;argument(1).toWTFString(state);
</span><span class="cx">     if (UNLIKELY(state-&gt;hadException()))
</span><span class="cx">         return JSValue::encode(jsUndefined());
</span><span class="lines">@@ -5267,7 +5287,12 @@
</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, createNotEnoughArgumentsError(state));
</span><del>-    auto objArg = JSTestObj::toWrapped(state-&gt;argument(0));
</del><ins>+    TestObj* objArg = nullptr;
+    if (!state-&gt;argument(0).isUndefinedOrNull()) {
+        objArg = JSTestObj::toWrapped(state-&gt;uncheckedArgument(0));
+        if (UNLIKELY(!objArg))
+            return throwArgumentTypeError(*state, 0, &quot;objArg&quot;, &quot;TestObject&quot;, &quot;overloadedMethod&quot;, &quot;TestObj&quot;);
+    }
</ins><span class="cx">     auto longArg = state-&gt;argument(1).isUndefined() ? Optional&lt;int32_t&gt;() : convert&lt;int32_t&gt;(*state, state-&gt;uncheckedArgument(1), NormalConversion);
</span><span class="cx">     if (UNLIKELY(state-&gt;hadException()))
</span><span class="cx">         return JSValue::encode(jsUndefined());
</span><span class="lines">@@ -5336,9 +5361,14 @@
</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, createNotEnoughArgumentsError(state));
</span><del>-    auto listArg = JSDOMStringList::toWrapped(*state, state-&gt;argument(0));
-    if (UNLIKELY(state-&gt;hadException()))
-        return JSValue::encode(jsUndefined());
</del><ins>+    RefPtr&lt;DOMStringList&gt; listArg = nullptr;
+    if (!state-&gt;argument(0).isUndefinedOrNull()) {
+        listArg = JSDOMStringList::toWrapped(*state, state-&gt;uncheckedArgument(0));
+        if (UNLIKELY(state-&gt;hadException()))
+            return JSValue::encode(jsUndefined());
+        if (UNLIKELY(!listArg))
+            return throwArgumentTypeError(*state, 0, &quot;listArg&quot;, &quot;TestObject&quot;, &quot;overloadedMethod&quot;, &quot;DOMStringList&quot;);
+    }
</ins><span class="cx">     impl.overloadedMethod(WTFMove(listArg));
</span><span class="cx">     return JSValue::encode(jsUndefined());
</span><span class="cx"> }
</span><span class="lines">@@ -5493,8 +5523,18 @@
</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, createNotEnoughArgumentsError(state));
</span><del>-    auto objArg1 = JSTestObj::toWrapped(state-&gt;argument(0));
-    auto objArg2 = JSTestObj::toWrapped(state-&gt;argument(1));
</del><ins>+    TestObj* objArg1 = nullptr;
+    if (!state-&gt;argument(0).isUndefinedOrNull()) {
+        objArg1 = JSTestObj::toWrapped(state-&gt;uncheckedArgument(0));
+        if (UNLIKELY(!objArg1))
+            return throwArgumentTypeError(*state, 0, &quot;objArg1&quot;, &quot;TestObject&quot;, &quot;overloadedMethodWithOptionalParameter&quot;, &quot;TestObj&quot;);
+    }
+    TestObj* objArg2 = nullptr;
+    if (!state-&gt;argument(1).isUndefinedOrNull()) {
+        objArg2 = JSTestObj::toWrapped(state-&gt;uncheckedArgument(1));
+        if (UNLIKELY(!objArg2))
+            return throwArgumentTypeError(*state, 1, &quot;objArg2&quot;, &quot;TestObject&quot;, &quot;overloadedMethodWithOptionalParameter&quot;, &quot;TestObj&quot;);
+    }
</ins><span class="cx">     impl.overloadedMethodWithOptionalParameter(WTFMove(objArg1), WTFMove(objArg2));
</span><span class="cx">     return JSValue::encode(jsUndefined());
</span><span class="cx"> }
</span><span class="lines">@@ -5509,7 +5549,12 @@
</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, createNotEnoughArgumentsError(state));
</span><del>-    auto objArg = JSTestObj::toWrapped(state-&gt;argument(0));
</del><ins>+    TestObj* objArg = nullptr;
+    if (!state-&gt;argument(0).isUndefinedOrNull()) {
+        objArg = JSTestObj::toWrapped(state-&gt;uncheckedArgument(0));
+        if (UNLIKELY(!objArg))
+            return throwArgumentTypeError(*state, 0, &quot;objArg&quot;, &quot;TestObject&quot;, &quot;overloadedMethodWithOptionalParameter&quot;, &quot;TestObj&quot;);
+    }
</ins><span class="cx">     auto longArg = state-&gt;argument(1).isUndefined() ? Optional&lt;int32_t&gt;() : convert&lt;int32_t&gt;(*state, state-&gt;uncheckedArgument(1), NormalConversion);
</span><span class="cx">     if (UNLIKELY(state-&gt;hadException()))
</span><span class="cx">         return JSValue::encode(jsUndefined());
</span><span class="lines">@@ -5800,7 +5845,12 @@
</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, createNotEnoughArgumentsError(state));
</span><del>-    auto value = JSTestNode::toWrapped(state-&gt;argument(0));
</del><ins>+    TestNode* value = nullptr;
+    if (!state-&gt;argument(0).isUndefinedOrNull()) {
+        value = JSTestNode::toWrapped(state-&gt;uncheckedArgument(0));
+        if (UNLIKELY(!value))
+            return throwArgumentTypeError(*state, 0, &quot;value&quot;, &quot;TestObject&quot;, &quot;convert2&quot;, &quot;TestNode&quot;);
+    }
</ins><span class="cx">     impl.convert2(WTFMove(value));
</span><span class="cx">     return JSValue::encode(jsUndefined());
</span><span class="cx"> }
</span><span class="lines">@@ -5921,7 +5971,7 @@
</span><span class="cx">     auto a = toNativeArray&lt;uint32_t&gt;(*state, state-&gt;argument(1));
</span><span class="cx">     if (UNLIKELY(state-&gt;hadException()))
</span><span class="cx">         return JSValue::encode(jsUndefined());
</span><del>-    JSValue result = jsBoolean(impl.strictFunctionWithSequence(objArg, WTFMove(a), ec));
</del><ins>+    JSValue result = jsBoolean(impl.strictFunctionWithSequence(WTFMove(objArg), WTFMove(a), ec));
</ins><span class="cx"> 
</span><span class="cx">     setDOMException(state, ec);
</span><span class="cx">     return JSValue::encode(result);
</span></span></pre>
</div>
</div>

</body>
</html>