<!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>[199970] 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/199970">199970</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2016-04-24 17:27:30 -0700 (Sun, 24 Apr 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>Autogenerated IDBFactory.open() does the wrong thing if you pass an explicit 'undefined' as the second argument
https://bugs.webkit.org/show_bug.cgi?id=156939
Reviewed by Darin Adler.
LayoutTests/imported/w3c:
Re-sync tests from upstream b1818929.
* IndexedDB-private-browsing/idbfactory_open9-expected.txt:
* IndexedDB-private-browsing/idbfactory_open9.html:
* web-platform-tests/IndexedDB/idbfactory_open9-expected.txt:
* web-platform-tests/IndexedDB/idbfactory_open9.htm:
Source/WebCore:
As per WebIDL, if undefined is passed by JS for an optional parameter then
we should use its default value if it has one, or use the special value
"missing":
http://heycam.github.io/webidl/#es-overloads (step 10.4)
Our bindings generator was already mapping undefined to the parameter's
default value when present. However, it was missing the notion of
"missing" value when there no default value. This patch adds supports
for its by passing Optional<>(Nullopt) to the implementation in such
case. This means that the implementation will need to use WTF::Optional<>
type for parameters that do not have a default value. Thankfully though,
in most cases, we will be able to specify a default value in the IDL
so cases where we will need to use WTF::Optional<> will actually be
rare.
To avoid having to do too much refactoring in this patch, the support
for WTF::Optional is currently blacklisted for most IDL types. I will
gradually stop blacklisting each type in follow-up patches, as I either:
- Add default parameter values in our IDL (preferred)
- Use WTF::Optional<> in our implementation (when we cannot specify a
default value).
This patch fixes a bug with IDBFactory.open()'s second parameter (version)
for which undefined should not throw and indicate that the version
should not be changed. We now use WTF::Optional in the implementation to
distinguish this case and not throw.
No new tests, existing tests were updated / rebaselined.
* Modules/indexeddb/IDBFactory.cpp:
(WebCore::IDBFactory::open):
(WebCore::IDBFactory::openInternal): Deleted.
* Modules/indexeddb/IDBFactory.h:
* bindings/scripts/CodeGeneratorJS.pm:
(ShouldUseWTFOptionalForParameterType):
(GenerateParametersCheck):
* fileapi/Blob.idl:
* inspector/InspectorIndexedDBAgent.cpp:
LayoutTests:
Update / rebaseline existing test now that passing undefined as second parameter to
IDBFactory.open() no longer throws.
* storage/indexeddb/intversion-bad-parameters-expected.txt:
* storage/indexeddb/intversion-bad-parameters-private-expected.txt:
* storage/indexeddb/resources/intversion-bad-parameters.js:
(deleteSuccess):</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsimportedw3cChangeLog">trunk/LayoutTests/imported/w3c/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsimportedw3cIndexedDBprivatebrowsingidbfactory_open9expectedtxt">trunk/LayoutTests/imported/w3c/IndexedDB-private-browsing/idbfactory_open9-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cIndexedDBprivatebrowsingidbfactory_open9html">trunk/LayoutTests/imported/w3c/IndexedDB-private-browsing/idbfactory_open9.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsIndexedDBidbfactory_open9expectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idbfactory_open9-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsIndexedDBidbfactory_open9htm">trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idbfactory_open9.htm</a></li>
<li><a href="#trunkLayoutTestsstorageindexeddbintversionbadparametersexpectedtxt">trunk/LayoutTests/storage/indexeddb/intversion-bad-parameters-expected.txt</a></li>
<li><a href="#trunkLayoutTestsstorageindexeddbintversionbadparametersprivateexpectedtxt">trunk/LayoutTests/storage/indexeddb/intversion-bad-parameters-private-expected.txt</a></li>
<li><a href="#trunkLayoutTestsstorageindexeddbresourcesintversionbadparametersjs">trunk/LayoutTests/storage/indexeddb/resources/intversion-bad-parameters.js</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBFactorycpp">trunk/Source/WebCore/Modules/indexeddb/IDBFactory.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBFactoryh">trunk/Source/WebCore/Modules/indexeddb/IDBFactory.h</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="#trunkSourceWebCorebindingsscriptstestJSJSTestTypedefscpp">trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.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="#trunkSourceWebCorebindingsscriptstestTestTypedefsidl">trunk/Source/WebCore/bindings/scripts/test/TestTypedefs.idl</a></li>
<li><a href="#trunkSourceWebCorefileapiBlobidl">trunk/Source/WebCore/fileapi/Blob.idl</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorIndexedDBAgentcpp">trunk/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (199969 => 199970)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-04-24 17:23:41 UTC (rev 199969)
+++ trunk/LayoutTests/ChangeLog        2016-04-25 00:27:30 UTC (rev 199970)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2016-04-24 Chris Dumez <cdumez@apple.com>
+
+ Autogenerated IDBFactory.open() does the wrong thing if you pass an explicit 'undefined' as the second argument
+ https://bugs.webkit.org/show_bug.cgi?id=156939
+
+ Reviewed by Darin Adler.
+
+ Update / rebaseline existing test now that passing undefined as second parameter to
+ IDBFactory.open() no longer throws.
+
+ * storage/indexeddb/intversion-bad-parameters-expected.txt:
+ * storage/indexeddb/intversion-bad-parameters-private-expected.txt:
+ * storage/indexeddb/resources/intversion-bad-parameters.js:
+ (deleteSuccess):
+
</ins><span class="cx"> 2016-04-23 Chris Dumez <cdumez@apple.com>
</span><span class="cx">
</span><span class="cx"> [WebIDL] Drop [Default] WebKit-IDL extended attribute
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/ChangeLog (199969 => 199970)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/ChangeLog        2016-04-24 17:23:41 UTC (rev 199969)
+++ trunk/LayoutTests/imported/w3c/ChangeLog        2016-04-25 00:27:30 UTC (rev 199970)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2016-04-24 Chris Dumez <cdumez@apple.com>
+
+ Autogenerated IDBFactory.open() does the wrong thing if you pass an explicit 'undefined' as the second argument
+ https://bugs.webkit.org/show_bug.cgi?id=156939
+
+ Reviewed by Darin Adler.
+
+ Re-sync tests from upstream b1818929.
+
+ * IndexedDB-private-browsing/idbfactory_open9-expected.txt:
+ * IndexedDB-private-browsing/idbfactory_open9.html:
+ * web-platform-tests/IndexedDB/idbfactory_open9-expected.txt:
+ * web-platform-tests/IndexedDB/idbfactory_open9.htm:
+
</ins><span class="cx"> 2016-04-23 Chris Dumez <cdumez@apple.com>
</span><span class="cx">
</span><span class="cx"> [WebIDL] Drop [Default] WebKit-IDL extended attribute
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cIndexedDBprivatebrowsingidbfactory_open9expectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/IndexedDB-private-browsing/idbfactory_open9-expected.txt (199969 => 199970)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/IndexedDB-private-browsing/idbfactory_open9-expected.txt        2016-04-24 17:23:41 UTC (rev 199969)
+++ trunk/LayoutTests/imported/w3c/IndexedDB-private-browsing/idbfactory_open9-expected.txt        2016-04-25 00:27:30 UTC (rev 199970)
</span><span class="lines">@@ -9,7 +9,6 @@
</span><span class="cx"> PASS Calling open() with version argument Infinity should throw TypeError.
</span><span class="cx"> PASS Calling open() with version argument -Infinity should throw TypeError.
</span><span class="cx"> PASS Calling open() with version argument "foo" should throw TypeError.
</span><del>-PASS Calling open() with version argument undefined should throw TypeError.
</del><span class="cx"> PASS Calling open() with version argument null should throw TypeError.
</span><span class="cx"> PASS Calling open() with version argument false should throw TypeError.
</span><span class="cx"> PASS Calling open() with version argument object should throw TypeError.
</span><span class="lines">@@ -17,4 +16,5 @@
</span><span class="cx"> PASS Calling open() with version argument object (third) should throw TypeError.
</span><span class="cx"> PASS Calling open() with version argument 1.5 should not throw.
</span><span class="cx"> PASS Calling open() with version argument 9007199254740991 should not throw.
</span><ins>+PASS Calling open() with version argument undefined should not throw.
</ins><span class="cx">
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cIndexedDBprivatebrowsingidbfactory_open9html"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/IndexedDB-private-browsing/idbfactory_open9.html (199969 => 199970)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/IndexedDB-private-browsing/idbfactory_open9.html        2016-04-24 17:23:41 UTC (rev 199969)
+++ trunk/LayoutTests/imported/w3c/IndexedDB-private-browsing/idbfactory_open9.html        2016-04-25 00:27:30 UTC (rev 199970)
</span><span class="lines">@@ -2,7 +2,6 @@
</span><span class="cx"> <title>IDBFactory.open() - errors in version argument</title>
</span><span class="cx"> <script src="../../../resources/testharness.js"></script>
</span><span class="cx"> <script src="../../../resources/testharnessreport.js"></script>
</span><del>-<script src=support.js></script>
</del><span class="cx">
</span><span class="cx"> <script>
</span><span class="cx"> function should_throw(val, name) {
</span><span class="lines">@@ -26,7 +25,6 @@
</span><span class="cx"> should_throw(Infinity)
</span><span class="cx"> should_throw(-Infinity)
</span><span class="cx"> should_throw("foo")
</span><del>-should_throw(undefined)
</del><span class="cx"> should_throw(null)
</span><span class="cx"> should_throw(false)
</span><span class="cx">
</span><span class="lines">@@ -46,17 +44,27 @@
</span><span class="cx">
</span><span class="cx"> /* Valid */
</span><span class="cx">
</span><del>-function should_work(val) {
</del><ins>+function should_work(val, expected_version) {
</ins><span class="cx"> var name = format_value(val);
</span><del>- var t = async_test("Calling open() with version argument " + name + " should not throw.")
- var rq = createdb(t, val)
- rq.onupgradeneeded = function() {
- t.done()
- }
</del><ins>+ var dbname = 'test-db-does-not-exist';
+ async_test(function(t) {
+ window.indexedDB.deleteDatabase(dbname);
+ var rq = window.indexedDB.open(dbname, val);
+ rq.onupgradeneeded = t.step_func(function() {
+ var db = rq.result;
+ assert_equals(db.version, expected_version, 'version');
+ rq.transaction.abort();
+ });
+ rq.onsuccess = t.unreached_func("open should fail");
+ rq.onerror = t.step_func(function() {
+ t.done()
+ });
+ }, "Calling open() with version argument " + name + " should not throw.")
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-should_work(1.5)
-should_work(Number.MAX_SAFE_INTEGER) // 0x20000000000000 - 1
</del><ins>+should_work(1.5, 1)
+should_work(Number.MAX_SAFE_INTEGER, Number.MAX_SAFE_INTEGER) // 0x20000000000000 - 1
+should_work(undefined, 1)
</ins><span class="cx">
</span><span class="cx"> </script>
</span><span class="cx">
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsIndexedDBidbfactory_open9expectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idbfactory_open9-expected.txt (199969 => 199970)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idbfactory_open9-expected.txt        2016-04-24 17:23:41 UTC (rev 199969)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idbfactory_open9-expected.txt        2016-04-25 00:27:30 UTC (rev 199970)
</span><span class="lines">@@ -9,7 +9,6 @@
</span><span class="cx"> PASS Calling open() with version argument Infinity should throw TypeError.
</span><span class="cx"> PASS Calling open() with version argument -Infinity should throw TypeError.
</span><span class="cx"> PASS Calling open() with version argument "foo" should throw TypeError.
</span><del>-PASS Calling open() with version argument undefined should throw TypeError.
</del><span class="cx"> PASS Calling open() with version argument null should throw TypeError.
</span><span class="cx"> PASS Calling open() with version argument false should throw TypeError.
</span><span class="cx"> PASS Calling open() with version argument object should throw TypeError.
</span><span class="lines">@@ -17,4 +16,5 @@
</span><span class="cx"> PASS Calling open() with version argument object (third) should throw TypeError.
</span><span class="cx"> PASS Calling open() with version argument 1.5 should not throw.
</span><span class="cx"> PASS Calling open() with version argument 9007199254740991 should not throw.
</span><ins>+PASS Calling open() with version argument undefined should not throw.
</ins><span class="cx">
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsIndexedDBidbfactory_open9htm"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idbfactory_open9.htm (199969 => 199970)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idbfactory_open9.htm        2016-04-24 17:23:41 UTC (rev 199969)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idbfactory_open9.htm        2016-04-25 00:27:30 UTC (rev 199970)
</span><span class="lines">@@ -1,18 +1,16 @@
</span><span class="cx"> <!DOCTYPE html>
</span><span class="cx"> <title>IDBFactory.open() - errors in version argument</title>
</span><del>-<script src="../../../resources/testharness.js"></script>
-<script src="../../../resources/testharnessreport.js"></script>
-<script src=support.js></script>
</del><ins>+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
</ins><span class="cx">
</span><span class="cx"> <script>
</span><del>-var date = Date();
</del><span class="cx"> function should_throw(val, name) {
</span><span class="cx"> if (!name) {
</span><span class="cx"> name = ((typeof val == "object" && val) ? "object" : format_value(val))
</span><span class="cx"> }
</span><span class="cx"> test(function() {
</span><span class="cx"> assert_throws(new TypeError(), function() {
</span><del>- window.indexedDB.open('test' + date, val);
</del><ins>+ window.indexedDB.open('test', val);
</ins><span class="cx"> });
</span><span class="cx"> }, "Calling open() with version argument " + name + " should throw TypeError.")
</span><span class="cx"> }
</span><span class="lines">@@ -27,7 +25,6 @@
</span><span class="cx"> should_throw(Infinity)
</span><span class="cx"> should_throw(-Infinity)
</span><span class="cx"> should_throw("foo")
</span><del>-should_throw(undefined)
</del><span class="cx"> should_throw(null)
</span><span class="cx"> should_throw(false)
</span><span class="cx">
</span><span class="lines">@@ -47,18 +44,27 @@
</span><span class="cx">
</span><span class="cx"> /* Valid */
</span><span class="cx">
</span><del>-function should_work(val) {
-
</del><ins>+function should_work(val, expected_version) {
</ins><span class="cx"> var name = format_value(val);
</span><del>- var t = async_test("Calling open() with version argument " + name + " should not throw.")
- var rq = createdb(t, val + date)
- rq.onupgradeneeded = function() {
- t.done()
- }
</del><ins>+ var dbname = 'test-db-does-not-exist';
+ async_test(function(t) {
+ window.indexedDB.deleteDatabase(dbname);
+ var rq = window.indexedDB.open(dbname, val);
+ rq.onupgradeneeded = t.step_func(function() {
+ var db = rq.result;
+ assert_equals(db.version, expected_version, 'version');
+ rq.transaction.abort();
+ });
+ rq.onsuccess = t.unreached_func("open should fail");
+ rq.onerror = t.step_func(function() {
+ t.done()
+ });
+ }, "Calling open() with version argument " + name + " should not throw.")
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-should_work(1.5)
-should_work(Number.MAX_SAFE_INTEGER) // 0x20000000000000 - 1
</del><ins>+should_work(1.5, 1)
+should_work(Number.MAX_SAFE_INTEGER, Number.MAX_SAFE_INTEGER) // 0x20000000000000 - 1
+should_work(undefined, 1)
</ins><span class="cx">
</span><span class="cx"> </script>
</span><span class="cx">
</span></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbintversionbadparametersexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/storage/indexeddb/intversion-bad-parameters-expected.txt (199969 => 199970)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/intversion-bad-parameters-expected.txt        2016-04-24 17:23:41 UTC (rev 199969)
+++ trunk/LayoutTests/storage/indexeddb/intversion-bad-parameters-expected.txt        2016-04-25 00:27:30 UTC (rev 199970)
</span><span class="lines">@@ -35,9 +35,7 @@
</span><span class="cx"> Expecting TypeError exception from indexedDB.open(dbname, null)
</span><span class="cx"> PASS Exception was thrown.
</span><span class="cx"> PASS indexedDB.open(dbname, null) threw TypeError: IDBFactory.open() called with a version of 0
</span><del>-Expecting TypeError exception from indexedDB.open(dbname, undefined)
-PASS Exception was thrown.
-PASS indexedDB.open(dbname, undefined) threw TypeError: Value NaN is outside the range [0, 9007199254740991]
</del><ins>+PASS indexedDB.open(dbname, undefined) did not throw exception.
</ins><span class="cx"> PASS successfullyParsed is true
</span><span class="cx">
</span><span class="cx"> TEST COMPLETE
</span></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbintversionbadparametersprivateexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/storage/indexeddb/intversion-bad-parameters-private-expected.txt (199969 => 199970)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/intversion-bad-parameters-private-expected.txt        2016-04-24 17:23:41 UTC (rev 199969)
+++ trunk/LayoutTests/storage/indexeddb/intversion-bad-parameters-private-expected.txt        2016-04-25 00:27:30 UTC (rev 199970)
</span><span class="lines">@@ -35,9 +35,7 @@
</span><span class="cx"> Expecting TypeError exception from indexedDB.open(dbname, null)
</span><span class="cx"> PASS Exception was thrown.
</span><span class="cx"> PASS indexedDB.open(dbname, null) threw TypeError: IDBFactory.open() called with a version of 0
</span><del>-Expecting TypeError exception from indexedDB.open(dbname, undefined)
-PASS Exception was thrown.
-PASS indexedDB.open(dbname, undefined) threw TypeError: Value NaN is outside the range [0, 9007199254740991]
</del><ins>+PASS indexedDB.open(dbname, undefined) did not throw exception.
</ins><span class="cx"> PASS successfullyParsed is true
</span><span class="cx">
</span><span class="cx"> TEST COMPLETE
</span></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbresourcesintversionbadparametersjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/storage/indexeddb/resources/intversion-bad-parameters.js (199969 => 199970)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/resources/intversion-bad-parameters.js        2016-04-24 17:23:41 UTC (rev 199969)
+++ trunk/LayoutTests/storage/indexeddb/resources/intversion-bad-parameters.js        2016-04-25 00:27:30 UTC (rev 199970)
</span><span class="lines">@@ -26,7 +26,7 @@
</span><span class="cx"> evalAndExpectExceptionClass("indexedDB.open(dbname, -1)", "TypeError");
</span><span class="cx"> evalAndExpectExceptionClass("indexedDB.open(dbname, 0x20000000000000)", "TypeError");
</span><span class="cx"> evalAndExpectExceptionClass("indexedDB.open(dbname, null)", "TypeError");
</span><del>- evalAndExpectExceptionClass("indexedDB.open(dbname, undefined)", "TypeError");
</del><ins>+ shouldNotThrow("indexedDB.open(dbname, undefined)");
</ins><span class="cx"> finishJSTest();
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (199969 => 199970)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-04-24 17:23:41 UTC (rev 199969)
+++ trunk/Source/WebCore/ChangeLog        2016-04-25 00:27:30 UTC (rev 199970)
</span><span class="lines">@@ -1,3 +1,49 @@
</span><ins>+2016-04-24 Chris Dumez <cdumez@apple.com>
+
+ Autogenerated IDBFactory.open() does the wrong thing if you pass an explicit 'undefined' as the second argument
+ https://bugs.webkit.org/show_bug.cgi?id=156939
+
+ Reviewed by Darin Adler.
+
+ As per WebIDL, if undefined is passed by JS for an optional parameter then
+ we should use its default value if it has one, or use the special value
+ "missing":
+ http://heycam.github.io/webidl/#es-overloads (step 10.4)
+
+ Our bindings generator was already mapping undefined to the parameter's
+ default value when present. However, it was missing the notion of
+ "missing" value when there no default value. This patch adds supports
+ for its by passing Optional<>(Nullopt) to the implementation in such
+ case. This means that the implementation will need to use WTF::Optional<>
+ type for parameters that do not have a default value. Thankfully though,
+ in most cases, we will be able to specify a default value in the IDL
+ so cases where we will need to use WTF::Optional<> will actually be
+ rare.
+
+ To avoid having to do too much refactoring in this patch, the support
+ for WTF::Optional is currently blacklisted for most IDL types. I will
+ gradually stop blacklisting each type in follow-up patches, as I either:
+ - Add default parameter values in our IDL (preferred)
+ - Use WTF::Optional<> in our implementation (when we cannot specify a
+ default value).
+
+ This patch fixes a bug with IDBFactory.open()'s second parameter (version)
+ for which undefined should not throw and indicate that the version
+ should not be changed. We now use WTF::Optional in the implementation to
+ distinguish this case and not throw.
+
+ No new tests, existing tests were updated / rebaselined.
+
+ * Modules/indexeddb/IDBFactory.cpp:
+ (WebCore::IDBFactory::open):
+ (WebCore::IDBFactory::openInternal): Deleted.
+ * Modules/indexeddb/IDBFactory.h:
+ * bindings/scripts/CodeGeneratorJS.pm:
+ (ShouldUseWTFOptionalForParameterType):
+ (GenerateParametersCheck):
+ * fileapi/Blob.idl:
+ * inspector/InspectorIndexedDBAgent.cpp:
+
</ins><span class="cx"> 2016-04-23 Chris Dumez <cdumez@apple.com>
</span><span class="cx">
</span><span class="cx"> [WebIDL] Drop [Default] WebKit-IDL extended attribute
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBFactorycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBFactory.cpp (199969 => 199970)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBFactory.cpp        2016-04-24 17:23:41 UTC (rev 199969)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBFactory.cpp        2016-04-25 00:27:30 UTC (rev 199970)
</span><span class="lines">@@ -76,24 +76,17 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<IDBOpenDBRequest> IDBFactory::open(ScriptExecutionContext& context, const String& name, ExceptionCodeWithMessage& ec)
</del><ins>+RefPtr<IDBOpenDBRequest> IDBFactory::open(ScriptExecutionContext& context, const String& name, Optional<unsigned long long> version, ExceptionCodeWithMessage& ec)
</ins><span class="cx"> {
</span><span class="cx"> LOG(IndexedDB, "IDBFactory::open");
</span><span class="cx">
</span><del>- return openInternal(context, name, 0, ec);
-}
-
-RefPtr<IDBOpenDBRequest> IDBFactory::open(ScriptExecutionContext& context, const String& name, unsigned long long version, ExceptionCodeWithMessage& ec)
-{
- LOG(IndexedDB, "IDBFactory::open");
-
- if (!version) {
</del><ins>+ if (version && !version.value()) {
</ins><span class="cx"> ec.code = TypeError;
</span><span class="cx"> ec.message = ASCIILiteral("IDBFactory.open() called with a version of 0");
</span><span class="cx"> return nullptr;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- return openInternal(context, name, version, ec);
</del><ins>+ return openInternal(context, name, version.valueOr(0), ec);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> RefPtr<IDBOpenDBRequest> IDBFactory::openInternal(ScriptExecutionContext& context, const String& name, unsigned long long version, ExceptionCodeWithMessage& ec)
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBFactoryh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBFactory.h (199969 => 199970)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBFactory.h        2016-04-24 17:23:41 UTC (rev 199969)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBFactory.h        2016-04-25 00:27:30 UTC (rev 199970)
</span><span class="lines">@@ -53,8 +53,7 @@
</span><span class="cx"> static Ref<IDBFactory> create(IDBClient::IDBConnectionProxy&);
</span><span class="cx"> ~IDBFactory();
</span><span class="cx">
</span><del>- RefPtr<IDBOpenDBRequest> open(ScriptExecutionContext&, const String& name, ExceptionCodeWithMessage&);
- RefPtr<IDBOpenDBRequest> open(ScriptExecutionContext&, const String& name, unsigned long long version, ExceptionCodeWithMessage&);
</del><ins>+ RefPtr<IDBOpenDBRequest> open(ScriptExecutionContext&, const String& name, Optional<unsigned long long> version, ExceptionCodeWithMessage&);
</ins><span class="cx"> RefPtr<IDBOpenDBRequest> deleteDatabase(ScriptExecutionContext&, const String& name, ExceptionCodeWithMessage&);
</span><span class="cx">
</span><span class="cx"> short cmp(ScriptExecutionContext&, JSC::JSValue first, JSC::JSValue second, ExceptionCodeWithMessage&);
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptsCodeGeneratorJSpm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (199969 => 199970)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2016-04-24 17:23:41 UTC (rev 199969)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2016-04-25 00:27:30 UTC (rev 199970)
</span><span class="lines">@@ -3370,6 +3370,29 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+sub CanUseWTFOptionalForParameterType
+{
+ my $type = shift;
+
+ # FIXME: We should progressively stop blacklisting each type below
+ # and eventually get rid of this function entirely.
+ return 0 if $codeGenerator->IsEnumType($type);
+ return 0 if $codeGenerator->IsTypedArrayType($type);
+ return 0 if $codeGenerator->IsWrapperType($type);
+ return 0 if $type eq "DOMString";
+ return 0 if $type eq "Dictionary";
+ return 0 if $type eq "any";
+ return 0 if $type eq "boolean";
+ return 0 if $type eq "float";
+ return 0 if $type eq "long";
+ return 0 if $type eq "unrestricted float";
+ return 0 if $type eq "unrestricted double";
+ return 0 if $type eq "unsigned long";
+ return 0 if $type eq "unsigned short";
+
+ return 1;
+}
+
</ins><span class="cx"> sub GenerateParametersCheck
</span><span class="cx"> {
</span><span class="cx"> my $outputArray = shift;
</span><span class="lines">@@ -3419,7 +3442,7 @@
</span><span class="cx"> # Optional arguments with [Optional=...] should not generate the early call.
</span><span class="cx"> # Optional Dictionary arguments always considered to have default of empty dictionary.
</span><span class="cx"> my $optional = $parameter->isOptional;
</span><del>- if ($optional && !defined($parameter->default) && $argType ne "Dictionary" && !$codeGenerator->IsCallbackInterface($argType)) {
</del><ins>+ if ($optional && !defined($parameter->default) && !CanUseWTFOptionalForParameterType($parameter->type) && $argType ne "Dictionary" && !$codeGenerator->IsCallbackInterface($argType)) {
</ins><span class="cx"> # Generate early call if there are enough parameters.
</span><span class="cx"> if (!$hasOptionalArguments) {
</span><span class="cx"> push(@$outputArray, "\n size_t argsCount = state->argumentCount();\n");
</span><span class="lines">@@ -3576,6 +3599,8 @@
</span><span class="cx"> } else {
</span><span class="cx"> my $outer;
</span><span class="cx"> my $inner;
</span><ins>+ my $nativeType = GetNativeTypeFromSignature($parameter);
+
</ins><span class="cx"> if ($optional && defined($parameter->default)) {
</span><span class="cx"> my $defaultValue = $parameter->default;
</span><span class="cx">
</span><span class="lines">@@ -3592,16 +3617,23 @@
</span><span class="cx"> } else {
</span><span class="cx"> $defaultValue = "nullptr" if $defaultValue eq "null";
</span><span class="cx"> $defaultValue = "PNaN" if $defaultValue eq "NaN";
</span><del>- $defaultValue = GetNativeTypeFromSignature($parameter) . "()" if $defaultValue eq "[]";
</del><ins>+ $defaultValue = "$nativeType()" if $defaultValue eq "[]";
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> $outer = "state->argument($argsIndex).isUndefined() ? $defaultValue : ";
</span><span class="cx"> $inner = "state->uncheckedArgument($argsIndex)";
</span><ins>+ } elsif ($optional && !defined($parameter->default) && CanUseWTFOptionalForParameterType($parameter->type)) {
+ # Use WTF::Optional<>() for optional parameters that are missing or undefined and that do not have
+ # a default value in the IDL.
+ my $defaultValue = "Optional<$nativeType>()";
+ $nativeType = "Optional<$nativeType>";
+ $outer = "state->argument($argsIndex).isUndefined() ? $defaultValue : ";
+ $inner = "state->uncheckedArgument($argsIndex)";
</ins><span class="cx"> } else {
</span><span class="cx"> $outer = "";
</span><span class="cx"> $inner = "state->argument($argsIndex)";
</span><span class="cx"> }
</span><del>- push(@$outputArray, " " . GetNativeTypeFromSignature($parameter) . " $name = $outer" . JSValueToNative($parameter, $inner, $function->signature->extendedAttributes->{"Conditional"}) . ";\n");
</del><ins>+ push(@$outputArray, " $nativeType $name = $outer" . JSValueToNative($parameter, $inner, $function->signature->extendedAttributes->{"Conditional"}) . ";\n");
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> # Check if the type conversion succeeded.
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestGObjectWebKitDOMTestObjcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp (199969 => 199970)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp        2016-04-24 17:23:41 UTC (rev 199969)
+++ trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp        2016-04-25 00:27:30 UTC (rev 199970)
</span><span class="lines">@@ -1648,6 +1648,58 @@
</span><span class="cx"> item->methodWithOptionalFloatIsNaN(number);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void webkit_dom_test_obj_method_with_optional_long_long(WebKitDOMTestObj* self, gint64 number)
+{
+ WebCore::JSMainThreadNullState state;
+ g_return_if_fail(WEBKIT_DOM_IS_TEST_OBJ(self));
+ WebCore::TestObj* item = WebKit::core(self);
+ item->methodWithOptionalLongLong(number);
+}
+
+void webkit_dom_test_obj_method_with_optional_long_long_is_zero(WebKitDOMTestObj* self, gint64 number)
+{
+ WebCore::JSMainThreadNullState state;
+ g_return_if_fail(WEBKIT_DOM_IS_TEST_OBJ(self));
+ WebCore::TestObj* item = WebKit::core(self);
+ item->methodWithOptionalLongLongIsZero(number);
+}
+
+void webkit_dom_test_obj_method_with_optional_unsigned_long_long(WebKitDOMTestObj* self, guint64 number)
+{
+ WebCore::JSMainThreadNullState state;
+ g_return_if_fail(WEBKIT_DOM_IS_TEST_OBJ(self));
+ WebCore::TestObj* item = WebKit::core(self);
+ item->methodWithOptionalUnsignedLongLong(number);
+}
+
+void webkit_dom_test_obj_method_with_optional_unsigned_long_long_is_zero(WebKitDOMTestObj* self, guint64 number)
+{
+ WebCore::JSMainThreadNullState state;
+ g_return_if_fail(WEBKIT_DOM_IS_TEST_OBJ(self));
+ WebCore::TestObj* item = WebKit::core(self);
+ item->methodWithOptionalUnsignedLongLongIsZero(number);
+}
+
+void webkit_dom_test_obj_method_with_optional_array(WebKitDOMTestObj* self, const gchar* array)
+{
+ WebCore::JSMainThreadNullState state;
+ g_return_if_fail(WEBKIT_DOM_IS_TEST_OBJ(self));
+ g_return_if_fail(WEBKIT_DOM_IS_DOM_STRING[](array));
+ WebCore::TestObj* item = WebKit::core(self);
+ WebCore::DOMString[]* convertedArray = WebKit::core(array);
+ item->methodWithOptionalArray(convertedArray);
+}
+
+void webkit_dom_test_obj_method_with_optional_array_is_empty(WebKitDOMTestObj* self, const gchar* array)
+{
+ WebCore::JSMainThreadNullState state;
+ g_return_if_fail(WEBKIT_DOM_IS_TEST_OBJ(self));
+ g_return_if_fail(WEBKIT_DOM_IS_DOM_STRING[](array));
+ WebCore::TestObj* item = WebKit::core(self);
+ WebCore::DOMString[]* convertedArray = WebKit::core(array);
+ item->methodWithOptionalArrayIsEmpty(convertedArray);
+}
+
</ins><span class="cx"> gchar* webkit_dom_test_obj_conditional_method1(WebKitDOMTestObj* self)
</span><span class="cx"> {
</span><span class="cx"> #if ENABLE(Condition1)
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestGObjectWebKitDOMTestObjh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h (199969 => 199970)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h        2016-04-24 17:23:41 UTC (rev 199969)
+++ trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h        2016-04-25 00:27:30 UTC (rev 199970)
</span><span class="lines">@@ -609,6 +609,66 @@
</span><span class="cx"> webkit_dom_test_obj_method_with_optional_float_is_na_n(WebKitDOMTestObj* self, gfloat number);
</span><span class="cx">
</span><span class="cx"> /**
</span><ins>+ * webkit_dom_test_obj_method_with_optional_long_long:
+ * @self: A #WebKitDOMTestObj
+ * @number: A #gint64
+ *
+ * Stability: Unstable
+**/
+WEBKIT_API void
+webkit_dom_test_obj_method_with_optional_long_long(WebKitDOMTestObj* self, gint64 number);
+
+/**
+ * webkit_dom_test_obj_method_with_optional_long_long_is_zero:
+ * @self: A #WebKitDOMTestObj
+ * @number: A #gint64
+ *
+ * Stability: Unstable
+**/
+WEBKIT_API void
+webkit_dom_test_obj_method_with_optional_long_long_is_zero(WebKitDOMTestObj* self, gint64 number);
+
+/**
+ * webkit_dom_test_obj_method_with_optional_unsigned_long_long:
+ * @self: A #WebKitDOMTestObj
+ * @number: A #guint64
+ *
+ * Stability: Unstable
+**/
+WEBKIT_API void
+webkit_dom_test_obj_method_with_optional_unsigned_long_long(WebKitDOMTestObj* self, guint64 number);
+
+/**
+ * webkit_dom_test_obj_method_with_optional_unsigned_long_long_is_zero:
+ * @self: A #WebKitDOMTestObj
+ * @number: A #guint64
+ *
+ * Stability: Unstable
+**/
+WEBKIT_API void
+webkit_dom_test_obj_method_with_optional_unsigned_long_long_is_zero(WebKitDOMTestObj* self, guint64 number);
+
+/**
+ * webkit_dom_test_obj_method_with_optional_array:
+ * @self: A #WebKitDOMTestObj
+ * @array: A #gchar
+ *
+ * Stability: Unstable
+**/
+WEBKIT_API void
+webkit_dom_test_obj_method_with_optional_array(WebKitDOMTestObj* self, const gchar* array);
+
+/**
+ * webkit_dom_test_obj_method_with_optional_array_is_empty:
+ * @self: A #WebKitDOMTestObj
+ * @array: A #gchar
+ *
+ * Stability: Unstable
+**/
+WEBKIT_API void
+webkit_dom_test_obj_method_with_optional_array_is_empty(WebKitDOMTestObj* self, const gchar* array);
+
+/**
</ins><span class="cx"> * webkit_dom_test_obj_conditional_method1:
</span><span class="cx"> * @self: A #WebKitDOMTestObj
</span><span class="cx"> *
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestObjcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (199969 => 199970)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp        2016-04-24 17:23:41 UTC (rev 199969)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp        2016-04-25 00:27:30 UTC (rev 199970)
</span><span class="lines">@@ -148,6 +148,12 @@
</span><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalDoubleIsNaN(JSC::ExecState*);
</span><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalFloatIsNaN(JSC::ExecState*);
</span><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalSequence(JSC::ExecState*);
</span><ins>+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalLongLong(JSC::ExecState*);
+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalLongLongIsZero(JSC::ExecState*);
+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalUnsignedLongLong(JSC::ExecState*);
+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalUnsignedLongLongIsZero(JSC::ExecState*);
+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalArray(JSC::ExecState*);
+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalArrayIsEmpty(JSC::ExecState*);
</ins><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithCallbackArg(JSC::ExecState*);
</span><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonCallbackArgAndCallbackArg(JSC::ExecState*);
</span><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithCallbackAndOptionalArg(JSC::ExecState*);
</span><span class="lines">@@ -707,6 +713,12 @@
</span><span class="cx"> { "methodWithOptionalDoubleIsNaN", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithOptionalDoubleIsNaN), (intptr_t) (0) } },
</span><span class="cx"> { "methodWithOptionalFloatIsNaN", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithOptionalFloatIsNaN), (intptr_t) (0) } },
</span><span class="cx"> { "methodWithOptionalSequence", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithOptionalSequence), (intptr_t) (0) } },
</span><ins>+ { "methodWithOptionalLongLong", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithOptionalLongLong), (intptr_t) (0) } },
+ { "methodWithOptionalLongLongIsZero", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithOptionalLongLongIsZero), (intptr_t) (0) } },
+ { "methodWithOptionalUnsignedLongLong", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithOptionalUnsignedLongLong), (intptr_t) (0) } },
+ { "methodWithOptionalUnsignedLongLongIsZero", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithOptionalUnsignedLongLongIsZero), (intptr_t) (0) } },
+ { "methodWithOptionalArray", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithOptionalArray), (intptr_t) (0) } },
+ { "methodWithOptionalArrayIsEmpty", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithOptionalArrayIsEmpty), (intptr_t) (0) } },
</ins><span class="cx"> { "methodWithCallbackArg", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithCallbackArg), (intptr_t) (1) } },
</span><span class="cx"> { "methodWithNonCallbackArgAndCallbackArg", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithNonCallbackArgAndCallbackArg), (intptr_t) (2) } },
</span><span class="cx"> { "methodWithCallbackAndOptionalArg", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithCallbackAndOptionalArg), (intptr_t) (0) } },
</span><span class="lines">@@ -4241,6 +4253,96 @@
</span><span class="cx"> return JSValue::encode(jsUndefined());
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalLongLong(ExecState* state)
+{
+ JSValue thisValue = state->thisValue();
+ auto castedThis = jsDynamicCast<JSTestObj*>(thisValue);
+ if (UNLIKELY(!castedThis))
+ return throwThisTypeError(*state, "TestObj", "methodWithOptionalLongLong");
+ ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
+ auto& impl = castedThis->wrapped();
+ Optional<long long> number = state->argument(0).isUndefined() ? Optional<long long>() : toInt64(state, state->uncheckedArgument(0), NormalConversion);
+ if (UNLIKELY(state->hadException()))
+ return JSValue::encode(jsUndefined());
+ impl.methodWithOptionalLongLong(number);
+ return JSValue::encode(jsUndefined());
+}
+
+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalLongLongIsZero(ExecState* state)
+{
+ JSValue thisValue = state->thisValue();
+ auto castedThis = jsDynamicCast<JSTestObj*>(thisValue);
+ if (UNLIKELY(!castedThis))
+ return throwThisTypeError(*state, "TestObj", "methodWithOptionalLongLongIsZero");
+ ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
+ auto& impl = castedThis->wrapped();
+ long long number = state->argument(0).isUndefined() ? 0 : toInt64(state, state->uncheckedArgument(0), NormalConversion);
+ if (UNLIKELY(state->hadException()))
+ return JSValue::encode(jsUndefined());
+ impl.methodWithOptionalLongLongIsZero(number);
+ return JSValue::encode(jsUndefined());
+}
+
+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalUnsignedLongLong(ExecState* state)
+{
+ JSValue thisValue = state->thisValue();
+ auto castedThis = jsDynamicCast<JSTestObj*>(thisValue);
+ if (UNLIKELY(!castedThis))
+ return throwThisTypeError(*state, "TestObj", "methodWithOptionalUnsignedLongLong");
+ ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
+ auto& impl = castedThis->wrapped();
+ Optional<unsigned long long> number = state->argument(0).isUndefined() ? Optional<unsigned long long>() : toUInt64(state, state->uncheckedArgument(0), NormalConversion);
+ if (UNLIKELY(state->hadException()))
+ return JSValue::encode(jsUndefined());
+ impl.methodWithOptionalUnsignedLongLong(number);
+ return JSValue::encode(jsUndefined());
+}
+
+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalUnsignedLongLongIsZero(ExecState* state)
+{
+ JSValue thisValue = state->thisValue();
+ auto castedThis = jsDynamicCast<JSTestObj*>(thisValue);
+ if (UNLIKELY(!castedThis))
+ return throwThisTypeError(*state, "TestObj", "methodWithOptionalUnsignedLongLongIsZero");
+ ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
+ auto& impl = castedThis->wrapped();
+ unsigned long long number = state->argument(0).isUndefined() ? 0 : toUInt64(state, state->uncheckedArgument(0), NormalConversion);
+ if (UNLIKELY(state->hadException()))
+ return JSValue::encode(jsUndefined());
+ impl.methodWithOptionalUnsignedLongLongIsZero(number);
+ return JSValue::encode(jsUndefined());
+}
+
+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalArray(ExecState* state)
+{
+ JSValue thisValue = state->thisValue();
+ auto castedThis = jsDynamicCast<JSTestObj*>(thisValue);
+ if (UNLIKELY(!castedThis))
+ return throwThisTypeError(*state, "TestObj", "methodWithOptionalArray");
+ ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
+ auto& impl = castedThis->wrapped();
+ Optional<Vector<String>> array = state->argument(0).isUndefined() ? Optional<Vector<String>>() : toNativeArray<String>(state, state->uncheckedArgument(0));
+ if (UNLIKELY(state->hadException()))
+ return JSValue::encode(jsUndefined());
+ impl.methodWithOptionalArray(array);
+ return JSValue::encode(jsUndefined());
+}
+
+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalArrayIsEmpty(ExecState* state)
+{
+ JSValue thisValue = state->thisValue();
+ auto castedThis = jsDynamicCast<JSTestObj*>(thisValue);
+ if (UNLIKELY(!castedThis))
+ return throwThisTypeError(*state, "TestObj", "methodWithOptionalArrayIsEmpty");
+ ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
+ auto& impl = castedThis->wrapped();
+ Vector<String> array = state->argument(0).isUndefined() ? Vector<String>() : toNativeArray<String>(state, state->uncheckedArgument(0));
+ if (UNLIKELY(state->hadException()))
+ return JSValue::encode(jsUndefined());
+ impl.methodWithOptionalArrayIsEmpty(array);
+ return JSValue::encode(jsUndefined());
+}
+
</ins><span class="cx"> EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithCallbackArg(ExecState* state)
</span><span class="cx"> {
</span><span class="cx"> JSValue thisValue = state->thisValue();
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestTypedefscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp (199969 => 199970)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp        2016-04-24 17:23:41 UTC (rev 199969)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp        2016-04-25 00:27:30 UTC (rev 199970)
</span><span class="lines">@@ -463,14 +463,7 @@
</span><span class="cx"> return throwThisTypeError(*state, "TestTypedefs", "func");
</span><span class="cx"> ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestTypedefs::info());
</span><span class="cx"> auto& impl = castedThis->wrapped();
</span><del>-
- size_t argsCount = state->argumentCount();
- if (argsCount <= 0) {
- impl.func();
- return JSValue::encode(jsUndefined());
- }
-
- Vector<int> x = toNativeArray<int>(state, state->argument(0));
</del><ins>+ Vector<int> x = state->argument(0).isUndefined() ? Vector<int>() : toNativeArray<int>(state, state->uncheckedArgument(0));
</ins><span class="cx"> if (UNLIKELY(state->hadException()))
</span><span class="cx"> return JSValue::encode(jsUndefined());
</span><span class="cx"> impl.func(x);
</span><span class="lines">@@ -570,13 +563,6 @@
</span><span class="cx"> if (!std::isnan(arg1NativeValue))
</span><span class="cx"> arg1 = clampTo<unsigned long long>(arg1NativeValue);
</span><span class="cx">
</span><del>-
- size_t argsCount = state->argumentCount();
- if (argsCount <= 1) {
- impl.funcWithClamp(arg1);
- return JSValue::encode(jsUndefined());
- }
-
</del><span class="cx"> unsigned long long arg2 = 0;
</span><span class="cx"> double arg2NativeValue = state->argument(1).toNumber(state);
</span><span class="cx"> if (UNLIKELY(state->hadException()))
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestObjCDOMTestObjh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h (199969 => 199970)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h        2016-04-24 17:23:41 UTC (rev 199969)
+++ trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h        2016-04-25 00:27:30 UTC (rev 199970)
</span><span class="lines">@@ -184,6 +184,10 @@
</span><span class="cx"> - (void)methodWithOptionalAtomicStringIsEmptyString:(NSString *)str;
</span><span class="cx"> - (void)methodWithOptionalDoubleIsNaN:(double)number;
</span><span class="cx"> - (void)methodWithOptionalFloatIsNaN:(float)number;
</span><ins>+- (void)methodWithOptionalLongLong:(long long)number;
+- (void)methodWithOptionalLongLongIsZero:(long long)number;
+- (void)methodWithOptionalUnsignedLongLong:(unsigned long long)number;
+- (void)methodWithOptionalUnsignedLongLongIsZero:(unsigned long long)number;
</ins><span class="cx"> - (void)classMethod;
</span><span class="cx"> - (int)classMethodWithOptional:(int)arg;
</span><span class="cx"> - (void)classMethod2:(int)arg;
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestObjCDOMTestObjmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm (199969 => 199970)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm        2016-04-24 17:23:41 UTC (rev 199969)
+++ trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm        2016-04-25 00:27:30 UTC (rev 199970)
</span><span class="lines">@@ -1316,7 +1316,31 @@
</span><span class="cx"> IMPL->methodWithOptionalFloatIsNaN(number);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+- (void)methodWithOptionalLongLong:(long long)number
+{
+ WebCore::JSMainThreadNullState state;
+ IMPL->methodWithOptionalLongLong(number);
+}
</ins><span class="cx">
</span><ins>+- (void)methodWithOptionalLongLongIsZero:(long long)number
+{
+ WebCore::JSMainThreadNullState state;
+ IMPL->methodWithOptionalLongLongIsZero(number);
+}
+
+- (void)methodWithOptionalUnsignedLongLong:(unsigned long long)number
+{
+ WebCore::JSMainThreadNullState state;
+ IMPL->methodWithOptionalUnsignedLongLong(number);
+}
+
+- (void)methodWithOptionalUnsignedLongLongIsZero:(unsigned long long)number
+{
+ WebCore::JSMainThreadNullState state;
+ IMPL->methodWithOptionalUnsignedLongLongIsZero(number);
+}
+
+
</ins><span class="cx"> #if ENABLE(Condition1)
</span><span class="cx"> - (NSString *)conditionalMethod1
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestTestObjidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/TestObj.idl (199969 => 199970)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/TestObj.idl        2016-04-24 17:23:41 UTC (rev 199969)
+++ trunk/Source/WebCore/bindings/scripts/test/TestObj.idl        2016-04-25 00:27:30 UTC (rev 199970)
</span><span class="lines">@@ -189,6 +189,12 @@
</span><span class="cx"> void methodWithOptionalDoubleIsNaN(optional unrestricted double number = NaN);
</span><span class="cx"> void methodWithOptionalFloatIsNaN(optional unrestricted float number = NaN);
</span><span class="cx"> void methodWithOptionalSequence(optional sequence<DOMString> sequence = []);
</span><ins>+ void methodWithOptionalLongLong(optional long long number);
+ void methodWithOptionalLongLongIsZero(optional long long number = 0);
+ void methodWithOptionalUnsignedLongLong(optional unsigned long long number);
+ void methodWithOptionalUnsignedLongLongIsZero(optional unsigned long long number = 0);
+ void methodWithOptionalArray(optional DOMString[] array);
+ void methodWithOptionalArrayIsEmpty(optional DOMString[] array = []);
</ins><span class="cx">
</span><span class="cx"> #if defined(TESTING_JS)
</span><span class="cx"> // Callback interface parameters.
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestTestTypedefsidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/TestTypedefs.idl (199969 => 199970)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/TestTypedefs.idl        2016-04-24 17:23:41 UTC (rev 199969)
+++ trunk/Source/WebCore/bindings/scripts/test/TestTypedefs.idl        2016-04-25 00:27:30 UTC (rev 199970)
</span><span class="lines">@@ -40,7 +40,7 @@
</span><span class="cx">
</span><span class="cx"> static readonly attribute T TestSubObj;
</span><span class="cx">
</span><del>- [StrictTypeChecking] void func(optional ARRAY_OF_LONGS x);
</del><ins>+ [StrictTypeChecking] void func(optional ARRAY_OF_LONGS x = []);
</ins><span class="cx">
</span><span class="cx"> void setShadow(DOUBLE width, DOUBLE height, unrestricted float blur, [StrictTypeChecking] optional STRING color, optional DOUBLE alpha);
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorefileapiBlobidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/fileapi/Blob.idl (199969 => 199970)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/fileapi/Blob.idl        2016-04-24 17:23:41 UTC (rev 199969)
+++ trunk/Source/WebCore/fileapi/Blob.idl        2016-04-25 00:27:30 UTC (rev 199970)
</span><span class="lines">@@ -39,7 +39,7 @@
</span><span class="cx"> readonly attribute DOMString type;
</span><span class="cx">
</span><span class="cx"> #if !defined(LANGUAGE_OBJECTIVE_C)
</span><del>- Blob slice(optional long long start, optional long long end, optional DOMString? contentType);
</del><ins>+ Blob slice(optional long long start = 0, optional long long end = 0x7FFFFFFFFFFFFFFF, optional DOMString? contentType = null);
</ins><span class="cx"> #endif
</span><span class="cx"> };
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorIndexedDBAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp (199969 => 199970)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp        2016-04-24 17:23:41 UTC (rev 199969)
+++ trunk/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp        2016-04-25 00:27:30 UTC (rev 199970)
</span><span class="lines">@@ -213,7 +213,7 @@
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- RefPtr<IDBOpenDBRequest> idbOpenDBRequest = idbFactory->open(*context(), databaseName, ec);
</del><ins>+ RefPtr<IDBOpenDBRequest> idbOpenDBRequest = idbFactory->open(*context(), databaseName, Nullopt, ec);
</ins><span class="cx"> if (ec.code) {
</span><span class="cx"> requestCallback().sendFailure("Could not open database.");
</span><span class="cx"> return;
</span></span></pre>
</div>
</div>
</body>
</html>