summaryrefslogtreecommitdiffstats
path: root/LayoutTests/storage
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2011-05-18 13:36:51 +0100
committerSteve Block <steveblock@google.com>2011-05-24 15:38:28 +0100
commit2fc2651226baac27029e38c9d6ef883fa32084db (patch)
treee396d4bf89dcce6ed02071be66212495b1df1dec /LayoutTests/storage
parentb3725cedeb43722b3b175aaeff70552e562d2c94 (diff)
downloadexternal_webkit-2fc2651226baac27029e38c9d6ef883fa32084db.zip
external_webkit-2fc2651226baac27029e38c9d6ef883fa32084db.tar.gz
external_webkit-2fc2651226baac27029e38c9d6ef883fa32084db.tar.bz2
Merge WebKit at r78450: Initial merge by git.
Change-Id: I6d3e5f1f868ec266a0aafdef66182ddc3f265dc1
Diffstat (limited to 'LayoutTests/storage')
-rw-r--r--LayoutTests/storage/indexeddb/create-object-store-options-expected.txt2
-rw-r--r--LayoutTests/storage/indexeddb/create-object-store-options.html2
-rw-r--r--LayoutTests/storage/indexeddb/cursor-delete-expected.txt8
-rw-r--r--LayoutTests/storage/indexeddb/cursor-delete.html8
-rw-r--r--LayoutTests/storage/indexeddb/cursor-index-delete-expected.txt11
-rw-r--r--LayoutTests/storage/indexeddb/cursor-index-delete.html11
-rw-r--r--LayoutTests/storage/indexeddb/cursor-skip-deleted-expected.txt185
-rw-r--r--LayoutTests/storage/indexeddb/cursor-skip-deleted.html218
-rw-r--r--LayoutTests/storage/indexeddb/cursor-update-expected.txt283
-rw-r--r--LayoutTests/storage/indexeddb/cursor-update.html249
-rw-r--r--LayoutTests/storage/indexeddb/data-corruption-expected.txt69
-rw-r--r--LayoutTests/storage/indexeddb/data-corruption.html88
-rw-r--r--LayoutTests/storage/indexeddb/database-quota-expected.txt3
-rw-r--r--LayoutTests/storage/indexeddb/database-quota.html3
-rw-r--r--LayoutTests/storage/indexeddb/duplicates-expected.txt4
-rw-r--r--LayoutTests/storage/indexeddb/duplicates.html4
-rw-r--r--LayoutTests/storage/indexeddb/error-causes-abort-by-default-expected.txt107
-rw-r--r--LayoutTests/storage/indexeddb/error-causes-abort-by-default.html127
-rw-r--r--LayoutTests/storage/indexeddb/index-basics-expected.txt2
-rw-r--r--LayoutTests/storage/indexeddb/index-basics.html4
-rw-r--r--LayoutTests/storage/indexeddb/index-cursor.html4
-rw-r--r--LayoutTests/storage/indexeddb/objectstore-autoincrement-expected.txt42
-rw-r--r--LayoutTests/storage/indexeddb/objectstore-autoincrement.html43
-rw-r--r--LayoutTests/storage/indexeddb/objectstore-basics-expected.txt11
-rw-r--r--LayoutTests/storage/indexeddb/objectstore-basics.html22
-rw-r--r--LayoutTests/storage/indexeddb/objectstore-clear-expected.txt151
-rw-r--r--LayoutTests/storage/indexeddb/objectstore-clear.html130
-rw-r--r--LayoutTests/storage/indexeddb/objectstore-cursor.html4
-rw-r--r--LayoutTests/storage/indexeddb/open-cursor-expected.txt4
-rw-r--r--LayoutTests/storage/indexeddb/open-cursor.html4
-rw-r--r--LayoutTests/storage/indexeddb/request-event-propagation-expected.txt166
-rw-r--r--LayoutTests/storage/indexeddb/request-event-propagation.html272
-rw-r--r--LayoutTests/storage/indexeddb/transaction-after-close-expected.txt95
-rw-r--r--LayoutTests/storage/indexeddb/transaction-after-close.html105
-rw-r--r--LayoutTests/storage/indexeddb/transaction-and-objectstore-calls-expected.txt24
-rw-r--r--LayoutTests/storage/indexeddb/transaction-and-objectstore-calls.html24
-rw-r--r--LayoutTests/storage/indexeddb/transaction-basics.html6
-rw-r--r--LayoutTests/storage/indexeddb/transaction-event-propagation-expected.txt79
-rw-r--r--LayoutTests/storage/indexeddb/transaction-event-propagation.html153
-rw-r--r--LayoutTests/storage/indexeddb/tutorial.html24
40 files changed, 2628 insertions, 123 deletions
diff --git a/LayoutTests/storage/indexeddb/create-object-store-options-expected.txt b/LayoutTests/storage/indexeddb/create-object-store-options-expected.txt
index 9e727a5..5519508 100644
--- a/LayoutTests/storage/indexeddb/create-object-store-options-expected.txt
+++ b/LayoutTests/storage/indexeddb/create-object-store-options-expected.txt
@@ -17,7 +17,7 @@ Deleted all object stores.
db.createObjectStore('a', {keyPath: 'a'})
db.createObjectStore('b')
db.createObjectStore('c', {autoIncrement: true});
-trans = db.transaction({mode: webkitIDBTransaction.READ_WRITE})
+trans = db.transaction([], webkitIDBTransaction.READ_WRITE)
PASS trans.mode is webkitIDBTransaction.READ_WRITE
trans.objectStore('a').put({'a': 0})
trans.objectStore('b').put({'a': 0}, 0)
diff --git a/LayoutTests/storage/indexeddb/create-object-store-options.html b/LayoutTests/storage/indexeddb/create-object-store-options.html
index eacb09d..6709e58 100644
--- a/LayoutTests/storage/indexeddb/create-object-store-options.html
+++ b/LayoutTests/storage/indexeddb/create-object-store-options.html
@@ -47,7 +47,7 @@ function cleaned()
debug("db.createObjectStore('c', {autoIncrement: true});");
db.createObjectStore('c', {autoIncrement: true});
- trans = evalAndLog("trans = db.transaction({mode: webkitIDBTransaction.READ_WRITE})");
+ trans = evalAndLog("trans = db.transaction([], webkitIDBTransaction.READ_WRITE)");
shouldBe("trans.mode", "webkitIDBTransaction.READ_WRITE");
req = evalAndLog("trans.objectStore('a').put({'a': 0})");
diff --git a/LayoutTests/storage/indexeddb/cursor-delete-expected.txt b/LayoutTests/storage/indexeddb/cursor-delete-expected.txt
index bed1d0d..525ced7 100644
--- a/LayoutTests/storage/indexeddb/cursor-delete-expected.txt
+++ b/LayoutTests/storage/indexeddb/cursor-delete-expected.txt
@@ -48,7 +48,7 @@ objectStore.add('myValue2', 'myKey2')
objectStore.add('myValue3', 'myKey3')
objectStore.add('myValue4', 'myKey4')
openCursor1
-trans = db.transaction({objectStoreNames: 'test', mode: webkitIDBTransaction.READ_WRITE})
+trans = db.transaction(['test'], webkitIDBTransaction.READ_WRITE)
trans.objectStore('test').openCursor({range: keyRange})
PASS 'onsuccess' in result is true
PASS 'onerror' in result is true
@@ -68,7 +68,7 @@ event.result.delete()
PASS event.result.value is "myValue4"
event.result.continue()
PASS counter is 5
-trans.objectStore('test').openCursor({range: keyRange})
+trans.objectStore('test').openCursor(keyRange)
PASS 'onsuccess' in result is true
PASS 'onerror' in result is true
PASS 'readyState' in result is true
@@ -86,7 +86,7 @@ PASS 'readyState' in event.target is true
PASS event.target.readyState is event.target.DONE
PASS event.result is null
-trans = db.transaction({objectStoreNames: 'test', mode: webkitIDBTransaction.READ_WRITE})
+trans = db.transaction(['test'], webkitIDBTransaction.READ_WRITE)
objectStore = trans.objectStore('test')
objectStore.add('myValue1', 'myKey1')
PASS 'onsuccess' in result is true
@@ -95,7 +95,7 @@ PASS 'readyState' in result is true
An event should fire shortly...
openCursor2
-objectStore.openCursor({range: keyRange})
+objectStore.openCursor(keyRange)
PASS 'onsuccess' in result is true
PASS 'onerror' in result is true
PASS 'readyState' in result is true
diff --git a/LayoutTests/storage/indexeddb/cursor-delete.html b/LayoutTests/storage/indexeddb/cursor-delete.html
index a3290b9..bb0102f 100644
--- a/LayoutTests/storage/indexeddb/cursor-delete.html
+++ b/LayoutTests/storage/indexeddb/cursor-delete.html
@@ -59,7 +59,7 @@ function createAndPopulateObjectStore()
function openCursor()
{
debug("openCursor1");
- evalAndLog("trans = db.transaction({objectStoreNames: 'test', mode: webkitIDBTransaction.READ_WRITE})");
+ evalAndLog("trans = db.transaction(['test'], webkitIDBTransaction.READ_WRITE)");
keyRange = webkitIDBKeyRange.lowerBound("myKey1");
result = evalAndLog("trans.objectStore('test').openCursor({range: keyRange})");
verifyResult(result);
@@ -72,7 +72,7 @@ function cursorSuccess()
{
if (event.result == null) {
shouldBe("counter", "5");
- result = evalAndLog("trans.objectStore('test').openCursor({range: keyRange})");
+ result = evalAndLog("trans.objectStore('test').openCursor(keyRange)");
verifyResult(result);
result.onsuccess = cursorEmpty;
result.onerror = unexpectedErrorCallback;
@@ -92,7 +92,7 @@ function cursorEmpty()
function addObject()
{
- evalAndLog("trans = db.transaction({objectStoreNames: 'test', mode: webkitIDBTransaction.READ_WRITE})");
+ evalAndLog("trans = db.transaction(['test'], webkitIDBTransaction.READ_WRITE)");
objectStore = evalAndLog("objectStore = trans.objectStore('test')");
result = evalAndLog("objectStore.add('myValue1', 'myKey1')");
verifyResult(result);
@@ -103,7 +103,7 @@ function addObject()
function openCursor2()
{
debug("openCursor2");
- result = evalAndLog("objectStore.openCursor({range: keyRange})");
+ result = evalAndLog("objectStore.openCursor(keyRange)");
verifyResult(result);
result.onsuccess = deleteObject;
result.onerror = unexpectedErrorCallback;
diff --git a/LayoutTests/storage/indexeddb/cursor-index-delete-expected.txt b/LayoutTests/storage/indexeddb/cursor-index-delete-expected.txt
index 27f3117..a477a25 100644
--- a/LayoutTests/storage/indexeddb/cursor-index-delete-expected.txt
+++ b/LayoutTests/storage/indexeddb/cursor-index-delete-expected.txt
@@ -49,8 +49,8 @@ objectStore.add({x: 2}, 'myKey2')
objectStore.add({x: 3}, 'myKey3')
objectStore.add({x: 4}, 'myKey4')
openCursor1
-trans = db.transaction({objectStoreNames: 'test', mode: webkitIDBTransaction.READ_WRITE})
-trans.objectStore('test').index('testIndex').openCursor({range: keyRange})
+trans = db.transaction(['test'], webkitIDBTransaction.READ_WRITE)
+trans.objectStore('test').index('testIndex').openCursor(keyRange)
PASS 'onsuccess' in result is true
PASS 'onerror' in result is true
PASS 'readyState' in result is true
@@ -69,7 +69,7 @@ event.result.delete()
PASS event.result.key is counter++
event.result.continue()
PASS counter is 5
-trans.objectStore('test').index('testIndex').openCursor({range: keyRange})
+trans.objectStore('test').index('testIndex').openCursor(keyRange)
PASS 'onsuccess' in result is true
PASS 'onerror' in result is true
PASS 'readyState' in result is true
@@ -87,7 +87,7 @@ PASS 'readyState' in event.target is true
PASS event.target.readyState is event.target.DONE
PASS event.result is null
-trans = db.transaction({objectStoreNames: 'test', mode: webkitIDBTransaction.READ_WRITE})
+trans = db.transaction(['test'], webkitIDBTransaction.READ_WRITE)
objectStore = trans.objectStore('test')
objectStore.add({x: 1}, 'myKey1')
PASS 'onsuccess' in result is true
@@ -97,7 +97,7 @@ An event should fire shortly...
openCursor2
index = event.source.index('testIndex')
-index.openCursor({range: keyRange})
+index.openCursor(keyRange)
PASS 'onsuccess' in result is true
PASS 'onerror' in result is true
PASS 'readyState' in result is true
@@ -128,6 +128,7 @@ PASS 'onerror' in event.target is true
PASS 'readyState' in event.target is true
PASS event.target.readyState is event.target.DONE
+event.preventDefault()
PASS successfullyParsed is true
TEST COMPLETE
diff --git a/LayoutTests/storage/indexeddb/cursor-index-delete.html b/LayoutTests/storage/indexeddb/cursor-index-delete.html
index 1bddf63..852a7eb 100644
--- a/LayoutTests/storage/indexeddb/cursor-index-delete.html
+++ b/LayoutTests/storage/indexeddb/cursor-index-delete.html
@@ -61,9 +61,9 @@ function createAndPopulateObjectStoreAndIndex()
function openCursor()
{
debug("openCursor1");
- evalAndLog("trans = db.transaction({objectStoreNames: 'test', mode: webkitIDBTransaction.READ_WRITE})");
+ evalAndLog("trans = db.transaction(['test'], webkitIDBTransaction.READ_WRITE)");
keyRange = webkitIDBKeyRange.lowerBound(1);
- result = evalAndLog("trans.objectStore('test').index('testIndex').openCursor({range: keyRange})");
+ result = evalAndLog("trans.objectStore('test').index('testIndex').openCursor(keyRange)");
verifyResult(result);
result.onsuccess = cursorSuccess;
result.onerror = unexpectedErrorCallback;
@@ -74,7 +74,7 @@ function cursorSuccess()
{
if (event.result == null) {
shouldBe("counter", "5");
- result = evalAndLog("trans.objectStore('test').index('testIndex').openCursor({range: keyRange})");
+ result = evalAndLog("trans.objectStore('test').index('testIndex').openCursor(keyRange)");
verifyResult(result);
result.onsuccess = cursorEmpty;
result.onerror = unexpectedErrorCallback;
@@ -95,7 +95,7 @@ function cursorEmpty()
function addObject()
{
- evalAndLog("trans = db.transaction({objectStoreNames: 'test', mode: webkitIDBTransaction.READ_WRITE})");
+ evalAndLog("trans = db.transaction(['test'], webkitIDBTransaction.READ_WRITE)");
objectStore = evalAndLog("objectStore = trans.objectStore('test')");
result = evalAndLog("objectStore.add({x: 1}, 'myKey1')");
verifyResult(result);
@@ -107,7 +107,7 @@ function openCursor2()
{
debug("openCursor2");
evalAndLog("index = event.source.index('testIndex')");
- result = evalAndLog("index.openCursor({range: keyRange})");
+ result = evalAndLog("index.openCursor(keyRange)");
verifyResult(result);
result.onsuccess = deleteObject;
result.onerror = unexpectedErrorCallback;
@@ -126,6 +126,7 @@ function deleteObject()
function verifyObjectDeleted()
{
verifyErrorEvent(event);
+ evalAndLog("event.preventDefault()");
done();
}
diff --git a/LayoutTests/storage/indexeddb/cursor-skip-deleted-expected.txt b/LayoutTests/storage/indexeddb/cursor-skip-deleted-expected.txt
new file mode 100644
index 0000000..f1bb3f7
--- /dev/null
+++ b/LayoutTests/storage/indexeddb/cursor-skip-deleted-expected.txt
@@ -0,0 +1,185 @@
+Test IndexedDB's cursor skips deleted entries.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+webkitIndexedDB.open('name')
+PASS 'onsuccess' in result is true
+PASS 'onerror' in result is true
+PASS 'readyState' in result is true
+An event should fire shortly...
+
+Success event fired:
+PASS 'result' in event is true
+PASS 'code' in event is false
+PASS 'message' in event is false
+PASS 'source' in event is true
+PASS event.source != null is true
+PASS 'onsuccess' in event.target is true
+PASS 'onerror' in event.target is true
+PASS 'readyState' in event.target is true
+PASS event.target.readyState is event.target.DONE
+
+db = event.result
+db.setVersion('new version')
+PASS 'onsuccess' in result is true
+PASS 'onerror' in result is true
+PASS 'readyState' in result is true
+An event should fire shortly...
+
+setVersionSuccess():
+Success event fired:
+PASS 'result' in event is true
+PASS 'code' in event is false
+PASS 'message' in event is false
+PASS 'source' in event is true
+PASS event.source != null is true
+PASS 'onsuccess' in event.target is true
+PASS 'onerror' in event.target is true
+PASS 'readyState' in event.target is true
+PASS event.target.readyState is event.target.DONE
+
+trans = event.result
+PASS trans !== null is true
+Deleted all object stores.
+createAndPopulateObjectStore():
+objectStore = db.createObjectStore('store', {keyPath: 'id'})
+objectStore.createIndex('nameIndex', 'name')
+
+resetObjectStore():
+
+basicCursorTest()
+trans = db.transaction([], webkitIDBTransaction.READ_WRITE)
+
+testCursor():
+trans.objectStore('store').openCursor(webkitIDBKeyRange.lowerBound(0))
+PASS 'onsuccess' in result is true
+PASS 'onerror' in result is true
+PASS 'readyState' in result is true
+An event should fire shortly...
+
+0: Alpha
+1: Bravo
+request = trans.objectStore('store').delete(0)
+2: Charlie
+request = trans.objectStore('store').delete(25)
+3: Delta
+request = trans.objectStore('store').delete(5)
+request = trans.objectStore('store').delete(6)
+request = trans.objectStore('store').delete(7)
+4: Echo
+8: India
+9: Juliet
+10: Kilo
+request = trans.objectStore('store').delete(10)
+11: Lima
+12: Mike
+request = trans.objectStore('store').delete(13)
+14: Oscar
+15: Papa
+request = trans.objectStore('store').delete(14)
+16: Quebec
+17: Romeo
+18: Sierra
+19: Tango
+20: Uniform
+request = trans.objectStore('store').delete(17)
+request = trans.objectStore('store').delete(18)
+21: Victor
+22: Whiskey
+23: X-ray
+24: Yankee
+
+
+resetObjectStore():
+
+reverseCursorTest():
+
+testCursor():
+trans.objectStore('store').openCursor(webkitIDBKeyRange.lowerBound(0), webkitIDBCursor.PREV)
+PASS 'onsuccess' in result is true
+PASS 'onerror' in result is true
+PASS 'readyState' in result is true
+An event should fire shortly...
+
+25: Zulu
+24: Yankee
+request = trans.objectStore('store').delete(25)
+23: X-ray
+request = trans.objectStore('store').delete(0)
+22: Whiskey
+request = trans.objectStore('store').delete(20)
+request = trans.objectStore('store').delete(19)
+request = trans.objectStore('store').delete(18)
+21: Victor
+17: Romeo
+16: Quebec
+15: Papa
+request = trans.objectStore('store').delete(15)
+14: Oscar
+13: November
+request = trans.objectStore('store').delete(12)
+11: Lima
+10: Kilo
+request = trans.objectStore('store').delete(11)
+9: Juliet
+8: India
+7: Hotel
+6: Golf
+5: Foxtrot
+request = trans.objectStore('store').delete(7)
+request = trans.objectStore('store').delete(8)
+4: Echo
+3: Delta
+2: Charlie
+1: Bravo
+
+
+resetObjectStore():
+
+indexCursorTest():
+
+testCursor():
+trans.objectStore('store').index('nameIndex').openCursor(webkitIDBKeyRange.lowerBound('Alpha'))
+PASS 'onsuccess' in result is true
+PASS 'onerror' in result is true
+PASS 'readyState' in result is true
+An event should fire shortly...
+
+0: Alpha
+1: Bravo
+request = trans.objectStore('store').delete(0)
+2: Charlie
+request = trans.objectStore('store').delete(25)
+3: Delta
+request = trans.objectStore('store').delete(5)
+request = trans.objectStore('store').delete(6)
+request = trans.objectStore('store').delete(7)
+4: Echo
+8: India
+9: Juliet
+10: Kilo
+request = trans.objectStore('store').delete(10)
+11: Lima
+12: Mike
+request = trans.objectStore('store').delete(13)
+14: Oscar
+15: Papa
+request = trans.objectStore('store').delete(14)
+16: Quebec
+17: Romeo
+18: Sierra
+19: Tango
+20: Uniform
+request = trans.objectStore('store').delete(17)
+request = trans.objectStore('store').delete(18)
+21: Victor
+22: Whiskey
+23: X-ray
+24: Yankee
+
+transactionComplete():
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/storage/indexeddb/cursor-skip-deleted.html b/LayoutTests/storage/indexeddb/cursor-skip-deleted.html
new file mode 100644
index 0000000..a97c4af
--- /dev/null
+++ b/LayoutTests/storage/indexeddb/cursor-skip-deleted.html
@@ -0,0 +1,218 @@
+<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's cursor skips deleted entries.");
+if (window.layoutTestController)
+ layoutTestController.waitUntilDone();
+
+var names = ['Alpha', 'Bravo', 'Charlie', 'Delta', 'Echo', 'Foxtrot', 'Golf',
+ 'Hotel', 'India', 'Juliet', 'Kilo', 'Lima', 'Mike', 'November',
+ 'Oscar', 'Papa', 'Quebec', 'Romeo', 'Sierra', 'Tango', 'Uniform',
+ 'Victor', 'Whiskey', 'X-ray', 'Yankee', 'Zulu'];
+
+test();
+
+function test()
+{
+ result = evalAndLog("webkitIndexedDB.open('name')");
+ verifyResult(result);
+ result.onsuccess = openSuccess;
+ result.onerror = unexpectedErrorCallback;
+}
+
+function openSuccess()
+{
+ verifySuccessEvent(event);
+ var db = evalAndLog("db = event.result");
+
+ result = evalAndLog("db.setVersion('new version')");
+ verifyResult(result);
+ result.onsuccess = setVersionSuccess;
+ result.onerror = unexpectedErrorCallback;
+}
+
+function setVersionSuccess()
+{
+ debug("setVersionSuccess():");
+ verifySuccessEvent(event);
+ window.trans = evalAndLog("trans = event.result");
+ shouldBeTrue("trans !== null");
+ trans.onabort = unexpectedAbortCallback;
+ trans.oncomplete = basicCursorTest;
+
+ deleteAllObjectStores(db, createAndPopulateObjectStore);
+}
+
+function createAndPopulateObjectStore()
+{
+ debug("createAndPopulateObjectStore():");
+
+ var objectStore = evalAndLog("objectStore = db.createObjectStore('store', {keyPath: 'id'})");
+ evalAndLog("objectStore.createIndex('nameIndex', 'name')");
+ resetObjectStore(function() {});
+}
+
+var silentErrorHandler = function() { event.preventDefault(); }
+
+function resetObjectStore(callback)
+{
+ debug("\nresetObjectStore():");
+ if (callback === undefined)
+ callback = function () {};
+
+ var objectStore = trans.objectStore('store');
+ for (var i = 0; i < names.length; i++)
+ objectStore.delete(i).onerror = silentErrorHandler;
+ for (var i = 0; i < names.length; i++)
+ objectStore.add({id: i, name: names[i]}).onerror = unexpectedErrorCallback;
+
+ debug("");
+ callback();
+}
+
+function contains(arr, obj)
+{
+ for (var i = 0; i < arr.length; i++) {
+ if (arr[i] == obj)
+ return true;
+ }
+ return false;
+}
+
+var cursor;
+var deleted;
+var seen;
+
+function testCursor(deleteList, createCursorCommand, callback)
+{
+ debug("\ntestCursor():");
+ deleted = [];
+ seen = [];
+
+ // Create the cursor.
+ request = evalAndLog(createCursorCommand);
+ verifyResult(request);
+
+ request.onerror = unexpectedErrorCallback;
+ request.onsuccess = function () {
+ if (event.result == null) {
+ // Make sure we have seen every non-deleted item.
+ for (var i = 0; i < names.length; i++) {
+ if (contains(deleted, i))
+ continue;
+
+ if (!contains(seen, i))
+ testFailed("Cursor did not see item with id: " + i);
+ }
+
+ // Make sure we used every rule in |deleteList|.
+ for (var i = 0; i < deleteList.length; i++) {
+ if (!contains(seen, deleteList[i].id))
+ testFailed("deleteList rule with id: " + deleteList[i].id + " was never used.");
+ }
+
+ debug("");
+ callback();
+ return;
+ }
+
+ cursor = event.result;
+ debug(event.result.value.id + ": " + event.result.value.name);
+ seen.push(event.result.value.id);
+
+ // Make sure we don't see any deleted items.
+ if (contains(deleted, event.result.value.id))
+ testFailed("Cursor hit previously deleted element.");
+
+ for (var i = 0; i < deleteList.length; i++) {
+ if (event.result.value.id == deleteList[i].id) {
+ // Delete objects targeted by this id.
+ var targets = deleteList[i].targets;
+ for (var j = 0; j < targets.length; j++) {
+ deleted.push(targets[j]);
+ request = evalAndLog("request = trans.objectStore('store').delete(" + targets[j] + ")");
+ request.onerror = unexpectedErrorCallback;
+ if (j == targets.length - 1)
+ request.onsuccess = function() { cursor.continue(); }
+ }
+ return;
+ }
+ }
+
+ cursor.continue();
+ }
+}
+
+function basicCursorTest()
+{
+ debug("basicCursorTest()");
+
+ evalAndLog("trans = db.transaction([], webkitIDBTransaction.READ_WRITE)");
+ trans.onabort = unexpectedAbortCallback;
+ trans.oncomplete = transactionComplete;
+
+ var deletes = [{id: 1, targets: [0]},
+ {id: 2, targets: [names.length - 1]},
+ {id: 3, targets: [5,6,7]},
+ {id: 10, targets: [10]},
+ {id: 12, targets: [13]},
+ {id: 15, targets: [14]},
+ {id: 20, targets: [17,18]}
+ ];
+
+ testCursor(deletes, "trans.objectStore('store').openCursor(webkitIDBKeyRange.lowerBound(0))", function() { resetObjectStore(reverseCursorTest); });
+}
+
+function reverseCursorTest()
+{
+ debug("reverseCursorTest():");
+
+ var deletes = [{id: 24, targets: [names.length - 1]},
+ {id: 23, targets: [0]},
+ {id: 22, targets: [20, 19, 18]},
+ {id: 15, targets: [15]},
+ {id: 13, targets: [12]},
+ {id: 10, targets: [11]},
+ {id: 5, targets: [7,8]}
+ ];
+
+
+ testCursor(deletes, "trans.objectStore('store').openCursor(webkitIDBKeyRange.lowerBound(0), webkitIDBCursor.PREV)", function() { resetObjectStore(indexCursorTest); });
+}
+
+function indexCursorTest()
+{
+ debug("indexCursorTest():");
+
+ var deletes = [{id: 1, targets: [0]},
+ {id: 2, targets: [names.length - 1]},
+ {id: 3, targets: [5,6,7]},
+ {id: 10, targets: [10]},
+ {id: 12, targets: [13]},
+ {id: 15, targets: [14]},
+ {id: 20, targets: [17,18]}
+ ];
+
+ testCursor(deletes, "trans.objectStore('store').index('nameIndex').openCursor(webkitIDBKeyRange.lowerBound('Alpha'))", function() { });
+}
+
+function transactionComplete()
+{
+ debug("transactionComplete():");
+ done();
+}
+
+var successfullyParsed = true;
+
+</script>
+</body>
+</html>
diff --git a/LayoutTests/storage/indexeddb/cursor-update-expected.txt b/LayoutTests/storage/indexeddb/cursor-update-expected.txt
new file mode 100644
index 0000000..4f2e659
--- /dev/null
+++ b/LayoutTests/storage/indexeddb/cursor-update-expected.txt
@@ -0,0 +1,283 @@
+Test IndexedDB's cursor update.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+webkitIndexedDB.open('name')
+PASS 'onsuccess' in result is true
+PASS 'onerror' in result is true
+PASS 'readyState' in result is true
+An event should fire shortly...
+
+Success event fired:
+PASS 'result' in event is true
+PASS 'code' in event is false
+PASS 'message' in event is false
+PASS 'source' in event is true
+PASS event.source != null is true
+PASS 'onsuccess' in event.target is true
+PASS 'onerror' in event.target is true
+PASS 'readyState' in event.target is true
+PASS event.target.readyState is event.target.DONE
+
+db = event.result
+db.setVersion('new version')
+PASS 'onsuccess' in result is true
+PASS 'onerror' in result is true
+PASS 'readyState' in result is true
+An event should fire shortly...
+
+setVersionSuccess():
+Success event fired:
+PASS 'result' in event is true
+PASS 'code' in event is false
+PASS 'message' in event is false
+PASS 'source' in event is true
+PASS event.source != null is true
+PASS 'onsuccess' in event.target is true
+PASS 'onerror' in event.target is true
+PASS 'readyState' in event.target is true
+PASS event.target.readyState is event.target.DONE
+
+trans = event.result
+PASS trans !== null is true
+Deleted all object stores.
+createAndPopulateObjectStore():
+objectStore = db.createObjectStore('basicStore')
+objectStore.add('myValue1', 'myKey1').onerror = unexpectedErrorCallback
+objectStore.add('myValue2', 'myKey2').onerror = unexpectedErrorCallback
+objectStore.add('myValue3', 'myKey3').onerror = unexpectedErrorCallback
+objectStore.add('myValue4', 'myKey4').onerror = unexpectedErrorCallback
+objectStore = db.createObjectStore('autoIncrementStore', {autoIncrement: true})
+objectStore.add('foo1').onerror = unexpectedErrorCallback
+objectStore.add('foo2').onerror = unexpectedErrorCallback
+objectStore.add('foo3').onerror = unexpectedErrorCallback
+objectStore.add('foo4').onerror = unexpectedErrorCallback
+objectStore = db.createObjectStore('keyPathStore', {keyPath: 'id'})
+objectStore.createIndex('numberIndex', 'number')
+objectStore.add({number: 1, id: 1}).onerror = unexpectedErrorCallback
+objectStore.add({number: 2, id: 2}).onerror = unexpectedErrorCallback
+objectStore.add({number: 3, id: 3}).onerror = unexpectedErrorCallback
+objectStore.add({number: 4, id: 4}).onerror = unexpectedErrorCallback
+openBasicCursor()
+trans = db.transaction([], webkitIDBTransaction.READ_WRITE)
+trans.objectStore('basicStore').openCursor(keyRange)
+PASS 'onsuccess' in result is true
+PASS 'onerror' in result is true
+PASS 'readyState' in result is true
+An event should fire shortly...
+
+basicUpdateCursor()
+event.result.update('myUpdatedValue' + counter++)
+event.source.continue()
+basicUpdateCursor()
+event.result.update('myUpdatedValue' + counter++)
+event.source.continue()
+basicUpdateCursor()
+event.result.update('myUpdatedValue' + counter++)
+event.source.continue()
+basicUpdateCursor()
+event.result.update('myUpdatedValue' + counter++)
+event.source.continue()
+basicUpdateCursor()
+PASS counter is 5
+trans.objectStore('basicStore').openCursor(keyRange)
+PASS 'onsuccess' in result is true
+PASS 'onerror' in result is true
+PASS 'readyState' in result is true
+An event should fire shortly...
+
+basicCheckCursor()
+PASS event.result.key is "myKey1"
+PASS event.result.value is "myUpdatedValue1"
+event.result.continue()
+basicCheckCursor()
+PASS event.result.key is "myKey2"
+PASS event.result.value is "myUpdatedValue2"
+event.result.continue()
+basicCheckCursor()
+PASS event.result.key is "myKey3"
+PASS event.result.value is "myUpdatedValue3"
+event.result.continue()
+basicCheckCursor()
+PASS event.result.key is "myKey4"
+PASS event.result.value is "myUpdatedValue4"
+event.result.continue()
+basicCheckCursor()
+PASS counter is 5
+trans.objectStore('autoIncrementStore').openCursor(keyRange)
+PASS 'onsuccess' in result is true
+PASS 'onerror' in result is true
+PASS 'readyState' in result is true
+An event should fire shortly...
+
+autoIncrementUpdateCursor()
+event.result.update('myUpdatedFoo' + counter++)
+event.source.continue()
+autoIncrementUpdateCursor()
+event.result.update('myUpdatedFoo' + counter++)
+event.source.continue()
+autoIncrementUpdateCursor()
+event.result.update('myUpdatedFoo' + counter++)
+event.source.continue()
+autoIncrementUpdateCursor()
+event.result.update('myUpdatedFoo' + counter++)
+event.source.continue()
+autoIncrementUpdateCursor()
+PASS counter is 5
+trans.objectStore('autoIncrementStore').openCursor(keyRange)
+PASS 'onsuccess' in result is true
+PASS 'onerror' in result is true
+PASS 'readyState' in result is true
+An event should fire shortly...
+
+autoIncrementCheckCursor()
+PASS event.result.key is counter
+PASS event.result.value is "myUpdatedFoo1"
+event.result.continue()
+autoIncrementCheckCursor()
+PASS event.result.key is counter
+PASS event.result.value is "myUpdatedFoo2"
+event.result.continue()
+autoIncrementCheckCursor()
+PASS event.result.key is counter
+PASS event.result.value is "myUpdatedFoo3"
+event.result.continue()
+autoIncrementCheckCursor()
+PASS event.result.key is counter
+PASS event.result.value is "myUpdatedFoo4"
+event.result.continue()
+autoIncrementCheckCursor()
+PASS counter is 5
+trans.objectStore('keyPathStore').openCursor(keyRange)
+PASS 'onsuccess' in result is true
+PASS 'onerror' in result is true
+PASS 'readyState' in result is true
+An event should fire shortly...
+
+keyPathUpdateCursor()
+event.result.update({id: 100 + counter, number: 100 + counter})
+Error event fired:
+PASS 'result' in event is false
+PASS 'code' in event is true
+PASS 'message' in event is true
+PASS 'source' in event is true
+PASS event.source != null is true
+PASS 'onsuccess' in event.target is true
+PASS 'onerror' in event.target is true
+PASS 'readyState' in event.target is true
+PASS event.target.readyState is event.target.DONE
+
+PASS event.code is webkitIDBDatabaseException.DATA_ERR
+event.preventDefault()
+event.source.update({id: counter, number: 100 + counter++})
+event.source.continue()
+keyPathUpdateCursor()
+event.result.update({id: 100 + counter, number: 100 + counter})
+Error event fired:
+PASS 'result' in event is false
+PASS 'code' in event is true
+PASS 'message' in event is true
+PASS 'source' in event is true
+PASS event.source != null is true
+PASS 'onsuccess' in event.target is true
+PASS 'onerror' in event.target is true
+PASS 'readyState' in event.target is true
+PASS event.target.readyState is event.target.DONE
+
+PASS event.code is webkitIDBDatabaseException.DATA_ERR
+event.preventDefault()
+event.source.update({id: counter, number: 100 + counter++})
+event.source.continue()
+keyPathUpdateCursor()
+event.result.update({id: 100 + counter, number: 100 + counter})
+Error event fired:
+PASS 'result' in event is false
+PASS 'code' in event is true
+PASS 'message' in event is true
+PASS 'source' in event is true
+PASS event.source != null is true
+PASS 'onsuccess' in event.target is true
+PASS 'onerror' in event.target is true
+PASS 'readyState' in event.target is true
+PASS event.target.readyState is event.target.DONE
+
+PASS event.code is webkitIDBDatabaseException.DATA_ERR
+event.preventDefault()
+event.source.update({id: counter, number: 100 + counter++})
+event.source.continue()
+keyPathUpdateCursor()
+event.result.update({id: 100 + counter, number: 100 + counter})
+Error event fired:
+PASS 'result' in event is false
+PASS 'code' in event is true
+PASS 'message' in event is true
+PASS 'source' in event is true
+PASS event.source != null is true
+PASS 'onsuccess' in event.target is true
+PASS 'onerror' in event.target is true
+PASS 'readyState' in event.target is true
+PASS event.target.readyState is event.target.DONE
+
+PASS event.code is webkitIDBDatabaseException.DATA_ERR
+event.preventDefault()
+event.source.update({id: counter, number: 100 + counter++})
+event.source.continue()
+keyPathUpdateCursor()
+PASS counter is 5
+trans.objectStore('keyPathStore').openCursor(keyRange)
+PASS 'onsuccess' in result is true
+PASS 'onerror' in result is true
+PASS 'readyState' in result is true
+An event should fire shortly...
+
+keyPathCheckCursor()
+PASS event.result.key is counter
+PASS event.result.value.id is counter
+PASS event.result.value.number is 101
+event.result.continue()
+keyPathCheckCursor()
+PASS event.result.key is counter
+PASS event.result.value.id is counter
+PASS event.result.value.number is 102
+event.result.continue()
+keyPathCheckCursor()
+PASS event.result.key is counter
+PASS event.result.value.id is counter
+PASS event.result.value.number is 103
+event.result.continue()
+keyPathCheckCursor()
+PASS event.result.key is counter
+PASS event.result.value.id is counter
+PASS event.result.value.number is 104
+event.result.continue()
+keyPathCheckCursor()
+PASS counter is 5
+trans.objectStore('keyPathStore').index('numberIndex').openKeyCursor(keyRange)
+keyCursor()
+PASS event.result.key is counter + 100
+PASS event.result.value is counter
+event.result.update({id: counter, number: counter + 200})
+PASS code is webkitIDBDatabaseException.NOT_ALLOWED_ERR
+keyCursor()
+PASS event.result.key is counter + 100
+PASS event.result.value is counter
+event.result.update({id: counter, number: counter + 200})
+PASS code is webkitIDBDatabaseException.NOT_ALLOWED_ERR
+keyCursor()
+PASS event.result.key is counter + 100
+PASS event.result.value is counter
+event.result.update({id: counter, number: counter + 200})
+PASS code is webkitIDBDatabaseException.NOT_ALLOWED_ERR
+keyCursor()
+PASS event.result.key is counter + 100
+PASS event.result.value is counter
+event.result.update({id: counter, number: counter + 200})
+PASS code is webkitIDBDatabaseException.NOT_ALLOWED_ERR
+keyCursor()
+PASS counter is 5
+transactionComplete()
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/storage/indexeddb/cursor-update.html b/LayoutTests/storage/indexeddb/cursor-update.html
new file mode 100644
index 0000000..0a80b84
--- /dev/null
+++ b/LayoutTests/storage/indexeddb/cursor-update.html
@@ -0,0 +1,249 @@
+<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's cursor update.");
+if (window.layoutTestController)
+ layoutTestController.waitUntilDone();
+
+test();
+
+function test()
+{
+ result = evalAndLog("webkitIndexedDB.open('name')");
+ verifyResult(result);
+ result.onsuccess = openSuccess;
+ result.onerror = unexpectedErrorCallback;
+}
+
+function openSuccess()
+{
+ verifySuccessEvent(event);
+ var db = evalAndLog("db = event.result");
+
+ result = evalAndLog("db.setVersion('new version')");
+ verifyResult(result);
+ result.onsuccess = setVersionSuccess;
+ result.onerror = unexpectedErrorCallback;
+}
+
+function setVersionSuccess()
+{
+ debug("setVersionSuccess():");
+ verifySuccessEvent(event);
+ window.trans = evalAndLog("trans = event.result");
+ shouldBeTrue("trans !== null");
+ trans.onabort = unexpectedAbortCallback;
+ trans.oncomplete = openBasicCursor;
+
+ deleteAllObjectStores(db, createAndPopulateObjectStore);
+}
+
+function createAndPopulateObjectStore()
+{
+ debug("createAndPopulateObjectStore():");
+ var objectStore = evalAndLog("objectStore = db.createObjectStore('basicStore')");
+ evalAndLog("objectStore.add('myValue1', 'myKey1').onerror = unexpectedErrorCallback");
+ evalAndLog("objectStore.add('myValue2', 'myKey2').onerror = unexpectedErrorCallback");
+ evalAndLog("objectStore.add('myValue3', 'myKey3').onerror = unexpectedErrorCallback");
+ evalAndLog("objectStore.add('myValue4', 'myKey4').onerror = unexpectedErrorCallback");
+
+ var objectStore = evalAndLog("objectStore = db.createObjectStore('autoIncrementStore', {autoIncrement: true})");
+ evalAndLog("objectStore.add('foo1').onerror = unexpectedErrorCallback");
+ evalAndLog("objectStore.add('foo2').onerror = unexpectedErrorCallback");
+ evalAndLog("objectStore.add('foo3').onerror = unexpectedErrorCallback");
+ evalAndLog("objectStore.add('foo4').onerror = unexpectedErrorCallback");
+
+ var objectStore = evalAndLog("objectStore = db.createObjectStore('keyPathStore', {keyPath: 'id'})");
+ evalAndLog("objectStore.createIndex('numberIndex', 'number')");
+ evalAndLog("objectStore.add({number: 1, id: 1}).onerror = unexpectedErrorCallback");
+ evalAndLog("objectStore.add({number: 2, id: 2}).onerror = unexpectedErrorCallback");
+ evalAndLog("objectStore.add({number: 3, id: 3}).onerror = unexpectedErrorCallback");
+ evalAndLog("objectStore.add({number: 4, id: 4}).onerror = unexpectedErrorCallback");
+}
+
+function openBasicCursor()
+{
+ debug("openBasicCursor()");
+ evalAndLog("trans = db.transaction([], webkitIDBTransaction.READ_WRITE)");
+ trans.onabort = unexpectedAbortCallback;
+ trans.oncomplete = transactionComplete;
+
+ keyRange = webkitIDBKeyRange.lowerBound("myKey1");
+ result = evalAndLog("trans.objectStore('basicStore').openCursor(keyRange)");
+ verifyResult(result);
+ result.onsuccess = basicUpdateCursor;
+ result.onerror = unexpectedErrorCallback;
+ counter = 1;
+}
+
+function basicUpdateCursor()
+{
+ debug("basicUpdateCursor()");
+ if (event.result == null) {
+ shouldBe("counter", "5");
+ counter = 1;
+
+ result = evalAndLog("trans.objectStore('basicStore').openCursor(keyRange)");
+ verifyResult(result);
+ result.onsuccess = basicCheckCursor;
+ result.onerror = unexpectedErrorCallback;
+ return;
+ }
+
+ result = evalAndLog("event.result.update('myUpdatedValue' + counter++)");
+ result.onsuccess = function() { evalAndLog("event.source.continue()"); }
+ result.onerror = unexpectedErrorCallback;
+}
+
+function basicCheckCursor()
+{
+ debug("basicCheckCursor()");
+ if (event.result == null) {
+ shouldBe("counter", "5");
+ counter = 1;
+
+ keyRange = webkitIDBKeyRange.lowerBound(1);
+ result = evalAndLog("trans.objectStore('autoIncrementStore').openCursor(keyRange)");
+ verifyResult(result);
+ result.onsuccess = autoIncrementUpdateCursor;
+ result.onerror = unexpectedErrorCallback;
+ return;
+ }
+
+ shouldBeEqualToString("event.result.key", "myKey" + counter);
+ shouldBeEqualToString("event.result.value", "myUpdatedValue" + counter++);
+ evalAndLog("event.result.continue()");
+}
+
+function autoIncrementUpdateCursor()
+{
+ debug("autoIncrementUpdateCursor()");
+ if (event.result == null) {
+ shouldBe("counter", "5");
+ counter = 1;
+
+ result = evalAndLog("trans.objectStore('autoIncrementStore').openCursor(keyRange)");
+ verifyResult(result);
+ result.onsuccess = autoIncrementCheckCursor;
+ result.onerror = unexpectedErrorCallback;
+ return;
+ }
+
+ result = evalAndLog("event.result.update('myUpdatedFoo' + counter++)");
+ result.onsuccess = function() { evalAndLog("event.source.continue()"); }
+ result.onerror = unexpectedErrorCallback;
+}
+
+function autoIncrementCheckCursor()
+{
+ debug("autoIncrementCheckCursor()");
+ if (event.result == null) {
+ shouldBe("counter", "5");
+ counter = 1;
+
+ keyRange = webkitIDBKeyRange.lowerBound(1);
+ result = evalAndLog("trans.objectStore('keyPathStore').openCursor(keyRange)");
+ verifyResult(result);
+ result.onsuccess = keyPathUpdateCursor;
+ result.onerror = unexpectedErrorCallback;
+ return;
+ }
+
+ shouldBe("event.result.key", "counter");
+ shouldBeEqualToString("event.result.value", "myUpdatedFoo" + counter++);
+ evalAndLog("event.result.continue()");
+}
+
+function keyPathUpdateCursor()
+{
+ debug("keyPathUpdateCursor()");
+ if (event.result == null) {
+ shouldBe("counter", "5");
+ counter = 1;
+
+ result = evalAndLog("trans.objectStore('keyPathStore').openCursor(keyRange)");
+ verifyResult(result);
+ result.onsuccess = keyPathCheckCursor;
+ result.onerror = unexpectedErrorCallback;
+ return;
+ }
+
+ result = evalAndLog("event.result.update({id: 100 + counter, number: 100 + counter})");
+ result.onsuccess = unexpectedSuccessCallback;
+ result.onerror = function() {
+ verifyErrorEvent(event);
+ shouldBe("event.code", "webkitIDBDatabaseException.DATA_ERR");
+
+ evalAndLog("event.preventDefault()");
+
+ result = evalAndLog("event.source.update({id: counter, number: 100 + counter++})");
+ result.onsuccess = function() { evalAndLog("event.source.continue()") };
+ result.onerror = unexpectedErrorCallback;
+ }
+}
+
+function keyPathCheckCursor()
+{
+ debug("keyPathCheckCursor()");
+ if (event.result == null) {
+ shouldBe("counter", "5");
+ counter = 1;
+
+ keyRange = webkitIDBKeyRange.lowerBound(101);
+ result = evalAndLog("trans.objectStore('keyPathStore').index('numberIndex').openKeyCursor(keyRange)");
+ result.onsuccess = keyCursor;
+ result.onerror = unexpectedErrorCallback;
+ return;
+ }
+
+ shouldBe("event.result.key", "counter");
+ shouldBe("event.result.value.id", "counter");
+ shouldBe("event.result.value.number", (counter + 100).toString());
+ counter++;
+ evalAndLog("event.result.continue()");
+}
+
+function keyCursor()
+{
+ debug("keyCursor()");
+ if (event.result == null) {
+ shouldBe("counter", "5");
+ return;
+ }
+
+ shouldBe("event.result.key", "counter + 100");
+ shouldBe("event.result.value", "counter");
+
+ try {
+ debug("event.result.update({id: counter, number: counter + 200})");
+ event.result.update({id: counter, number: counter + 200});
+ testFailed("Expected exception.");
+ } catch (e) {
+ code = e.code;
+ shouldBe("code", "webkitIDBDatabaseException.NOT_ALLOWED_ERR");
+ }
+
+ counter++;
+ event.result.continue();
+}
+
+function transactionComplete()
+{
+ debug("transactionComplete()");
+ done();
+}
+
+var successfullyParsed = true;
+
+</script>
+</body>
+</html>
diff --git a/LayoutTests/storage/indexeddb/data-corruption-expected.txt b/LayoutTests/storage/indexeddb/data-corruption-expected.txt
new file mode 100644
index 0000000..ac7116a
--- /dev/null
+++ b/LayoutTests/storage/indexeddb/data-corruption-expected.txt
@@ -0,0 +1,69 @@
+Test that data inserted into IndexedDB does not get corrupted on disk.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+webkitIndexedDB.open('name')
+PASS 'onsuccess' in result is true
+PASS 'onerror' in result is true
+PASS 'readyState' in result is true
+An event should fire shortly...
+
+openSuccess():
+Success event fired:
+PASS 'result' in event is true
+PASS 'code' in event is false
+PASS 'message' in event is false
+PASS 'source' in event is true
+PASS event.source != null is true
+PASS 'onsuccess' in event.target is true
+PASS 'onerror' in event.target is true
+PASS 'readyState' in event.target is true
+PASS event.target.readyState is event.target.DONE
+
+db = event.result
+db.setVersion('new version')
+PASS 'onsuccess' in result is true
+PASS 'onerror' in result is true
+PASS 'readyState' in result is true
+An event should fire shortly...
+
+setVersionSuccess():
+Success event fired:
+PASS 'result' in event is true
+PASS 'code' in event is false
+PASS 'message' in event is false
+PASS 'source' in event is true
+PASS event.source != null is true
+PASS 'onsuccess' in event.target is true
+PASS 'onerror' in event.target is true
+PASS 'readyState' in event.target is true
+PASS event.target.readyState is event.target.DONE
+
+trans = event.result
+PASS trans !== null is true
+Deleted all object stores.
+createObjectStore():
+db.createObjectStore('storeName')
+addData():
+transaction = db.transaction([], webkitIDBTransaction.READ_WRITE)
+result = transaction.objectStore('storeName').add({x: testDate}, 'key')
+addData():
+transaction = db.transaction([], webkitIDBTransaction.READ_ONLY)
+result = transaction.objectStore('storeName').get('key')
+Success event fired:
+PASS 'result' in event is true
+PASS 'code' in event is false
+PASS 'message' in event is false
+PASS 'source' in event is true
+PASS event.source != null is true
+PASS 'onsuccess' in event.target is true
+PASS 'onerror' in event.target is true
+PASS 'readyState' in event.target is true
+PASS event.target.readyState is event.target.DONE
+
+PASS event.result.x.toString() == testDate.toString() is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/storage/indexeddb/data-corruption.html b/LayoutTests/storage/indexeddb/data-corruption.html
new file mode 100644
index 0000000..664ff6d
--- /dev/null
+++ b/LayoutTests/storage/indexeddb/data-corruption.html
@@ -0,0 +1,88 @@
+<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 that data inserted into IndexedDB does not get corrupted on disk.");
+if (window.layoutTestController)
+ layoutTestController.waitUntilDone();
+
+function test()
+{
+ result = evalAndLog("webkitIndexedDB.open('name')");
+ verifyResult(result);
+ result.onsuccess = openSuccess;
+ result.onerror = unexpectedErrorCallback;
+}
+
+function openSuccess()
+{
+ debug("openSuccess():");
+ verifySuccessEvent(event);
+ window.db = evalAndLog("db = event.result");
+
+ result = evalAndLog("db.setVersion('new version')");
+ verifyResult(result);
+ result.onsuccess = setVersionSuccess;
+ result.onerror = unexpectedErrorCallback;
+}
+
+function setVersionSuccess()
+{
+ debug("setVersionSuccess():");
+ verifySuccessEvent(event);
+ window.trans = evalAndLog("trans = event.result");
+ shouldBeTrue("trans !== null");
+ trans.onabort = unexpectedAbortCallback;
+ trans.oncomplete = addData;
+
+ deleteAllObjectStores(db, createObjectStore);
+}
+
+function createObjectStore()
+{
+ debug("createObjectStore():");
+ evalAndLog("db.createObjectStore('storeName')");
+}
+
+var testDate = new Date('February 24, 1955 12:00:08');
+
+function addData()
+{
+ debug("addData():");
+ var transaction = evalAndLog("transaction = db.transaction([], webkitIDBTransaction.READ_WRITE)");
+ var result = evalAndLog("result = transaction.objectStore('storeName').add({x: testDate}, 'key')");
+ result.onerror = unexpectedErrorCallback;
+ transaction.oncomplete = getData;
+}
+
+function getData()
+{
+ debug("addData():");
+ var transaction = evalAndLog("transaction = db.transaction([], webkitIDBTransaction.READ_ONLY)");
+ var result = evalAndLog("result = transaction.objectStore('storeName').get('key')");
+ result.onerror = unexpectedErrorCallback;
+ result.onsuccess = doCheck;
+}
+
+function doCheck()
+{
+ verifySuccessEvent(event);
+ shouldBeTrue("event.result.x.toString() == testDate.toString()");
+ done();
+}
+
+test();
+
+var successfullyParsed = true;
+
+</script>
+</body>
+</html>
diff --git a/LayoutTests/storage/indexeddb/database-quota-expected.txt b/LayoutTests/storage/indexeddb/database-quota-expected.txt
index 0f06145..876d412 100644
--- a/LayoutTests/storage/indexeddb/database-quota-expected.txt
+++ b/LayoutTests/storage/indexeddb/database-quota-expected.txt
@@ -64,7 +64,7 @@ PASS db.objectStoreNames.length is 1
PASS db.objectStoreNames.contains('') is false
PASS db.objectStoreNames.contains('test456') is false
PASS db.objectStoreNames.contains('test123') is true
-trans = db.transaction({mode: webkitIDBTransaction.READ_WRITE})
+trans = db.transaction([], webkitIDBTransaction.READ_WRITE)
Creating 'data' which contains 64K of data
PASS data.length is 65536
store = trans.objectStore('test123')
@@ -80,6 +80,7 @@ PASS 'onerror' in event.target is true
PASS 'readyState' in event.target is true
PASS event.target.readyState is event.target.DONE
+event.preventDefault()
PASS Adding data failed due to quota error. Data added was about 5 MB
PASS successfullyParsed is true
diff --git a/LayoutTests/storage/indexeddb/database-quota.html b/LayoutTests/storage/indexeddb/database-quota.html
index d21b051..b447505 100644
--- a/LayoutTests/storage/indexeddb/database-quota.html
+++ b/LayoutTests/storage/indexeddb/database-quota.html
@@ -74,7 +74,7 @@ function commitAndContinue()
function checkQuotaEnforcing()
{
- var trans = evalAndLog("trans = db.transaction({mode: webkitIDBTransaction.READ_WRITE})");
+ var trans = evalAndLog("trans = db.transaction([], webkitIDBTransaction.READ_WRITE)");
trans.onabort = testComplete;
trans.oncomplete = unexpectedCompleteCallback;
debug("Creating 'data' which contains 64K of data");
@@ -107,6 +107,7 @@ function logError()
{
debug("Error function called: (" + event.code + ") " + event.message);
verifyErrorEvent(event);
+ evalAndLog("event.preventDefault()");
}
function testComplete()
diff --git a/LayoutTests/storage/indexeddb/duplicates-expected.txt b/LayoutTests/storage/indexeddb/duplicates-expected.txt
index 8de488c..551b0bb 100644
--- a/LayoutTests/storage/indexeddb/duplicates-expected.txt
+++ b/LayoutTests/storage/indexeddb/duplicates-expected.txt
@@ -133,6 +133,7 @@ PASS 'readyState' in event.target is true
PASS event.target.readyState is event.target.DONE
PASS event.code is webkitIDBDatabaseException.NOT_FOUND_ERR
+event.preventDefault()
indexObject.get('does not exist')
PASS 'onsuccess' in result is true
PASS 'onerror' in result is true
@@ -151,6 +152,7 @@ PASS 'readyState' in event.target is true
PASS event.target.readyState is event.target.DONE
PASS event.code is webkitIDBDatabaseException.NOT_FOUND_ERR
+event.preventDefault()
indexObject.openKeyCursor()
PASS 'onsuccess' in result is true
PASS 'onerror' in result is true
@@ -399,6 +401,7 @@ PASS 'readyState' in event.target is true
PASS event.target.readyState is event.target.DONE
PASS event.code is webkitIDBDatabaseException.NOT_FOUND_ERR
+event.preventDefault()
indexObject.get('does not exist')
PASS 'onsuccess' in result is true
PASS 'onerror' in result is true
@@ -417,6 +420,7 @@ PASS 'readyState' in event.target is true
PASS event.target.readyState is event.target.DONE
PASS event.code is webkitIDBDatabaseException.NOT_FOUND_ERR
+event.preventDefault()
indexObject.openKeyCursor()
PASS 'onsuccess' in result is true
PASS 'onerror' in result is true
diff --git a/LayoutTests/storage/indexeddb/duplicates.html b/LayoutTests/storage/indexeddb/duplicates.html
index 352367f..cdfdcaa 100644
--- a/LayoutTests/storage/indexeddb/duplicates.html
+++ b/LayoutTests/storage/indexeddb/duplicates.html
@@ -111,6 +111,8 @@ function getObjectDataFail()
verifyErrorEvent(event);
shouldBe("event.code", "webkitIDBDatabaseException.NOT_FOUND_ERR");
+ evalAndLog("event.preventDefault()");
+
result = evalAndLog("indexObject.get('does not exist')");
verifyResult(result);
result.onsuccess = unexpectedSuccessCallback;
@@ -122,6 +124,8 @@ function openKeyCursor()
verifyErrorEvent(event);
shouldBe("event.code", "webkitIDBDatabaseException.NOT_FOUND_ERR");
+ evalAndLog("event.preventDefault()");
+
window.result = evalAndLog("indexObject.openKeyCursor()");
verifyResult(result);
result.onsuccess = cursor1Continue;
diff --git a/LayoutTests/storage/indexeddb/error-causes-abort-by-default-expected.txt b/LayoutTests/storage/indexeddb/error-causes-abort-by-default-expected.txt
new file mode 100644
index 0000000..dd8fd61
--- /dev/null
+++ b/LayoutTests/storage/indexeddb/error-causes-abort-by-default-expected.txt
@@ -0,0 +1,107 @@
+Verify that a transaction with an error aborts unless preventDefault() is called.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+webkitIndexedDB.open('name')
+PASS 'onsuccess' in result is true
+PASS 'onerror' in result is true
+PASS 'readyState' in result is true
+An event should fire shortly...
+
+Success event fired:
+PASS 'result' in event is true
+PASS 'code' in event is false
+PASS 'message' in event is false
+PASS 'source' in event is true
+PASS event.source != null is true
+PASS 'onsuccess' in event.target is true
+PASS 'onerror' in event.target is true
+PASS 'readyState' in event.target is true
+PASS event.target.readyState is event.target.DONE
+
+db = event.result
+db.setVersion('new version')
+PASS 'onsuccess' in result is true
+PASS 'onerror' in result is true
+PASS 'readyState' in result is true
+An event should fire shortly...
+
+setVersionSuccess():
+Success event fired:
+PASS 'result' in event is true
+PASS 'code' in event is false
+PASS 'message' in event is false
+PASS 'source' in event is true
+PASS event.source != null is true
+PASS 'onsuccess' in event.target is true
+PASS 'onerror' in event.target is true
+PASS 'readyState' in event.target is true
+PASS event.target.readyState is event.target.DONE
+
+trans = event.result
+PASS trans !== null is true
+trans.oncomplete = addData
+Deleted all object stores.
+db.createObjectStore('storeName', null)
+trans = db.transaction([], webkitIDBTransaction.READ_WRITE)
+trans.onabort = unexpectedAbortCallback
+trans.oncomplete = transactionCompleted
+store = trans.objectStore('storeName')
+store.add({x: 'value', y: 'zzz'}, 'key')
+PASS 'onsuccess' in result is true
+PASS 'onerror' in result is true
+PASS 'readyState' in result is true
+An event should fire shortly...
+
+Success event fired:
+PASS 'result' in event is true
+PASS 'code' in event is false
+PASS 'message' in event is false
+PASS 'source' in event is true
+PASS event.source != null is true
+PASS 'onsuccess' in event.target is true
+PASS 'onerror' in event.target is true
+PASS 'readyState' in event.target is true
+PASS event.target.readyState is event.target.DONE
+
+event.source.add({x: 'value', y: 'zzz'}, 'key')
+PASS 'onsuccess' in result is true
+PASS 'onerror' in result is true
+PASS 'readyState' in result is true
+An event should fire shortly...
+
+event.preventDefault()
+PASS Transaction completed
+
+
+trans = db.transaction([], webkitIDBTransaction.READ_WRITE)
+trans.onabort = transactionAborted1
+trans.oncomplete = unexpectedCompleteCallback
+store = trans.objectStore('storeName')
+store.add({x: 'value', y: 'zzz'}, 'key')
+PASS 'onsuccess' in result is true
+PASS 'onerror' in result is true
+PASS 'readyState' in result is true
+An event should fire shortly...
+
+Doing nothing to prevent the default action...
+PASS Transaction aborted
+
+
+trans = db.transaction([], webkitIDBTransaction.READ_WRITE)
+trans.onabort = transactionAborted2
+trans.oncomplete = unexpectedCompleteCallback
+store = trans.objectStore('storeName')
+store.add({x: 'value', y: 'zzz'}, 'key')
+PASS 'onsuccess' in result is true
+PASS 'onerror' in result is true
+PASS 'readyState' in result is true
+An event should fire shortly...
+
+Omitting an onerror handler
+PASS Transaction aborted
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/storage/indexeddb/error-causes-abort-by-default.html b/LayoutTests/storage/indexeddb/error-causes-abort-by-default.html
new file mode 100644
index 0000000..ab4c58a
--- /dev/null
+++ b/LayoutTests/storage/indexeddb/error-causes-abort-by-default.html
@@ -0,0 +1,127 @@
+<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("Verify that a transaction with an error aborts unless preventDefault() is called.");
+if (window.layoutTestController)
+ layoutTestController.waitUntilDone();
+
+function test()
+{
+ result = evalAndLog("webkitIndexedDB.open('name')");
+ verifyResult(result);
+ result.onsuccess = setVersion;
+ result.onerror = unexpectedErrorCallback;
+}
+
+function setVersion()
+{
+ verifySuccessEvent(event);
+ db = evalAndLog("db = event.result");
+
+ result = evalAndLog("db.setVersion('new version')");
+ verifyResult(result);
+ result.onsuccess = deleteExisting;
+ result.onerror = unexpectedErrorCallback;
+}
+
+function deleteExisting()
+{
+ debug("setVersionSuccess():");
+ verifySuccessEvent(event);
+ window.trans = evalAndLog("trans = event.result");
+ shouldBeTrue("trans !== null");
+ trans.onabort = unexpectedAbortCallback;
+ evalAndLog("trans.oncomplete = addData");
+
+ deleteAllObjectStores(db, createObjectStore);
+}
+
+function createObjectStore()
+{
+ evalAndLog("db.createObjectStore('storeName', null)");
+}
+
+function addData()
+{
+ trans = evalAndLog("trans = db.transaction([], webkitIDBTransaction.READ_WRITE)");
+ evalAndLog("trans.onabort = unexpectedAbortCallback");
+ evalAndLog("trans.oncomplete = transactionCompleted");
+ store = evalAndLog("store = trans.objectStore('storeName')");
+ result = evalAndLog("store.add({x: 'value', y: 'zzz'}, 'key')");
+ verifyResult(result);
+ result.onsuccess = addMore;
+ result.onerror = unexpectedErrorCallback;
+}
+
+function addMore()
+{
+ verifySuccessEvent(event);
+
+ result = evalAndLog("event.source.add({x: 'value', y: 'zzz'}, 'key')");
+ verifyResult(result);
+ result.onsuccess = unexpectedSuccessCallback;
+ result.addEventListener("error", preventTheDefault);
+}
+
+function preventTheDefault()
+{
+ evalAndLog("event.preventDefault()");
+}
+
+function transactionCompleted()
+{
+ testPassed("Transaction completed");
+ debug("");
+ debug("");
+ trans = evalAndLog("trans = db.transaction([], webkitIDBTransaction.READ_WRITE)");
+ evalAndLog("trans.onabort = transactionAborted1");
+ evalAndLog("trans.oncomplete = unexpectedCompleteCallback");
+ store = evalAndLog("store = trans.objectStore('storeName')");
+ result = evalAndLog("store.add({x: 'value', y: 'zzz'}, 'key')");
+ verifyResult(result);
+ result.onsuccess = unexpectedSuccessCallback;
+ result.onerror = allowDefault;
+}
+
+function allowDefault()
+{
+ debug("Doing nothing to prevent the default action...");
+}
+
+function transactionAborted1()
+{
+ testPassed("Transaction aborted");
+ debug("");
+ debug("");
+ trans = evalAndLog("trans = db.transaction([], webkitIDBTransaction.READ_WRITE)");
+ evalAndLog("trans.onabort = transactionAborted2");
+ evalAndLog("trans.oncomplete = unexpectedCompleteCallback");
+ store = evalAndLog("store = trans.objectStore('storeName')");
+ result = evalAndLog("store.add({x: 'value', y: 'zzz'}, 'key')");
+ verifyResult(result);
+ result.onsuccess = unexpectedSuccessCallback;
+ debug("Omitting an onerror handler");
+}
+
+function transactionAborted2()
+{
+ testPassed("Transaction aborted");
+ done();
+}
+
+test();
+
+var successfullyParsed = true;
+
+</script>
+</body>
+</html>
diff --git a/LayoutTests/storage/indexeddb/index-basics-expected.txt b/LayoutTests/storage/indexeddb/index-basics-expected.txt
index 099dde3..d18a09a 100644
--- a/LayoutTests/storage/indexeddb/index-basics-expected.txt
+++ b/LayoutTests/storage/indexeddb/index-basics-expected.txt
@@ -183,6 +183,7 @@ PASS 'readyState' in event.target is true
PASS event.target.readyState is event.target.DONE
PASS event.code is webkitIDBDatabaseException.NOT_FOUND_ERR
+event.preventDefault()
indexObject.get('does not exist')
PASS 'onsuccess' in result is true
PASS 'onerror' in result is true
@@ -201,6 +202,7 @@ PASS 'readyState' in event.target is true
PASS event.target.readyState is event.target.DONE
PASS event.code is webkitIDBDatabaseException.NOT_FOUND_ERR
+event.preventDefault()
indexObject.openKeyCursor()
PASS 'onsuccess' in result is true
PASS 'onerror' in result is true
diff --git a/LayoutTests/storage/indexeddb/index-basics.html b/LayoutTests/storage/indexeddb/index-basics.html
index d5eec0a..863566a 100644
--- a/LayoutTests/storage/indexeddb/index-basics.html
+++ b/LayoutTests/storage/indexeddb/index-basics.html
@@ -144,6 +144,8 @@ function getObjectDataFail()
verifyErrorEvent(event);
shouldBe("event.code", "webkitIDBDatabaseException.NOT_FOUND_ERR");
+ evalAndLog("event.preventDefault()");
+
result = evalAndLog("indexObject.get('does not exist')");
verifyResult(result);
result.onsuccess = unexpectedSuccessCallback;
@@ -155,6 +157,8 @@ function openKeyCursor()
verifyErrorEvent(event);
shouldBe("event.code", "webkitIDBDatabaseException.NOT_FOUND_ERR");
+ evalAndLog("event.preventDefault()");
+
window.result = evalAndLog("indexObject.openKeyCursor()");
verifyResult(result);
result.onsuccess = cursor1Continue;
diff --git a/LayoutTests/storage/indexeddb/index-cursor.html b/LayoutTests/storage/indexeddb/index-cursor.html
index 1a04d57..97985a4 100644
--- a/LayoutTests/storage/indexeddb/index-cursor.html
+++ b/LayoutTests/storage/indexeddb/index-cursor.html
@@ -187,7 +187,7 @@ function runNextTest()
else
keyRange = webkitIDBKeyRange.upperBound(testData[upper], upperIsOpen);
- var request = indexObject.openKeyCursor({range: keyRange, direction: ascending ? webkitIDBCursor.NEXT : webkitIDBCursor.PREV});
+ var request = indexObject.openKeyCursor(keyRange, ascending ? webkitIDBCursor.NEXT : webkitIDBCursor.PREV);
request.onsuccess = cursorIteration;
request.onerror = unexpectedErrorCallback;
}
@@ -254,7 +254,7 @@ function testNullKeyRange()
debug("");
debug(str);
- var request = indexObject.openKeyCursor({direction: ascending ? webkitIDBCursor.NEXT : webkitIDBCursor.PREV});
+ var request = indexObject.openKeyCursor(null, ascending ? webkitIDBCursor.NEXT : webkitIDBCursor.PREV);
request.onsuccess = cursorIteration;
request.onerror = unexpectedErrorCallback;
}
diff --git a/LayoutTests/storage/indexeddb/objectstore-autoincrement-expected.txt b/LayoutTests/storage/indexeddb/objectstore-autoincrement-expected.txt
index 8e36c96..5ba278b 100644
--- a/LayoutTests/storage/indexeddb/objectstore-autoincrement-expected.txt
+++ b/LayoutTests/storage/indexeddb/objectstore-autoincrement-expected.txt
@@ -55,15 +55,15 @@ PASS storeNames.contains('StoreWithAutoIncrement') is true
PASS storeNames.contains('PlainOldStore') is true
PASS storeNames.length is 3
setVersionCompleted():
-trans = db.transaction({mode: webkitIDBTransaction.READ_WRITE})
+trans = db.transaction([], webkitIDBTransaction.READ_WRITE)
store = trans.objectStore('StoreWithKeyPath')
-Insert in object store with key gen and key path
-store.add({name: 'Lincoln', number: '7012'})
-addLincolnError():
-Error event fired:
-PASS 'result' in event is false
-PASS 'code' in event is true
-PASS 'message' in event is true
+Insert into object store with auto increment and key path, with key in the object.
+store.add({name: 'Jeffersson', number: '7010', id: 3})
+addJefferssonSuccess():
+Success event fired:
+PASS 'result' in event is true
+PASS 'code' in event is false
+PASS 'message' in event is false
PASS 'source' in event is true
PASS event.source != null is true
PASS 'onsuccess' in event.target is true
@@ -71,11 +71,10 @@ PASS 'onerror' in event.target is true
PASS 'readyState' in event.target is true
PASS event.target.readyState is event.target.DONE
-PASS event.code is webkitIDBDatabaseException.UNKNOWN_ERR
-store = trans.objectStore('StoreWithAutoIncrement')
-Insert into object store with key gen using explicit key
-store.add({name: 'Lincoln'}, 1)
-addWithExplicitKeyError():
+PASS event.result is 3
+Insert into object store with auto increment and key path, without key in the object.
+store.add({name: 'Lincoln', number: '7012'})
+addLincolnError():
Error event fired:
PASS 'result' in event is false
PASS 'code' in event is true
@@ -87,9 +86,11 @@ PASS 'onerror' in event.target is true
PASS 'readyState' in event.target is true
PASS event.target.readyState is event.target.DONE
-PASS event.code is webkitIDBDatabaseException.DATA_ERR
-Insert into object store with key gen and no key path
-store.add({name: 'Lincoln', number: '7012'})
+PASS event.code is webkitIDBDatabaseException.UNKNOWN_ERR
+event.preventDefault()
+store = trans.objectStore('StoreWithAutoIncrement')
+Insert into object store with key gen using explicit key
+store.add({name: 'Lincoln', number: '7012'}, 5)
addLincolnSuccess():
Success event fired:
PASS 'result' in event is true
@@ -102,8 +103,8 @@ PASS 'onerror' in event.target is true
PASS 'readyState' in event.target is true
PASS event.target.readyState is event.target.DONE
-PASS event.result is 1
-store.get(1)
+PASS event.result is 5
+store.get(5)
getLincolnSuccess():
Success event fired:
PASS 'result' in event is true
@@ -131,8 +132,8 @@ PASS 'onerror' in event.target is true
PASS 'readyState' in event.target is true
PASS event.target.readyState is event.target.DONE
-PASS event.result is 2
-store.get(2)
+PASS event.result is 6
+store.get(6)
getAbrahamSuccess():
Success event fired:
PASS 'result' in event is true
@@ -163,6 +164,7 @@ PASS 'readyState' in event.target is true
PASS event.target.readyState is event.target.DONE
PASS event.code is webkitIDBDatabaseException.DATA_ERR
+event.preventDefault()
store.add({name: 'Adam'}, 1)
addAdamSuccess():
Success event fired:
diff --git a/LayoutTests/storage/indexeddb/objectstore-autoincrement.html b/LayoutTests/storage/indexeddb/objectstore-autoincrement.html
index 2b44a7a..0c0e9f5 100644
--- a/LayoutTests/storage/indexeddb/objectstore-autoincrement.html
+++ b/LayoutTests/storage/indexeddb/objectstore-autoincrement.html
@@ -68,13 +68,25 @@ function setVersionCompleted()
{
debug("setVersionCompleted():");
- window.trans = evalAndLog("trans = db.transaction({mode: webkitIDBTransaction.READ_WRITE})");
+ window.trans = evalAndLog("trans = db.transaction([], webkitIDBTransaction.READ_WRITE)");
trans.onabort = unexpectedAbortCallback;
trans.oncomplete = done;
window.store = evalAndLog("store = trans.objectStore('StoreWithKeyPath')");
- debug("Insert in object store with key gen and key path");
+ debug("Insert into object store with auto increment and key path, with key in the object.");
+ result = evalAndLog("store.add({name: 'Jeffersson', number: '7010', id: 3})");
+ result.onsuccess = addJefferssonSuccess;
+ result.onerror = unexpectedErrorCallback;
+}
+
+function addJefferssonSuccess()
+{
+ debug("addJefferssonSuccess():");
+ verifySuccessEvent(event);
+ shouldBe("event.result", "3");
+
+ debug("Insert into object store with auto increment and key path, without key in the object.");
result = evalAndLog("store.add({name: 'Lincoln', number: '7012'})");
result.onsuccess = unexpectedSuccessCallback;
result.onerror = addLincolnError;
@@ -87,32 +99,21 @@ function addLincolnError()
// FIXME: This should be implemented, but we make it an error for now.
shouldBe("event.code", "webkitIDBDatabaseException.UNKNOWN_ERR");
+ evalAndLog("event.preventDefault()");
+
window.store = evalAndLog("store = trans.objectStore('StoreWithAutoIncrement')");
debug("Insert into object store with key gen using explicit key");
- result = evalAndLog("store.add({name: 'Lincoln'}, 1)");
- result.onsuccess = unexpectedSuccessCallback;
- result.onerror = addWithExplicitKeyError;
-}
-
-function addWithExplicitKeyError()
-{
- debug("addWithExplicitKeyError():");
- verifyErrorEvent(event);
- shouldBe("event.code", "webkitIDBDatabaseException.DATA_ERR");
-
- debug("Insert into object store with key gen and no key path");
- result = evalAndLog("store.add({name: 'Lincoln', number: '7012'})");
+ result = evalAndLog("store.add({name: 'Lincoln', number: '7012'}, 5)");
result.onsuccess = addLincolnSuccess;
- result.onerror = unexpectedErrorCallback;
}
function addLincolnSuccess()
{
debug("addLincolnSuccess():");
verifySuccessEvent(event);
- shouldBe("event.result", "1");
+ shouldBe("event.result", "5");
- result = evalAndLog("store.get(1)");
+ result = evalAndLog("store.get(5)");
result.onsuccess = getLincolnSuccess;
result.onerror = unexpectedErrorCallback;
}
@@ -133,9 +134,9 @@ function putAbrahamSuccess()
{
debug("putAbrahamSuccess():");
verifySuccessEvent(event);
- shouldBe("event.result", "2");
+ shouldBe("event.result", "6");
- result = evalAndLog("store.get(2)");
+ result = evalAndLog("store.get(6)");
result.onsuccess = getAbrahamSuccess;
result.onerror = unexpectedErrorCallback;
}
@@ -160,6 +161,8 @@ function addAdamError()
verifyErrorEvent(event);
shouldBe("event.code", "webkitIDBDatabaseException.DATA_ERR");
+ evalAndLog("event.preventDefault()");
+
result = evalAndLog("store.add({name: 'Adam'}, 1)");
result.onsuccess = addAdamSuccess;
result.onerror = unexpectedErrorCallback;
diff --git a/LayoutTests/storage/indexeddb/objectstore-basics-expected.txt b/LayoutTests/storage/indexeddb/objectstore-basics-expected.txt
index b842dcc..cfbdbbf 100644
--- a/LayoutTests/storage/indexeddb/objectstore-basics-expected.txt
+++ b/LayoutTests/storage/indexeddb/objectstore-basics-expected.txt
@@ -95,7 +95,7 @@ PASS store.indexNames[1] is null
PASS store.indexNames[100] is null
PASS store.indexNames.item(1) is null
PASS store.indexNames.item(100) is null
-transaction = db.transaction({mode: webkitIDBTransaction.READ_WRITE})
+transaction = db.transaction([], webkitIDBTransaction.READ_WRITE)
store = transaction.objectStore('storeName')
Try to insert data with a Date key:
store.add({x: 'foo'}, testDate)
@@ -137,7 +137,8 @@ PASS 'readyState' in event.target is true
PASS event.target.readyState is event.target.DONE
PASS event.code is webkitIDBDatabaseException.UNKNOWN_ERR
-db.transaction({mode: webkitIDBTransaction.READ_WRITE})
+event.preventDefault()
+db.transaction([], webkitIDBTransaction.READ_WRITE)
store = transaction.objectStore('storeName')
store.add({x: 'othervalue'}, null)
PASS 'onsuccess' in result is true
@@ -158,7 +159,8 @@ PASS 'readyState' in event.target is true
PASS event.target.readyState is event.target.DONE
PASS event.code is webkitIDBDatabaseException.DATA_ERR
-db.transaction({mode: webkitIDBTransaction.READ_WRITE})
+event.preventDefault()
+db.transaction([], webkitIDBTransaction.READ_WRITE)
store = transaction.objectStore('storeName')
store.add({x: null}, 'validkey')
PASS 'onsuccess' in result is true
@@ -179,7 +181,8 @@ PASS 'readyState' in event.target is true
PASS event.target.readyState is event.target.DONE
PASS event.code is webkitIDBDatabaseException.DATA_ERR
-db.transaction({mode: webkitIDBTransaction.READ_WRITE})
+event.preventDefault()
+db.transaction([], webkitIDBTransaction.READ_WRITE)
store = transaction.objectStore('storeName')
store.get('key')
PASS 'onsuccess' in result is true
diff --git a/LayoutTests/storage/indexeddb/objectstore-basics.html b/LayoutTests/storage/indexeddb/objectstore-basics.html
index d388aa0..46b771e 100644
--- a/LayoutTests/storage/indexeddb/objectstore-basics.html
+++ b/LayoutTests/storage/indexeddb/objectstore-basics.html
@@ -141,7 +141,7 @@ var testDateB = new Date("Wed Jan 05 2011 15:54:49");
function addData()
{
- var transaction = evalAndLog("transaction = db.transaction({mode: webkitIDBTransaction.READ_WRITE})");
+ var transaction = evalAndLog("transaction = db.transaction([], webkitIDBTransaction.READ_WRITE)");
transaction.onabort = unexpectedAbortCallback;
window.store = evalAndLog("store = transaction.objectStore('storeName')");
@@ -179,7 +179,7 @@ function addSuccess()
result = evalAndLog("event.source.add({x: 'foo'}, 'zzz')");
verifyResult(result);
result.onsuccess = unexpectedSuccessCallback;
- result.onerror = addAgainFailure;
+ result.addEventListener('error', addAgainFailure, false);
}
function addAgainFailure()
@@ -189,14 +189,16 @@ function addAgainFailure()
// FIXME: This error code needs to be specced.
shouldBe("event.code", "webkitIDBDatabaseException.UNKNOWN_ERR");
- transaction = evalAndLog("db.transaction({mode: webkitIDBTransaction.READ_WRITE})");
+ evalAndLog("event.preventDefault()");
+
+ transaction = evalAndLog("db.transaction([], webkitIDBTransaction.READ_WRITE)");
transaction.onabort = unexpectedErrorCallback;
var store = evalAndLog("store = transaction.objectStore('storeName')");
result = evalAndLog("store.add({x: 'othervalue'}, null)");
verifyResult(result);
result.onsuccess = unexpectedSuccessCallback;
- result.onerror = addWithNullKeyFailure;
+ result.addEventListener('error', addWithNullKeyFailure, true);
}
function addWithNullKeyFailure()
@@ -205,7 +207,9 @@ function addWithNullKeyFailure()
verifyErrorEvent(event);
shouldBe("event.code", "webkitIDBDatabaseException.DATA_ERR");
- transaction = evalAndLog("db.transaction({mode: webkitIDBTransaction.READ_WRITE})");
+ evalAndLog("event.preventDefault()");
+
+ transaction = evalAndLog("db.transaction([], webkitIDBTransaction.READ_WRITE)");
transaction.onabort = unexpectedErrorCallback;
var store = evalAndLog("store = transaction.objectStore('storeName')");
@@ -221,13 +225,15 @@ function addWithNullIndexFailure()
verifyErrorEvent(event);
shouldBe("event.code", "webkitIDBDatabaseException.DATA_ERR");
- transaction = evalAndLog("db.transaction({mode: webkitIDBTransaction.READ_WRITE})");
+ evalAndLog("event.preventDefault()");
+
+ transaction = evalAndLog("db.transaction([], webkitIDBTransaction.READ_WRITE)");
transaction.onabort = unexpectedErrorCallback;
var store = evalAndLog("store = transaction.objectStore('storeName')");
result = evalAndLog("store.get('key')");
verifyResult(result);
- result.onsuccess = getSuccess;
+ result.addEventListener('success', getSuccess, true);
result.onerror = unexpectedErrorCallback;
}
@@ -239,7 +245,7 @@ function getSuccess()
var store = evalAndLog("store = event.source");
result = evalAndLog("store.get(testDate)");
- result.onsuccess = getSuccessDateKey;
+ result.addEventListener('success', getSuccessDateKey, false);
result.onerror = unexpectedErrorCallback;
}
diff --git a/LayoutTests/storage/indexeddb/objectstore-clear-expected.txt b/LayoutTests/storage/indexeddb/objectstore-clear-expected.txt
new file mode 100644
index 0000000..5d99fcb
--- /dev/null
+++ b/LayoutTests/storage/indexeddb/objectstore-clear-expected.txt
@@ -0,0 +1,151 @@
+Test IndexedDB's webkitIDBObjectStore.clear().
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+webkitIndexedDB.open('name')
+PASS 'onsuccess' in result is true
+PASS 'onerror' in result is true
+PASS 'readyState' in result is true
+An event should fire shortly...
+
+Success event fired:
+PASS 'result' in event is true
+PASS 'code' in event is false
+PASS 'message' in event is false
+PASS 'source' in event is true
+PASS event.source != null is true
+PASS 'onsuccess' in event.target is true
+PASS 'onerror' in event.target is true
+PASS 'readyState' in event.target is true
+PASS event.target.readyState is event.target.DONE
+
+db = event.result
+db.setVersion('new version')
+PASS 'onsuccess' in result is true
+PASS 'onerror' in result is true
+PASS 'readyState' in result is true
+An event should fire shortly...
+
+Success event fired:
+PASS 'result' in event is true
+PASS 'code' in event is false
+PASS 'message' in event is false
+PASS 'source' in event is true
+PASS event.source != null is true
+PASS 'onsuccess' in event.target is true
+PASS 'onerror' in event.target is true
+PASS 'readyState' in event.target is true
+PASS event.target.readyState is event.target.DONE
+
+trans = event.result
+PASS trans !== null is true
+Deleted all object stores.
+store = db.createObjectStore('storeName', null)
+store.createIndex('indexName', '')
+PASS store.indexNames.contains('indexName') is true
+store.add('value', 'key')
+PASS 'onsuccess' in result is true
+PASS 'onerror' in result is true
+PASS 'readyState' in result is true
+An event should fire shortly...
+
+Success event fired:
+PASS 'result' in event is true
+PASS 'code' in event is false
+PASS 'message' in event is false
+PASS 'source' in event is true
+PASS event.source != null is true
+PASS 'onsuccess' in event.target is true
+PASS 'onerror' in event.target is true
+PASS 'readyState' in event.target is true
+PASS event.target.readyState is event.target.DONE
+
+otherStore = db.createObjectStore('otherStoreName', null)
+otherStore.add('value', 'key')
+PASS 'onsuccess' in result is true
+PASS 'onerror' in result is true
+PASS 'readyState' in result is true
+An event should fire shortly...
+
+Success event fired:
+PASS 'result' in event is true
+PASS 'code' in event is false
+PASS 'message' in event is false
+PASS 'source' in event is true
+PASS event.source != null is true
+PASS 'onsuccess' in event.target is true
+PASS 'onerror' in event.target is true
+PASS 'readyState' in event.target is true
+PASS event.target.readyState is event.target.DONE
+
+store.clear()
+PASS 'onsuccess' in result is true
+PASS 'onerror' in result is true
+PASS 'readyState' in result is true
+An event should fire shortly...
+
+Success event fired:
+PASS 'result' in event is true
+PASS 'code' in event is false
+PASS 'message' in event is false
+PASS 'source' in event is true
+PASS event.source != null is true
+PASS 'onsuccess' in event.target is true
+PASS 'onerror' in event.target is true
+PASS 'readyState' in event.target is true
+PASS event.target.readyState is event.target.DONE
+
+PASS event.result is undefined.
+store.openCursor()
+Success event fired:
+PASS 'result' in event is true
+PASS 'code' in event is false
+PASS 'message' in event is false
+PASS 'source' in event is true
+PASS event.source != null is true
+PASS 'onsuccess' in event.target is true
+PASS 'onerror' in event.target is true
+PASS 'readyState' in event.target is true
+PASS event.target.readyState is event.target.DONE
+
+PASS event.result is null
+index = store.index('indexName')
+index.openKeyCursor()
+openKeyCursorSuccess():
+Success event fired:
+PASS 'result' in event is true
+PASS 'code' in event is false
+PASS 'message' in event is false
+PASS 'source' in event is true
+PASS event.source != null is true
+PASS 'onsuccess' in event.target is true
+PASS 'onerror' in event.target is true
+PASS 'readyState' in event.target is true
+PASS event.target.readyState is event.target.DONE
+
+PASS event.result is null
+db.transaction({mode: webkitIDBTransaction.READ_WRITE})
+otherStore = transaction.objectStore('otherStoreName')
+otherStore.get('key')
+PASS 'onsuccess' in result is true
+PASS 'onerror' in result is true
+PASS 'readyState' in result is true
+An event should fire shortly...
+
+Success event fired:
+PASS 'result' in event is true
+PASS 'code' in event is false
+PASS 'message' in event is false
+PASS 'source' in event is true
+PASS event.source != null is true
+PASS 'onsuccess' in event.target is true
+PASS 'onerror' in event.target is true
+PASS 'readyState' in event.target is true
+PASS event.target.readyState is event.target.DONE
+
+PASS event.result is "value"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/storage/indexeddb/objectstore-clear.html b/LayoutTests/storage/indexeddb/objectstore-clear.html
new file mode 100644
index 0000000..7f4034f
--- /dev/null
+++ b/LayoutTests/storage/indexeddb/objectstore-clear.html
@@ -0,0 +1,130 @@
+<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's webkitIDBObjectStore.clear().");
+if (window.layoutTestController)
+ layoutTestController.waitUntilDone();
+
+function test()
+{
+ result = evalAndLog("webkitIndexedDB.open('name')");
+ verifyResult(result);
+ result.onsuccess = startSetVersion;
+ result.onerror = unexpectedErrorCallback;
+}
+
+function startSetVersion()
+{
+ verifySuccessEvent(event);
+ db = evalAndLog("db = event.result");
+
+ result = evalAndLog("db.setVersion('new version')");
+ verifyResult(result);
+ result.onsuccess = deleteExisting;
+ result.onerror = unexpectedErrorCallback;
+}
+
+function deleteExisting()
+{
+ verifySuccessEvent(event);
+ window.trans = evalAndLog("trans = event.result");
+ shouldBeTrue("trans !== null");
+
+ deleteAllObjectStores(db, createObjectStoreAndAddValue);
+}
+
+function createObjectStoreAndAddValue()
+{
+ store = evalAndLog("store = db.createObjectStore('storeName', null)");
+
+ window.index = evalAndLog("store.createIndex('indexName', '')");
+ shouldBeTrue("store.indexNames.contains('indexName')");
+
+ result = evalAndLog("store.add('value', 'key')");
+ verifyResult(result);
+ result.onsuccess = createSecondObjectStoreAndAddValue;
+ result.onerror = unexpectedErrorCallback;
+}
+
+function createSecondObjectStoreAndAddValue()
+{
+ verifySuccessEvent(event);
+
+ otherStore = evalAndLog("otherStore = db.createObjectStore('otherStoreName', null)");
+
+ result = evalAndLog("otherStore.add('value', 'key')");
+ verifyResult(result);
+ result.onsuccess = clearObjectStore;
+ result.onerror = unexpectedErrorCallback;
+}
+
+function clearObjectStore()
+{
+ verifySuccessEvent(event);
+
+ result = evalAndLog("store.clear()");
+ verifyResult(result);
+ result.onsuccess = clearSuccess;
+ result.onerror = unexpectedErrorCallback;
+}
+
+function clearSuccess()
+{
+ verifySuccessEvent(event);
+ shouldBeUndefined("event.result");
+
+ result = evalAndLog("store.openCursor()");
+ result.onsuccess = openCursorSuccess;
+ result.onerror = unexpectedErrorCallback;
+}
+
+function openCursorSuccess()
+{
+ verifySuccessEvent(event);
+ shouldBeNull("event.result");
+
+ index = evalAndLog("index = store.index('indexName')");
+ result = evalAndLog("index.openKeyCursor()");
+ result.onsuccess = openKeyCursorSuccess;
+ result.onerror = unexpectedErrorCallback;
+}
+
+function openKeyCursorSuccess()
+{
+ debug("openKeyCursorSuccess():");
+ verifySuccessEvent(event);
+ shouldBeNull("event.result");
+
+ transaction = evalAndLog("db.transaction({mode: webkitIDBTransaction.READ_WRITE})");
+ transaction.onabort = unexpectedErrorCallback;
+ var otherStore = evalAndLog("otherStore = transaction.objectStore('otherStoreName')");
+
+ result = evalAndLog("otherStore.get('key')");
+ verifyResult(result);
+ result.onsuccess = getSuccess;
+ result.onerror = unexpectedErrorCallback;
+}
+
+function getSuccess()
+{
+ verifySuccessEvent(event);
+ shouldBeEqualToString("event.result", "value");
+
+ done();
+}
+
+test();
+
+var successfullyParsed = true;
+</script>
+</body>
+</html>
diff --git a/LayoutTests/storage/indexeddb/objectstore-cursor.html b/LayoutTests/storage/indexeddb/objectstore-cursor.html
index e0db08f..bb7b65b 100644
--- a/LayoutTests/storage/indexeddb/objectstore-cursor.html
+++ b/LayoutTests/storage/indexeddb/objectstore-cursor.html
@@ -165,7 +165,7 @@ function runNextTest()
else
keyRange = webkitIDBKeyRange.upperBound(testData[upper], upperIsOpen);
- var request = objectStore.openCursor({range: keyRange, direction: ascending ? webkitIDBCursor.NEXT : webkitIDBCursor.PREV});
+ var request = objectStore.openCursor(keyRange, ascending ? webkitIDBCursor.NEXT : webkitIDBCursor.PREV);
request.onsuccess = cursorIteration;
request.onerror = unexpectedErrorCallback;
}
@@ -231,7 +231,7 @@ function testNullKeyRange()
debug("");
debug(str);
- var request = objectStore.openCursor({direction: ascending ? webkitIDBCursor.NEXT : webkitIDBCursor.PREV});
+ var request = objectStore.openCursor(null, ascending ? webkitIDBCursor.NEXT : webkitIDBCursor.PREV);
request.onsuccess = cursorIteration;
request.onerror = unexpectedErrorCallback;
}
diff --git a/LayoutTests/storage/indexeddb/open-cursor-expected.txt b/LayoutTests/storage/indexeddb/open-cursor-expected.txt
index d40436c..ddaa51a 100644
--- a/LayoutTests/storage/indexeddb/open-cursor-expected.txt
+++ b/LayoutTests/storage/indexeddb/open-cursor-expected.txt
@@ -50,7 +50,7 @@ PASS 'readyState' in result is true
An event should fire shortly...
Opening cursor
-event.source.openCursor({range: keyRange})
+event.source.openCursor(keyRange)
PASS 'onsuccess' in result is true
PASS 'onerror' in result is true
PASS 'readyState' in result is true
@@ -76,7 +76,7 @@ Passing an invalid key into .continue().
PASS Caught exception: Error: TYPE_MISMATCH_ERR: DOM Exception 17
Opening an empty cursor.
-objectStore.openCursor({range: keyRange})
+objectStore.openCursor(keyRange)
PASS 'onsuccess' in result is true
PASS 'onerror' in result is true
PASS 'readyState' in result is true
diff --git a/LayoutTests/storage/indexeddb/open-cursor.html b/LayoutTests/storage/indexeddb/open-cursor.html
index e4dc8f0..17ed9ab 100644
--- a/LayoutTests/storage/indexeddb/open-cursor.html
+++ b/LayoutTests/storage/indexeddb/open-cursor.html
@@ -26,7 +26,7 @@ function openEmptyCursor()
{
debug("Opening an empty cursor.");
keyRange = webkitIDBKeyRange.lowerBound("InexistentKey");
- result = evalAndLog("objectStore.openCursor({range: keyRange})");
+ result = evalAndLog("objectStore.openCursor(keyRange)");
verifyResult(result);
result.onsuccess = emptyCursorSuccess;
result.onerror = unexpectedErrorCallback;
@@ -56,7 +56,7 @@ function openCursor()
{
debug("Opening cursor");
keyRange = webkitIDBKeyRange.lowerBound("myKey");
- result = evalAndLog("event.source.openCursor({range: keyRange})");
+ result = evalAndLog("event.source.openCursor(keyRange)");
verifyResult(result);
result.onsuccess = cursorSuccess;
result.onerror = unexpectedErrorCallback;
diff --git a/LayoutTests/storage/indexeddb/request-event-propagation-expected.txt b/LayoutTests/storage/indexeddb/request-event-propagation-expected.txt
new file mode 100644
index 0000000..deda6a7
--- /dev/null
+++ b/LayoutTests/storage/indexeddb/request-event-propagation-expected.txt
@@ -0,0 +1,166 @@
+Test event propogation on IDBRequest.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+webkitIndexedDB.open('name')
+PASS 'onsuccess' in result is true
+PASS 'onerror' in result is true
+PASS 'readyState' in result is true
+An event should fire shortly...
+
+Success event fired:
+PASS 'result' in event is true
+PASS 'code' in event is false
+PASS 'message' in event is false
+PASS 'source' in event is true
+PASS event.source != null is true
+PASS 'onsuccess' in event.target is true
+PASS 'onerror' in event.target is true
+PASS 'readyState' in event.target is true
+PASS event.target.readyState is event.target.DONE
+
+db = event.result
+db.setVersion('new version')
+PASS 'onsuccess' in result is true
+PASS 'onerror' in result is true
+PASS 'readyState' in result is true
+An event should fire shortly...
+
+setVersionSuccess():
+Success event fired:
+PASS 'result' in event is true
+PASS 'code' in event is false
+PASS 'message' in event is false
+PASS 'source' in event is true
+PASS event.source != null is true
+PASS 'onsuccess' in event.target is true
+PASS 'onerror' in event.target is true
+PASS 'readyState' in event.target is true
+PASS event.target.readyState is event.target.DONE
+
+trans = event.result
+PASS trans !== null is true
+trans.oncomplete = startTest
+Deleted all object stores.
+store = db.createObjectStore('storeName', null)
+store.add({x: 'value', y: 'zzz'}, 'key')
+Verify that handler fires and that not preventing default will result in an abort
+trans = db.transaction([], webkitIDBTransaction.READ_WRITE)
+trans.onabort = transactionAborted
+trans.oncomplete = unexpectedCompleteCallback
+trans.onerror = allowDefault
+store = trans.objectStore('storeName')
+store.add({x: 'value', y: 'zzz'}, 'key')
+PASS Event handler fired
+Doing nothing to prevent the default action...
+PASS handlerFired is true
+
+Verifing error
+trans = db.transaction([], webkitIDBTransaction.READ_WRITE)
+trans.onabort = transactionAborted2
+trans.oncomplete = unexpectedAbortCallback
+trans.addEventListener('error', errorCaptureCallback, true)
+trans.addEventListener('error', errorBubbleCallback, false)
+trans.addEventListener('success', unexpectedSuccessCallback, true)
+trans.addEventListener('success', unexpectedSuccessCallback, false)
+db.addEventListener('error', dbErrorCaptureCallback, true)
+db.addEventListener('error', dbErrorBubbleCallback, false)
+db.addEventListener('success', unexpectedSuccessCallback, true)
+db.addEventListener('success', unexpectedSuccessCallback, false)
+store = trans.objectStore('storeName')
+store.add({x: 'value', y: 'zzz'}, 'key')
+
+In IDBDatabase error capture
+PASS dbCaptureFired is false
+PASS captureFired is false
+PASS requestFired is false
+PASS bubbleFired is false
+PASS dbBubbleFired is false
+
+In IDBTransaction error capture
+PASS dbCaptureFired is true
+PASS captureFired is false
+PASS requestFired is false
+PASS bubbleFired is false
+PASS dbBubbleFired is false
+
+In IDBRequest handler
+PASS dbCaptureFired is true
+PASS captureFired is true
+PASS requestFired is false
+PASS bubbleFired is false
+PASS dbBubbleFired is false
+
+In IDBTransaction error bubble
+PASS dbCaptureFired is true
+PASS captureFired is true
+PASS requestFired is true
+PASS bubbleFired is false
+PASS dbBubbleFired is false
+
+In IDBDatabase error bubble
+PASS dbCaptureFired is true
+PASS captureFired is true
+PASS requestFired is true
+PASS bubbleFired is true
+PASS dbBubbleFired is false
+
+Transaction aborted
+PASS dbCaptureFired is true
+PASS captureFired is true
+PASS requestFired is true
+PASS bubbleFired is true
+PASS dbBubbleFired is true
+
+Verifing success.
+trans = db.transaction([], webkitIDBTransaction.READ_WRITE)
+trans.oncomplete = transactionComplete
+trans.onabort = unexpectedAbortCallback
+trans.addEventListener('success', successCaptureCallback, true)
+trans.addEventListener('success', successBubbleCallback, false)
+trans.addEventListener('error', unexpectedErrorCallback, true)
+trans.addEventListener('error', unexpectedErrorCallback, false)
+db.removeEventListener('error', dbErrorCaptureCallback, true)
+db.removeEventListener('error', dbErrorBubbleCallback, false)
+db.removeEventListener('success', unexpectedSuccessCallback, true)
+db.removeEventListener('success', unexpectedSuccessCallback, false)
+db.addEventListener('success', dbSuccessCaptureCallback, true)
+db.addEventListener('success', dbSuccessBubbleCallback, false)
+db.addEventListener('error', unexpectedErrorCallback, true)
+db.addEventListener('error', unexpectedErrorCallback, false)
+store = trans.objectStore('storeName')
+store.add({x: 'value', y: 'zzz'}, 'key2')
+
+In IDBDatabase success capture
+PASS dbCaptureFired is false
+PASS captureFired is false
+PASS requestFired is false
+PASS bubbleFired is false
+PASS dbBubbleFired is false
+
+In IDBTransaction success capture
+PASS dbCaptureFired is true
+PASS captureFired is false
+PASS requestFired is false
+PASS bubbleFired is false
+PASS dbBubbleFired is false
+
+In IDBRequest handler
+PASS dbCaptureFired is true
+PASS captureFired is true
+PASS requestFired is false
+PASS bubbleFired is false
+PASS dbBubbleFired is false
+
+Transaction completed
+PASS dbCaptureFired is true
+PASS captureFired is true
+PASS requestFired is true
+PASS bubbleFired is false
+PASS dbBubbleFired is false
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/storage/indexeddb/request-event-propagation.html b/LayoutTests/storage/indexeddb/request-event-propagation.html
new file mode 100644
index 0000000..87f6a2d
--- /dev/null
+++ b/LayoutTests/storage/indexeddb/request-event-propagation.html
@@ -0,0 +1,272 @@
+<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 event propogation on IDBRequest.");
+if (window.layoutTestController)
+ layoutTestController.waitUntilDone();
+
+function test()
+{
+ result = evalAndLog("webkitIndexedDB.open('name')");
+ verifyResult(result);
+ result.onsuccess = setVersion;
+ result.onerror = unexpectedErrorCallback;
+}
+
+function setVersion()
+{
+ verifySuccessEvent(event);
+ db = evalAndLog("db = event.result");
+
+ result = evalAndLog("db.setVersion('new version')");
+ verifyResult(result);
+ result.onsuccess = deleteExisting;
+ result.onerror = unexpectedErrorCallback;
+}
+
+function deleteExisting()
+{
+ debug("setVersionSuccess():");
+ verifySuccessEvent(event);
+ window.trans = evalAndLog("trans = event.result");
+ shouldBeTrue("trans !== null");
+ trans.onabort = unexpectedAbortCallback;
+ evalAndLog("trans.oncomplete = startTest");
+
+ deleteAllObjectStores(db, createObjectStore);
+}
+
+function createObjectStore()
+{
+ store = evalAndLog("store = db.createObjectStore('storeName', null)");
+ result = evalAndLog("store.add({x: 'value', y: 'zzz'}, 'key')");
+ result.onerror = unexpectedErrorCallback;
+}
+
+function startTest()
+{
+ debug("Verify that handler fires and that not preventing default will result in an abort");
+ trans = evalAndLog("trans = db.transaction([], webkitIDBTransaction.READ_WRITE)");
+ evalAndLog("trans.onabort = transactionAborted");
+ evalAndLog("trans.oncomplete = unexpectedCompleteCallback");
+ evalAndLog("trans.onerror = allowDefault");
+ store = evalAndLog("store = trans.objectStore('storeName')");
+ result = evalAndLog("store.add({x: 'value', y: 'zzz'}, 'key')");
+ result.onsuccess = unexpectedSuccessCallback;
+ handlerFired = false;
+}
+
+function allowDefault()
+{
+ testPassed("Event handler fired");
+ debug("Doing nothing to prevent the default action...");
+ handlerFired = true;
+}
+
+function transactionAborted()
+{
+ shouldBeTrue("handlerFired");
+ debug("");
+ debug("Verifing error");
+ trans = evalAndLog("trans = db.transaction([], webkitIDBTransaction.READ_WRITE)");
+ evalAndLog("trans.onabort = transactionAborted2");
+ evalAndLog("trans.oncomplete = unexpectedAbortCallback");
+ evalAndLog("trans.addEventListener('error', errorCaptureCallback, true)");
+ evalAndLog("trans.addEventListener('error', errorBubbleCallback, false)");
+ evalAndLog("trans.addEventListener('success', unexpectedSuccessCallback, true)");
+ evalAndLog("trans.addEventListener('success', unexpectedSuccessCallback, false)");
+ evalAndLog("db.addEventListener('error', dbErrorCaptureCallback, true)");
+ evalAndLog("db.addEventListener('error', dbErrorBubbleCallback, false)");
+ evalAndLog("db.addEventListener('success', unexpectedSuccessCallback, true)");
+ evalAndLog("db.addEventListener('success', unexpectedSuccessCallback, false)");
+ store = evalAndLog("store = trans.objectStore('storeName')");
+ result = evalAndLog("store.add({x: 'value', y: 'zzz'}, 'key')");
+ result.onsuccess = unexpectedSuccessCallback;
+ result.onerror = errorFiredCallback;
+ dbCaptureFired = false;
+ captureFired = false;
+ requestFired = false;
+ bubbleFired = false;
+ dbBubbleFired = false;
+}
+
+function dbErrorCaptureCallback()
+{
+ debug("");
+ debug("In IDBDatabase error capture");
+ shouldBeFalse("dbCaptureFired");
+ shouldBeFalse("captureFired");
+ shouldBeFalse("requestFired");
+ shouldBeFalse("bubbleFired");
+ shouldBeFalse("dbBubbleFired");
+ dbCaptureFired = true;
+}
+
+function errorCaptureCallback()
+{
+ debug("");
+ debug("In IDBTransaction error capture");
+ shouldBeTrue("dbCaptureFired");
+ shouldBeFalse("captureFired");
+ shouldBeFalse("requestFired");
+ shouldBeFalse("bubbleFired");
+ shouldBeFalse("dbBubbleFired");
+ captureFired = true;
+}
+
+function errorFiredCallback()
+{
+ debug("");
+ debug("In IDBRequest handler");
+ shouldBeTrue("dbCaptureFired");
+ shouldBeTrue("captureFired");
+ shouldBeFalse("requestFired");
+ shouldBeFalse("bubbleFired");
+ shouldBeFalse("dbBubbleFired");
+ requestFired = true;
+}
+
+function errorBubbleCallback()
+{
+ debug("");
+ debug("In IDBTransaction error bubble");
+ shouldBeTrue("dbCaptureFired");
+ shouldBeTrue("captureFired");
+ shouldBeTrue("requestFired");
+ shouldBeFalse("bubbleFired");
+ shouldBeFalse("dbBubbleFired");
+ bubbleFired = true;
+}
+
+function dbErrorBubbleCallback()
+{
+ debug("");
+ debug("In IDBDatabase error bubble");
+ shouldBeTrue("dbCaptureFired");
+ shouldBeTrue("captureFired");
+ shouldBeTrue("requestFired");
+ shouldBeTrue("bubbleFired");
+ shouldBeFalse("dbBubbleFired");
+ dbBubbleFired = true;
+}
+
+function transactionAborted2()
+{
+ debug("");
+ debug("Transaction aborted");
+ shouldBeTrue("dbCaptureFired");
+ shouldBeTrue("captureFired");
+ shouldBeTrue("requestFired");
+ shouldBeTrue("bubbleFired");
+ shouldBeTrue("dbBubbleFired");
+ debug("");
+ debug("Verifing success.");
+ trans = evalAndLog("trans = db.transaction([], webkitIDBTransaction.READ_WRITE)");
+ evalAndLog("trans.oncomplete = transactionComplete");
+ evalAndLog("trans.onabort = unexpectedAbortCallback");
+ evalAndLog("trans.addEventListener('success', successCaptureCallback, true)");
+ evalAndLog("trans.addEventListener('success', successBubbleCallback, false)");
+ evalAndLog("trans.addEventListener('error', unexpectedErrorCallback, true)");
+ evalAndLog("trans.addEventListener('error', unexpectedErrorCallback, false)");
+ evalAndLog("db.removeEventListener('error', dbErrorCaptureCallback, true)");
+ evalAndLog("db.removeEventListener('error', dbErrorBubbleCallback, false)");
+ evalAndLog("db.removeEventListener('success', unexpectedSuccessCallback, true)");
+ evalAndLog("db.removeEventListener('success', unexpectedSuccessCallback, false)");
+ evalAndLog("db.addEventListener('success', dbSuccessCaptureCallback, true)");
+ evalAndLog("db.addEventListener('success', dbSuccessBubbleCallback, false)");
+ evalAndLog("db.addEventListener('error', unexpectedErrorCallback, true)");
+ evalAndLog("db.addEventListener('error', unexpectedErrorCallback, false)");
+ store = evalAndLog("store = trans.objectStore('storeName')");
+ result = evalAndLog("store.add({x: 'value', y: 'zzz'}, 'key2')");
+ result.onerror = unexpectedErrorCallback;
+ result.onsuccess = successFiredCallback;
+ dbCaptureFired = false;
+ captureFired = false;
+ requestFired = false;
+ bubbleFired = false;
+ dbBubbleFired = false;
+}
+
+function dbSuccessCaptureCallback()
+{
+ debug("");
+ debug("In IDBDatabase success capture");
+ shouldBeFalse("dbCaptureFired");
+ shouldBeFalse("captureFired");
+ shouldBeFalse("requestFired");
+ shouldBeFalse("bubbleFired");
+ shouldBeFalse("dbBubbleFired");
+ dbCaptureFired = true;
+}
+
+function successCaptureCallback()
+{
+ debug("");
+ debug("In IDBTransaction success capture");
+ shouldBeTrue("dbCaptureFired");
+ shouldBeFalse("captureFired");
+ shouldBeFalse("requestFired");
+ shouldBeFalse("bubbleFired");
+ shouldBeFalse("dbBubbleFired");
+ captureFired = true;
+}
+
+function successFiredCallback()
+{
+ debug("");
+ debug("In IDBRequest handler");
+ shouldBeTrue("dbCaptureFired");
+ shouldBeTrue("captureFired");
+ shouldBeFalse("requestFired");
+ shouldBeFalse("bubbleFired");
+ shouldBeFalse("dbBubbleFired");
+ requestFired = true;
+}
+
+function successBubbleCallback()
+{
+ debug("");
+ debug("In IDBTransaction success bubble");
+ testFailed("Success bubble callback should NOT fire");
+ bubbleFired = true;
+}
+
+function dbSuccessBubbleCallback()
+{
+ debug("");
+ debug("In IDBDatabase success bubble");
+ testFailed("Success bubble callback should NOT fire");
+ dbBubbleFired = true;
+}
+
+function transactionComplete()
+{
+ debug("");
+ debug("Transaction completed");
+ shouldBeTrue("dbCaptureFired");
+ shouldBeTrue("captureFired");
+ shouldBeTrue("requestFired");
+ shouldBeFalse("bubbleFired");
+ shouldBeFalse("dbBubbleFired");
+ debug("");
+
+ done();
+ return;
+}
+
+test();
+
+var successfullyParsed = true;
+
+</script>
+</body>
+</html>
diff --git a/LayoutTests/storage/indexeddb/transaction-after-close-expected.txt b/LayoutTests/storage/indexeddb/transaction-after-close-expected.txt
new file mode 100644
index 0000000..653bd87
--- /dev/null
+++ b/LayoutTests/storage/indexeddb/transaction-after-close-expected.txt
@@ -0,0 +1,95 @@
+Test closing a database connection in IndexedDB.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS 'webkitIndexedDB' in window is true
+PASS webkitIndexedDB == null is false
+webkitIndexedDB.open('some db name')
+PASS 'onsuccess' in result is true
+PASS 'onerror' in result is true
+PASS 'readyState' in result is true
+An event should fire shortly...
+
+openSuccess():
+Success event fired:
+PASS 'result' in event is true
+PASS 'code' in event is false
+PASS 'message' in event is false
+PASS 'source' in event is true
+PASS event.source != null is true
+PASS 'onsuccess' in event.target is true
+PASS 'onerror' in event.target is true
+PASS 'readyState' in event.target is true
+PASS event.target.readyState is event.target.DONE
+
+db = event.result
+result = db.setVersion('version 1')
+Success event fired:
+PASS 'result' in event is true
+PASS 'code' in event is false
+PASS 'message' in event is false
+PASS 'source' in event is true
+PASS event.source != null is true
+PASS 'onsuccess' in event.target is true
+PASS 'onerror' in event.target is true
+PASS 'readyState' in event.target is true
+PASS event.target.readyState is event.target.DONE
+
+Deleted all object stores.
+store = db.createObjectStore('store')
+request = store.put('x', 'y')
+Success event fired:
+PASS 'result' in event is true
+PASS 'code' in event is false
+PASS 'message' in event is false
+PASS 'source' in event is true
+PASS event.source != null is true
+PASS 'onsuccess' in event.target is true
+PASS 'onerror' in event.target is true
+PASS 'readyState' in event.target is true
+PASS event.target.readyState is event.target.DONE
+
+running first transaction
+currentTransaction = db.transaction([], webkitIDBTransaction.READ_WRITE)
+objectStore.put('a', 'b')
+db.close()
+Expecting exception from db.transaction([], webkitIDBTransaction.READ_WRITE)
+PASS code is webkitIDBDatabaseException.NOT_ALLOWED_ERR
+
+verify that we can reopen the db after calling close
+webkitIndexedDB.open('some db name')
+PASS 'onsuccess' in result is true
+PASS 'onerror' in result is true
+PASS 'readyState' in result is true
+An event should fire shortly...
+
+Success event fired:
+PASS 'result' in event is true
+PASS 'code' in event is false
+PASS 'message' in event is false
+PASS 'source' in event is true
+PASS event.source != null is true
+PASS 'onsuccess' in event.target is true
+PASS 'onerror' in event.target is true
+PASS 'readyState' in event.target is true
+PASS event.target.readyState is event.target.DONE
+
+second_db = event.result
+currentTransaction = second_db.transaction([], webkitIDBTransaction.READ_WRITE)
+request = store.put('1', '2')
+Success event fired:
+PASS 'result' in event is true
+PASS 'code' in event is false
+PASS 'message' in event is false
+PASS 'source' in event is true
+PASS event.source != null is true
+PASS 'onsuccess' in event.target is true
+PASS 'onerror' in event.target is true
+PASS 'readyState' in event.target is true
+PASS event.target.readyState is event.target.DONE
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/storage/indexeddb/transaction-after-close.html b/LayoutTests/storage/indexeddb/transaction-after-close.html
new file mode 100644
index 0000000..718c05a
--- /dev/null
+++ b/LayoutTests/storage/indexeddb/transaction-after-close.html
@@ -0,0 +1,105 @@
+<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 closing a database connection in IndexedDB.");
+if (window.layoutTestController)
+ layoutTestController.waitUntilDone();
+
+function test()
+{
+ shouldBeTrue("'webkitIndexedDB' in window");
+ shouldBeFalse("webkitIndexedDB == null");
+
+ result = evalAndLog("webkitIndexedDB.open('some db name')");
+ verifyResult(result);
+ result.onsuccess = openSuccess;
+ result.onerror = unexpectedErrorCallback;
+}
+
+function openSuccess()
+{
+ debug("openSuccess():");
+ verifySuccessEvent(event);
+ window.db = evalAndLog("db = event.result");
+ result = evalAndLog("result = db.setVersion('version 1')");
+ result.onsuccess = inSetVersion;
+ result.onerror = unexpectedErrorCallback;
+}
+
+function inSetVersion()
+{
+ verifySuccessEvent(event);
+ deleteAllObjectStores(db, doSetVersionStuff);
+}
+
+function doSetVersionStuff()
+{
+ event.result.oncomplete = runFirstRegularTransaction;
+ event.result.onabort = unexpectedAbortCallback;
+ store = evalAndLog("store = db.createObjectStore('store')");
+ request = evalAndLog("request = store.put('x', 'y')");
+ request.onsuccess = onPutSuccess;
+ request.onerror = unexpectedErrorCallback;
+}
+
+function onPutSuccess()
+{
+ verifySuccessEvent(event);
+}
+
+function runFirstRegularTransaction()
+{
+ debug("running first transaction")
+ currentTransaction = evalAndLog("currentTransaction = db.transaction([], webkitIDBTransaction.READ_WRITE)");
+ currentTransaction.onabort = unexpectedAbortCallback;
+ currentTransaction.oncomplete = firstTransactionComplete;
+ objectStore = currentTransaction.objectStore('store');
+ result = evalAndLog("objectStore.put('a', 'b')");
+ result.onerror = unexpectedErrorCallback;
+}
+
+function firstTransactionComplete()
+{
+ evalAndLog("db.close()");
+ evalAndExpectException("db.transaction([], webkitIDBTransaction.READ_WRITE)", "webkitIDBDatabaseException.NOT_ALLOWED_ERR");
+
+ debug("")
+ debug("verify that we can reopen the db after calling close")
+ result = evalAndLog("webkitIndexedDB.open('some db name')");
+ verifyResult(result);
+ result.onsuccess = onSecondOpen
+ result.onerror = unexpectedErrorCallback;
+}
+
+function onSecondOpen() {
+ verifySuccessEvent(event);
+ second_db = evalAndLog("second_db = event.result");
+ currentTransaction = evalAndLog("currentTransaction = second_db.transaction([], webkitIDBTransaction.READ_WRITE)");
+ store = currentTransaction.objectStore('store');
+ request = evalAndLog("request = store.put('1', '2')");
+ request.onsuccess = onFinalPutSuccess;
+ request.onerror = unexpectedErrorCallback;
+ currentTransaction.oncomplete = done;
+ currentTransaction.onabort = unexpectedAbortCallback;
+}
+
+function onFinalPutSuccess() {
+ verifySuccessEvent(event);
+}
+
+var successfullyParsed = true;
+
+test();
+
+</script>
+</body>
+</html>
diff --git a/LayoutTests/storage/indexeddb/transaction-and-objectstore-calls-expected.txt b/LayoutTests/storage/indexeddb/transaction-and-objectstore-calls-expected.txt
index df373d6..36ca01e 100644
--- a/LayoutTests/storage/indexeddb/transaction-and-objectstore-calls-expected.txt
+++ b/LayoutTests/storage/indexeddb/transaction-and-objectstore-calls-expected.txt
@@ -17,42 +17,42 @@ trans = event.result
Deleted all object stores.
db.createObjectStore('a')
db.createObjectStore('b')
-trans.oncomplete = created
+trans.addEventListener('complete', created, true)
-trans = db.transaction({objectStoreNames: 'a'})
+trans = db.transaction(['a'])
trans.objectStore('a')
Expecting exception from trans.objectStore('b')
PASS code is webkitIDBDatabaseException.NOT_FOUND_ERR
Expecting exception from trans.objectStore('x')
PASS code is webkitIDBDatabaseException.NOT_FOUND_ERR
-trans = db.transaction({objectStoreNames: ['a']})
+trans = db.transaction(['a'])
trans.objectStore('a')
Expecting exception from trans.objectStore('b')
PASS code is webkitIDBDatabaseException.NOT_FOUND_ERR
Expecting exception from trans.objectStore('x')
PASS code is webkitIDBDatabaseException.NOT_FOUND_ERR
-trans = db.transaction({objectStoreNames: ['b']})
+trans = db.transaction(['b'])
trans.objectStore('b')
Expecting exception from trans.objectStore('a')
PASS code is webkitIDBDatabaseException.NOT_FOUND_ERR
Expecting exception from trans.objectStore('x')
PASS code is webkitIDBDatabaseException.NOT_FOUND_ERR
-trans = db.transaction({objectStoreNames: ['a', 'b']})
+trans = db.transaction(['a', 'b'])
trans.objectStore('a')
trans.objectStore('b')
Expecting exception from trans.objectStore('x')
PASS code is webkitIDBDatabaseException.NOT_FOUND_ERR
-trans = db.transaction({objectStoreNames: ['b', 'a']})
+trans = db.transaction(['b', 'a'])
trans.objectStore('a')
trans.objectStore('b')
Expecting exception from trans.objectStore('x')
PASS code is webkitIDBDatabaseException.NOT_FOUND_ERR
-trans = db.transaction({objectStoreNames: []})
+trans = db.transaction([])
trans.objectStore('a')
trans.objectStore('b')
Expecting exception from trans.objectStore('x')
@@ -64,15 +64,15 @@ trans.objectStore('b')
Expecting exception from trans.objectStore('x')
PASS code is webkitIDBDatabaseException.NOT_FOUND_ERR
-Expecting exception from db.transaction({objectStoreNames: 'x'})
+Expecting exception from db.transaction(['x'])
PASS code is webkitIDBDatabaseException.NOT_FOUND_ERR
-Expecting exception from db.transaction({objectStoreNames: ['x']})
+Expecting exception from db.transaction(['x'])
PASS code is webkitIDBDatabaseException.NOT_FOUND_ERR
-Expecting exception from db.transaction({objectStoreNames: ['a', 'x']})
+Expecting exception from db.transaction(['a', 'x'])
PASS code is webkitIDBDatabaseException.NOT_FOUND_ERR
-Expecting exception from db.transaction({objectStoreNames: ['x', 'x']})
+Expecting exception from db.transaction(['x', 'x'])
PASS code is webkitIDBDatabaseException.NOT_FOUND_ERR
-Expecting exception from db.transaction({objectStoreNames: ['a', 'x', 'b']})
+Expecting exception from db.transaction(['a', 'x', 'b'])
PASS code is webkitIDBDatabaseException.NOT_FOUND_ERR
PASS successfullyParsed is true
diff --git a/LayoutTests/storage/indexeddb/transaction-and-objectstore-calls.html b/LayoutTests/storage/indexeddb/transaction-and-objectstore-calls.html
index 580ca5d..144df4f 100644
--- a/LayoutTests/storage/indexeddb/transaction-and-objectstore-calls.html
+++ b/LayoutTests/storage/indexeddb/transaction-and-objectstore-calls.html
@@ -43,43 +43,43 @@ function cleaned()
{
evalAndLog("db.createObjectStore('a')");
evalAndLog("db.createObjectStore('b')");
- evalAndLog("trans.oncomplete = created");
+ evalAndLog("trans.addEventListener('complete', created, true)");
debug("");
}
function created()
{
- trans = evalAndLog("trans = db.transaction({objectStoreNames: 'a'})");
+ trans = evalAndLog("trans = db.transaction(['a'])");
evalAndLog("trans.objectStore('a')");
evalAndExpectException("trans.objectStore('b')", "webkitIDBDatabaseException.NOT_FOUND_ERR");
evalAndExpectException("trans.objectStore('x')", "webkitIDBDatabaseException.NOT_FOUND_ERR");
debug("");
- trans = evalAndLog("trans = db.transaction({objectStoreNames: ['a']})");
+ trans = evalAndLog("trans = db.transaction(['a'])");
evalAndLog("trans.objectStore('a')");
evalAndExpectException("trans.objectStore('b')", "webkitIDBDatabaseException.NOT_FOUND_ERR");
evalAndExpectException("trans.objectStore('x')", "webkitIDBDatabaseException.NOT_FOUND_ERR");
debug("");
- trans = evalAndLog("trans = db.transaction({objectStoreNames: ['b']})");
+ trans = evalAndLog("trans = db.transaction(['b'])");
evalAndLog("trans.objectStore('b')");
evalAndExpectException("trans.objectStore('a')", "webkitIDBDatabaseException.NOT_FOUND_ERR");
evalAndExpectException("trans.objectStore('x')", "webkitIDBDatabaseException.NOT_FOUND_ERR");
debug("");
- trans = evalAndLog("trans = db.transaction({objectStoreNames: ['a', 'b']})");
+ trans = evalAndLog("trans = db.transaction(['a', 'b'])");
evalAndLog("trans.objectStore('a')");
evalAndLog("trans.objectStore('b')");
evalAndExpectException("trans.objectStore('x')", "webkitIDBDatabaseException.NOT_FOUND_ERR");
debug("");
- trans = evalAndLog("trans = db.transaction({objectStoreNames: ['b', 'a']})");
+ trans = evalAndLog("trans = db.transaction(['b', 'a'])");
evalAndLog("trans.objectStore('a')");
evalAndLog("trans.objectStore('b')");
evalAndExpectException("trans.objectStore('x')", "webkitIDBDatabaseException.NOT_FOUND_ERR");
debug("");
- trans = evalAndLog("trans = db.transaction({objectStoreNames: []})");
+ trans = evalAndLog("trans = db.transaction([])");
evalAndLog("trans.objectStore('a')");
evalAndLog("trans.objectStore('b')");
evalAndExpectException("trans.objectStore('x')", "webkitIDBDatabaseException.NOT_FOUND_ERR");
@@ -91,11 +91,11 @@ function created()
evalAndExpectException("trans.objectStore('x')", "webkitIDBDatabaseException.NOT_FOUND_ERR");
debug("");
- evalAndExpectException("db.transaction({objectStoreNames: 'x'})", "webkitIDBDatabaseException.NOT_FOUND_ERR");
- evalAndExpectException("db.transaction({objectStoreNames: ['x']})", "webkitIDBDatabaseException.NOT_FOUND_ERR");
- evalAndExpectException("db.transaction({objectStoreNames: ['a', 'x']})", "webkitIDBDatabaseException.NOT_FOUND_ERR");
- evalAndExpectException("db.transaction({objectStoreNames: ['x', 'x']})", "webkitIDBDatabaseException.NOT_FOUND_ERR");
- evalAndExpectException("db.transaction({objectStoreNames: ['a', 'x', 'b']})", "webkitIDBDatabaseException.NOT_FOUND_ERR");
+ evalAndExpectException("db.transaction(['x'])", "webkitIDBDatabaseException.NOT_FOUND_ERR");
+ evalAndExpectException("db.transaction(['x'])", "webkitIDBDatabaseException.NOT_FOUND_ERR");
+ evalAndExpectException("db.transaction(['a', 'x'])", "webkitIDBDatabaseException.NOT_FOUND_ERR");
+ evalAndExpectException("db.transaction(['x', 'x'])", "webkitIDBDatabaseException.NOT_FOUND_ERR");
+ evalAndExpectException("db.transaction(['a', 'x', 'b'])", "webkitIDBDatabaseException.NOT_FOUND_ERR");
debug("");
done();
diff --git a/LayoutTests/storage/indexeddb/transaction-basics.html b/LayoutTests/storage/indexeddb/transaction-basics.html
index 8995e6d..9626129 100644
--- a/LayoutTests/storage/indexeddb/transaction-basics.html
+++ b/LayoutTests/storage/indexeddb/transaction-basics.html
@@ -55,7 +55,7 @@ function addRemoveIDBObjects()
verifySuccessEvent(event);
var trans = evalAndLog("trans = event.result");
shouldBeTrue("trans !== null");
- trans.onabort = testSetVersionAbort2;
+ trans.addEventListener('abort', testSetVersionAbort2, true);
trans.oncomplete = unexpectedCompleteCallback;
var store = evalAndLog("store = db.createObjectStore('storeFail', null)");
@@ -80,7 +80,7 @@ function addRemoveAddIDBObjects()
verifySuccessEvent(event);
var trans = evalAndLog("trans = event.result");
shouldBeTrue("trans !== null");
- trans.onabort = testSetVersionAbort3;
+ trans.addEventListener('abort', testSetVersionAbort3, false);
trans.oncomplete = unexpectedCompleteCallback;
var store = evalAndLog("store = db.createObjectStore('storeFail', null)");
@@ -209,7 +209,7 @@ function setVersionSuccess()
window.trans = evalAndLog("trans = event.result");
shouldBeTrue("trans !== null");
trans.onabort = unexpectedAbortCallback;
- trans.oncomplete = completeCallback;
+ trans.addEventListener('complete', completeCallback, false);
window.completeEventFired = false;
deleteAllObjectStores(db, createObjectStoreAndStartTransaction);
diff --git a/LayoutTests/storage/indexeddb/transaction-event-propagation-expected.txt b/LayoutTests/storage/indexeddb/transaction-event-propagation-expected.txt
new file mode 100644
index 0000000..9d04b0a
--- /dev/null
+++ b/LayoutTests/storage/indexeddb/transaction-event-propagation-expected.txt
@@ -0,0 +1,79 @@
+Test event propogation on IDBTransaction.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+webkitIndexedDB.open('name')
+PASS 'onsuccess' in result is true
+PASS 'onerror' in result is true
+PASS 'readyState' in result is true
+An event should fire shortly...
+
+db = event.result
+db.setVersion('new version')
+PASS 'onsuccess' in result is true
+PASS 'onerror' in result is true
+PASS 'readyState' in result is true
+An event should fire shortly...
+
+trans = event.result
+PASS trans !== null is true
+trans.oncomplete = startTest
+Deleted all object stores.
+store = db.createObjectStore('storeName', null)
+store.add({x: 'value', y: 'zzz'}, 'key')
+Verifing abort
+trans = db.transaction([], webkitIDBTransaction.READ_WRITE)
+trans.onabort = abortFiredCallback
+trans.oncomplete = unexpectedAbortCallback
+db.addEventListener('abort', dbAbortCaptureCallback, true)
+db.addEventListener('abort', dbAbortBubbleCallback, false)
+db.addEventListener('complete', unexpectedCompleteCallback, true)
+db.addEventListener('complete', unexpectedCompleteCallback, false)
+store = trans.objectStore('storeName')
+store.add({x: 'value', y: 'zzz'}, 'key')
+
+In IDBDatabase abort capture
+PASS dbCaptureFired is false
+PASS abortFired is false
+PASS dbBubbleFired1 is false
+
+In abort handler
+PASS dbCaptureFired is true
+PASS abortFired is false
+PASS dbBubbleFired1 is false
+
+In IDBDatabase error bubble
+PASS dbCaptureFired is true
+PASS abortFired is true
+PASS dbBubbleFired1 is false
+
+Verifing success.
+trans = db.transaction([], webkitIDBTransaction.READ_WRITE)
+trans.oncomplete = completeFiredCallback
+trans.onabort = unexpectedAbortCallback
+db.removeEventListener('abort', dbAbortCaptureCallback, true)
+db.removeEventListener('abort', dbAbortBubbleCallback, false)
+db.removeEventListener('complete', unexpectedCompleteCallback, true)
+db.removeEventListener('complete', unexpectedCompleteCallback, false)
+db.addEventListener('complete', dbCompleteCaptureCallback, true)
+db.addEventListener('complete', dbCompleteBubbleCallback, false)
+db.addEventListener('abort', unexpectedAbortCallback, true)
+db.addEventListener('abort', unexpectedAbortCallback, false)
+store = trans.objectStore('storeName')
+store.add({x: 'value', y: 'zzz'}, 'key2')
+
+In IDBDatabase complete capture
+PASS dbCaptureFired is false
+PASS completeFired is false
+PASS dbBubbleFired2 is false
+
+In IDBRequest handler
+PASS dbCaptureFired is true
+PASS completeFired is false
+PASS dbBubbleFired2 is false
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/storage/indexeddb/transaction-event-propagation.html b/LayoutTests/storage/indexeddb/transaction-event-propagation.html
new file mode 100644
index 0000000..c31646a
--- /dev/null
+++ b/LayoutTests/storage/indexeddb/transaction-event-propagation.html
@@ -0,0 +1,153 @@
+<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 event propogation on IDBTransaction.");
+if (window.layoutTestController)
+ layoutTestController.waitUntilDone();
+
+function test()
+{
+ result = evalAndLog("webkitIndexedDB.open('name')");
+ verifyResult(result);
+ result.onsuccess = setVersion;
+ result.onerror = unexpectedErrorCallback;
+}
+
+function setVersion()
+{
+ db = evalAndLog("db = event.result");
+
+ result = evalAndLog("db.setVersion('new version')");
+ verifyResult(result);
+ result.onsuccess = deleteExisting;
+ result.onerror = unexpectedErrorCallback;
+}
+
+function deleteExisting()
+{
+ window.trans = evalAndLog("trans = event.result");
+ shouldBeTrue("trans !== null");
+ trans.onabort = unexpectedAbortCallback;
+ evalAndLog("trans.oncomplete = startTest");
+
+ deleteAllObjectStores(db, createObjectStore);
+}
+
+function createObjectStore()
+{
+ store = evalAndLog("store = db.createObjectStore('storeName', null)");
+ result = evalAndLog("store.add({x: 'value', y: 'zzz'}, 'key')");
+ result.onerror = unexpectedErrorCallback;
+}
+
+function startTest()
+{
+ debug("Verifing abort");
+ trans = evalAndLog("trans = db.transaction([], webkitIDBTransaction.READ_WRITE)");
+ evalAndLog("trans.onabort = abortFiredCallback");
+ evalAndLog("trans.oncomplete = unexpectedAbortCallback");
+ evalAndLog("db.addEventListener('abort', dbAbortCaptureCallback, true)");
+ evalAndLog("db.addEventListener('abort', dbAbortBubbleCallback, false)");
+ evalAndLog("db.addEventListener('complete', unexpectedCompleteCallback, true)");
+ evalAndLog("db.addEventListener('complete', unexpectedCompleteCallback, false)");
+ store = evalAndLog("store = trans.objectStore('storeName')");
+ evalAndLog("store.add({x: 'value', y: 'zzz'}, 'key')");
+ dbCaptureFired = false;
+ abortFired = false;
+ dbBubbleFired1 = false;
+}
+
+function dbAbortCaptureCallback()
+{
+ debug("");
+ debug("In IDBDatabase abort capture");
+ shouldBeFalse("dbCaptureFired");
+ shouldBeFalse("abortFired");
+ shouldBeFalse("dbBubbleFired1");
+ dbCaptureFired = true;
+}
+
+function abortFiredCallback()
+{
+ debug("");
+ debug("In abort handler");
+ shouldBeTrue("dbCaptureFired");
+ shouldBeFalse("abortFired");
+ shouldBeFalse("dbBubbleFired1");
+ abortFired = true;
+}
+
+function dbAbortBubbleCallback()
+{
+ debug("");
+ debug("In IDBDatabase error bubble");
+ shouldBeTrue("dbCaptureFired");
+ shouldBeTrue("abortFired");
+ shouldBeFalse("dbBubbleFired1");
+ dbBubbleFired1 = true;
+ debug("");
+ debug("Verifing success.");
+ trans = evalAndLog("trans = db.transaction([], webkitIDBTransaction.READ_WRITE)");
+ evalAndLog("trans.oncomplete = completeFiredCallback");
+ evalAndLog("trans.onabort = unexpectedAbortCallback");
+ evalAndLog("db.removeEventListener('abort', dbAbortCaptureCallback, true)");
+ evalAndLog("db.removeEventListener('abort', dbAbortBubbleCallback, false)");
+ evalAndLog("db.removeEventListener('complete', unexpectedCompleteCallback, true)");
+ evalAndLog("db.removeEventListener('complete', unexpectedCompleteCallback, false)");
+ evalAndLog("db.addEventListener('complete', dbCompleteCaptureCallback, true)");
+ evalAndLog("db.addEventListener('complete', dbCompleteBubbleCallback, false)");
+ evalAndLog("db.addEventListener('abort', unexpectedAbortCallback, true)");
+ evalAndLog("db.addEventListener('abort', unexpectedAbortCallback, false)");
+ store = evalAndLog("store = trans.objectStore('storeName')");
+ evalAndLog("store.add({x: 'value', y: 'zzz'}, 'key2')");
+ dbCaptureFired = false;
+ completeFired = false;
+ dbBubbleFired2 = false;
+}
+
+function dbCompleteCaptureCallback()
+{
+ debug("");
+ debug("In IDBDatabase complete capture");
+ shouldBeFalse("dbCaptureFired");
+ shouldBeFalse("completeFired");
+ shouldBeFalse("dbBubbleFired2");
+ dbCaptureFired = true;
+}
+
+function completeFiredCallback()
+{
+ debug("");
+ debug("In IDBRequest handler");
+ shouldBeTrue("dbCaptureFired");
+ shouldBeFalse("completeFired");
+ shouldBeFalse("dbBubbleFired2");
+ completeFired = true;
+ debug("");
+ done();
+}
+
+function dbCompleteBubbleCallback()
+{
+ debug("");
+ debug("In IDBDatabase complete bubble");
+ testFailed("Complete bubble callback should NOT fire");
+ dbBubbleFired2 = true;
+}
+
+test();
+
+var successfullyParsed = true;
+
+</script>
+</body>
+</html>
diff --git a/LayoutTests/storage/indexeddb/tutorial.html b/LayoutTests/storage/indexeddb/tutorial.html
index 445213c..0490df8 100644
--- a/LayoutTests/storage/indexeddb/tutorial.html
+++ b/LayoutTests/storage/indexeddb/tutorial.html
@@ -114,7 +114,7 @@ function onSetVersion()
{
// We are now in a setVersion transaction. Such a transaction is the only place where one
// can add or delete indexes and objectStores. The result (property of event) is an
- // IDBTransaction object that has "complete", "abort", and "timeout" event handlers which tell
+ // IDBTransaction object that has "complete" and "abort" event handlers which tell
// us when the transaction has committed, aborted, or timed out.
window.currentTransaction = event.result;
currentTransaction.oncomplete = onSetVersionComplete;
@@ -207,7 +207,7 @@ function onSetVersionComplete()
{
// Lets create a new transaction and then not schedule any work on it to watch it abort itself.
// Transactions (besides those created with setVersion) are created synchronously. Like
- // createObjectStore, transaction optionally takes in an object with various optional parameters.
+ // createObjectStore, transaction optionally takes in various optional parameters.
//
// First of all is the parameter "objectStoreNames". If you pass in a string, we lock just that
// objectStore. If you pass in an array, we lock those. Otherwise (for example, if you omit it
@@ -218,11 +218,7 @@ function onSetVersionComplete()
// Next is "mode" which specifies the locking mode. The default is READ_ONLY (i.e. a shared lock).
// That's fine for this case, but later we'll ask for IDBTransaction.READ_WRITE. At the moment,
// Chromium/WebKit pretends every transaction is READ_WRITE, which is kind of bad.
- //
- // Last is "timeout" which is measured in seconds. At the moment, Chromium/WebKit defaults to 0 which
- // means never, but it's possible we'll change this in the future and other implementations may
- // use something different, so set it if you really care.
- window.currentTransaction = db.transaction({mode: IDBTransaction.READ_WRITE, timeout: 0});
+ window.currentTransaction = db.transaction([], IDBTransaction.READ_WRITE);
currentTransaction.oncomplete = unexpectedComplete;
currentTransaction.onabort = onTransactionAborted;
@@ -272,7 +268,7 @@ function onTransactionAborted()
// Now let's make a real transaction and a person to our objectStore. Just to show it's possible,
// we'll omit the objectStoreNames parameter which means we'll lock everything even though we only
// ever access "people".
- window.currentTransaction = db.transaction({mode: IDBTransaction.READ_WRITE});
+ window.currentTransaction = db.transaction([], IDBTransaction.READ_WRITE);
currentTransaction.onabort = unexpectedAbort;
var people = currentTransaction.objectStore("people");
@@ -310,7 +306,7 @@ function onPutTransactionComplete()
// OK, now let's query the people objectStore in a couple different ways. First up, let's try get.
// It simply takes in a key and returns a request whose result will be the value. Note that here
// we're passing in an array for objectStoreNames rather than a simple string.
- window.currentTransaction = db.transaction({objectStoreNames: ["people"], mode: IDBTransaction.READ_WRITE, timeout: 0});
+ window.currentTransaction = db.transaction(["people"], IDBTransaction.READ_WRITE, 0);
currentTransaction.onabort = unexpectedAbort;
var people = currentTransaction.objectStore("people");
@@ -341,7 +337,7 @@ function onGetSuccess()
// return unique entires (only applies to indexes with unique set to false), PREV to move backwards,
// and PREV_NO_DUPLICATE.
var keyRange = IDBKeyRange.bound(1, 3, true, false);
- var request = people.openCursor({range: keyRange, direction: IDBCursor.NEXT});
+ var request = people.openCursor(keyRange, IDBCursor.NEXT);
request.onsuccess = onObjectStoreCursor;
request.onerror = unexpectedError;
}
@@ -394,10 +390,10 @@ function onIndexGetSuccess()
// different IDBKeyRanges just to demonstrate how to use them, but we won't bother to handle
// the onsuccess conditions.
var lname = event.source;
- lname.openCursor({range: IDBKeyRange.lowerBound("Doe", false), direction: IDBCursor.NEXT_NO_DUPLICATE});
- lname.openCursor({direction: IDBCursor.PREV_NO_DUPLICATE});
- lname.openCursor({range: IDBKeyRange.upperBound("ZZZZ")});
- lname.openCursor({range: IDBKeyRange.only("Doe"), direction: IDBCursor.PREV});
+ lname.openCursor(IDBKeyRange.lowerBound("Doe", false), IDBCursor.NEXT_NO_DUPLICATE);
+ lname.openCursor(null, IDBCursor.PREV_NO_DUPLICATE);
+ lname.openCursor(IDBKeyRange.upperBound("ZZZZ"));
+ lname.openCursor(IDBKeyRange.only("Doe"), IDBCursor.PREV);
lname.openCursor();
lname.openKeyCursor();