<!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>[189957] 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/189957">189957</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2015-09-17 18:48:17 -0700 (Thu, 17 Sep 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>[WebIDL] Add support for default parameter values
https://bugs.webkit.org/show_bug.cgi?id=149263
<rdar://problem/22545600>
Reviewed by Ryosuke Niwa.
LayoutTests/imported/w3c:
Rebaseline several W3C tests now that more NodeIterator / TreeWalker
checks are passing.
* web-platform-tests/dom/traversal/NodeIterator-expected.txt:
* web-platform-tests/dom/traversal/TreeWalker-basic-expected.txt:
Source/WebCore:
Add support for default parameter values to our Web IDL parser and JS
bindings generator. This allows the bindings to convert undefined to
the parameter's default value for optional parameters:
https://heycam.github.io/webidl/#dfn-optional-argument-default-value
Previously, our bindings generator would just convert undefined to
0 / false / "undefined" for optional parameters, depending on the
parameter type.
This patch uses the new default parameter support to fix a bug in
document.createNodeIterator() / document.createTreeWalker()'s handling
of the whatToShow parameter:
https://dom.spec.whatwg.org/#document
WebKit currently was undefined to 0 in this case, even though it should
use the parameter's default value: OxFFFFFFFF.
I am planning to go through other optional parameters in a follow-up
patch and add default values where needed.
No new tests, already covered by existing layout tests and
added bindings tests coverage.
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateParametersCheck):
* bindings/scripts/IDLParser.pm:
(parseOptionalOrRequiredArgument):
* bindings/scripts/test/GObject/WebKitDOMTestObj.cpp:
(webkit_dom_test_obj_method_with_optional_arg_and_default_value):
(webkit_dom_test_obj_method_with_optional_string_and_default_value):
* bindings/scripts/test/GObject/WebKitDOMTestObj.h:
* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::jsTestObjPrototypeFunctionMethodWithOptionalArgAndDefaultValue):
(WebCore::jsTestObjPrototypeFunctionMethodWithOptionalStringAndDefaultValue):
* bindings/scripts/test/ObjC/DOMTestObj.h:
* bindings/scripts/test/ObjC/DOMTestObj.mm:
(-[DOMTestObj methodWithOptionalArgAndDefaultValue:]):
(-[DOMTestObj methodWithOptionalStringAndDefaultValue:]):
* bindings/scripts/test/TestObj.idl:
* dom/Document.idl:
LayoutTests:
Rebaseline several NodeIterator / TreeWalker tests now that more checks
are passing.
* fast/dom/createNodeIterator-parameters-expected.txt:
* fast/dom/createTreeWalker-parameters-expected.txt:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsfastdomcreateNodeIteratorparametersexpectedtxt">trunk/LayoutTests/fast/dom/createNodeIterator-parameters-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomcreateTreeWalkerparametersexpectedtxt">trunk/LayoutTests/fast/dom/createTreeWalker-parameters-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cChangeLog">trunk/LayoutTests/imported/w3c/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsdomtraversalNodeIteratorexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/dom/traversal/NodeIterator-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsdomtraversalTreeWalkerbasicexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/dom/traversal/TreeWalker-basic-expected.txt</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="#trunkSourceWebCorebindingsscriptsIDLParserpm">trunk/Source/WebCore/bindings/scripts/IDLParser.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="#trunkSourceWebCoredomDocumentidl">trunk/Source/WebCore/dom/Document.idl</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (189956 => 189957)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-09-18 01:34:58 UTC (rev 189956)
+++ trunk/LayoutTests/ChangeLog        2015-09-18 01:48:17 UTC (rev 189957)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2015-09-17 Chris Dumez <cdumez@apple.com>
+
+ [WebIDL] Add support for default parameter values
+ https://bugs.webkit.org/show_bug.cgi?id=149263
+ <rdar://problem/22545600>
+
+ Reviewed by Ryosuke Niwa.
+
+ Rebaseline several NodeIterator / TreeWalker tests now that more checks
+ are passing.
+
+ * fast/dom/createNodeIterator-parameters-expected.txt:
+ * fast/dom/createTreeWalker-parameters-expected.txt:
+
</ins><span class="cx"> 2015-09-17 Saam barati <sbarati@apple.com>
</span><span class="cx">
</span><span class="cx"> add a regress test for richards with try/catch.
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomcreateNodeIteratorparametersexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dom/createNodeIterator-parameters-expected.txt (189956 => 189957)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/createNodeIterator-parameters-expected.txt        2015-09-18 01:34:58 UTC (rev 189956)
+++ trunk/LayoutTests/fast/dom/createNodeIterator-parameters-expected.txt        2015-09-18 01:48:17 UTC (rev 189957)
</span><span class="lines">@@ -29,7 +29,7 @@
</span><span class="cx"> iterator = document.createNodeIterator(document, undefined, undefined)
</span><span class="cx"> PASS iterator.root is document
</span><span class="cx"> PASS iterator.referenceNode is document
</span><del>-FAIL iterator.whatToShow should be 4294967295. Was 0.
</del><ins>+PASS iterator.whatToShow is 0xFFFFFFFF
</ins><span class="cx"> PASS iterator.filter is null
</span><span class="cx"> PASS iterator.pointerBeforeReferenceNode is true
</span><span class="cx"> PASS successfullyParsed is true
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomcreateTreeWalkerparametersexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dom/createTreeWalker-parameters-expected.txt (189956 => 189957)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/createTreeWalker-parameters-expected.txt        2015-09-18 01:34:58 UTC (rev 189956)
+++ trunk/LayoutTests/fast/dom/createTreeWalker-parameters-expected.txt        2015-09-18 01:48:17 UTC (rev 189957)
</span><span class="lines">@@ -27,7 +27,7 @@
</span><span class="cx"> walker = document.createTreeWalker(document, undefined, undefined)
</span><span class="cx"> PASS walker.root is document
</span><span class="cx"> PASS walker.currentNode is document
</span><del>-FAIL walker.whatToShow should be 4294967295. Was 0.
</del><ins>+PASS walker.whatToShow is 0xFFFFFFFF
</ins><span class="cx"> PASS walker.filter is null
</span><span class="cx"> PASS successfullyParsed is true
</span><span class="cx">
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/ChangeLog (189956 => 189957)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/ChangeLog        2015-09-18 01:34:58 UTC (rev 189956)
+++ trunk/LayoutTests/imported/w3c/ChangeLog        2015-09-18 01:48:17 UTC (rev 189957)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2015-09-17 Chris Dumez <cdumez@apple.com>
+
+ [WebIDL] Add support for default parameter values
+ https://bugs.webkit.org/show_bug.cgi?id=149263
+ <rdar://problem/22545600>
+
+ Reviewed by Ryosuke Niwa.
+
+ Rebaseline several W3C tests now that more NodeIterator / TreeWalker
+ checks are passing.
+
+ * web-platform-tests/dom/traversal/NodeIterator-expected.txt:
+ * web-platform-tests/dom/traversal/TreeWalker-basic-expected.txt:
+
</ins><span class="cx"> 2015-09-17 Zalan Bujtas <zalan@apple.com>
</span><span class="cx">
</span><span class="cx"> CSS WG multicol-1 tests failures with 1px differences due to baseline difference.
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsdomtraversalNodeIteratorexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/dom/traversal/NodeIterator-expected.txt (189956 => 189957)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/dom/traversal/NodeIterator-expected.txt        2015-09-18 01:34:58 UTC (rev 189956)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/dom/traversal/NodeIterator-expected.txt        2015-09-18 01:48:17 UTC (rev 189957)
</span><span class="lines">@@ -2,7 +2,7 @@
</span><span class="cx"> PASS detach() should be a no-op
</span><span class="cx"> PASS createNodeIterator() parameter defaults
</span><span class="cx"> PASS createNodeIterator() with null as arguments
</span><del>-FAIL createNodeIterator() with undefined as arguments assert_equals: whatToShow expected 4294967295 but got 0
</del><ins>+PASS createNodeIterator() with undefined as arguments
</ins><span class="cx"> PASS Propagate exception from filter function
</span><span class="cx"> PASS document.createNodeIterator(paras[0], 0, null)
</span><span class="cx"> PASS document.createNodeIterator(paras[0], 0, (function(node) { return true }))
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsdomtraversalTreeWalkerbasicexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/dom/traversal/TreeWalker-basic-expected.txt (189956 => 189957)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/dom/traversal/TreeWalker-basic-expected.txt        2015-09-18 01:34:58 UTC (rev 189956)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/dom/traversal/TreeWalker-basic-expected.txt        2015-09-18 01:48:17 UTC (rev 189957)
</span><span class="lines">@@ -3,7 +3,7 @@
</span><span class="cx">
</span><span class="cx"> PASS Construct a TreeWalker by document.createTreeWalker(root).
</span><span class="cx"> PASS Construct a TreeWalker by document.createTreeWalker(root, null, null).
</span><del>-FAIL Construct a TreeWalker by document.createTreeWalker(root, undefined, undefined). assert_equals: whatToShow expected 4294967295 but got 0
</del><ins>+PASS Construct a TreeWalker by document.createTreeWalker(root, undefined, undefined).
</ins><span class="cx"> PASS Give an invalid root node to document.createTreeWalker().
</span><span class="cx"> PASS Walk over nodes.
</span><span class="cx"> PASS Optional arguments to createTreeWalker should be optional (3 passed, null).
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (189956 => 189957)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-09-18 01:34:58 UTC (rev 189956)
+++ trunk/Source/WebCore/ChangeLog        2015-09-18 01:48:17 UTC (rev 189957)
</span><span class="lines">@@ -1,3 +1,52 @@
</span><ins>+2015-09-17 Chris Dumez <cdumez@apple.com>
+
+ [WebIDL] Add support for default parameter values
+ https://bugs.webkit.org/show_bug.cgi?id=149263
+ <rdar://problem/22545600>
+
+ Reviewed by Ryosuke Niwa.
+
+ Add support for default parameter values to our Web IDL parser and JS
+ bindings generator. This allows the bindings to convert undefined to
+ the parameter's default value for optional parameters:
+ https://heycam.github.io/webidl/#dfn-optional-argument-default-value
+
+ Previously, our bindings generator would just convert undefined to
+ 0 / false / "undefined" for optional parameters, depending on the
+ parameter type.
+
+ This patch uses the new default parameter support to fix a bug in
+ document.createNodeIterator() / document.createTreeWalker()'s handling
+ of the whatToShow parameter:
+ https://dom.spec.whatwg.org/#document
+
+ WebKit currently was undefined to 0 in this case, even though it should
+ use the parameter's default value: OxFFFFFFFF.
+
+ I am planning to go through other optional parameters in a follow-up
+ patch and add default values where needed.
+
+ No new tests, already covered by existing layout tests and
+ added bindings tests coverage.
+
+ * bindings/scripts/CodeGeneratorJS.pm:
+ (GenerateParametersCheck):
+ * bindings/scripts/IDLParser.pm:
+ (parseOptionalOrRequiredArgument):
+ * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp:
+ (webkit_dom_test_obj_method_with_optional_arg_and_default_value):
+ (webkit_dom_test_obj_method_with_optional_string_and_default_value):
+ * bindings/scripts/test/GObject/WebKitDOMTestObj.h:
+ * bindings/scripts/test/JS/JSTestObj.cpp:
+ (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalArgAndDefaultValue):
+ (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalStringAndDefaultValue):
+ * bindings/scripts/test/ObjC/DOMTestObj.h:
+ * bindings/scripts/test/ObjC/DOMTestObj.mm:
+ (-[DOMTestObj methodWithOptionalArgAndDefaultValue:]):
+ (-[DOMTestObj methodWithOptionalStringAndDefaultValue:]):
+ * bindings/scripts/test/TestObj.idl:
+ * dom/Document.idl:
+
</ins><span class="cx"> 2015-09-17 Dean Jackson <dino@apple.com>
</span><span class="cx">
</span><span class="cx"> Multi-hop reference cycles not detected.
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptsCodeGeneratorJSpm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (189956 => 189957)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2015-09-18 01:34:58 UTC (rev 189956)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2015-09-18 01:48:17 UTC (rev 189957)
</span><span class="lines">@@ -3404,6 +3404,9 @@
</span><span class="cx"> if ($optional && $defaultAttribute && $defaultAttribute eq "NullString") {
</span><span class="cx"> $outer = "exec->argument($argsIndex).isUndefined() ? String() : ";
</span><span class="cx"> $inner = "exec->uncheckedArgument($argsIndex)";
</span><ins>+ } elsif ($optional && $parameter->default) {
+ $outer = "exec->argument($argsIndex).isUndefined() ? " . $parameter->default . " : ";
+ $inner = "exec->uncheckedArgument($argsIndex)";
</ins><span class="cx"> } else {
</span><span class="cx"> $outer = "";
</span><span class="cx"> $inner = "exec->argument($argsIndex)";
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptsIDLParserpm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/IDLParser.pm (189956 => 189957)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/IDLParser.pm        2015-09-18 01:34:58 UTC (rev 189956)
+++ trunk/Source/WebCore/bindings/scripts/IDLParser.pm        2015-09-18 01:48:17 UTC (rev 189957)
</span><span class="lines">@@ -82,6 +82,7 @@
</span><span class="cx"> isNullable => '$', # Is variable type Nullable (T?)
</span><span class="cx"> isVariadic => '$', # Is variable variadic (long... numbers)
</span><span class="cx"> isOptional => '$', # Is variable optional (optional T)
</span><ins>+ default => '$', # Default value for parameters
</ins><span class="cx"> });
</span><span class="cx">
</span><span class="cx"> # Used to represent string constants
</span><span class="lines">@@ -1433,7 +1434,7 @@
</span><span class="cx"> $paramDataNode->type(identifierRemoveNullablePrefix(typeRemoveNullableSuffix($type)));
</span><span class="cx"> $paramDataNode->isOptional(1);
</span><span class="cx"> $paramDataNode->name($self->parseArgumentName());
</span><del>- $self->parseDefault();
</del><ins>+ $paramDataNode->default($self->parseDefault());
</ins><span class="cx"> return $paramDataNode;
</span><span class="cx"> }
</span><span class="cx"> if ($next->type() == IdentifierToken || $next->value() =~ /$nextExceptionField_1/) {
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestGObjectWebKitDOMTestObjcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp (189956 => 189957)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp        2015-09-18 01:34:58 UTC (rev 189956)
+++ trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp        2015-09-18 01:48:17 UTC (rev 189957)
</span><span class="lines">@@ -1283,6 +1283,14 @@
</span><span class="cx"> item->methodWithOptionalArg(opt);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void webkit_dom_test_obj_method_with_optional_arg_and_default_value(WebKitDOMTestObj* self, glong opt)
+{
+ WebCore::JSMainThreadNullState state;
+ g_return_if_fail(WEBKIT_DOM_IS_TEST_OBJ(self));
+ WebCore::TestObj* item = WebKit::core(self);
+ item->methodWithOptionalArgAndDefaultValue(opt);
+}
+
</ins><span class="cx"> void webkit_dom_test_obj_method_with_non_optional_arg_and_optional_arg(WebKitDOMTestObj* self, glong nonOpt, glong opt)
</span><span class="cx"> {
</span><span class="cx"> WebCore::JSMainThreadNullState state;
</span><span class="lines">@@ -1309,6 +1317,16 @@
</span><span class="cx"> item->methodWithOptionalString(convertedStr);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void webkit_dom_test_obj_method_with_optional_string_and_default_value(WebKitDOMTestObj* self, const gchar* str)
+{
+ WebCore::JSMainThreadNullState state;
+ g_return_if_fail(WEBKIT_DOM_IS_TEST_OBJ(self));
+ g_return_if_fail(str);
+ WebCore::TestObj* item = WebKit::core(self);
+ WTF::String convertedStr = WTF::String::fromUTF8(str);
+ item->methodWithOptionalStringAndDefaultValue(convertedStr);
+}
+
</ins><span class="cx"> void webkit_dom_test_obj_method_with_optional_string_is_undefined(WebKitDOMTestObj* self, const gchar* str)
</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 (189956 => 189957)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h        2015-09-18 01:34:58 UTC (rev 189956)
+++ trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h        2015-09-18 01:48:17 UTC (rev 189957)
</span><span class="lines">@@ -384,6 +384,16 @@
</span><span class="cx"> webkit_dom_test_obj_method_with_optional_arg(WebKitDOMTestObj* self, glong opt);
</span><span class="cx">
</span><span class="cx"> /**
</span><ins>+ * webkit_dom_test_obj_method_with_optional_arg_and_default_value:
+ * @self: A #WebKitDOMTestObj
+ * @opt: A #glong
+ *
+ * Stability: Unstable
+**/
+WEBKIT_API void
+webkit_dom_test_obj_method_with_optional_arg_and_default_value(WebKitDOMTestObj* self, glong opt);
+
+/**
</ins><span class="cx"> * webkit_dom_test_obj_method_with_non_optional_arg_and_optional_arg:
</span><span class="cx"> * @self: A #WebKitDOMTestObj
</span><span class="cx"> * @nonOpt: A #glong
</span><span class="lines">@@ -417,6 +427,16 @@
</span><span class="cx"> webkit_dom_test_obj_method_with_optional_string(WebKitDOMTestObj* self, const gchar* str);
</span><span class="cx">
</span><span class="cx"> /**
</span><ins>+ * webkit_dom_test_obj_method_with_optional_string_and_default_value:
+ * @self: A #WebKitDOMTestObj
+ * @str: A #gchar
+ *
+ * Stability: Unstable
+**/
+WEBKIT_API void
+webkit_dom_test_obj_method_with_optional_string_and_default_value(WebKitDOMTestObj* self, const gchar* str);
+
+/**
</ins><span class="cx"> * webkit_dom_test_obj_method_with_optional_string_is_undefined:
</span><span class="cx"> * @self: A #WebKitDOMTestObj
</span><span class="cx"> * @str: A #gchar
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestObjcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (189956 => 189957)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp        2015-09-18 01:34:58 UTC (rev 189956)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp        2015-09-18 01:48:17 UTC (rev 189957)
</span><span class="lines">@@ -109,9 +109,11 @@
</span><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptExecutionContextAndScriptStateWithSpaces(JSC::ExecState*);
</span><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptArgumentsAndCallStack(JSC::ExecState*);
</span><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalArg(JSC::ExecState*);
</span><ins>+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalArgAndDefaultValue(JSC::ExecState*);
</ins><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg(JSC::ExecState*);
</span><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgs(JSC::ExecState*);
</span><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalString(JSC::ExecState*);
</span><ins>+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalStringAndDefaultValue(JSC::ExecState*);
</ins><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalStringIsUndefined(JSC::ExecState*);
</span><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalStringIsNullString(JSC::ExecState*);
</span><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithCallbackArg(JSC::ExecState*);
</span><span class="lines">@@ -620,9 +622,11 @@
</span><span class="cx"> { "withScriptExecutionContextAndScriptStateWithSpaces", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionWithScriptExecutionContextAndScriptStateWithSpaces), (intptr_t) (0) } },
</span><span class="cx"> { "withScriptArgumentsAndCallStack", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionWithScriptArgumentsAndCallStack), (intptr_t) (0) } },
</span><span class="cx"> { "methodWithOptionalArg", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithOptionalArg), (intptr_t) (0) } },
</span><ins>+ { "methodWithOptionalArgAndDefaultValue", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithOptionalArgAndDefaultValue), (intptr_t) (0) } },
</ins><span class="cx"> { "methodWithNonOptionalArgAndOptionalArg", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg), (intptr_t) (1) } },
</span><span class="cx"> { "methodWithNonOptionalArgAndTwoOptionalArgs", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgs), (intptr_t) (1) } },
</span><span class="cx"> { "methodWithOptionalString", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithOptionalString), (intptr_t) (0) } },
</span><ins>+ { "methodWithOptionalStringAndDefaultValue", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithOptionalStringAndDefaultValue), (intptr_t) (0) } },
</ins><span class="cx"> { "methodWithOptionalStringIsUndefined", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithOptionalStringIsUndefined), (intptr_t) (0) } },
</span><span class="cx"> { "methodWithOptionalStringIsNullString", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithOptionalStringIsNullString), (intptr_t) (0) } },
</span><span class="cx"> { "methodWithCallbackArg", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithCallbackArg), (intptr_t) (1) } },
</span><span class="lines">@@ -3529,6 +3533,28 @@
</span><span class="cx"> return JSValue::encode(jsUndefined());
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalArgAndDefaultValue(ExecState* exec)
+{
+ JSValue thisValue = exec->thisValue();
+ JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(thisValue);
+ if (UNLIKELY(!castedThis))
+ return throwThisTypeError(*exec, "TestObj", "methodWithOptionalArgAndDefaultValue");
+ ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
+ auto& impl = castedThis->impl();
+
+ size_t argsCount = exec->argumentCount();
+ if (argsCount <= 0) {
+ impl.methodWithOptionalArgAndDefaultValue();
+ return JSValue::encode(jsUndefined());
+ }
+
+ int opt = exec->argument(0).isUndefined() ? 666 : toInt32(exec, exec->uncheckedArgument(0), NormalConversion);
+ if (UNLIKELY(exec->hadException()))
+ return JSValue::encode(jsUndefined());
+ impl.methodWithOptionalArgAndDefaultValue(opt);
+ return JSValue::encode(jsUndefined());
+}
+
</ins><span class="cx"> EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg(ExecState* exec)
</span><span class="cx"> {
</span><span class="cx"> JSValue thisValue = exec->thisValue();
</span><span class="lines">@@ -3613,6 +3639,28 @@
</span><span class="cx"> return JSValue::encode(jsUndefined());
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalStringAndDefaultValue(ExecState* exec)
+{
+ JSValue thisValue = exec->thisValue();
+ JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(thisValue);
+ if (UNLIKELY(!castedThis))
+ return throwThisTypeError(*exec, "TestObj", "methodWithOptionalStringAndDefaultValue");
+ ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
+ auto& impl = castedThis->impl();
+
+ size_t argsCount = exec->argumentCount();
+ if (argsCount <= 0) {
+ impl.methodWithOptionalStringAndDefaultValue();
+ return JSValue::encode(jsUndefined());
+ }
+
+ String str = exec->argument(0).isUndefined() ? "foo" : exec->uncheckedArgument(0).toString(exec)->value(exec);
+ if (UNLIKELY(exec->hadException()))
+ return JSValue::encode(jsUndefined());
+ impl.methodWithOptionalStringAndDefaultValue(str);
+ return JSValue::encode(jsUndefined());
+}
+
</ins><span class="cx"> EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalStringIsUndefined(ExecState* exec)
</span><span class="cx"> {
</span><span class="cx"> JSValue thisValue = exec->thisValue();
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestObjCDOMTestObjh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h (189956 => 189957)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h        2015-09-18 01:34:58 UTC (rev 189956)
+++ trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h        2015-09-18 01:48:17 UTC (rev 189957)
</span><span class="lines">@@ -151,9 +151,11 @@
</span><span class="cx"> - (DOMTestObj *)withScriptExecutionContextAndScriptStateWithSpaces;
</span><span class="cx"> - (void)withScriptArgumentsAndCallStack;
</span><span class="cx"> - (void)methodWithOptionalArg:(int)opt;
</span><ins>+- (void)methodWithOptionalArgAndDefaultValue:(int)opt;
</ins><span class="cx"> - (void)methodWithNonOptionalArgAndOptionalArg:(int)nonOpt opt:(int)opt;
</span><span class="cx"> - (void)methodWithNonOptionalArgAndTwoOptionalArgs:(int)nonOpt opt1:(int)opt1 opt2:(int)opt2;
</span><span class="cx"> - (void)methodWithOptionalString:(NSString *)str;
</span><ins>+- (void)methodWithOptionalStringAndDefaultValue:(NSString *)str;
</ins><span class="cx"> - (void)methodWithOptionalStringIsUndefined:(NSString *)str;
</span><span class="cx"> - (void)methodWithOptionalStringIsNullString:(NSString *)str;
</span><span class="cx"> - (void)classMethod;
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestObjCDOMTestObjmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm (189956 => 189957)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm        2015-09-18 01:34:58 UTC (rev 189956)
+++ trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm        2015-09-18 01:48:17 UTC (rev 189957)
</span><span class="lines">@@ -1007,6 +1007,12 @@
</span><span class="cx"> IMPL->methodWithOptionalArg(opt);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+- (void)methodWithOptionalArgAndDefaultValue:(int)opt
+{
+ WebCore::JSMainThreadNullState state;
+ IMPL->methodWithOptionalArgAndDefaultValue(opt);
+}
+
</ins><span class="cx"> - (void)methodWithNonOptionalArgAndOptionalArg:(int)nonOpt opt:(int)opt
</span><span class="cx"> {
</span><span class="cx"> WebCore::JSMainThreadNullState state;
</span><span class="lines">@@ -1025,6 +1031,12 @@
</span><span class="cx"> IMPL->methodWithOptionalString(str);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+- (void)methodWithOptionalStringAndDefaultValue:(NSString *)str
+{
+ WebCore::JSMainThreadNullState state;
+ IMPL->methodWithOptionalStringAndDefaultValue(str);
+}
+
</ins><span class="cx"> - (void)methodWithOptionalStringIsUndefined:(NSString *)str
</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 (189956 => 189957)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/TestObj.idl        2015-09-18 01:34:58 UTC (rev 189956)
+++ trunk/Source/WebCore/bindings/scripts/test/TestObj.idl        2015-09-18 01:48:17 UTC (rev 189957)
</span><span class="lines">@@ -140,11 +140,13 @@
</span><span class="cx"> [CallWith= ScriptExecutionContext & ScriptState ] attribute TestObj withScriptExecutionContextAndScriptStateWithSpacesAttribute;
</span><span class="cx"> [CallWith=ScriptArguments&CallStack] attribute TestObj withScriptArgumentsAndCallStackAttribute;
</span><span class="cx">
</span><del>- // 'Optional' extended attribute
</del><ins>+ // Optional parameters.
</ins><span class="cx"> void methodWithOptionalArg(optional long opt);
</span><ins>+ void methodWithOptionalArgAndDefaultValue(optional long opt = 666);
</ins><span class="cx"> void methodWithNonOptionalArgAndOptionalArg(long nonOpt, optional long opt);
</span><span class="cx"> void methodWithNonOptionalArgAndTwoOptionalArgs(long nonOpt, optional long opt1, optional long opt2);
</span><span class="cx"> void methodWithOptionalString(optional DOMString str);
</span><ins>+ void methodWithOptionalStringAndDefaultValue(optional DOMString str = "foo");
</ins><span class="cx"> void methodWithOptionalStringIsUndefined([Default=Undefined] optional DOMString str);
</span><span class="cx"> void methodWithOptionalStringIsNullString([Default=NullString] optional DOMString str);
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoredomDocumentidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Document.idl (189956 => 189957)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Document.idl        2015-09-18 01:34:58 UTC (rev 189956)
+++ trunk/Source/WebCore/dom/Document.idl        2015-09-18 01:48:17 UTC (rev 189957)
</span><span class="lines">@@ -93,11 +93,11 @@
</span><span class="cx"> // DOM Level 2 Tranversal and Range (DocumentTraversal interface)
</span><span class="cx">
</span><span class="cx"> [ObjCLegacyUnnamedParameters, RaisesException, NewObject] NodeIterator createNodeIterator(Node root,
</span><del>- optional unsigned long whatToShow,
</del><ins>+ optional unsigned long whatToShow = 0xFFFFFFFF,
</ins><span class="cx"> optional NodeFilter? filter,
</span><span class="cx"> optional boolean expandEntityReferences);
</span><span class="cx"> [ObjCLegacyUnnamedParameters, RaisesException, NewObject] TreeWalker createTreeWalker(Node root,
</span><del>- optional unsigned long whatToShow,
</del><ins>+ optional unsigned long whatToShow = 0xFFFFFFFF,
</ins><span class="cx"> optional NodeFilter? filter,
</span><span class="cx"> optional boolean expandEntityReferences);
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>