From 2fc2651226baac27029e38c9d6ef883fa32084db Mon Sep 17 00:00:00 2001 From: Steve Block Date: Wed, 18 May 2011 13:36:51 +0100 Subject: Merge WebKit at r78450: Initial merge by git. Change-Id: I6d3e5f1f868ec266a0aafdef66182ddc3f265dc1 --- .../create-object-store-options-expected.txt | 2 +- .../indexeddb/create-object-store-options.html | 2 +- .../storage/indexeddb/cursor-delete-expected.txt | 8 +- LayoutTests/storage/indexeddb/cursor-delete.html | 8 +- .../indexeddb/cursor-index-delete-expected.txt | 11 +- .../storage/indexeddb/cursor-index-delete.html | 11 +- .../indexeddb/cursor-skip-deleted-expected.txt | 185 ++++++++++++++ .../storage/indexeddb/cursor-skip-deleted.html | 218 ++++++++++++++++ .../storage/indexeddb/cursor-update-expected.txt | 283 +++++++++++++++++++++ LayoutTests/storage/indexeddb/cursor-update.html | 249 ++++++++++++++++++ .../storage/indexeddb/data-corruption-expected.txt | 69 +++++ LayoutTests/storage/indexeddb/data-corruption.html | 88 +++++++ .../storage/indexeddb/database-quota-expected.txt | 3 +- LayoutTests/storage/indexeddb/database-quota.html | 3 +- .../storage/indexeddb/duplicates-expected.txt | 4 + LayoutTests/storage/indexeddb/duplicates.html | 4 + .../error-causes-abort-by-default-expected.txt | 107 ++++++++ .../indexeddb/error-causes-abort-by-default.html | 127 +++++++++ .../storage/indexeddb/index-basics-expected.txt | 2 + LayoutTests/storage/indexeddb/index-basics.html | 4 + LayoutTests/storage/indexeddb/index-cursor.html | 4 +- .../objectstore-autoincrement-expected.txt | 42 +-- .../indexeddb/objectstore-autoincrement.html | 43 ++-- .../indexeddb/objectstore-basics-expected.txt | 11 +- .../storage/indexeddb/objectstore-basics.html | 22 +- .../indexeddb/objectstore-clear-expected.txt | 151 +++++++++++ .../storage/indexeddb/objectstore-clear.html | 130 ++++++++++ .../storage/indexeddb/objectstore-cursor.html | 4 +- .../storage/indexeddb/open-cursor-expected.txt | 4 +- LayoutTests/storage/indexeddb/open-cursor.html | 4 +- .../request-event-propagation-expected.txt | 166 ++++++++++++ .../indexeddb/request-event-propagation.html | 272 ++++++++++++++++++++ .../indexeddb/transaction-after-close-expected.txt | 95 +++++++ .../storage/indexeddb/transaction-after-close.html | 105 ++++++++ .../transaction-and-objectstore-calls-expected.txt | 24 +- .../transaction-and-objectstore-calls.html | 24 +- .../storage/indexeddb/transaction-basics.html | 6 +- .../transaction-event-propagation-expected.txt | 79 ++++++ .../indexeddb/transaction-event-propagation.html | 153 +++++++++++ LayoutTests/storage/indexeddb/tutorial.html | 24 +- 40 files changed, 2628 insertions(+), 123 deletions(-) create mode 100644 LayoutTests/storage/indexeddb/cursor-skip-deleted-expected.txt create mode 100644 LayoutTests/storage/indexeddb/cursor-skip-deleted.html create mode 100644 LayoutTests/storage/indexeddb/cursor-update-expected.txt create mode 100644 LayoutTests/storage/indexeddb/cursor-update.html create mode 100644 LayoutTests/storage/indexeddb/data-corruption-expected.txt create mode 100644 LayoutTests/storage/indexeddb/data-corruption.html create mode 100644 LayoutTests/storage/indexeddb/error-causes-abort-by-default-expected.txt create mode 100644 LayoutTests/storage/indexeddb/error-causes-abort-by-default.html create mode 100644 LayoutTests/storage/indexeddb/objectstore-clear-expected.txt create mode 100644 LayoutTests/storage/indexeddb/objectstore-clear.html create mode 100644 LayoutTests/storage/indexeddb/request-event-propagation-expected.txt create mode 100644 LayoutTests/storage/indexeddb/request-event-propagation.html create mode 100644 LayoutTests/storage/indexeddb/transaction-after-close-expected.txt create mode 100644 LayoutTests/storage/indexeddb/transaction-after-close.html create mode 100644 LayoutTests/storage/indexeddb/transaction-event-propagation-expected.txt create mode 100644 LayoutTests/storage/indexeddb/transaction-event-propagation.html (limited to 'LayoutTests/storage') 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 @@ + + + + + + + + +

+
+ + + 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 @@ + + + + + + + + +

+
+ + + 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 @@ + + + + + + + + +

+
+ + + 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 @@ + + + + + + + + +

+
+ + + 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 @@ + + + + + + + + +

+
+ + + 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 @@ + + + + + + + + +

+
+ + + 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 @@ + + + + + + + + +

+
+ + + 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 @@ + + + + + + + + +

+
+ + + 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(); -- cgit v1.1