2011-06-22 Mark Pilgrim <pilgrim@chromium.org>
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 22 Jun 2011 18:03:33 +0000 (18:03 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 22 Jun 2011 18:03:33 +0000 (18:03 +0000)
        Reviewed by Adam Barth.

        IndexedDB: fix multiple issues in IDBDatabase.idl
        https://bugs.webkit.org/show_bug.cgi?id=63140

        * storage/indexeddb/createObjectStore-name-argument-required-expected.txt: Added.
        * storage/indexeddb/createObjectStore-name-argument-required.html: Added.
        * storage/indexeddb/createObjectStore-null-name-expected.txt: Added.
        * storage/indexeddb/createObjectStore-null-name.html: Added.
        * storage/indexeddb/deleteObjectStore-name-argument-required-expected.txt: Added.
        * storage/indexeddb/deleteObjectStore-name-argument-required.html: Added.
        * storage/indexeddb/deleteObjectStore-null-name-expected.txt: Added.
        * storage/indexeddb/deleteObjectStore-null-name.html: Added.
        * storage/indexeddb/mozilla/create-objectstore-null-name-expected.txt:
        * storage/indexeddb/mozilla/create-objectstore-null-name.html:
        * storage/indexeddb/setVersion-null-expected.txt: Added.
        * storage/indexeddb/setVersion-null.html: Added.
        * storage/indexeddb/setVersion-undefined-expected.txt:
        * storage/indexeddb/setVersion-undefined.html:
        * storage/indexeddb/transaction-and-objectstore-calls-expected.txt:
        * storage/indexeddb/transaction-and-objectstore-calls.html:
        * storage/indexeddb/transaction-crash-on-abort-expected.txt:
        * storage/indexeddb/transaction-crash-on-abort.html:
        * storage/indexeddb/transaction-read-only-expected.txt:
        * storage/indexeddb/transaction-read-only.html:
        * storage/indexeddb/transaction-storeNames-required-expected.txt: Added.
        * storage/indexeddb/transaction-storeNames-required.html: Added.
2011-06-22  Mark Pilgrim  <pilgrim@chromium.org>

        Reviewed by Adam Barth.

        IndexedDB: fix multiple issues in IDBDatabase.idl
        https://bugs.webkit.org/show_bug.cgi?id=63140

        Tests: storage/indexeddb/createObjectStore-name-argument-required.html
               storage/indexeddb/createObjectStore-null-name.html
               storage/indexeddb/deleteObjectStore-name-argument-required.html
               storage/indexeddb/deleteObjectStore-null-name.html
               storage/indexeddb/setVersion-null.html
               storage/indexeddb/transaction-storeNames-required.html

        * storage/IDBDatabase.idl: remove LegacyDefaultOptionalArguments so
        all functions will throw TypeError when called with too few arguments,
        as per WebIDL spec. Also remove ConvertNullToNullString flags so null
        values are stringified as "null" (also as per WebIDL spec).

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@89451 268f45cc-cd09-0410-ab3c-d52691b4dbfc

25 files changed:
LayoutTests/ChangeLog
LayoutTests/storage/indexeddb/createObjectStore-name-argument-required-expected.txt [new file with mode: 0644]
LayoutTests/storage/indexeddb/createObjectStore-name-argument-required.html [new file with mode: 0644]
LayoutTests/storage/indexeddb/createObjectStore-null-name-expected.txt [new file with mode: 0644]
LayoutTests/storage/indexeddb/createObjectStore-null-name.html [new file with mode: 0644]
LayoutTests/storage/indexeddb/deleteObjectStore-name-argument-required-expected.txt [new file with mode: 0644]
LayoutTests/storage/indexeddb/deleteObjectStore-name-argument-required.html [new file with mode: 0644]
LayoutTests/storage/indexeddb/deleteObjectStore-null-name-expected.txt [new file with mode: 0644]
LayoutTests/storage/indexeddb/deleteObjectStore-null-name.html [new file with mode: 0644]
LayoutTests/storage/indexeddb/mozilla/create-objectstore-null-name-expected.txt
LayoutTests/storage/indexeddb/mozilla/create-objectstore-null-name.html
LayoutTests/storage/indexeddb/setVersion-null-expected.txt [new file with mode: 0644]
LayoutTests/storage/indexeddb/setVersion-null.html [new file with mode: 0644]
LayoutTests/storage/indexeddb/setVersion-undefined-expected.txt
LayoutTests/storage/indexeddb/setVersion-undefined.html
LayoutTests/storage/indexeddb/transaction-and-objectstore-calls-expected.txt
LayoutTests/storage/indexeddb/transaction-and-objectstore-calls.html
LayoutTests/storage/indexeddb/transaction-crash-on-abort-expected.txt
LayoutTests/storage/indexeddb/transaction-crash-on-abort.html
LayoutTests/storage/indexeddb/transaction-read-only-expected.txt
LayoutTests/storage/indexeddb/transaction-read-only.html
LayoutTests/storage/indexeddb/transaction-storeNames-required-expected.txt [new file with mode: 0644]
LayoutTests/storage/indexeddb/transaction-storeNames-required.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/storage/IDBDatabase.idl

index 0a88b5b..c3b1c44 100644 (file)
@@ -1,3 +1,33 @@
+2011-06-22  Mark Pilgrim  <pilgrim@chromium.org>
+
+        Reviewed by Adam Barth.
+
+        IndexedDB: fix multiple issues in IDBDatabase.idl
+        https://bugs.webkit.org/show_bug.cgi?id=63140
+
+        * storage/indexeddb/createObjectStore-name-argument-required-expected.txt: Added.
+        * storage/indexeddb/createObjectStore-name-argument-required.html: Added.
+        * storage/indexeddb/createObjectStore-null-name-expected.txt: Added.
+        * storage/indexeddb/createObjectStore-null-name.html: Added.
+        * storage/indexeddb/deleteObjectStore-name-argument-required-expected.txt: Added.
+        * storage/indexeddb/deleteObjectStore-name-argument-required.html: Added.
+        * storage/indexeddb/deleteObjectStore-null-name-expected.txt: Added.
+        * storage/indexeddb/deleteObjectStore-null-name.html: Added.
+        * storage/indexeddb/mozilla/create-objectstore-null-name-expected.txt:
+        * storage/indexeddb/mozilla/create-objectstore-null-name.html:
+        * storage/indexeddb/setVersion-null-expected.txt: Added.
+        * storage/indexeddb/setVersion-null.html: Added.
+        * storage/indexeddb/setVersion-undefined-expected.txt:
+        * storage/indexeddb/setVersion-undefined.html:
+        * storage/indexeddb/transaction-and-objectstore-calls-expected.txt:
+        * storage/indexeddb/transaction-and-objectstore-calls.html:
+        * storage/indexeddb/transaction-crash-on-abort-expected.txt:
+        * storage/indexeddb/transaction-crash-on-abort.html:
+        * storage/indexeddb/transaction-read-only-expected.txt:
+        * storage/indexeddb/transaction-read-only.html:
+        * storage/indexeddb/transaction-storeNames-required-expected.txt: Added.
+        * storage/indexeddb/transaction-storeNames-required.html: Added.
+
 2011-06-22  Matthew Delaney  <mdelaney@apple.com>
 
         Adding a mac platform expected result for webgl test to help fix burning bot.
diff --git a/LayoutTests/storage/indexeddb/createObjectStore-name-argument-required-expected.txt b/LayoutTests/storage/indexeddb/createObjectStore-name-argument-required-expected.txt
new file mode 100644 (file)
index 0000000..edf0d49
--- /dev/null
@@ -0,0 +1,22 @@
+Test IndexedDB createObjectStore name argument is required
+
+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
+IDBCursor = window.IDBCursor || window.webkitIDBCursor;
+PASS IDBCursor == null is false
+IDBKeyRange = window.IDBKeyRange || window.webkitIDBKeyRange;
+PASS IDBKeyRange == null is false
+indexedDB.open(name, description)
+db = event.target.result
+request = db.setVersion('1')
+Deleted all object stores.
+PASS db.createObjectStore(); threw exception TypeError: Not enough arguments.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/storage/indexeddb/createObjectStore-name-argument-required.html b/LayoutTests/storage/indexeddb/createObjectStore-name-argument-required.html
new file mode 100644 (file)
index 0000000..58f5c82
--- /dev/null
@@ -0,0 +1,59 @@
+<!DOCTYPE html>
+<html>
+<head>
+<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+<script src="../../fast/js/resources/js-test-post-function.js"></script>
+<script src="resources/shared.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script>
+
+description("Test IndexedDB createObjectStore name argument is required");
+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");
+    IDBCursor = evalAndLog("IDBCursor = window.IDBCursor || window.webkitIDBCursor;");
+    shouldBeFalse("IDBCursor == null");
+    IDBKeyRange = evalAndLog("IDBKeyRange = window.IDBKeyRange || window.webkitIDBKeyRange;");
+    shouldBeFalse("IDBKeyRange == 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 = createAndPopulateObjectStore;
+    request.onerror = unexpectedErrorCallback;
+}
+
+function createAndPopulateObjectStore()
+{
+    deleteAllObjectStores(db);
+
+    shouldThrow("db.createObjectStore();");
+    done();
+}
+
+var successfullyParsed = true;
+
+test();
+
+</script>
+</body>
+</html>
diff --git a/LayoutTests/storage/indexeddb/createObjectStore-null-name-expected.txt b/LayoutTests/storage/indexeddb/createObjectStore-null-name-expected.txt
new file mode 100644 (file)
index 0000000..83e4a62
--- /dev/null
@@ -0,0 +1,23 @@
+Test IndexedDB createObjectStore null handling
+
+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
+IDBCursor = window.IDBCursor || window.webkitIDBCursor;
+PASS IDBCursor == null is false
+IDBKeyRange = window.IDBKeyRange || window.webkitIDBKeyRange;
+PASS IDBKeyRange == null is false
+indexedDB.open(name, description)
+db = event.target.result
+request = db.setVersion('1')
+Deleted all object stores.
+db.createObjectStore(null);
+PASS objectStore.name is 'null'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/storage/indexeddb/createObjectStore-null-name.html b/LayoutTests/storage/indexeddb/createObjectStore-null-name.html
new file mode 100644 (file)
index 0000000..542f279
--- /dev/null
@@ -0,0 +1,60 @@
+<!DOCTYPE html>
+<html>
+<head>
+<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+<script src="../../fast/js/resources/js-test-post-function.js"></script>
+<script src="resources/shared.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script>
+
+description("Test IndexedDB createObjectStore null handling");
+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");
+    IDBCursor = evalAndLog("IDBCursor = window.IDBCursor || window.webkitIDBCursor;");
+    shouldBeFalse("IDBCursor == null");
+    IDBKeyRange = evalAndLog("IDBKeyRange = window.IDBKeyRange || window.webkitIDBKeyRange;");
+    shouldBeFalse("IDBKeyRange == 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 = createAndPopulateObjectStore;
+    request.onerror = unexpectedErrorCallback;
+}
+
+function createAndPopulateObjectStore()
+{
+    deleteAllObjectStores(db);
+
+    objectStore = evalAndLog("db.createObjectStore(null);");
+    shouldBe("objectStore.name", "'null'");
+    done();
+}
+
+var successfullyParsed = true;
+
+test();
+
+</script>
+</body>
+</html>
diff --git a/LayoutTests/storage/indexeddb/deleteObjectStore-name-argument-required-expected.txt b/LayoutTests/storage/indexeddb/deleteObjectStore-name-argument-required-expected.txt
new file mode 100644 (file)
index 0000000..a974fa4
--- /dev/null
@@ -0,0 +1,22 @@
+Test IndexedDB deleteObjectStore required argument
+
+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
+IDBCursor = window.IDBCursor || window.webkitIDBCursor;
+PASS IDBCursor == null is false
+IDBKeyRange = window.IDBKeyRange || window.webkitIDBKeyRange;
+PASS IDBKeyRange == null is false
+indexedDB.open(name, description)
+db = event.target.result
+request = db.setVersion('1')
+Deleted all object stores.
+PASS db.deleteObjectStore(); threw exception TypeError: Not enough arguments.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/storage/indexeddb/deleteObjectStore-name-argument-required.html b/LayoutTests/storage/indexeddb/deleteObjectStore-name-argument-required.html
new file mode 100644 (file)
index 0000000..a15d7c9
--- /dev/null
@@ -0,0 +1,59 @@
+<!DOCTYPE html>
+<html>
+<head>
+<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+<script src="../../fast/js/resources/js-test-post-function.js"></script>
+<script src="resources/shared.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script>
+
+description("Test IndexedDB deleteObjectStore required argument");
+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");
+    IDBCursor = evalAndLog("IDBCursor = window.IDBCursor || window.webkitIDBCursor;");
+    shouldBeFalse("IDBCursor == null");
+    IDBKeyRange = evalAndLog("IDBKeyRange = window.IDBKeyRange || window.webkitIDBKeyRange;");
+    shouldBeFalse("IDBKeyRange == 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 = createAndPopulateObjectStore;
+    request.onerror = unexpectedErrorCallback;
+}
+
+function createAndPopulateObjectStore()
+{
+    deleteAllObjectStores(db);
+
+    shouldThrow("db.deleteObjectStore();");
+    done();
+}
+
+var successfullyParsed = true;
+
+test();
+
+</script>
+</body>
+</html>
diff --git a/LayoutTests/storage/indexeddb/deleteObjectStore-null-name-expected.txt b/LayoutTests/storage/indexeddb/deleteObjectStore-null-name-expected.txt
new file mode 100644 (file)
index 0000000..a4e11e8
--- /dev/null
@@ -0,0 +1,23 @@
+Test IndexedDB deleteObjectStore required argument
+
+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
+IDBCursor = window.IDBCursor || window.webkitIDBCursor;
+PASS IDBCursor == null is false
+IDBKeyRange = window.IDBKeyRange || window.webkitIDBKeyRange;
+PASS IDBKeyRange == null is false
+indexedDB.open(name, description)
+db = event.target.result
+request = db.setVersion('1')
+Deleted all object stores.
+db.createObjectStore('null');
+db.deleteObjectStore(null);
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/storage/indexeddb/deleteObjectStore-null-name.html b/LayoutTests/storage/indexeddb/deleteObjectStore-null-name.html
new file mode 100644 (file)
index 0000000..cb29bfd
--- /dev/null
@@ -0,0 +1,60 @@
+<!DOCTYPE html>
+<html>
+<head>
+<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+<script src="../../fast/js/resources/js-test-post-function.js"></script>
+<script src="resources/shared.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script>
+
+description("Test IndexedDB deleteObjectStore required argument");
+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");
+    IDBCursor = evalAndLog("IDBCursor = window.IDBCursor || window.webkitIDBCursor;");
+    shouldBeFalse("IDBCursor == null");
+    IDBKeyRange = evalAndLog("IDBKeyRange = window.IDBKeyRange || window.webkitIDBKeyRange;");
+    shouldBeFalse("IDBKeyRange == 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 = createAndPopulateObjectStore;
+    request.onerror = unexpectedErrorCallback;
+}
+
+function createAndPopulateObjectStore()
+{
+    deleteAllObjectStores(db);
+
+    evalAndLog("db.createObjectStore('null');");
+    evalAndLog("db.deleteObjectStore(null);");
+    done();
+}
+
+var successfullyParsed = true;
+
+test();
+
+</script>
+</body>
+</html>
index 667d1b5..8106f74 100644 (file)
@@ -11,9 +11,8 @@ 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
+objectStore = db.createObjectStore(null);
+PASS objectStore.name is 'null'
 PASS successfullyParsed is true
 
 TEST COMPLETE
index 7cb3467..efe4a1a 100644 (file)
@@ -48,7 +48,8 @@ function cleanDatabase()
 {
     deleteAllObjectStores(db);
 
-    evalAndExpectException("db.createObjectStore(null);", "IDBDatabaseException.NON_TRANSIENT_ERR");
+    objectStore = evalAndLog("objectStore = db.createObjectStore(null);");
+    shouldBe("objectStore.name", "'null'");
 
     done();
 }
diff --git a/LayoutTests/storage/indexeddb/setVersion-null-expected.txt b/LayoutTests/storage/indexeddb/setVersion-null-expected.txt
new file mode 100644 (file)
index 0000000..c190d44
--- /dev/null
@@ -0,0 +1,21 @@
+Test IndexedDB with null version string
+
+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
+IDBCursor = window.IDBCursor || window.webkitIDBCursor;
+PASS IDBCursor == null is false
+IDBKeyRange = window.IDBKeyRange || window.webkitIDBKeyRange;
+PASS IDBKeyRange == null is false
+indexedDB.open(name, description)
+db = event.target.result
+db.setVersion(null);
+PASS db.version is 'null'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/storage/indexeddb/setVersion-null.html b/LayoutTests/storage/indexeddb/setVersion-null.html
new file mode 100644 (file)
index 0000000..15fe044
--- /dev/null
@@ -0,0 +1,57 @@
+<!DOCTYPE html> 
+<html> 
+<head> 
+<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css"> 
+<script src="../../fast/js/resources/js-test-pre.js"></script> 
+<script src="../../fast/js/resources/js-test-post-function.js"></script> 
+<script src="resources/shared.js"></script> 
+</head> 
+<body> 
+<p id="description"></p> 
+<div id="console"></div> 
+<script> 
+description("Test IndexedDB with null version string");
+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");
+    IDBCursor = evalAndLog("IDBCursor = window.IDBCursor || window.webkitIDBCursor;");
+    shouldBeFalse("IDBCursor == null");
+    IDBKeyRange = evalAndLog("IDBKeyRange = window.IDBKeyRange || window.webkitIDBKeyRange;");
+    shouldBeFalse("IDBKeyRange == 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("db.setVersion(null);");
+    request.onsuccess = postSetVersion;
+    request.onerror = unexpectedErrorCallback;
+}
+
+function postSetVersion()
+{
+    shouldBe("db.version", "'null'");
+    done();
+}
+var successfullyParsed = true;
+test();
+</script> 
+</body> 
+</html>
index fcf9040..51dccb1 100644 (file)
@@ -1,4 +1,4 @@
-Test IndexedDB version string is required and can not be null
+Test IndexedDB version string is required
 
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
@@ -13,12 +13,7 @@ IDBKeyRange = window.IDBKeyRange || window.webkitIDBKeyRange;
 PASS IDBKeyRange == null is false
 indexedDB.open(name, description)
 db = event.target.result
-Expecting exception from db.setVersion();
-PASS Exception was thrown.
-PASS code is IDBDatabaseException.NON_TRANSIENT_ERR
-Expecting exception from db.setVersion(null);
-PASS Exception was thrown.
-PASS code is IDBDatabaseException.NON_TRANSIENT_ERR
+PASS db.setVersion(); threw exception TypeError: Not enough arguments.
 PASS successfullyParsed is true
 
 TEST COMPLETE
index 32957aa..ab8adc5 100644 (file)
@@ -11,7 +11,7 @@
 <div id="console"></div> 
 <script> 
  
-description("Test IndexedDB version string is required and can not be null");
+description("Test IndexedDB version string is required");
 if (window.layoutTestController)
     layoutTestController.waitUntilDone();
  
@@ -37,8 +37,7 @@ function openSuccess()
 {
     db = evalAndLog("db = event.target.result");
  
-    request = evalAndExpectException("db.setVersion();", "IDBDatabaseException.NON_TRANSIENT_ERR");
-    request = evalAndExpectException("db.setVersion(null);", "IDBDatabaseException.NON_TRANSIENT_ERR");
+    shouldThrow("db.setVersion();");
     done();
 }
  
index 3a9d2ed..313c1a1 100644 (file)
@@ -62,12 +62,7 @@ Expecting exception from trans.objectStore('x')
 PASS Exception was thrown.
 PASS code is webkitIDBDatabaseException.NOT_FOUND_ERR
 
-trans = db.transaction()
-trans.objectStore('a')
-trans.objectStore('b')
-Expecting exception from trans.objectStore('x')
-PASS Exception was thrown.
-PASS code is webkitIDBDatabaseException.NOT_FOUND_ERR
+PASS trans = db.transaction() threw exception TypeError: Not enough arguments.
 
 Expecting exception from db.transaction(['x'])
 PASS Exception was thrown.
index e9a3b8e..0935ef9 100644 (file)
@@ -81,10 +81,7 @@ function created()
     evalAndExpectException("trans.objectStore('x')", "webkitIDBDatabaseException.NOT_FOUND_ERR");
     debug("");
 
-    trans = evalAndLog("trans = db.transaction()");
-    evalAndLog("trans.objectStore('a')");
-    evalAndLog("trans.objectStore('b')");
-    evalAndExpectException("trans.objectStore('x')", "webkitIDBDatabaseException.NOT_FOUND_ERR");
+    shouldThrow("trans = db.transaction()");
     debug("");
 
     evalAndExpectException("db.transaction(['x'])", "webkitIDBDatabaseException.NOT_FOUND_ERR");
index 4f72614..f60eaa2 100644 (file)
@@ -8,7 +8,7 @@ PASS webkitIndexedDB == null is false
 webkitIndexedDB.open('transaction-crash-on-abort')
 openSuccess():
 db = event.target.result
-db.transaction()
+db.transaction('foo')
 window.gc()
 PASS successfullyParsed is true
 
index 8fa3514..75d122b 100644 (file)
@@ -28,7 +28,7 @@ function openSuccess()
 {
     debug("openSuccess():");
     db = evalAndLog("db = event.target.result");
-    evalAndLog("db.transaction()");
+    evalAndLog("db.transaction('foo')");
     evalAndLog("window.gc()");
     done();
 }
index a5a2b7e..20f129f 100644 (file)
@@ -12,15 +12,15 @@ result = db.setVersion('version 1')
 Deleted all object stores.
 store = db.createObjectStore('store')
 store.put('x', 'y')
-trans = db.transaction()
+trans = db.transaction('store')
 Expecting exception from trans.objectStore('store').put('a', 'b')
 PASS Exception was thrown.
 PASS code is webkitIDBDatabaseException.READ_ONLY_ERR
-trans = db.transaction()
+trans = db.transaction('store')
 Expecting exception from trans.objectStore('store').delete('x')
 PASS Exception was thrown.
 PASS code is webkitIDBDatabaseException.READ_ONLY_ERR
-trans = db.transaction()
+trans = db.transaction('store')
 cur = trans.objectStore('store').openCursor()
 PASS !event.target.result is false
 Expecting exception from event.target.result.delete()
index 9c336c8..a26686c 100644 (file)
@@ -45,13 +45,13 @@ function cleanDatabase()
 \r
 function setVersionDone()\r
 {\r
-    trans = evalAndLog("trans = db.transaction()");\r
+    trans = evalAndLog("trans = db.transaction('store')");\r
     evalAndExpectException("trans.objectStore('store').put('a', 'b')", "webkitIDBDatabaseException.READ_ONLY_ERR");\r
 \r
-    trans = evalAndLog("trans = db.transaction()");\r
+    trans = evalAndLog("trans = db.transaction('store')");\r
     evalAndExpectException("trans.objectStore('store').delete('x')", "webkitIDBDatabaseException.READ_ONLY_ERR");\r
 \r
-    trans = evalAndLog("trans = db.transaction()");\r
+    trans = evalAndLog("trans = db.transaction('store')");\r
     cur = evalAndLog("cur = trans.objectStore('store').openCursor()");\r
     cur.onsuccess = gotCursor;\r
     cur.onerror = unexpectedErrorCallback;\r
diff --git a/LayoutTests/storage/indexeddb/transaction-storeNames-required-expected.txt b/LayoutTests/storage/indexeddb/transaction-storeNames-required-expected.txt
new file mode 100644 (file)
index 0000000..a5fe5eb
--- /dev/null
@@ -0,0 +1,22 @@
+Test IndexedDB: transaction storeNames required arguments
+
+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
+IDBCursor = window.IDBCursor || window.webkitIDBCursor;
+PASS IDBCursor == null is false
+IDBKeyRange = window.IDBKeyRange || window.webkitIDBKeyRange;
+PASS IDBKeyRange == null is false
+indexedDB.open(name, description)
+db = event.target.result
+request = db.setVersion('1')
+Deleted all object stores.
+PASS db.transaction(); threw exception TypeError: Not enough arguments.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/storage/indexeddb/transaction-storeNames-required.html b/LayoutTests/storage/indexeddb/transaction-storeNames-required.html
new file mode 100644 (file)
index 0000000..a0745ed
--- /dev/null
@@ -0,0 +1,59 @@
+<!DOCTYPE html>
+<html>
+<head>
+<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+<script src="../../fast/js/resources/js-test-post-function.js"></script>
+<script src="resources/shared.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script>
+
+description("Test IndexedDB: transaction storeNames required arguments");
+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");
+    IDBCursor = evalAndLog("IDBCursor = window.IDBCursor || window.webkitIDBCursor;");
+    shouldBeFalse("IDBCursor == null");
+    IDBKeyRange = evalAndLog("IDBKeyRange = window.IDBKeyRange || window.webkitIDBKeyRange;");
+    shouldBeFalse("IDBKeyRange == 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 = createAndPopulateObjectStore;
+    request.onerror = unexpectedErrorCallback;
+}
+
+function createAndPopulateObjectStore()
+{
+    deleteAllObjectStores(db);
+
+    shouldThrow("db.transaction();");
+    done();
+}
+
+var successfullyParsed = true;
+
+test();
+
+</script>
+</body>
+</html>
index ef6bfae..bae3054 100644 (file)
@@ -1,3 +1,22 @@
+2011-06-22  Mark Pilgrim  <pilgrim@chromium.org>
+
+        Reviewed by Adam Barth.
+
+        IndexedDB: fix multiple issues in IDBDatabase.idl
+        https://bugs.webkit.org/show_bug.cgi?id=63140
+
+        Tests: storage/indexeddb/createObjectStore-name-argument-required.html
+               storage/indexeddb/createObjectStore-null-name.html
+               storage/indexeddb/deleteObjectStore-name-argument-required.html
+               storage/indexeddb/deleteObjectStore-null-name.html
+               storage/indexeddb/setVersion-null.html
+               storage/indexeddb/transaction-storeNames-required.html
+
+        * storage/IDBDatabase.idl: remove LegacyDefaultOptionalArguments so
+        all functions will throw TypeError when called with too few arguments,
+        as per WebIDL spec. Also remove ConvertNullToNullString flags so null
+        values are stringified as "null" (also as per WebIDL spec).
+
 2011-06-22  Vsevolod Vlasov  <vsevik@chromium.org>
 
         Reviewed by Pavel Feldman.
index 78d31b0..82f6435 100644 (file)
@@ -28,7 +28,6 @@ module storage {
 
     interface [
         Conditional=INDEXED_DATABASE,
-        LegacyDefaultOptionalArguments,
         ActiveDOMObject,
         EventTarget
     ] IDBDatabase {
@@ -40,23 +39,23 @@ module storage {
         attribute EventListener onerror;
         attribute EventListener onversionchange;
 
-        IDBObjectStore createObjectStore(in [ConvertNullToNullString] DOMString name, in [Optional] OptionsObject options)
+        IDBObjectStore createObjectStore(in DOMString name, in [Optional] OptionsObject options)
             raises (IDBDatabaseException);
         void deleteObjectStore(in DOMString name)
             raises (IDBDatabaseException);
-        [CallWith=ScriptExecutionContext] IDBVersionChangeRequest setVersion(in [ConvertUndefinedOrNullToNullString] DOMString version)
+        [CallWith=ScriptExecutionContext] IDBVersionChangeRequest setVersion(in DOMString version)
             raises (IDBDatabaseException);
-        [CallWith=ScriptExecutionContext] IDBTransaction transaction(in [Optional] DOMStringList storeNames, in [Optional] unsigned short mode)
+        [CallWith=ScriptExecutionContext] IDBTransaction transaction(in DOMStringList storeNames, in [Optional] unsigned short mode)
             raises (IDBDatabaseException);
         void close();
 
         // EventTarget interface
         void addEventListener(in DOMString type,
                               in EventListener listener,
-                              in boolean useCapture);
+                              in [Optional] boolean useCapture);
         void removeEventListener(in DOMString type,
                                  in EventListener listener,
-                                 in boolean useCapture);
+                                 in [Optional] boolean useCapture);
         boolean dispatchEvent(in Event evt)
             raises(EventException);
     };