Title: [86970] trunk
- Revision
- 86970
- Author
- commit-qu...@webkit.org
- Date
- 2011-05-20 11:30:35 -0700 (Fri, 20 May 2011)
Log Message
2011-05-20 Mark Pilgrim <pilg...@chromium.org>
Reviewed by Tony Chang.
IndexedDB createObjectStore should throw if name is null
https://bugs.webkit.org/show_bug.cgi?id=58465
* storage/indexeddb/mozilla/create-objectstore-null-name-expected.txt: Added.
* storage/indexeddb/mozilla/create-objectstore-null-name.html: Added.
2011-05-20 Mark Pilgrim <pilg...@chromium.org>
Reviewed by Tony Chang.
IndexedDB createObjectStore should throw if name is null
https://bugs.webkit.org/show_bug.cgi?id=58465
Test: storage/indexeddb/mozilla/create-objectstore-null-name.html
* storage/IDBDatabase.idl:
* storage/IDBDatabaseBackendImpl.cpp:
(WebCore::IDBDatabaseBackendImpl::createObjectStore):
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (86969 => 86970)
--- trunk/LayoutTests/ChangeLog 2011-05-20 18:23:50 UTC (rev 86969)
+++ trunk/LayoutTests/ChangeLog 2011-05-20 18:30:35 UTC (rev 86970)
@@ -1,3 +1,13 @@
+2011-05-20 Mark Pilgrim <pilg...@chromium.org>
+
+ Reviewed by Tony Chang.
+
+ IndexedDB createObjectStore should throw if name is null
+ https://bugs.webkit.org/show_bug.cgi?id=58465
+
+ * storage/indexeddb/mozilla/create-objectstore-null-name-expected.txt: Added.
+ * storage/indexeddb/mozilla/create-objectstore-null-name.html: Added.
+
2011-05-20 Xiaomei Ji <x...@chromium.org>
Reviewed by Ryosuke Niwa.
Added: trunk/LayoutTests/storage/indexeddb/mozilla/create-objectstore-null-name-expected.txt (0 => 86970)
--- trunk/LayoutTests/storage/indexeddb/mozilla/create-objectstore-null-name-expected.txt (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/mozilla/create-objectstore-null-name-expected.txt 2011-05-20 18:30:35 UTC (rev 86970)
@@ -0,0 +1,40 @@
+Test IndexedDB's creating object store with null name
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+indexedDB = window.indexedDB || window.webkitIndexedDB || window.mozIndexedDB;
+PASS indexedDB == null is false
+IDBDatabaseException = window.IDBDatabaseException || window.webkitIDBDatabaseException;
+PASS IDBDatabaseException == null is false
+indexedDB.open(name, description)
+db = event.target.result
+request = db.setVersion('1')
+Deleted all object stores.
+Expecting exception from db.createObjectStore(null);
+PASS Exception was thrown.
+PASS code is IDBDatabaseException.NON_TRANSIENT_ERR
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
+Test IndexedDB's creating object store with null name
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+indexedDB = window.indexedDB || window.webkitIndexedDB || window.mozIndexedDB;
+PASS indexedDB == null is false
+IDBDatabaseException = window.IDBDatabaseException || window.webkitIDBDatabaseException;
+PASS IDBDatabaseException == null is false
+indexedDB.open(name, description)
+db = event.target.result
+request = db.setVersion('1')
+Deleted all object stores.
+Expecting exception from db.createObjectStore(null);
+PASS Exception was thrown.
+PASS code is IDBDatabaseException.NON_TRANSIENT_ERR
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/storage/indexeddb/mozilla/create-objectstore-null-name.html (0 => 86970)
--- trunk/LayoutTests/storage/indexeddb/mozilla/create-objectstore-null-name.html (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/mozilla/create-objectstore-null-name.html 2011-05-20 18:30:35 UTC (rev 86970)
@@ -0,0 +1,63 @@
+<!DOCTYPE html>
+<!--
+ original test: http://mxr.mozilla.org/mozilla2.0/source/dom/indexedDB/test/test_create_objectStore.html
+ license of original test:
+ " Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ "
+-->
+<html>
+<head>
+<link rel="stylesheet" href=""
+<script src=""
+<script src=""
+<script src=""
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script>
+
+description("Test IndexedDB's creating object store with null name");
+if (window.layoutTestController)
+ layoutTestController.waitUntilDone();
+
+function test()
+{
+ indexedDB = evalAndLog("indexedDB = window.indexedDB || window.webkitIndexedDB || window.mozIndexedDB;");
+ shouldBeFalse("indexedDB == null");
+ IDBDatabaseException = evalAndLog("IDBDatabaseException = window.IDBDatabaseException || window.webkitIDBDatabaseException;");
+ shouldBeFalse("IDBDatabaseException == null");
+
+ name = window.location.pathname;
+ description = "My Test Database";
+ request = evalAndLog("indexedDB.open(name, description)");
+ request._onsuccess_ = openSuccess;
+ request._onerror_ = unexpectedErrorCallback;
+}
+
+function openSuccess()
+{
+ db = evalAndLog("db = event.target.result");
+
+ request = evalAndLog("request = db.setVersion('1')");
+ request._onsuccess_ = cleanDatabase;
+ request._onerror_ = unexpectedErrorCallback;
+}
+
+function cleanDatabase()
+{
+ deleteAllObjectStores(db);
+
+ evalAndExpectException("db.createObjectStore(null);", "IDBDatabaseException.NON_TRANSIENT_ERR");
+
+ done();
+}
+
+var successfullyParsed = true;
+
+test();
+
+</script>
+</body>
+</html>
+
Modified: trunk/Source/WebCore/ChangeLog (86969 => 86970)
--- trunk/Source/WebCore/ChangeLog 2011-05-20 18:23:50 UTC (rev 86969)
+++ trunk/Source/WebCore/ChangeLog 2011-05-20 18:30:35 UTC (rev 86970)
@@ -1,3 +1,16 @@
+2011-05-20 Mark Pilgrim <pilg...@chromium.org>
+
+ Reviewed by Tony Chang.
+
+ IndexedDB createObjectStore should throw if name is null
+ https://bugs.webkit.org/show_bug.cgi?id=58465
+
+ Test: storage/indexeddb/mozilla/create-objectstore-null-name.html
+
+ * storage/IDBDatabase.idl:
+ * storage/IDBDatabaseBackendImpl.cpp:
+ (WebCore::IDBDatabaseBackendImpl::createObjectStore):
+
2011-05-20 Xiaomei Ji <x...@chromium.org>
Reviewed by Ryosuke Niwa.
Modified: trunk/Source/WebCore/storage/IDBDatabase.idl (86969 => 86970)
--- trunk/Source/WebCore/storage/IDBDatabase.idl 2011-05-20 18:23:50 UTC (rev 86969)
+++ trunk/Source/WebCore/storage/IDBDatabase.idl 2011-05-20 18:30:35 UTC (rev 86970)
@@ -39,7 +39,7 @@
attribute EventListener onerror;
attribute EventListener onversionchange;
- IDBObjectStore createObjectStore(in DOMString name, in [Optional] OptionsObject options)
+ IDBObjectStore createObjectStore(in [ConvertNullToNullString] DOMString name, in [Optional] OptionsObject options)
raises (IDBDatabaseException);
void deleteObjectStore(in DOMString name)
raises (IDBDatabaseException);
Modified: trunk/Source/WebCore/storage/IDBDatabaseBackendImpl.cpp (86969 => 86970)
--- trunk/Source/WebCore/storage/IDBDatabaseBackendImpl.cpp 2011-05-20 18:23:50 UTC (rev 86969)
+++ trunk/Source/WebCore/storage/IDBDatabaseBackendImpl.cpp 2011-05-20 18:30:35 UTC (rev 86970)
@@ -101,6 +101,10 @@
{
ASSERT(transactionPtr->mode() == IDBTransaction::VERSION_CHANGE);
+ if (name.isNull()) {
+ ec = IDBDatabaseException::NON_TRANSIENT_ERR;
+ return 0;
+ }
if (m_objectStores.contains(name)) {
ec = IDBDatabaseException::CONSTRAINT_ERR;
return 0;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes