<!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>[190021] 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/190021">190021</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2015-09-19 17:45:26 -0700 (Sat, 19 Sep 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>[WebIDL] Specify default parameter values where it is useful
https://bugs.webkit.org/show_bug.cgi?id=149331
&lt;rdar://problem/22545600&gt;

Reviewed by Darin Adler.

Source/WebCore:

Specify default parameter values where it is useful in our IDL, that is
to say where undefined would be converted to something else than the
default value otherwise. This patch focuses on the HTML API.

This patch also adds support for default values for optional parameters
of string enumeration type as this was needed by the
CanvasRenderingContext2D API.

Test: fast/html/undefined-parameter-default-value.html

* bindings/scripts/CodeGeneratorJS.pm:
(GenerateParametersCheck):
Add support default values for optional parameters of string enumeration
type as this was needed by the CanvasRenderingContext2D API.

* bindings/scripts/test/GObject/WebKitDOMTestObj.cpp:
* bindings/scripts/test/GObject/WebKitDOMTestObj.h:
* bindings/scripts/test/JS/JSTestObj.cpp:
* bindings/scripts/test/ObjC/DOMTestObj.h:
* bindings/scripts/test/ObjC/DOMTestObj.mm:
* bindings/scripts/test/TestObj.idl:
Add bindings tests coverage for optional parameters of string enumeration
type and that have a default value.

* html/HTMLInputElement.idl:
Specify default parameter value for stepUp() / stepDown(). Without this,
stepUp(undefined) would be equivalent to calling stepUp(0) even though
it is supposed to be equivalent to calling stepUp(1).

* html/HTMLTableElement.idl:
* html/HTMLTableSectionElement.idl:
Specify default parameter value for insertRow(). Without this,
insertRow(undefined) would be equivalent to insertRow(0) instead of
insertRow(-1). This would prepend the row instead of appending it:
- https://html.spec.whatwg.org/#htmltableelement
- https://html.spec.whatwg.org/#htmltablesectionelement

* html/HTMLTableRowElement.idl:
Specify default parameter value for insertCell(). Without this,
insertCell(undefined) would be equivalent to insertCell(0) instead of
insertCell(-1). This would prepend the cell instead of appending it:
- https://html.spec.whatwg.org/#htmltablerowelement

* html/canvas/CanvasRenderingContext2D.idl:
Specify default value for CanvasWindingRule parameters so that calling
this with undefined will use the default enum value instead of using the
&quot;undefined&quot; string and then throwing because it is not a valid enum value:
- https://html.spec.whatwg.org/#canvasrenderingcontext2d

LayoutTests:

Add test to check the behavior of passing undefined for various optional
parameters that have a default value in the HTML specification.

* fast/html/undefined-parameter-default-value-expected.txt: Added.
* fast/html/undefined-parameter-default-value.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsfastcanvascanvasclippathexpectedtxt">trunk/LayoutTests/fast/canvas/canvas-clip-path-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastcanvascanvasfillpathexpectedtxt">trunk/LayoutTests/fast/canvas/canvas-fill-path-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastcanvasscripttestscanvasclippathjs">trunk/LayoutTests/fast/canvas/script-tests/canvas-clip-path.js</a></li>
<li><a href="#trunkLayoutTestsfastcanvasscripttestscanvasfillpathjs">trunk/LayoutTests/fast/canvas/script-tests/canvas-fill-path.js</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="#trunkSourceWebCorebindingsscriptstestGObjectWebKitDOMTestObjcpp">trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestGObjectWebKitDOMTestObjh">trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestJSJSTestObjcpp">trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestObjCDOMTestObjh">trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestObjCDOMTestObjmm">trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestTestObjidl">trunk/Source/WebCore/bindings/scripts/test/TestObj.idl</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLInputElementidl">trunk/Source/WebCore/html/HTMLInputElement.idl</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLTableElementidl">trunk/Source/WebCore/html/HTMLTableElement.idl</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLTableRowElementidl">trunk/Source/WebCore/html/HTMLTableRowElement.idl</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLTableSectionElementidl">trunk/Source/WebCore/html/HTMLTableSectionElement.idl</a></li>
<li><a href="#trunkSourceWebCorehtmlcanvasCanvasRenderingContext2Didl">trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.idl</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfasthtmlundefinedparameterdefaultvalueexpectedtxt">trunk/LayoutTests/fast/html/undefined-parameter-default-value-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfasthtmlundefinedparameterdefaultvaluehtml">trunk/LayoutTests/fast/html/undefined-parameter-default-value.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (190020 => 190021)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-09-20 00:43:08 UTC (rev 190020)
+++ trunk/LayoutTests/ChangeLog        2015-09-20 00:45:26 UTC (rev 190021)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2015-09-19  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        [WebIDL] Specify default parameter values where it is useful
+        https://bugs.webkit.org/show_bug.cgi?id=149331
+        &lt;rdar://problem/22545600&gt;
+
+        Reviewed by Darin Adler.
+
+        Add test to check the behavior of passing undefined for various optional
+        parameters that have a default value in the HTML specification.
+
+        * fast/html/undefined-parameter-default-value-expected.txt: Added.
+        * fast/html/undefined-parameter-default-value.html: Added.
+
</ins><span class="cx"> 2015-09-18  Dean Jackson  &lt;dino@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Null dereference loading Blink layout test svg/filters/feImage-failed-load-crash.html
</span></span></pre></div>
<a id="trunkLayoutTestsfastcanvascanvasclippathexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/canvas/canvas-clip-path-expected.txt (190020 => 190021)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/canvas/canvas-clip-path-expected.txt        2015-09-20 00:43:08 UTC (rev 190020)
+++ trunk/LayoutTests/fast/canvas/canvas-clip-path-expected.txt        2015-09-20 00:45:26 UTC (rev 190021)
</span><span class="lines">@@ -27,7 +27,7 @@
</span><span class="cx"> PASS ctx.clip(0) threw exception TypeError: Argument 1 ('winding') to CanvasRenderingContext2D.clip must be one of: &quot;nonzero&quot;, &quot;evenodd&quot;.
</span><span class="cx"> PASS ctx.clip(null) threw exception TypeError: Argument 1 ('winding') to CanvasRenderingContext2D.clip must be one of: &quot;nonzero&quot;, &quot;evenodd&quot;.
</span><span class="cx"> PASS ctx.clip('path2d') threw exception TypeError: Argument 1 ('winding') to CanvasRenderingContext2D.clip must be one of: &quot;nonzero&quot;, &quot;evenodd&quot;.
</span><del>-PASS ctx.clip(undefined) threw exception TypeError: Argument 1 ('winding') to CanvasRenderingContext2D.clip must be one of: &quot;nonzero&quot;, &quot;evenodd&quot;.
</del><ins>+PASS ctx.clip(undefined) did not throw exception.
</ins><span class="cx"> PASS ctx.clip(Number.MAX_VALUE) threw exception TypeError: Argument 1 ('winding') to CanvasRenderingContext2D.clip must be one of: &quot;nonzero&quot;, &quot;evenodd&quot;.
</span><span class="cx"> PASS ctx.clip(function() {}) threw exception TypeError: Argument 1 ('winding') to CanvasRenderingContext2D.clip must be one of: &quot;nonzero&quot;, &quot;evenodd&quot;.
</span><span class="cx"> PASS ctx.clip(false) threw exception TypeError: Argument 1 ('winding') to CanvasRenderingContext2D.clip must be one of: &quot;nonzero&quot;, &quot;evenodd&quot;.
</span></span></pre></div>
<a id="trunkLayoutTestsfastcanvascanvasfillpathexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/canvas/canvas-fill-path-expected.txt (190020 => 190021)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/canvas/canvas-fill-path-expected.txt        2015-09-20 00:43:08 UTC (rev 190020)
+++ trunk/LayoutTests/fast/canvas/canvas-fill-path-expected.txt        2015-09-20 00:45:26 UTC (rev 190021)
</span><span class="lines">@@ -26,7 +26,7 @@
</span><span class="cx"> PASS ctx.fill(0) threw exception TypeError: Argument 1 ('winding') to CanvasRenderingContext2D.fill must be one of: &quot;nonzero&quot;, &quot;evenodd&quot;.
</span><span class="cx"> PASS ctx.fill(null) threw exception TypeError: Argument 1 ('winding') to CanvasRenderingContext2D.fill must be one of: &quot;nonzero&quot;, &quot;evenodd&quot;.
</span><span class="cx"> PASS ctx.fill('path2d') threw exception TypeError: Argument 1 ('winding') to CanvasRenderingContext2D.fill must be one of: &quot;nonzero&quot;, &quot;evenodd&quot;.
</span><del>-PASS ctx.fill(undefined) threw exception TypeError: Argument 1 ('winding') to CanvasRenderingContext2D.fill must be one of: &quot;nonzero&quot;, &quot;evenodd&quot;.
</del><ins>+PASS ctx.fill(undefined) did not throw exception.
</ins><span class="cx"> PASS ctx.fill(Number.MAX_VALUE) threw exception TypeError: Argument 1 ('winding') to CanvasRenderingContext2D.fill must be one of: &quot;nonzero&quot;, &quot;evenodd&quot;.
</span><span class="cx"> PASS ctx.fill(function() {}) threw exception TypeError: Argument 1 ('winding') to CanvasRenderingContext2D.fill must be one of: &quot;nonzero&quot;, &quot;evenodd&quot;.
</span><span class="cx"> PASS ctx.fill(false) threw exception TypeError: Argument 1 ('winding') to CanvasRenderingContext2D.fill must be one of: &quot;nonzero&quot;, &quot;evenodd&quot;.
</span><span class="lines">@@ -34,7 +34,7 @@
</span><span class="cx"> PASS ctx.fill(0, 'nonzero') threw exception TypeError: Type error.
</span><span class="cx"> PASS ctx.fill(null, 'nonzero') threw exception TypeError: Type error.
</span><span class="cx"> PASS ctx.fill('path2d', 'nonzero') threw exception TypeError: Type error.
</span><del>-PASS ctx.fill(undefined) threw exception TypeError: Argument 1 ('winding') to CanvasRenderingContext2D.fill must be one of: &quot;nonzero&quot;, &quot;evenodd&quot;.
</del><ins>+FAIL ctx.fill(undefined) should throw an exception. Was undefined.
</ins><span class="cx"> PASS ctx.fill(Number.MAX_VALUE, 'nonzero') threw exception TypeError: Type error.
</span><span class="cx"> PASS ctx.fill(function() {}, 'nonzero') threw exception TypeError: Type error.
</span><span class="cx"> PASS ctx.fill(false, 'nonzero') threw exception TypeError: Type error.
</span></span></pre></div>
<a id="trunkLayoutTestsfastcanvasscripttestscanvasclippathjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/canvas/script-tests/canvas-clip-path.js (190020 => 190021)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/canvas/script-tests/canvas-clip-path.js        2015-09-20 00:43:08 UTC (rev 190020)
+++ trunk/LayoutTests/fast/canvas/script-tests/canvas-clip-path.js        2015-09-20 00:45:26 UTC (rev 190021)
</span><span class="lines">@@ -112,7 +112,7 @@
</span><span class="cx"> shouldThrow(&quot;ctx.clip(0)&quot;);
</span><span class="cx"> shouldThrow(&quot;ctx.clip(null)&quot;);
</span><span class="cx"> shouldThrow(&quot;ctx.clip('path2d')&quot;);
</span><del>-shouldThrow(&quot;ctx.clip(undefined)&quot;);
</del><ins>+shouldNotThrow(&quot;ctx.clip(undefined)&quot;);
</ins><span class="cx"> shouldThrow(&quot;ctx.clip(Number.MAX_VALUE)&quot;);
</span><span class="cx"> shouldThrow(&quot;ctx.clip(function() {})&quot;);
</span><span class="cx"> shouldThrow(&quot;ctx.clip(false)&quot;);
</span></span></pre></div>
<a id="trunkLayoutTestsfastcanvasscripttestscanvasfillpathjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/canvas/script-tests/canvas-fill-path.js (190020 => 190021)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/canvas/script-tests/canvas-fill-path.js        2015-09-20 00:43:08 UTC (rev 190020)
+++ trunk/LayoutTests/fast/canvas/script-tests/canvas-fill-path.js        2015-09-20 00:45:26 UTC (rev 190021)
</span><span class="lines">@@ -94,7 +94,7 @@
</span><span class="cx"> shouldThrow(&quot;ctx.fill(0)&quot;);
</span><span class="cx"> shouldThrow(&quot;ctx.fill(null)&quot;);
</span><span class="cx"> shouldThrow(&quot;ctx.fill('path2d')&quot;);
</span><del>-shouldThrow(&quot;ctx.fill(undefined)&quot;);
</del><ins>+shouldNotThrow(&quot;ctx.fill(undefined)&quot;);
</ins><span class="cx"> shouldThrow(&quot;ctx.fill(Number.MAX_VALUE)&quot;);
</span><span class="cx"> shouldThrow(&quot;ctx.fill(function() {})&quot;);
</span><span class="cx"> shouldThrow(&quot;ctx.fill(false)&quot;);
</span><span class="lines">@@ -106,4 +106,4 @@
</span><span class="cx"> shouldThrow(&quot;ctx.fill(Number.MAX_VALUE, 'nonzero')&quot;);
</span><span class="cx"> shouldThrow(&quot;ctx.fill(function() {}, 'nonzero')&quot;);
</span><span class="cx"> shouldThrow(&quot;ctx.fill(false, 'nonzero')&quot;);
</span><del>-shouldThrow(&quot;ctx.fill(new Date(), 'nonzero')&quot;);
</del><span class="cx">\ No newline at end of file
</span><ins>+shouldThrow(&quot;ctx.fill(new Date(), 'nonzero')&quot;);
</ins></span></pre></div>
<a id="trunkLayoutTestsfasthtmlundefinedparameterdefaultvalueexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/html/undefined-parameter-default-value-expected.txt (0 => 190021)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/html/undefined-parameter-default-value-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/html/undefined-parameter-default-value-expected.txt        2015-09-20 00:45:26 UTC (rev 190021)
</span><span class="lines">@@ -0,0 +1,53 @@
</span><ins>+Checks the behavior of passing undefined for optional parameters that have default values
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+* HTMLInputElement.stepUp(optional long n = 1)
+PASS testNumber.value is &quot;0&quot;
+testNumber.stepUp()
+PASS testNumber.value is &quot;1&quot;
+testNumber.stepUp(undefined)
+PASS testNumber.value is &quot;2&quot;
+
+* HTMLInputElement.stepDown(optional long n = 1)
+testNumber.stepDown()
+PASS testNumber.value is &quot;1&quot;
+testNumber.stepDown(undefined)
+PASS testNumber.value is &quot;0&quot;
+
+* HTMLTableElement.insertRow(optional long index = -1)
+newRow1 = testTable.insertRow()
+PASS testTable.rows[testTable.rows.length - 1] is newRow1
+newRow2 = testTable.insertRow(undefined)
+PASS testTable.rows[testTable.rows.length - 1] is newRow2
+
+* HTMLTableRowElement.insertCell(optional long index = -1)
+newCell1 = testRow.insertCell()
+PASS testRow.cells[testRow.cells.length - 1] is newCell1
+newCell2 = testRow.insertCell(undefined)
+PASS testRow.cells[testRow.cells.length - 1] is newCell2
+
+* HTMLTableSectionElement.insertRow(optional long index = -1)
+newRow3 = testTableSection.insertRow()
+PASS testTable.rows[testTableSection.rows.length - 1] is newRow3
+newRow4 = testTableSection.insertRow(undefined)
+PASS testTable.rows[testTableSection.rows.length - 1] is newRow4
+
+* CanvasRenderingContext2D.fill(optional CanvasWindingRule winding = 'nonzero')
+PASS ctx.fill(undefined) did not throw exception.
+
+* CanvasRenderingContext2D.fill(Path2D path, optional CanvasWindingRule winding = 'nonzero')
+PASS ctx.fill(path, undefined) did not throw exception.
+
+* CanvasRenderingContext2D.clip(optional CanvasWindingRule winding = 'nonzero')
+PASS ctx.clip(undefined) did not throw exception.
+
+* CanvasRenderingContext2D.clip(Path2D path, optional CanvasWindingRule winding = 'nonzero')
+PASS ctx.clip(path, undefined) did not throw exception.
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfasthtmlundefinedparameterdefaultvaluehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/html/undefined-parameter-default-value.html (0 => 190021)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/html/undefined-parameter-default-value.html                                (rev 0)
+++ trunk/LayoutTests/fast/html/undefined-parameter-default-value.html        2015-09-20 00:45:26 UTC (rev 190021)
</span><span class="lines">@@ -0,0 +1,93 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;body&gt;
+&lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;input type=&quot;number&quot; id=&quot;testNumber&quot; value=&quot;0&quot;&gt;
+
+&lt;table id=&quot;testTable&quot;&gt;
+  &lt;thead id=&quot;testTableSection&quot;&gt;
+    &lt;tr&gt;&lt;/tr&gt;
+  &lt;/thead&gt;
+  &lt;tr id=&quot;testRow&quot;&gt;
+    &lt;td id=&quot;testCell&quot;&gt;&lt;/td
+  &lt;/tr&gt;
+&lt;/table&gt;
+
+&lt;canvas id=&quot;testCanvas&quot; width=&quot;100&quot; height=&quot;100&quot;&gt;
+
+&lt;script&gt;
+description(&quot;Checks the behavior of passing undefined for optional parameters that have default values&quot;);
+
+debug(&quot;* HTMLInputElement.stepUp(optional long n = 1)&quot;);
+var testNumber = document.getElementById(&quot;testNumber&quot;);
+shouldBeEqualToString(&quot;testNumber.value&quot;, &quot;0&quot;);
+evalAndLog(&quot;testNumber.stepUp()&quot;);
+shouldBeEqualToString(&quot;testNumber.value&quot;, &quot;1&quot;);
+evalAndLog(&quot;testNumber.stepUp(undefined)&quot;);
+shouldBeEqualToString(&quot;testNumber.value&quot;, &quot;2&quot;);
+
+debug(&quot;&quot;);
+debug(&quot;* HTMLInputElement.stepDown(optional long n = 1)&quot;);
+evalAndLog(&quot;testNumber.stepDown()&quot;);
+shouldBeEqualToString(&quot;testNumber.value&quot;, &quot;1&quot;);
+evalAndLog(&quot;testNumber.stepDown(undefined)&quot;);
+shouldBeEqualToString(&quot;testNumber.value&quot;, &quot;0&quot;);
+
+debug(&quot;&quot;);
+debug(&quot;* HTMLTableElement.insertRow(optional long index = -1)&quot;);
+// Should append the row if index is missing or undefined.
+var testTable = document.getElementById(&quot;testTable&quot;);
+var newRow1;
+evalAndLog(&quot;newRow1 = testTable.insertRow()&quot;);
+shouldBe(&quot;testTable.rows[testTable.rows.length - 1]&quot;, &quot;newRow1&quot;);
+var newRow2
+evalAndLog(&quot;newRow2 = testTable.insertRow(undefined)&quot;);
+shouldBe(&quot;testTable.rows[testTable.rows.length - 1]&quot;, &quot;newRow2&quot;);
+
+debug(&quot;&quot;);
+debug(&quot;* HTMLTableRowElement.insertCell(optional long index = -1)&quot;);
+// Should append the cell if index is missing or undefined.
+var testRow = document.getElementById(&quot;testRow&quot;);
+var newCell1;
+evalAndLog(&quot;newCell1 = testRow.insertCell()&quot;);
+shouldBe(&quot;testRow.cells[testRow.cells.length - 1]&quot;, &quot;newCell1&quot;);
+var newCell2;
+evalAndLog(&quot;newCell2 = testRow.insertCell(undefined)&quot;);
+shouldBe(&quot;testRow.cells[testRow.cells.length - 1]&quot;, &quot;newCell2&quot;);
+
+debug(&quot;&quot;);
+debug(&quot;* HTMLTableSectionElement.insertRow(optional long index = -1)&quot;);
+// Should append the row if index is missing or undefined.
+var testTableSection = document.getElementById(&quot;testTableSection&quot;);
+var newRow3;
+evalAndLog(&quot;newRow3 = testTableSection.insertRow()&quot;);
+shouldBe(&quot;testTable.rows[testTableSection.rows.length - 1]&quot;, &quot;newRow3&quot;);
+var newRow4;
+evalAndLog(&quot;newRow4 = testTableSection.insertRow(undefined)&quot;);
+shouldBe(&quot;testTable.rows[testTableSection.rows.length - 1]&quot;, &quot;newRow4&quot;);
+
+debug(&quot;&quot;);
+debug(&quot;* CanvasRenderingContext2D.fill(optional CanvasWindingRule winding = 'nonzero')&quot;);
+var ctx = document.getElementById(&quot;testCanvas&quot;).getContext(&quot;2d&quot;);
+ctx.rect(0, 0, 150, 100);
+ctx.fillStyle = &quot;red&quot;;
+shouldNotThrow(&quot;ctx.fill(undefined)&quot;);
+
+debug(&quot;&quot;);
+debug(&quot;* CanvasRenderingContext2D.fill(Path2D path, optional CanvasWindingRule winding = 'nonzero')&quot;);
+var path = new Path2D();
+shouldNotThrow(&quot;ctx.fill(path, undefined)&quot;);
+
+debug(&quot;&quot;);
+debug(&quot;* CanvasRenderingContext2D.clip(optional CanvasWindingRule winding = 'nonzero')&quot;);
+shouldNotThrow(&quot;ctx.clip(undefined)&quot;);
+
+debug(&quot;&quot;);
+debug(&quot;* CanvasRenderingContext2D.clip(Path2D path, optional CanvasWindingRule winding = 'nonzero')&quot;);
+shouldNotThrow(&quot;ctx.clip(path, undefined)&quot;);
+
+debug(&quot;&quot;);
+&lt;/script&gt;
+&lt;script src=&quot;../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (190020 => 190021)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-09-20 00:43:08 UTC (rev 190020)
+++ trunk/Source/WebCore/ChangeLog        2015-09-20 00:45:26 UTC (rev 190021)
</span><span class="lines">@@ -1,3 +1,60 @@
</span><ins>+2015-09-19  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        [WebIDL] Specify default parameter values where it is useful
+        https://bugs.webkit.org/show_bug.cgi?id=149331
+        &lt;rdar://problem/22545600&gt;
+
+        Reviewed by Darin Adler.
+
+        Specify default parameter values where it is useful in our IDL, that is
+        to say where undefined would be converted to something else than the
+        default value otherwise. This patch focuses on the HTML API.
+
+        This patch also adds support for default values for optional parameters
+        of string enumeration type as this was needed by the
+        CanvasRenderingContext2D API.
+
+        Test: fast/html/undefined-parameter-default-value.html
+
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (GenerateParametersCheck):
+        Add support default values for optional parameters of string enumeration
+        type as this was needed by the CanvasRenderingContext2D API.
+
+        * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp:
+        * bindings/scripts/test/GObject/WebKitDOMTestObj.h:
+        * bindings/scripts/test/JS/JSTestObj.cpp:
+        * bindings/scripts/test/ObjC/DOMTestObj.h:
+        * bindings/scripts/test/ObjC/DOMTestObj.mm:
+        * bindings/scripts/test/TestObj.idl:
+        Add bindings tests coverage for optional parameters of string enumeration
+        type and that have a default value.
+
+        * html/HTMLInputElement.idl:
+        Specify default parameter value for stepUp() / stepDown(). Without this,
+        stepUp(undefined) would be equivalent to calling stepUp(0) even though
+        it is supposed to be equivalent to calling stepUp(1).
+
+        * html/HTMLTableElement.idl:
+        * html/HTMLTableSectionElement.idl:
+        Specify default parameter value for insertRow(). Without this,
+        insertRow(undefined) would be equivalent to insertRow(0) instead of
+        insertRow(-1). This would prepend the row instead of appending it:
+        - https://html.spec.whatwg.org/#htmltableelement
+        - https://html.spec.whatwg.org/#htmltablesectionelement
+
+        * html/HTMLTableRowElement.idl:
+        Specify default parameter value for insertCell(). Without this,
+        insertCell(undefined) would be equivalent to insertCell(0) instead of
+        insertCell(-1). This would prepend the cell instead of appending it:
+        - https://html.spec.whatwg.org/#htmltablerowelement
+
+        * html/canvas/CanvasRenderingContext2D.idl:
+        Specify default value for CanvasWindingRule parameters so that calling
+        this with undefined will use the default enum value instead of using the
+        &quot;undefined&quot; string and then throwing because it is not a valid enum value:
+        - https://html.spec.whatwg.org/#canvasrenderingcontext2d
+
</ins><span class="cx"> 2015-09-19  Eric Carlson  &lt;eric.carlson@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Cleanup code that finds and loads a media engine
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptsCodeGeneratorJSpm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (190020 => 190021)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2015-09-20 00:43:08 UTC (rev 190020)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2015-09-20 00:45:26 UTC (rev 190021)
</span><span class="lines">@@ -3359,26 +3359,46 @@
</span><span class="cx">         } elsif ($codeGenerator-&gt;IsEnumType($argType)) {
</span><span class="cx">             $implIncludes{&quot;&lt;runtime/Error.h&gt;&quot;} = 1;
</span><span class="cx"> 
</span><del>-            my $argValue = &quot;exec-&gt;argument($argsIndex)&quot;;
-            push(@$outputArray, &quot;    // Keep pointer to the JSString in a local so we don't need to ref the String.\n&quot;);
-            push(@$outputArray, &quot;    auto* ${name}String = ${argValue}.toString(exec);\n&quot;);
-            push(@$outputArray, &quot;    if (UNLIKELY(exec-&gt;hadException()))\n&quot;);
-            push(@$outputArray, &quot;        return JSValue::encode(jsUndefined());\n&quot;);
-            push(@$outputArray, &quot;    auto&amp; $name = ${name}String-&gt;value(exec);\n&quot;);
</del><ins>+            my $exceptionCheck = sub {
+                my $indent = shift;
+                push(@$outputArray, $indent . &quot;    if (UNLIKELY(exec-&gt;hadException()))\n&quot;);
+                push(@$outputArray, $indent . &quot;        return JSValue::encode(jsUndefined());\n&quot;);
+            };
</ins><span class="cx"> 
</span><del>-            my @enumValues = $codeGenerator-&gt;ValidEnumValues($argType);
-            my @enumChecks = ();
-            my $enums = 0;
-            foreach my $enumValue (@enumValues) {
-                push(@enumChecks, &quot;${name} != \&quot;$enumValue\&quot;&quot;);
-                if (!$enums) {
-                    $enums = &quot;\\\&quot;$enumValue\\\&quot;&quot;;
-                } else {
-                    $enums = $enums . &quot;, \\\&quot;&quot; . $enumValue . &quot;\\\&quot;&quot;;
</del><ins>+            my $enumValueCheck = sub {
+                my $indent = shift;
+                my @enumValues = $codeGenerator-&gt;ValidEnumValues($argType);
+                my @enumChecks = ();
+                my $enums = 0;
+                foreach my $enumValue (@enumValues) {
+                    push(@enumChecks, &quot;${name} != \&quot;$enumValue\&quot;&quot;);
+                    if (!$enums) {
+                        $enums = &quot;\\\&quot;$enumValue\\\&quot;&quot;;
+                    } else {
+                        $enums = $enums . &quot;, \\\&quot;&quot; . $enumValue . &quot;\\\&quot;&quot;;
+                    }
</ins><span class="cx">                 }
</span><ins>+                push(@$outputArray, $indent . &quot;    if (&quot; . join(&quot; &amp;&amp; &quot;, @enumChecks) . &quot;)\n&quot;);
+                push(@$outputArray, $indent . &quot;        return throwArgumentMustBeEnumError(*exec, $argsIndex, \&quot;$name\&quot;, \&quot;$interfaceName\&quot;, $quotedFunctionName, \&quot;$enums\&quot;);\n&quot;);
+            };
+
+            my $argValue = &quot;exec-&gt;argument($argsIndex)&quot;;
+            if ($parameter-&gt;isOptional &amp;&amp; $parameter-&gt;default) {
+                push(@$outputArray, &quot;    String $name;\n&quot;);
+                push(@$outputArray, &quot;    if (${argValue}.isUndefined())\n&quot;);
+                push(@$outputArray, &quot;        $name = ASCIILiteral(&quot; . $parameter-&gt;default . &quot;);\n&quot;);
+                push(@$outputArray, &quot;    else {\n&quot;);
+                push(@$outputArray, &quot;        $name = exec-&gt;uncheckedArgument($argsIndex).toString(exec)-&gt;value(exec);\n&quot;);
+                &amp;$exceptionCheck(&quot;    &quot;);
+                &amp;$enumValueCheck(&quot;    &quot;);
+                push(@$outputArray, &quot;    }\n&quot;);
+            } else {
+                push(@$outputArray, &quot;    // Keep pointer to the JSString in a local so we don't need to ref the String.\n&quot;);
+                push(@$outputArray, &quot;    auto* ${name}String = ${argValue}.toString(exec);\n&quot;);
+                push(@$outputArray, &quot;    auto&amp; $name = ${name}String-&gt;value(exec);\n&quot;);
+                &amp;$exceptionCheck(&quot;&quot;);
+                &amp;$enumValueCheck(&quot;&quot;);
</ins><span class="cx">             }
</span><del>-            push (@$outputArray, &quot;    if (&quot; . join(&quot; &amp;&amp; &quot;, @enumChecks) . &quot;)\n&quot;);
-            push (@$outputArray, &quot;        return throwArgumentMustBeEnumError(*exec, $argsIndex, \&quot;$name\&quot;, \&quot;$interfaceName\&quot;, $quotedFunctionName, \&quot;$enums\&quot;);\n&quot;);
</del><span class="cx">         } else {
</span><span class="cx">             # If the &quot;StrictTypeChecking&quot; extended attribute is present, and the argument's type is an
</span><span class="cx">             # interface type, then if the incoming value does not implement that interface, a TypeError
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestGObjectWebKitDOMTestObjcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp (190020 => 190021)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp        2015-09-20 00:43:08 UTC (rev 190020)
+++ trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp        2015-09-20 00:45:26 UTC (rev 190021)
</span><span class="lines">@@ -1152,6 +1152,16 @@
</span><span class="cx">     item-&gt;methodWithEnumArg(convertedEnumArg);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void webkit_dom_test_obj_method_with_optional_enum_arg_and_default_value(WebKitDOMTestObj* self, WebKitDOMTestEnumType* enumArg)
+{
+    WebCore::JSMainThreadNullState state;
+    g_return_if_fail(WEBKIT_DOM_IS_TEST_OBJ(self));
+    g_return_if_fail(WEBKIT_DOM_IS_TEST_ENUM_TYPE(enumArg));
+    WebCore::TestObj* item = WebKit::core(self);
+    WebCore::TestEnumType* convertedEnumArg = WebKit::core(enumArg);
+    item-&gt;methodWithOptionalEnumArgAndDefaultValue(convertedEnumArg);
+}
+
</ins><span class="cx"> WebKitDOMTestObj* webkit_dom_test_obj_method_that_requires_all_args_and_throws(WebKitDOMTestObj* self, const gchar* strArg, WebKitDOMTestObj* objArg, GError** error)
</span><span class="cx"> {
</span><span class="cx">     WebCore::JSMainThreadNullState state;
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestGObjectWebKitDOMTestObjh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h (190020 => 190021)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h        2015-09-20 00:43:08 UTC (rev 190020)
+++ trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h        2015-09-20 00:45:26 UTC (rev 190021)
</span><span class="lines">@@ -246,6 +246,16 @@
</span><span class="cx"> webkit_dom_test_obj_method_with_enum_arg(WebKitDOMTestObj* self, WebKitDOMTestEnumType* enumArg);
</span><span class="cx"> 
</span><span class="cx"> /**
</span><ins>+ * webkit_dom_test_obj_method_with_optional_enum_arg_and_default_value:
+ * @self: A #WebKitDOMTestObj
+ * @enumArg: A #WebKitDOMTestEnumType
+ *
+ * Stability: Unstable
+**/
+WEBKIT_API void
+webkit_dom_test_obj_method_with_optional_enum_arg_and_default_value(WebKitDOMTestObj* self, WebKitDOMTestEnumType* enumArg);
+
+/**
</ins><span class="cx">  * webkit_dom_test_obj_method_that_requires_all_args_and_throws:
</span><span class="cx">  * @self: A #WebKitDOMTestObj
</span><span class="cx">  * @strArg: A #gchar
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestObjcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (190020 => 190021)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp        2015-09-20 00:43:08 UTC (rev 190020)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp        2015-09-20 00:45:26 UTC (rev 190021)
</span><span class="lines">@@ -91,6 +91,7 @@
</span><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithSequenceArg(JSC::ExecState*);
</span><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodReturningSequence(JSC::ExecState*);
</span><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithEnumArg(JSC::ExecState*);
</span><ins>+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalEnumArgAndDefaultValue(JSC::ExecState*);
</ins><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodThatRequiresAllArgsAndThrows(JSC::ExecState*);
</span><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionSerializedValue(JSC::ExecState*);
</span><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOptionsObject(JSC::ExecState*);
</span><span class="lines">@@ -605,6 +606,7 @@
</span><span class="cx">     { &quot;methodWithSequenceArg&quot;, JSC::Function, NoIntrinsic, { (intptr_t)static_cast&lt;NativeFunction&gt;(jsTestObjPrototypeFunctionMethodWithSequenceArg), (intptr_t) (1) } },
</span><span class="cx">     { &quot;methodReturningSequence&quot;, JSC::Function, NoIntrinsic, { (intptr_t)static_cast&lt;NativeFunction&gt;(jsTestObjPrototypeFunctionMethodReturningSequence), (intptr_t) (1) } },
</span><span class="cx">     { &quot;methodWithEnumArg&quot;, JSC::Function, NoIntrinsic, { (intptr_t)static_cast&lt;NativeFunction&gt;(jsTestObjPrototypeFunctionMethodWithEnumArg), (intptr_t) (1) } },
</span><ins>+    { &quot;methodWithOptionalEnumArgAndDefaultValue&quot;, JSC::Function, NoIntrinsic, { (intptr_t)static_cast&lt;NativeFunction&gt;(jsTestObjPrototypeFunctionMethodWithOptionalEnumArgAndDefaultValue), (intptr_t) (0) } },
</ins><span class="cx">     { &quot;methodThatRequiresAllArgsAndThrows&quot;, JSC::Function, NoIntrinsic, { (intptr_t)static_cast&lt;NativeFunction&gt;(jsTestObjPrototypeFunctionMethodThatRequiresAllArgsAndThrows), (intptr_t) (2) } },
</span><span class="cx">     { &quot;serializedValue&quot;, JSC::Function, NoIntrinsic, { (intptr_t)static_cast&lt;NativeFunction&gt;(jsTestObjPrototypeFunctionSerializedValue), (intptr_t) (1) } },
</span><span class="cx">     { &quot;optionsObject&quot;, JSC::Function, NoIntrinsic, { (intptr_t)static_cast&lt;NativeFunction&gt;(jsTestObjPrototypeFunctionOptionsObject), (intptr_t) (1) } },
</span><span class="lines">@@ -3281,15 +3283,44 @@
</span><span class="cx">         return throwVMError(exec, createNotEnoughArgumentsError(exec));
</span><span class="cx">     // Keep pointer to the JSString in a local so we don't need to ref the String.
</span><span class="cx">     auto* enumArgString = exec-&gt;argument(0).toString(exec);
</span><ins>+    auto&amp; enumArg = enumArgString-&gt;value(exec);
</ins><span class="cx">     if (UNLIKELY(exec-&gt;hadException()))
</span><span class="cx">         return JSValue::encode(jsUndefined());
</span><del>-    auto&amp; enumArg = enumArgString-&gt;value(exec);
</del><span class="cx">     if (enumArg != &quot;&quot; &amp;&amp; enumArg != &quot;EnumValue1&quot; &amp;&amp; enumArg != &quot;EnumValue2&quot; &amp;&amp; enumArg != &quot;EnumValue3&quot;)
</span><span class="cx">         return throwArgumentMustBeEnumError(*exec, 0, &quot;enumArg&quot;, &quot;TestObj&quot;, &quot;methodWithEnumArg&quot;, &quot;\&quot;\&quot;, \&quot;EnumValue1\&quot;, \&quot;EnumValue2\&quot;, \&quot;EnumValue3\&quot;&quot;);
</span><span class="cx">     impl.methodWithEnumArg(enumArg);
</span><span class="cx">     return JSValue::encode(jsUndefined());
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalEnumArgAndDefaultValue(ExecState* exec)
+{
+    JSValue thisValue = exec-&gt;thisValue();
+    JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(thisValue);
+    if (UNLIKELY(!castedThis))
+        return throwThisTypeError(*exec, &quot;TestObj&quot;, &quot;methodWithOptionalEnumArgAndDefaultValue&quot;);
+    ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
+    auto&amp; impl = castedThis-&gt;impl();
+
+    size_t argsCount = exec-&gt;argumentCount();
+    if (argsCount &lt;= 0) {
+        impl.methodWithOptionalEnumArgAndDefaultValue();
+        return JSValue::encode(jsUndefined());
+    }
+
+    String enumArg;
+    if (exec-&gt;argument(0).isUndefined())
+        enumArg = String(ASCIILiteral(&quot;EnumValue1&quot;));
+    else {
+        enumArg = exec-&gt;uncheckedArgument(0).toString(exec)-&gt;value(exec);
+        if (UNLIKELY(exec-&gt;hadException()))
+            return JSValue::encode(jsUndefined());
+        if (enumArg != &quot;&quot; &amp;&amp; enumArg != &quot;EnumValue1&quot; &amp;&amp; enumArg != &quot;EnumValue2&quot; &amp;&amp; enumArg != &quot;EnumValue3&quot;)
+            return throwArgumentMustBeEnumError(*exec, 0, &quot;enumArg&quot;, &quot;TestObj&quot;, &quot;methodWithOptionalEnumArgAndDefaultValue&quot;, &quot;\&quot;\&quot;, \&quot;EnumValue1\&quot;, \&quot;EnumValue2\&quot;, \&quot;EnumValue3\&quot;&quot;);
+    }
+    impl.methodWithOptionalEnumArgAndDefaultValue(enumArg);
+    return JSValue::encode(jsUndefined());
+}
+
</ins><span class="cx"> EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodThatRequiresAllArgsAndThrows(ExecState* exec)
</span><span class="cx"> {
</span><span class="cx">     JSValue thisValue = exec-&gt;thisValue();
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestObjCDOMTestObjh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h (190020 => 190021)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h        2015-09-20 00:43:08 UTC (rev 190020)
+++ trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h        2015-09-20 00:45:26 UTC (rev 190021)
</span><span class="lines">@@ -134,6 +134,7 @@
</span><span class="cx"> - (DOMTestObj *)objMethod;
</span><span class="cx"> - (DOMTestObj *)objMethodWithArgs:(int)longArg strArg:(NSString *)strArg objArg:(DOMTestObj *)objArg;
</span><span class="cx"> - (void)methodWithEnumArg:(DOMTestEnumType *)enumArg;
</span><ins>+- (void)methodWithOptionalEnumArgAndDefaultValue:(DOMTestEnumType *)enumArg;
</ins><span class="cx"> - (DOMTestObj *)methodThatRequiresAllArgsAndThrows:(NSString *)strArg objArg:(DOMTestObj *)objArg;
</span><span class="cx"> - (void)serializedValue:(NSString *)serializedArg;
</span><span class="cx"> - (void)optionsObject:(DOMDictionary *)oo ooo:(DOMDictionary *)ooo;
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestObjCDOMTestObjmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm (190020 => 190021)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm        2015-09-20 00:43:08 UTC (rev 190020)
+++ trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm        2015-09-20 00:45:26 UTC (rev 190021)
</span><span class="lines">@@ -896,6 +896,12 @@
</span><span class="cx">     IMPL-&gt;methodWithEnumArg(core(enumArg));
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+- (void)methodWithOptionalEnumArgAndDefaultValue:(DOMTestEnumType *)enumArg
+{
+    WebCore::JSMainThreadNullState state;
+    IMPL-&gt;methodWithOptionalEnumArgAndDefaultValue(core(enumArg));
+}
+
</ins><span class="cx"> - (DOMTestObj *)methodThatRequiresAllArgsAndThrows:(NSString *)strArg objArg:(DOMTestObj *)objArg
</span><span class="cx"> {
</span><span class="cx">     WebCore::JSMainThreadNullState state;
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestTestObjidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/TestObj.idl (190020 => 190021)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/TestObj.idl        2015-09-20 00:43:08 UTC (rev 190020)
+++ trunk/Source/WebCore/bindings/scripts/test/TestObj.idl        2015-09-20 00:45:26 UTC (rev 190021)
</span><span class="lines">@@ -92,6 +92,7 @@
</span><span class="cx">     sequence&lt;ScriptProfile&gt; methodReturningSequence(long longArg);
</span><span class="cx"> 
</span><span class="cx">     void methodWithEnumArg(TestEnumType enumArg);
</span><ins>+    void methodWithOptionalEnumArgAndDefaultValue(optional TestEnumType enumArg = &quot;EnumValue1&quot;);
</ins><span class="cx">     [RaisesException] TestObj methodThatRequiresAllArgsAndThrows(DOMString strArg, TestObj objArg);
</span><span class="cx"> 
</span><span class="cx">     void serializedValue(SerializedScriptValue serializedArg);
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLInputElementidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLInputElement.idl (190020 => 190021)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLInputElement.idl        2015-09-20 00:43:08 UTC (rev 190020)
+++ trunk/Source/WebCore/html/HTMLInputElement.idl        2015-09-20 00:45:26 UTC (rev 190021)
</span><span class="lines">@@ -65,8 +65,8 @@
</span><span class="cx">     [SetterRaisesException] attribute Date valueAsDate;
</span><span class="cx">     [SetterRaisesException] attribute unrestricted double valueAsNumber;
</span><span class="cx"> 
</span><del>-    [RaisesException] void stepUp(optional long n);
-    [RaisesException] void stepDown(optional long n);
</del><ins>+    [RaisesException] void stepUp(optional long n = 1);
+    [RaisesException] void stepDown(optional long n = 1);
</ins><span class="cx"> 
</span><span class="cx">     attribute unsigned long width;
</span><span class="cx">     readonly attribute boolean willValidate;
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLTableElementidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLTableElement.idl (190020 => 190021)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLTableElement.idl        2015-09-20 00:43:08 UTC (rev 190020)
+++ trunk/Source/WebCore/html/HTMLTableElement.idl        2015-09-20 00:45:26 UTC (rev 190021)
</span><span class="lines">@@ -45,7 +45,7 @@
</span><span class="cx">     HTMLElement createCaption();
</span><span class="cx">     void deleteCaption();
</span><span class="cx"> 
</span><del>-    [RaisesException] HTMLElement insertRow(optional long index);
</del><ins>+    [RaisesException] HTMLElement insertRow(optional long index = -1);
</ins><span class="cx">     [RaisesException] void deleteRow([Default=Undefined] optional long index);
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLTableRowElementidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLTableRowElement.idl (190020 => 190021)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLTableRowElement.idl        2015-09-20 00:43:08 UTC (rev 190020)
+++ trunk/Source/WebCore/html/HTMLTableRowElement.idl        2015-09-20 00:45:26 UTC (rev 190021)
</span><span class="lines">@@ -27,7 +27,7 @@
</span><span class="cx">     [Reflect=char] attribute DOMString ch;
</span><span class="cx">     [Reflect=charoff] attribute DOMString chOff;
</span><span class="cx">     [Reflect] attribute DOMString vAlign;
</span><del>-    [RaisesException] HTMLElement insertCell(optional long index);
</del><ins>+    [RaisesException] HTMLElement insertCell(optional long index = -1);
</ins><span class="cx">     [RaisesException] void deleteCell([Default=Undefined] optional long index);
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLTableSectionElementidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLTableSectionElement.idl (190020 => 190021)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLTableSectionElement.idl        2015-09-20 00:43:08 UTC (rev 190020)
+++ trunk/Source/WebCore/html/HTMLTableSectionElement.idl        2015-09-20 00:45:26 UTC (rev 190021)
</span><span class="lines">@@ -26,7 +26,7 @@
</span><span class="cx">     [Reflect=charoff] attribute DOMString chOff;
</span><span class="cx">     [Reflect] attribute DOMString vAlign;
</span><span class="cx">     readonly attribute HTMLCollection rows;
</span><del>-    [RaisesException] HTMLElement insertRow(optional long index);
</del><ins>+    [RaisesException] HTMLElement insertRow(optional long index = -1);
</ins><span class="cx">     [RaisesException] void deleteRow([Default=Undefined] optional long index);
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlcanvasCanvasRenderingContext2Didl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.idl (190020 => 190021)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.idl        2015-09-20 00:43:08 UTC (rev 190020)
+++ trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.idl        2015-09-20 00:45:26 UTC (rev 190021)
</span><span class="lines">@@ -80,18 +80,18 @@
</span><span class="cx">         unrestricted float endAngle, [Default=Undefined] optional boolean anticlockwise);
</span><span class="cx">     [RaisesException] void ellipse(unrestricted float x, unrestricted float y, unrestricted float radiusX, unrestricted float radiusY, unrestricted float rotation, unrestricted float startAngle, unrestricted float endAngle, [Default=Undefined] optional boolean anticlockwise);
</span><span class="cx"> 
</span><del>-    void fill(DOMPath path, optional CanvasWindingRule winding);
</del><ins>+    void fill(DOMPath path, optional CanvasWindingRule winding = &quot;nonzero&quot;);
</ins><span class="cx">     void stroke(DOMPath path);
</span><del>-    void clip(DOMPath path, optional CanvasWindingRule winding);
</del><ins>+    void clip(DOMPath path, optional CanvasWindingRule winding = &quot;nonzero&quot;);
</ins><span class="cx"> 
</span><del>-    void fill(optional CanvasWindingRule winding);
</del><ins>+    void fill(optional CanvasWindingRule winding = &quot;nonzero&quot;);
</ins><span class="cx">     void stroke();
</span><del>-    void clip(optional CanvasWindingRule winding);
</del><ins>+    void clip(optional CanvasWindingRule winding = &quot;nonzero&quot;);
</ins><span class="cx"> 
</span><del>-    boolean isPointInPath(DOMPath path, unrestricted float x, unrestricted float y, optional CanvasWindingRule winding);
</del><ins>+    boolean isPointInPath(DOMPath path, unrestricted float x, unrestricted float y, optional CanvasWindingRule winding = &quot;nonzero&quot;);
</ins><span class="cx">     boolean isPointInStroke(DOMPath path, unrestricted float x, unrestricted float y);
</span><span class="cx"> 
</span><del>-    boolean isPointInPath(unrestricted float x, unrestricted float y, optional CanvasWindingRule winding);
</del><ins>+    boolean isPointInPath(unrestricted float x, unrestricted float y, optional CanvasWindingRule winding = &quot;nonzero&quot;);
</ins><span class="cx">     boolean isPointInStroke(unrestricted float x, unrestricted float y);
</span><span class="cx"> 
</span><span class="cx">     // text
</span></span></pre>
</div>
</div>

</body>
</html>