From 4576aa36e9a9671459299c7963ac95aa94beaea9 Mon Sep 17 00:00:00 2001 From: "Shimeng (Simon) Wang" Date: Tue, 7 Dec 2010 17:22:45 -0800 Subject: Merge WebKit at r73109: Initial merge by git. Change-Id: I61f1a66d9642e3d8405d3ac6ccab2a53421c75d8 --- .../create-event-onorientationchange-expected.txt | 16 -- .../create-event-onorientationchange.html | 13 - .../create-event-onorientationchange.js | 18 -- .../script-tests/event-after-navigation.js | 6 +- .../fast/encoding/xml-utf-8-default-expected.txt | 2 + LayoutTests/fast/encoding/xml-utf-8-default.xml | 1 + LayoutTests/fast/js/resources/standalone-pre.js | 2 + .../http/tests/resources/balls-of-the-orient.aif | Bin 0 -> 670184 bytes .../private-browsing-affects-storage-expected.txt | 8 +- .../private-browsing-affects-storage-expected.txt | 8 +- LayoutTests/storage/indexeddb/basics-expected.txt | 8 +- LayoutTests/storage/indexeddb/basics.html | 23 +- .../storage/indexeddb/constants-expected.txt | 8 +- LayoutTests/storage/indexeddb/constants.html | 9 +- .../create-and-remove-object-store-expected.txt | 60 +++++ .../indexeddb/create-and-remove-object-store.html | 96 ++++++++ .../create-object-store-options-expected.txt | 33 +++ .../indexeddb/create-object-store-options.html | 102 ++++++++ .../storage/indexeddb/database-basics-expected.txt | 42 ++-- LayoutTests/storage/indexeddb/database-basics.html | 22 +- .../storage/indexeddb/database-quota-expected.txt | 18 +- LayoutTests/storage/indexeddb/database-quota.html | 18 +- .../storage/indexeddb/duplicates-expected.txt | 4 +- LayoutTests/storage/indexeddb/duplicates.html | 4 +- .../storage/indexeddb/index-basics-expected.txt | 2 +- LayoutTests/storage/indexeddb/index-basics.html | 2 +- .../storage/indexeddb/index-cursor-expected.txt | 2 +- LayoutTests/storage/indexeddb/index-cursor.html | 17 +- .../storage/indexeddb/keyrange-expected.txt | 268 +++++++++++---------- LayoutTests/storage/indexeddb/keyrange.html | 115 ++++----- .../indexeddb/objectstore-basics-expected.txt | 63 ++++- .../storage/indexeddb/objectstore-basics.html | 79 +++++- .../indexeddb/objectstore-cursor-expected.txt | 2 +- .../storage/indexeddb/objectstore-cursor.html | 15 +- .../objectstore-removeobjectstore-expected.txt | 6 +- .../indexeddb/objectstore-removeobjectstore.html | 10 +- .../storage/indexeddb/open-cursor-expected.txt | 6 +- LayoutTests/storage/indexeddb/open-cursor.html | 10 +- .../storage/indexeddb/queued-commands-expected.txt | 2 +- LayoutTests/storage/indexeddb/queued-commands.html | 2 +- LayoutTests/storage/indexeddb/resources/shared.js | 16 +- .../transaction-and-objectstore-calls-expected.txt | 81 +++++++ .../transaction-and-objectstore-calls.html | 110 +++++++++ .../indexeddb/transaction-basics-expected.txt | 50 ++-- .../storage/indexeddb/transaction-basics.html | 26 +- LayoutTests/storage/indexeddb/tutorial.html | 85 ++++--- 46 files changed, 1024 insertions(+), 466 deletions(-) delete mode 100644 LayoutTests/fast/dom/DeviceOrientation/create-event-onorientationchange-expected.txt delete mode 100644 LayoutTests/fast/dom/DeviceOrientation/create-event-onorientationchange.html delete mode 100644 LayoutTests/fast/dom/DeviceOrientation/script-tests/create-event-onorientationchange.js create mode 100644 LayoutTests/http/tests/resources/balls-of-the-orient.aif create mode 100644 LayoutTests/storage/indexeddb/create-and-remove-object-store-expected.txt create mode 100644 LayoutTests/storage/indexeddb/create-and-remove-object-store.html create mode 100644 LayoutTests/storage/indexeddb/create-object-store-options-expected.txt create mode 100644 LayoutTests/storage/indexeddb/create-object-store-options.html create mode 100644 LayoutTests/storage/indexeddb/transaction-and-objectstore-calls-expected.txt create mode 100644 LayoutTests/storage/indexeddb/transaction-and-objectstore-calls.html (limited to 'LayoutTests') diff --git a/LayoutTests/fast/dom/DeviceOrientation/create-event-onorientationchange-expected.txt b/LayoutTests/fast/dom/DeviceOrientation/create-event-onorientationchange-expected.txt deleted file mode 100644 index 0f0aac6..0000000 --- a/LayoutTests/fast/dom/DeviceOrientation/create-event-onorientationchange-expected.txt +++ /dev/null @@ -1,16 +0,0 @@ -Tests that document.createEvent() works with orientationChange - -On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". - - - -FAIL... orientationChange event doesn't appear to be enabled or implemented. - - -PASS successfullyParsed is true - -TEST COMPLETE - - - - diff --git a/LayoutTests/fast/dom/DeviceOrientation/create-event-onorientationchange.html b/LayoutTests/fast/dom/DeviceOrientation/create-event-onorientationchange.html deleted file mode 100644 index 7a033e0..0000000 --- a/LayoutTests/fast/dom/DeviceOrientation/create-event-onorientationchange.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - -

-

-
- - - - diff --git a/LayoutTests/fast/dom/DeviceOrientation/script-tests/create-event-onorientationchange.js b/LayoutTests/fast/dom/DeviceOrientation/script-tests/create-event-onorientationchange.js deleted file mode 100644 index a63685b..0000000 --- a/LayoutTests/fast/dom/DeviceOrientation/script-tests/create-event-onorientationchange.js +++ /dev/null @@ -1,18 +0,0 @@ -description('Tests that document.createEvent() works with orientationChange') - -function handleOrientationChange() -{ - document.getElementById('result').innerHTML = "PASS"; -} - -window.addEventListener('onorientationchange', handleOrientationChange, false); - -try { - var event = document.createEvent("OrientationEvent"); - event.initEvent("orientationchange", false, false); - window.dispatchEvent(event); -} catch(e) { - document.getElementById('result').innerHTML = "FAIL... orientationChange event doesn't appear to be enabled or implemented."; -} - -window.successfullyParsed = true; diff --git a/LayoutTests/fast/dom/DeviceOrientation/script-tests/event-after-navigation.js b/LayoutTests/fast/dom/DeviceOrientation/script-tests/event-after-navigation.js index 2756e55..77e4ec7 100644 --- a/LayoutTests/fast/dom/DeviceOrientation/script-tests/event-after-navigation.js +++ b/LayoutTests/fast/dom/DeviceOrientation/script-tests/event-after-navigation.js @@ -5,8 +5,10 @@ if (window.layoutTestController) else debug('This test can not be run without the LayoutTestController'); -window.addEventListener('deviceorientation', function() { } ); -window.location = "resources/event-after-navigation-new.html"; +document.body.onload = function() { + window.addEventListener('deviceorientation', function() { } ); + window.location = "resources/event-after-navigation-new.html"; +} window.jsTestIsAsync = true; window.successfullyParsed = true; diff --git a/LayoutTests/fast/encoding/xml-utf-8-default-expected.txt b/LayoutTests/fast/encoding/xml-utf-8-default-expected.txt index 04a1c26..f70fd7f 100644 --- a/LayoutTests/fast/encoding/xml-utf-8-default-expected.txt +++ b/LayoutTests/fast/encoding/xml-utf-8-default-expected.txt @@ -1,3 +1,5 @@ When dumped into a text file by the test controller, this needs to be viewed as UTF-8: This is an em dash, —, this is is a delta symbol, ∆, this is an uppercase pi, ∏, and this is a lowercase pi, π. + +Characters from unicode plane 1, like mathematical bold script capital a, 𝓐, and mathematical bold fraktur small u, 𝖚, work too. diff --git a/LayoutTests/fast/encoding/xml-utf-8-default.xml b/LayoutTests/fast/encoding/xml-utf-8-default.xml index 1f07505..705bbaf 100644 --- a/LayoutTests/fast/encoding/xml-utf-8-default.xml +++ b/LayoutTests/fast/encoding/xml-utf-8-default.xml @@ -4,6 +4,7 @@

When dumped into a text file by the test controller, this needs to be viewed as UTF-8:

This is an em dash, —, this is is a delta symbol, ∆, this is an uppercase pi, ∏, and this is a lowercase pi, π.

+

Characters from unicode plane 1, like mathematical bold script capital a, 𝓐, and mathematical bold fraktur small u, 𝖚, work too.

diff --git a/LayoutTests/fast/js/resources/standalone-pre.js b/LayoutTests/fast/js/resources/standalone-pre.js index 692f1c1..b80c3cb 100644 --- a/LayoutTests/fast/js/resources/standalone-pre.js +++ b/LayoutTests/fast/js/resources/standalone-pre.js @@ -27,6 +27,8 @@ function testFailed(msg) function areArraysEqual(_a, _b) { + if (Object.prototype.toString.call(_a) != Object.prototype.toString.call([])) + return false; if (_a.length !== _b.length) return false; for (var i = 0; i < _a.length; i++) diff --git a/LayoutTests/http/tests/resources/balls-of-the-orient.aif b/LayoutTests/http/tests/resources/balls-of-the-orient.aif new file mode 100644 index 0000000..eabe5bf Binary files /dev/null and b/LayoutTests/http/tests/resources/balls-of-the-orient.aif differ diff --git a/LayoutTests/storage/domstorage/localstorage/private-browsing-affects-storage-expected.txt b/LayoutTests/storage/domstorage/localstorage/private-browsing-affects-storage-expected.txt index 6de4296..2fea061 100644 --- a/LayoutTests/storage/domstorage/localstorage/private-browsing-affects-storage-expected.txt +++ b/LayoutTests/storage/domstorage/localstorage/private-browsing-affects-storage-expected.txt @@ -1,7 +1,7 @@ This is a test to make sure that when private browsing is on any attempt to change the localStorage area fail. -Initial value of testItem is: InitialValue +Initial value of testItem is: null Caught exception trying to change item: Error: QUOTA_EXCEEDED_ERR: DOM Exception 22 -After change attempt, testItem is: InitialValue -After remove attempt, testItem is: InitialValue -After clear attempt, testItem is: InitialValue +After change attempt, testItem is: null +After remove attempt, testItem is: null +After clear attempt, testItem is: null diff --git a/LayoutTests/storage/domstorage/sessionstorage/private-browsing-affects-storage-expected.txt b/LayoutTests/storage/domstorage/sessionstorage/private-browsing-affects-storage-expected.txt index ed2017a..58c99f2 100644 --- a/LayoutTests/storage/domstorage/sessionstorage/private-browsing-affects-storage-expected.txt +++ b/LayoutTests/storage/domstorage/sessionstorage/private-browsing-affects-storage-expected.txt @@ -1,7 +1,7 @@ This is a test to make sure that when private browsing is on any attempt to change the sessionStorage area fail. -Initial value of testItem is: InitialValue +Initial value of testItem is: null Caught exception trying to change item: Error: QUOTA_EXCEEDED_ERR: DOM Exception 22 -After change attempt, testItem is: InitialValue -After remove attempt, testItem is: InitialValue -After clear attempt, testItem is: InitialValue +After change attempt, testItem is: null +After remove attempt, testItem is: null +After clear attempt, testItem is: null diff --git a/LayoutTests/storage/indexeddb/basics-expected.txt b/LayoutTests/storage/indexeddb/basics-expected.txt index b7b8b94..cae16d8 100644 --- a/LayoutTests/storage/indexeddb/basics-expected.txt +++ b/LayoutTests/storage/indexeddb/basics-expected.txt @@ -5,7 +5,7 @@ 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('name', 'description') +webkitIndexedDB.open('name') PASS 'onsuccess' in result is true PASS 'onerror' in result is true PASS 'readyState' in result is true @@ -22,12 +22,6 @@ PASS 'onerror' in event.target is true PASS 'readyState' in event.target is true PASS event.target.readyState is event.target.DONE -webkitIndexedDB.open('name'); -PASS Exception thrown. -webkitIndexedDB.open('name', null); -PASS Exception thrown. -webkitIndexedDB.open('name', undefined); -PASS Exception thrown. PASS successfullyParsed is true TEST COMPLETE diff --git a/LayoutTests/storage/indexeddb/basics.html b/LayoutTests/storage/indexeddb/basics.html index 2e382b2..2415070 100644 --- a/LayoutTests/storage/indexeddb/basics.html +++ b/LayoutTests/storage/indexeddb/basics.html @@ -21,7 +21,7 @@ function test() // FIXME: Verify other IndexedDatabaseRequest constructors, once they're implemented. - result = evalAndLog("webkitIndexedDB.open('name', 'description')"); + result = evalAndLog("webkitIndexedDB.open('name')"); verifyResult(result); result.onsuccess = openCallback; result.onerror = unexpectedErrorCallback; @@ -30,27 +30,6 @@ function test() function openCallback() { verifySuccessEvent(event); - try { - debug("webkitIndexedDB.open('name');"); - webkitIndexedDB.open('name'); - testFailed("Calling IDBFactory::open without a description should have thrown."); - } catch (err) { - testPassed("Exception thrown."); - } - try { - debug("webkitIndexedDB.open('name', null);"); - webkitIndexedDB.open('name', null); - testFailed("Calling IDBFactory::open with a null description should have thrown."); - } catch (err) { - testPassed("Exception thrown."); - } - try { - debug("webkitIndexedDB.open('name', undefined);"); - webkitIndexedDB.open('name', undefined); - testFailed("Calling IDBFactory::open with an undefined description should have thrown."); - } catch (err) { - testPassed("Exception thrown."); - } done(); } diff --git a/LayoutTests/storage/indexeddb/constants-expected.txt b/LayoutTests/storage/indexeddb/constants-expected.txt index 8f53b56..ead0937 100644 --- a/LayoutTests/storage/indexeddb/constants-expected.txt +++ b/LayoutTests/storage/indexeddb/constants-expected.txt @@ -3,11 +3,6 @@ Test IndexedDB's constants. On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". -PASS webkitIDBKeyRange.SINGLE is 0 -PASS webkitIDBKeyRange.LEFT_OPEN is 1 -PASS webkitIDBKeyRange.RIGHT_OPEN is 2 -PASS webkitIDBKeyRange.LEFT_BOUND is 4 -PASS webkitIDBKeyRange.RIGHT_BOUND is 8 PASS webkitIDBDatabaseException.UNKNOWN_ERR is 1 PASS webkitIDBDatabaseException.NON_TRANSIENT_ERR is 1 PASS webkitIDBDatabaseException.NOT_FOUND_ERR is 2 @@ -27,8 +22,7 @@ PASS webkitIDBCursor.PREV is 2 PASS webkitIDBCursor.PREV_NO_DUPLICATE is 3 PASS webkitIDBTransaction.READ_WRITE is 0 PASS webkitIDBTransaction.READ_ONLY is 1 -PASS webkitIDBTransaction.SNAPSHOT_READ is 2 -PASS webkitIDBTransaction.VERSION_CHANGE is 3 +PASS webkitIDBTransaction.VERSION_CHANGE is 2 PASS successfullyParsed is true TEST COMPLETE diff --git a/LayoutTests/storage/indexeddb/constants.html b/LayoutTests/storage/indexeddb/constants.html index 9cdf4c4..7909e24 100644 --- a/LayoutTests/storage/indexeddb/constants.html +++ b/LayoutTests/storage/indexeddb/constants.html @@ -16,12 +16,6 @@ if (window.layoutTestController) function test() { - shouldBe("webkitIDBKeyRange.SINGLE", "0"); - shouldBe("webkitIDBKeyRange.LEFT_OPEN", "1"); - shouldBe("webkitIDBKeyRange.RIGHT_OPEN", "2"); - shouldBe("webkitIDBKeyRange.LEFT_BOUND", "4"); - shouldBe("webkitIDBKeyRange.RIGHT_BOUND", "8"); - shouldBe("webkitIDBDatabaseException.UNKNOWN_ERR", "1"); shouldBe("webkitIDBDatabaseException.NON_TRANSIENT_ERR", "1"); shouldBe("webkitIDBDatabaseException.NOT_FOUND_ERR", "2"); @@ -44,8 +38,7 @@ function test() shouldBe("webkitIDBTransaction.READ_WRITE", "0"); shouldBe("webkitIDBTransaction.READ_ONLY", "1"); - shouldBe("webkitIDBTransaction.SNAPSHOT_READ", "2"); - shouldBe("webkitIDBTransaction.VERSION_CHANGE", "3"); + shouldBe("webkitIDBTransaction.VERSION_CHANGE", "2"); } test(); diff --git a/LayoutTests/storage/indexeddb/create-and-remove-object-store-expected.txt b/LayoutTests/storage/indexeddb/create-and-remove-object-store-expected.txt new file mode 100644 index 0000000..fd14c83 --- /dev/null +++ b/LayoutTests/storage/indexeddb/create-and-remove-object-store-expected.txt @@ -0,0 +1,60 @@ +Test IndexedDB's create and removeObjectStore + +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('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 +Trying create +PASS code is webkitIDBDatabaseException.NOT_ALLOWED_ERR +Trying remove +PASS code is webkitIDBDatabaseException.NOT_ALLOWED_ERR +result = db.setVersion('version 1') +Trying create +PASS code is webkitIDBDatabaseException.NOT_ALLOWED_ERR +Trying remove +PASS code is webkitIDBDatabaseException.NOT_ALLOWED_ERR +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. +db.createObjectStore('tmp') +Adding 'tmp' again +PASS code is webkitIDBDatabaseException.CONSTRAINT_ERR +trans = db.transaction({mode: webkitIDBTransaction.READ_WRITE}) +trans.objectStore('tmp').get(0) +Trying create +PASS code is webkitIDBDatabaseException.NOT_ALLOWED_ERR +Trying remove +PASS code is webkitIDBDatabaseException.NOT_ALLOWED_ERR +PASS successfullyParsed is true + +TEST COMPLETE + diff --git a/LayoutTests/storage/indexeddb/create-and-remove-object-store.html b/LayoutTests/storage/indexeddb/create-and-remove-object-store.html new file mode 100644 index 0000000..c5284af --- /dev/null +++ b/LayoutTests/storage/indexeddb/create-and-remove-object-store.html @@ -0,0 +1,96 @@ + + + + + + + + +

+
+ + + diff --git a/LayoutTests/storage/indexeddb/create-object-store-options-expected.txt b/LayoutTests/storage/indexeddb/create-object-store-options-expected.txt new file mode 100644 index 0000000..83016d6 --- /dev/null +++ b/LayoutTests/storage/indexeddb/create-object-store-options-expected.txt @@ -0,0 +1,33 @@ +Test IndexedDB's createObjectStore's various options + +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('name', 'description') +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 +result = db.setVersion('version 1') +Deleted all object stores. +db.createObjectStore('a', {keyPath: 'a'}) +db.createObjectStore('b') +db.createObjectStore('c', {autoIncrement: true}); +PASS Exception thrown +PASS code is webkitIDBDatabaseException.UNKNOWN_ERR +trans = db.transaction({mode: webkitIDBTransaction.READ_WRITE}) +PASS trans.mode is webkitIDBTransaction.READ_WRITE +trans.objectStore('a').put({'a': 0}) +trans.objectStore('b').put({'a': 0}, 0) +trans.objectStore('a').get(0) +PASS event.result.a is {a: 0} +trans.objectStore('b').get(0) +PASS event.result.a is {a: 0} +PASS successfullyParsed is true + +TEST COMPLETE + diff --git a/LayoutTests/storage/indexeddb/create-object-store-options.html b/LayoutTests/storage/indexeddb/create-object-store-options.html new file mode 100644 index 0000000..4abb8f6 --- /dev/null +++ b/LayoutTests/storage/indexeddb/create-object-store-options.html @@ -0,0 +1,102 @@ + + + + + + + + +

+
+ + + diff --git a/LayoutTests/storage/indexeddb/database-basics-expected.txt b/LayoutTests/storage/indexeddb/database-basics-expected.txt index 2a5fa2f..f1fa5ad 100644 --- a/LayoutTests/storage/indexeddb/database-basics-expected.txt +++ b/LayoutTests/storage/indexeddb/database-basics-expected.txt @@ -3,7 +3,7 @@ Test the basics of IndexedDB's IDBDatabase. On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". -webkitIndexedDB.open('name', 'description') +webkitIndexedDB.open('name') PASS 'onsuccess' in result is true PASS 'onerror' in result is true PASS 'readyState' in result is true @@ -79,17 +79,17 @@ PASS event.target.readyState is event.target.DONE PASS db.version is "version b" PASS db.name is "name" -PASS db.objectStores is [] -PASS db.objectStores.length is 0 -PASS db.objectStores.contains('') is false -PASS db.objectStores[0] is null -PASS db.objectStores.item(0) is null +PASS db.objectStoreNames is [] +PASS db.objectStoreNames.length is 0 +PASS db.objectStoreNames.contains('') is false +PASS db.objectStoreNames[0] is null +PASS db.objectStoreNames.item(0) is null db.createObjectStore("test123") -PASS db.objectStores is ['test123'] -PASS db.objectStores.length is 1 -PASS db.objectStores.contains('') is false -PASS db.objectStores.contains('test456') is false -PASS db.objectStores.contains('test123') is true +PASS db.objectStoreNames is ['test123'] +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 db.setVersion("version c") PASS 'onsuccess' in result is true PASS 'onerror' in result is true @@ -109,20 +109,20 @@ PASS event.target.readyState is event.target.DONE PASS db.version is "version c" PASS db.name is "name" -PASS db.objectStores is ['test123'] -PASS db.objectStores.length is 1 -PASS db.objectStores.contains('') is false -PASS db.objectStores.contains('test456') is false -PASS db.objectStores.contains('test123') is true +PASS db.objectStoreNames is ['test123'] +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 db.createObjectStore("test456") setVersionTrans = event.result PASS setVersionTrans !== null is true PASS db.version is "version b" -PASS db.objectStores is ['test123'] -PASS db.objectStores.length is 1 -PASS db.objectStores.contains('') is false -PASS db.objectStores.contains('test456') is false -PASS db.objectStores.contains('test123') is true +PASS db.objectStoreNames is ['test123'] +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 PASS successfullyParsed is true TEST COMPLETE diff --git a/LayoutTests/storage/indexeddb/database-basics.html b/LayoutTests/storage/indexeddb/database-basics.html index 31c887b..b070de0 100644 --- a/LayoutTests/storage/indexeddb/database-basics.html +++ b/LayoutTests/storage/indexeddb/database-basics.html @@ -16,7 +16,7 @@ if (window.layoutTestController) function test() { - result = evalAndLog("webkitIndexedDB.open('name', 'description')"); + result = evalAndLog("webkitIndexedDB.open('name')"); verifyResult(result); result.onsuccess = openSuccess; result.onerror = unexpectedErrorCallback; @@ -68,11 +68,11 @@ function createObjectStore() verifySuccessEvent(event); shouldBeEqualToString("db.version", "version b"); shouldBeEqualToString("db.name", "name"); - shouldBe("db.objectStores", "[]"); - shouldBe("db.objectStores.length", "0"); - shouldBe("db.objectStores.contains('')", "false"); - shouldBeNull("db.objectStores[0]"); - shouldBeNull("db.objectStores.item(0)"); + shouldBe("db.objectStoreNames", "[]"); + shouldBe("db.objectStoreNames.length", "0"); + shouldBe("db.objectStoreNames.contains('')", "false"); + shouldBeNull("db.objectStoreNames[0]"); + shouldBeNull("db.objectStoreNames.item(0)"); objectStore = evalAndLog('db.createObjectStore("test123")'); checkObjectStore(); @@ -81,11 +81,11 @@ function createObjectStore() function checkObjectStore() { - shouldBe("db.objectStores", "['test123']"); - shouldBe("db.objectStores.length", "1"); - shouldBe("db.objectStores.contains('')", "false"); - shouldBe("db.objectStores.contains('test456')", "false"); - shouldBe("db.objectStores.contains('test123')", "true"); + shouldBe("db.objectStoreNames", "['test123']"); + shouldBe("db.objectStoreNames.length", "1"); + shouldBe("db.objectStoreNames.contains('')", "false"); + shouldBe("db.objectStoreNames.contains('test456')", "false"); + shouldBe("db.objectStoreNames.contains('test123')", "true"); } function commitAndContinue() diff --git a/LayoutTests/storage/indexeddb/database-quota-expected.txt b/LayoutTests/storage/indexeddb/database-quota-expected.txt index 91d3ac7..3ea24d9 100644 --- a/LayoutTests/storage/indexeddb/database-quota-expected.txt +++ b/LayoutTests/storage/indexeddb/database-quota-expected.txt @@ -3,7 +3,7 @@ Tests IndexedDB's quota enforcing mechanism. On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". -webkitIndexedDB.open('name', 'description') +webkitIndexedDB.open('name') PASS 'onsuccess' in result is true PASS 'onerror' in result is true PASS 'readyState' in result is true @@ -55,15 +55,15 @@ PASS event.target.readyState is event.target.DONE PASS db.version is "new version" PASS db.name is "name" -PASS db.objectStores is [] -PASS db.objectStores.length is 0 -PASS db.objectStores.contains('') is false +PASS db.objectStoreNames is [] +PASS db.objectStoreNames.length is 0 +PASS db.objectStoreNames.contains('') is false db.createObjectStore("test123") -PASS db.objectStores is ['test123'] -PASS db.objectStores.length is 1 -PASS db.objectStores.contains('') is false -PASS db.objectStores.contains('test456') is false -PASS db.objectStores.contains('test123') is true +PASS db.objectStoreNames is ['test123'] +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() Creating 'data' which contains 64K of data PASS data.length is 65536 diff --git a/LayoutTests/storage/indexeddb/database-quota.html b/LayoutTests/storage/indexeddb/database-quota.html index aefe6b1..b4207d4 100644 --- a/LayoutTests/storage/indexeddb/database-quota.html +++ b/LayoutTests/storage/indexeddb/database-quota.html @@ -16,7 +16,7 @@ if (window.layoutTestController) function test() { - result = evalAndLog("webkitIndexedDB.open('name', 'description')"); + result = evalAndLog("webkitIndexedDB.open('name')"); verifyResult(result); result.onsuccess = openSuccess; result.onerror = unexpectedErrorCallback; @@ -49,9 +49,9 @@ function createNewObjectStore() verifySuccessEvent(event); shouldBeEqualToString("db.version", "new version"); shouldBeEqualToString("db.name", "name"); - shouldBe("db.objectStores", "[]"); - shouldBe("db.objectStores.length", "0"); - shouldBe("db.objectStores.contains('')", "false"); + shouldBe("db.objectStoreNames", "[]"); + shouldBe("db.objectStoreNames.length", "0"); + shouldBe("db.objectStoreNames.contains('')", "false"); objectStore = evalAndLog('db.createObjectStore("test123")'); checkObjectStore(); @@ -60,11 +60,11 @@ function createNewObjectStore() function checkObjectStore() { - shouldBe("db.objectStores", "['test123']"); - shouldBe("db.objectStores.length", "1"); - shouldBe("db.objectStores.contains('')", "false"); - shouldBe("db.objectStores.contains('test456')", "false"); - shouldBe("db.objectStores.contains('test123')", "true"); + shouldBe("db.objectStoreNames", "['test123']"); + shouldBe("db.objectStoreNames.length", "1"); + shouldBe("db.objectStoreNames.contains('')", "false"); + shouldBe("db.objectStoreNames.contains('test456')", "false"); + shouldBe("db.objectStoreNames.contains('test123')", "true"); } function commitAndContinue() diff --git a/LayoutTests/storage/indexeddb/duplicates-expected.txt b/LayoutTests/storage/indexeddb/duplicates-expected.txt index 2ea8c36..8de488c 100644 --- a/LayoutTests/storage/indexeddb/duplicates-expected.txt +++ b/LayoutTests/storage/indexeddb/duplicates-expected.txt @@ -3,7 +3,7 @@ Verify that you can put the same data in 2 different databases without uniquenes On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". -webkitIndexedDB.open('name', 'description') +webkitIndexedDB.open('name') PASS 'onsuccess' in result is true PASS 'onerror' in result is true PASS 'readyState' in result is true @@ -269,7 +269,7 @@ PASS 'readyState' in event.target is true PASS event.target.readyState is event.target.DONE PASS event.result === null is true -webkitIndexedDB.open('name2', 'description2') +webkitIndexedDB.open('name2') PASS 'onsuccess' in result is true PASS 'onerror' in result is true PASS 'readyState' in result is true diff --git a/LayoutTests/storage/indexeddb/duplicates.html b/LayoutTests/storage/indexeddb/duplicates.html index 70cf8c4..352367f 100644 --- a/LayoutTests/storage/indexeddb/duplicates.html +++ b/LayoutTests/storage/indexeddb/duplicates.html @@ -18,9 +18,9 @@ testCount = 0; function test() { if (testCount++ == 0) - result = evalAndLog("webkitIndexedDB.open('name', 'description')"); + result = evalAndLog("webkitIndexedDB.open('name')"); else - result = evalAndLog("webkitIndexedDB.open('name2', 'description2')"); + result = evalAndLog("webkitIndexedDB.open('name2')"); verifyResult(result); result.onsuccess = setVersion; result.onerror = unexpectedErrorCallback; diff --git a/LayoutTests/storage/indexeddb/index-basics-expected.txt b/LayoutTests/storage/indexeddb/index-basics-expected.txt index f886a19..acc5f4d 100644 --- a/LayoutTests/storage/indexeddb/index-basics-expected.txt +++ b/LayoutTests/storage/indexeddb/index-basics-expected.txt @@ -3,7 +3,7 @@ Test the basics of IndexedDB's webkitIDBIndex. On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". -webkitIndexedDB.open('name', 'description') +webkitIndexedDB.open('name') PASS 'onsuccess' in result is true PASS 'onerror' in result is true PASS 'readyState' in result is true diff --git a/LayoutTests/storage/indexeddb/index-basics.html b/LayoutTests/storage/indexeddb/index-basics.html index 7a16c3a..7907070 100644 --- a/LayoutTests/storage/indexeddb/index-basics.html +++ b/LayoutTests/storage/indexeddb/index-basics.html @@ -16,7 +16,7 @@ if (window.layoutTestController) function test() { - result = evalAndLog("webkitIndexedDB.open('name', 'description')"); + result = evalAndLog("webkitIndexedDB.open('name')"); verifyResult(result); result.onsuccess = setVersion; result.onerror = unexpectedErrorCallback; diff --git a/LayoutTests/storage/indexeddb/index-cursor-expected.txt b/LayoutTests/storage/indexeddb/index-cursor-expected.txt index bc01070..159fbd7 100644 --- a/LayoutTests/storage/indexeddb/index-cursor-expected.txt +++ b/LayoutTests/storage/indexeddb/index-cursor-expected.txt @@ -3,7 +3,7 @@ Test IndexedDB's webkitIDBIndex.openCursor + the cursor it produces in depth. On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". -webkitIndexedDB.open('someDB', 'some description') +webkitIndexedDB.open('someDB') PASS 'onsuccess' in result is true PASS 'onerror' in result is true PASS 'readyState' in result is true diff --git a/LayoutTests/storage/indexeddb/index-cursor.html b/LayoutTests/storage/indexeddb/index-cursor.html index 6a9d1ac..fb3147d 100644 --- a/LayoutTests/storage/indexeddb/index-cursor.html +++ b/LayoutTests/storage/indexeddb/index-cursor.html @@ -16,8 +16,8 @@ if (window.layoutTestController) // In order of how it should be sorted by IndexedDB. window.testData = [ - null, - null, + 1, + 1, 2, 2, 10, @@ -29,7 +29,7 @@ window.testData = [ function openDatabase() { - result = evalAndLog("webkitIndexedDB.open('someDB', 'some description')"); + result = evalAndLog("webkitIndexedDB.open('someDB')"); verifyResult(result); result.onsuccess = setVersion; result.onerror = unexpectedErrorCallback; @@ -72,6 +72,7 @@ function addData() result = evalAndLog("objectStore.add({'x': testData[nextToAdd]}, nextToAdd)"); verifyResult(result); result.onsuccess = ++window.nextToAdd < testData.length ? addData : scheduleTests; + result.onerror = unexpectedErrorCallback; } function scheduleTests() @@ -180,13 +181,13 @@ function runNextTest() var keyRange; if (lower !== null && upper !== null) - keyRange = webkitIDBKeyRange.bound(testData[lower], testData[upper], lowerIsOpen, upperIsOpen); + keyRange = webkitIDBKeyRange.bound(testData[lower], testData[upper], {lowerOpen: lowerIsOpen, upperOpen: upperIsOpen}); else if (lower !== null) - keyRange = webkitIDBKeyRange.leftBound(testData[lower], lowerIsOpen); + keyRange = webkitIDBKeyRange.lowerBound(testData[lower], lowerIsOpen); else - keyRange = webkitIDBKeyRange.rightBound(testData[upper], upperIsOpen); + keyRange = webkitIDBKeyRange.upperBound(testData[upper], upperIsOpen); - var request = indexObject.openKeyCursor(keyRange, ascending ? webkitIDBCursor.NEXT : webkitIDBCursor.PREV); + var request = indexObject.openKeyCursor({range: keyRange, direction: ascending ? webkitIDBCursor.NEXT : webkitIDBCursor.PREV}); request.onsuccess = cursorIteration; request.onerror = unexpectedErrorCallback; } @@ -253,7 +254,7 @@ function testNullKeyRange() debug(""); debug(str); - var request = indexObject.openKeyCursor(null, ascending ? webkitIDBCursor.NEXT : webkitIDBCursor.PREV); + var request = indexObject.openKeyCursor({direction: ascending ? webkitIDBCursor.NEXT : webkitIDBCursor.PREV}); request.onsuccess = cursorIteration; request.onerror = unexpectedErrorCallback; } diff --git a/LayoutTests/storage/indexeddb/keyrange-expected.txt b/LayoutTests/storage/indexeddb/keyrange-expected.txt index 1a7dfff..faac937 100644 --- a/LayoutTests/storage/indexeddb/keyrange-expected.txt +++ b/LayoutTests/storage/indexeddb/keyrange-expected.txt @@ -3,149 +3,155 @@ Test IndexedDB's KeyRange. On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". -PASS 'SINGLE' in webkitIDBKeyRange is true -PASS 'LEFT_OPEN' in webkitIDBKeyRange is true -PASS 'RIGHT_OPEN' in webkitIDBKeyRange is true -PASS 'LEFT_BOUND' in webkitIDBKeyRange is true -PASS 'RIGHT_BOUND' in webkitIDBKeyRange is true -PASS 'left' in webkitIDBKeyRange is false -PASS 'right' in webkitIDBKeyRange is false -PASS 'flags' in webkitIDBKeyRange is false +PASS 'lower' in webkitIDBKeyRange is false +PASS 'upper' in webkitIDBKeyRange is false +PASS 'lowerOpen' in webkitIDBKeyRange is false +PASS 'upperOpen' in webkitIDBKeyRange is false PASS 'only' in webkitIDBKeyRange is true -PASS 'leftBound' in webkitIDBKeyRange is true -PASS 'rightBound' in webkitIDBKeyRange is true +PASS 'lowerBound' in webkitIDBKeyRange is true +PASS 'upperBound' in webkitIDBKeyRange is true PASS 'bound' in webkitIDBKeyRange is true instance = webkitIDBKeyRange.only(1) -PASS 'SINGLE' in instance is true -PASS 'LEFT_OPEN' in instance is true -PASS 'RIGHT_OPEN' in instance is true -PASS 'LEFT_BOUND' in instance is true -PASS 'RIGHT_BOUND' in instance is true -PASS 'left' in instance is true -PASS 'right' in instance is true -PASS 'flags' in instance is true +PASS 'lower' in instance is true +PASS 'upper' in instance is true +PASS 'lowerOpen' in instance is true +PASS 'upperOpen' in instance is true PASS 'only' in instance is false -PASS 'leftBound' in instance is false -PASS 'rightBound' in instance is false +PASS 'lowerBound' in instance is false +PASS 'upperBound' in instance is false PASS 'bound' in instance is false webkitIDBKeyRange.only(1) -PASS keyRange.left is 1 -PASS keyRange.right is 1 -PASS keyRange.flags is keyRange.SINGLE +PASS keyRange.lower is 1 +PASS keyRange.upper is 1 +PASS keyRange.lowerOpen is false +PASS keyRange.upperOpen is false webkitIDBKeyRange.only('a') -PASS keyRange.left is 'a' -PASS keyRange.right is 'a' -PASS keyRange.flags is keyRange.SINGLE -webkitIDBKeyRange.leftBound(10,true) -PASS keyRange.left is 10 -PASS keyRange.right is null -PASS keyRange.flags is keyRange.LEFT_OPEN | keyRange.LEFT_BOUND -webkitIDBKeyRange.leftBound(11,false) -PASS keyRange.left is 11 -PASS keyRange.right is null -PASS keyRange.flags is keyRange.LEFT_BOUND -webkitIDBKeyRange.leftBound(12,undefined) -PASS keyRange.left is 12 -PASS keyRange.right is null -PASS keyRange.flags is keyRange.LEFT_BOUND -webkitIDBKeyRange.leftBound('aa',true) -PASS keyRange.left is 'aa' -PASS keyRange.right is null -PASS keyRange.flags is keyRange.LEFT_OPEN | keyRange.LEFT_BOUND -webkitIDBKeyRange.leftBound('ab',false) -PASS keyRange.left is 'ab' -PASS keyRange.right is null -PASS keyRange.flags is keyRange.LEFT_BOUND -webkitIDBKeyRange.leftBound('ac',undefined) -PASS keyRange.left is 'ac' -PASS keyRange.right is null -PASS keyRange.flags is keyRange.LEFT_BOUND -webkitIDBKeyRange.rightBound(20,true) -PASS keyRange.right is 20 -PASS keyRange.left is null -PASS keyRange.flags is keyRange.RIGHT_OPEN | keyRange.RIGHT_BOUND -webkitIDBKeyRange.rightBound(21,false) -PASS keyRange.right is 21 -PASS keyRange.left is null -PASS keyRange.flags is keyRange.RIGHT_BOUND -webkitIDBKeyRange.rightBound(22,undefined) -PASS keyRange.right is 22 -PASS keyRange.left is null -PASS keyRange.flags is keyRange.RIGHT_BOUND -webkitIDBKeyRange.rightBound('ba',true) -PASS keyRange.right is 'ba' -PASS keyRange.left is null -PASS keyRange.flags is keyRange.RIGHT_OPEN | keyRange.RIGHT_BOUND -webkitIDBKeyRange.rightBound('bb',false) -PASS keyRange.right is 'bb' -PASS keyRange.left is null -PASS keyRange.flags is keyRange.RIGHT_BOUND -webkitIDBKeyRange.rightBound('bc',undefined) -PASS keyRange.right is 'bc' -PASS keyRange.left is null -PASS keyRange.flags is keyRange.RIGHT_BOUND -webkitIDBKeyRange.bound(30,40,undefined,undefined) -PASS keyRange.left is 30 -PASS keyRange.right is 40 -PASS leftFlags is keyRange.LEFT_BOUND -PASS rightFlags is keyRange.RIGHT_BOUND -webkitIDBKeyRange.bound(31,41,false,false) -PASS keyRange.left is 31 -PASS keyRange.right is 41 -PASS leftFlags is keyRange.LEFT_BOUND -PASS rightFlags is keyRange.RIGHT_BOUND -webkitIDBKeyRange.bound(32,42,false,true) -PASS keyRange.left is 32 -PASS keyRange.right is 42 -PASS leftFlags is keyRange.LEFT_BOUND -PASS rightFlags is keyRange.RIGHT_OPEN | keyRange.RIGHT_BOUND -webkitIDBKeyRange.bound(33,43,true,false) -PASS keyRange.left is 33 -PASS keyRange.right is 43 -PASS leftFlags is keyRange.LEFT_OPEN | keyRange.LEFT_BOUND -PASS rightFlags is keyRange.RIGHT_BOUND -webkitIDBKeyRange.bound(34,44,true,true) -PASS keyRange.left is 34 -PASS keyRange.right is 44 -PASS leftFlags is keyRange.LEFT_OPEN | keyRange.LEFT_BOUND -PASS rightFlags is keyRange.RIGHT_OPEN | keyRange.RIGHT_BOUND -webkitIDBKeyRange.bound('aaa','aba',false,false) -PASS keyRange.left is 'aaa' -PASS keyRange.right is 'aba' -PASS leftFlags is keyRange.LEFT_BOUND -PASS rightFlags is keyRange.RIGHT_BOUND -webkitIDBKeyRange.bound('aab','abb',undefined,undefined) -PASS keyRange.left is 'aab' -PASS keyRange.right is 'abb' -PASS leftFlags is keyRange.LEFT_BOUND -PASS rightFlags is keyRange.RIGHT_BOUND -webkitIDBKeyRange.bound('aac','abc',false,false) -PASS keyRange.left is 'aac' -PASS keyRange.right is 'abc' -PASS leftFlags is keyRange.LEFT_BOUND -PASS rightFlags is keyRange.RIGHT_BOUND -webkitIDBKeyRange.bound('aad','abd',false,true) -PASS keyRange.left is 'aad' -PASS keyRange.right is 'abd' -PASS leftFlags is keyRange.LEFT_BOUND -PASS rightFlags is keyRange.RIGHT_OPEN | keyRange.RIGHT_BOUND -webkitIDBKeyRange.bound('aae','abe',true,false) -PASS keyRange.left is 'aae' -PASS keyRange.right is 'abe' -PASS leftFlags is keyRange.LEFT_OPEN | keyRange.LEFT_BOUND -PASS rightFlags is keyRange.RIGHT_BOUND -webkitIDBKeyRange.bound('aaf','abf',true,true) -PASS keyRange.left is 'aaf' -PASS keyRange.right is 'abf' -PASS leftFlags is keyRange.LEFT_OPEN | keyRange.LEFT_BOUND -PASS rightFlags is keyRange.RIGHT_OPEN | keyRange.RIGHT_BOUND +PASS keyRange.lower is 'a' +PASS keyRange.upper is 'a' +PASS keyRange.lowerOpen is false +PASS keyRange.upperOpen is false +webkitIDBKeyRange.lowerBound(10,true) +PASS keyRange.lower is 10 +PASS keyRange.lowerOpen is true +PASS keyRange.upper is null +PASS keyRange.upperOpen is false +webkitIDBKeyRange.lowerBound(11,false) +PASS keyRange.lower is 11 +PASS keyRange.lowerOpen is false +PASS keyRange.upper is null +PASS keyRange.upperOpen is false +webkitIDBKeyRange.lowerBound(12,undefined) +PASS keyRange.lower is 12 +PASS keyRange.lowerOpen is false +PASS keyRange.upper is null +PASS keyRange.upperOpen is false +webkitIDBKeyRange.lowerBound('aa',true) +PASS keyRange.lower is 'aa' +PASS keyRange.lowerOpen is true +PASS keyRange.upper is null +PASS keyRange.upperOpen is false +webkitIDBKeyRange.lowerBound('ab',false) +PASS keyRange.lower is 'ab' +PASS keyRange.lowerOpen is false +PASS keyRange.upper is null +PASS keyRange.upperOpen is false +webkitIDBKeyRange.lowerBound('ac',undefined) +PASS keyRange.lower is 'ac' +PASS keyRange.lowerOpen is false +PASS keyRange.upper is null +PASS keyRange.upperOpen is false +webkitIDBKeyRange.upperBound(20,true) +PASS keyRange.upper is 20 +PASS keyRange.upperOpen is true +PASS keyRange.lower is null +PASS keyRange.lowerOpen is false +webkitIDBKeyRange.upperBound(21,false) +PASS keyRange.upper is 21 +PASS keyRange.upperOpen is false +PASS keyRange.lower is null +PASS keyRange.lowerOpen is false +webkitIDBKeyRange.upperBound(22,undefined) +PASS keyRange.upper is 22 +PASS keyRange.upperOpen is false +PASS keyRange.lower is null +PASS keyRange.lowerOpen is false +webkitIDBKeyRange.upperBound('ba',true) +PASS keyRange.upper is 'ba' +PASS keyRange.upperOpen is true +PASS keyRange.lower is null +PASS keyRange.lowerOpen is false +webkitIDBKeyRange.upperBound('bb',false) +PASS keyRange.upper is 'bb' +PASS keyRange.upperOpen is false +PASS keyRange.lower is null +PASS keyRange.lowerOpen is false +webkitIDBKeyRange.upperBound('bc',undefined) +PASS keyRange.upper is 'bc' +PASS keyRange.upperOpen is false +PASS keyRange.lower is null +PASS keyRange.lowerOpen is false +webkitIDBKeyRange.bound(30,40, {lowerOpen: undefined, upperOpen:undefined}) +PASS keyRange.lower is 30 +PASS keyRange.upper is 40 +PASS keyRange.lowerOpen is false +PASS keyRange.upperOpen is false +webkitIDBKeyRange.bound(31,41, {lowerOpen: false, upperOpen:false}) +PASS keyRange.lower is 31 +PASS keyRange.upper is 41 +PASS keyRange.lowerOpen is false +PASS keyRange.upperOpen is false +webkitIDBKeyRange.bound(32,42, {lowerOpen: false, upperOpen:true}) +PASS keyRange.lower is 32 +PASS keyRange.upper is 42 +PASS keyRange.lowerOpen is false +PASS keyRange.upperOpen is true +webkitIDBKeyRange.bound(33,43, {lowerOpen: true, upperOpen:false}) +PASS keyRange.lower is 33 +PASS keyRange.upper is 43 +PASS keyRange.lowerOpen is true +PASS keyRange.upperOpen is false +webkitIDBKeyRange.bound(34,44, {lowerOpen: true, upperOpen:true}) +PASS keyRange.lower is 34 +PASS keyRange.upper is 44 +PASS keyRange.lowerOpen is true +PASS keyRange.upperOpen is true +webkitIDBKeyRange.bound('aaa','aba', {lowerOpen: false, upperOpen:false}) +PASS keyRange.lower is 'aaa' +PASS keyRange.upper is 'aba' +PASS keyRange.lowerOpen is false +PASS keyRange.upperOpen is false +webkitIDBKeyRange.bound('aab','abb', {lowerOpen: undefined, upperOpen:undefined}) +PASS keyRange.lower is 'aab' +PASS keyRange.upper is 'abb' +PASS keyRange.lowerOpen is false +PASS keyRange.upperOpen is false +webkitIDBKeyRange.bound('aac','abc', {lowerOpen: false, upperOpen:false}) +PASS keyRange.lower is 'aac' +PASS keyRange.upper is 'abc' +PASS keyRange.lowerOpen is false +PASS keyRange.upperOpen is false +webkitIDBKeyRange.bound('aad','abd', {lowerOpen: false, upperOpen:true}) +PASS keyRange.lower is 'aad' +PASS keyRange.upper is 'abd' +PASS keyRange.lowerOpen is false +PASS keyRange.upperOpen is true +webkitIDBKeyRange.bound('aae','abe', {lowerOpen: true, upperOpen:false}) +PASS keyRange.lower is 'aae' +PASS keyRange.upper is 'abe' +PASS keyRange.lowerOpen is true +PASS keyRange.upperOpen is false +webkitIDBKeyRange.bound('aaf','abf', {lowerOpen: true, upperOpen:true}) +PASS keyRange.lower is 'aaf' +PASS keyRange.upper is 'abf' +PASS keyRange.lowerOpen is true +PASS keyRange.upperOpen is true Passing an invalid key into only([]) PASS Caught exception: Error: TYPE_MISMATCH_ERR: DOM Exception 17 -Passing an invalid key into rightBound([]) +Passing an invalid key into upperBound([]) PASS Caught exception: Error: TYPE_MISMATCH_ERR: DOM Exception 17 -Passing an invalid key into leftBound([]) +Passing an invalid key into lowerBound([]) PASS Caught exception: Error: TYPE_MISMATCH_ERR: DOM Exception 17 Passing an invalid key into bound(null, []) PASS Caught exception: Error: TYPE_MISMATCH_ERR: DOM Exception 17 diff --git a/LayoutTests/storage/indexeddb/keyrange.html b/LayoutTests/storage/indexeddb/keyrange.html index 48708d9..4b926da 100644 --- a/LayoutTests/storage/indexeddb/keyrange.html +++ b/LayoutTests/storage/indexeddb/keyrange.html @@ -17,67 +17,68 @@ if (window.layoutTestController) function checkSingleKeyRange(value) { keyRange = evalAndLog("webkitIDBKeyRange.only(" + value + ")"); - shouldBe("keyRange.left", "" + value); - shouldBe("keyRange.right", "" + value); - shouldBe("keyRange.flags", "keyRange.SINGLE"); + shouldBe("keyRange.lower", "" + value); + shouldBe("keyRange.upper", "" + value); + shouldBeFalse("keyRange.lowerOpen"); + shouldBeFalse("keyRange.upperOpen"); } -function checkLeftBoundKeyRange(value, open) +function checkLowerBoundKeyRange(value, open) { - keyRange = evalAndLog("webkitIDBKeyRange.leftBound(" + value + "," + open + ")"); - shouldBe("keyRange.left", "" + value); - shouldBeNull("keyRange.right"); - shouldBe("keyRange.flags", open ? "keyRange.LEFT_OPEN | keyRange.LEFT_BOUND" : "keyRange.LEFT_BOUND"); + keyRange = evalAndLog("webkitIDBKeyRange.lowerBound(" + value + "," + open + ")"); + shouldBe("keyRange.lower", "" + value); + if (open === undefined) + open = false; + shouldBe("keyRange.lowerOpen", "" + open); + shouldBeNull("keyRange.upper"); + shouldBeFalse("keyRange.upperOpen"); } -function checkRightBoundKeyRange(value, open) +function checkUpperBoundKeyRange(value, open) { - keyRange = evalAndLog("webkitIDBKeyRange.rightBound(" + value + "," + open + ")"); - shouldBe("keyRange.right", "" + value); - shouldBeNull("keyRange.left"); - shouldBe("keyRange.flags", open ? "keyRange.RIGHT_OPEN | keyRange.RIGHT_BOUND" : "keyRange.RIGHT_BOUND"); + keyRange = evalAndLog("webkitIDBKeyRange.upperBound(" + value + "," + open + ")"); + shouldBe("keyRange.upper", "" + value); + if (open === undefined) + open = false; + shouldBe("keyRange.upperOpen", "" + open); + shouldBeNull("keyRange.lower"); + shouldBeFalse("keyRange.lowerOpen"); } -function checkBoundKeyRange(left, right, openLeft, openRight) +function checkBoundKeyRange(lower, upper, lowerOpen, upperOpen) { - keyRange = evalAndLog("webkitIDBKeyRange.bound(" + left + "," + right + "," + openLeft + "," + openRight + ")"); - shouldBe("keyRange.left", "" + left); - shouldBe("keyRange.right", "" + right); - leftFlags = keyRange.flags & (keyRange.LEFT_OPEN | keyRange.LEFT_BOUND); - shouldBe("leftFlags", openLeft ? "keyRange.LEFT_OPEN | keyRange.LEFT_BOUND" : "keyRange.LEFT_BOUND"); - rightFlags = keyRange.flags & (keyRange.RIGHT_OPEN | keyRange.RIGHT_BOUND); - shouldBe("rightFlags", openRight ? "keyRange.RIGHT_OPEN | keyRange.RIGHT_BOUND" : "keyRange.RIGHT_BOUND"); + keyRange = evalAndLog("webkitIDBKeyRange.bound(" + lower + "," + upper + ", {lowerOpen: " + lowerOpen + ", upperOpen:" + upperOpen + "})"); + shouldBe("keyRange.lower", "" + lower); + shouldBe("keyRange.upper", "" + upper); + if (lowerOpen === undefined) + lowerOpen = false; + if (upperOpen === undefined) + upperOpen = false; + shouldBe("keyRange.lowerOpen", "" + lowerOpen); + shouldBe("keyRange.upperOpen", "" + upperOpen); } function test() { - shouldBeTrue("'SINGLE' in webkitIDBKeyRange"); - shouldBeTrue("'LEFT_OPEN' in webkitIDBKeyRange"); - shouldBeTrue("'RIGHT_OPEN' in webkitIDBKeyRange"); - shouldBeTrue("'LEFT_BOUND' in webkitIDBKeyRange"); - shouldBeTrue("'RIGHT_BOUND' in webkitIDBKeyRange"); - shouldBeFalse("'left' in webkitIDBKeyRange"); - shouldBeFalse("'right' in webkitIDBKeyRange"); - shouldBeFalse("'flags' in webkitIDBKeyRange"); + shouldBeFalse("'lower' in webkitIDBKeyRange"); + shouldBeFalse("'upper' in webkitIDBKeyRange"); + shouldBeFalse("'lowerOpen' in webkitIDBKeyRange"); + shouldBeFalse("'upperOpen' in webkitIDBKeyRange"); shouldBeTrue("'only' in webkitIDBKeyRange"); - shouldBeTrue("'leftBound' in webkitIDBKeyRange"); - shouldBeTrue("'rightBound' in webkitIDBKeyRange"); + shouldBeTrue("'lowerBound' in webkitIDBKeyRange"); + shouldBeTrue("'upperBound' in webkitIDBKeyRange"); shouldBeTrue("'bound' in webkitIDBKeyRange"); debug(""); var instance = evalAndLog("instance = webkitIDBKeyRange.only(1)"); - shouldBeTrue("'SINGLE' in instance"); - shouldBeTrue("'LEFT_OPEN' in instance"); - shouldBeTrue("'RIGHT_OPEN' in instance"); - shouldBeTrue("'LEFT_BOUND' in instance"); - shouldBeTrue("'RIGHT_BOUND' in instance"); - shouldBeTrue("'left' in instance"); - shouldBeTrue("'right' in instance"); - shouldBeTrue("'flags' in instance"); + shouldBeTrue("'lower' in instance"); + shouldBeTrue("'upper' in instance"); + shouldBeTrue("'lowerOpen' in instance"); + shouldBeTrue("'upperOpen' in instance"); shouldBeFalse("'only' in instance"); - shouldBeFalse("'leftBound' in instance"); - shouldBeFalse("'rightBound' in instance"); + shouldBeFalse("'lowerBound' in instance"); + shouldBeFalse("'upperBound' in instance"); shouldBeFalse("'bound' in instance"); debug(""); @@ -85,19 +86,19 @@ function test() checkSingleKeyRange(1); checkSingleKeyRange("'a'"); - checkLeftBoundKeyRange(10, true); - checkLeftBoundKeyRange(11, false); - checkLeftBoundKeyRange(12); - checkLeftBoundKeyRange("'aa'", true); - checkLeftBoundKeyRange("'ab'", false); - checkLeftBoundKeyRange("'ac'"); + checkLowerBoundKeyRange(10, true); + checkLowerBoundKeyRange(11, false); + checkLowerBoundKeyRange(12); + checkLowerBoundKeyRange("'aa'", true); + checkLowerBoundKeyRange("'ab'", false); + checkLowerBoundKeyRange("'ac'"); - checkRightBoundKeyRange(20, true); - checkRightBoundKeyRange(21, false); - checkRightBoundKeyRange(22); - checkRightBoundKeyRange("'ba'", true); - checkRightBoundKeyRange("'bb'", false); - checkRightBoundKeyRange("'bc'"); + checkUpperBoundKeyRange(20, true); + checkUpperBoundKeyRange(21, false); + checkUpperBoundKeyRange(22); + checkUpperBoundKeyRange("'ba'", true); + checkUpperBoundKeyRange("'bb'", false); + checkUpperBoundKeyRange("'bc'"); checkBoundKeyRange(30, 40); checkBoundKeyRange(31, 41, false, false); @@ -121,16 +122,16 @@ function test() } try { - debug("Passing an invalid key into rightBound([])"); - webkitIDBKeyRange.rightBound([]); + debug("Passing an invalid key into upperBound([])"); + webkitIDBKeyRange.upperBound([]); testFailed("No exception thrown"); } catch (e) { testPassed("Caught exception: " + e.toString()); } try { - debug("Passing an invalid key into leftBound([])"); - webkitIDBKeyRange.leftBound([]); + debug("Passing an invalid key into lowerBound([])"); + webkitIDBKeyRange.lowerBound([]); testFailed("No exception thrown"); } catch (e) { testPassed("Caught exception: " + e.toString()); diff --git a/LayoutTests/storage/indexeddb/objectstore-basics-expected.txt b/LayoutTests/storage/indexeddb/objectstore-basics-expected.txt index e0c9770..e736d2f 100644 --- a/LayoutTests/storage/indexeddb/objectstore-basics-expected.txt +++ b/LayoutTests/storage/indexeddb/objectstore-basics-expected.txt @@ -3,7 +3,7 @@ Test the basics of IndexedDB's IDBObjectStore. On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". -webkitIndexedDB.open('name', 'description') +webkitIndexedDB.open('name') PASS 'onsuccess' in result is true PASS 'onerror' in result is true PASS 'readyState' in result is true @@ -45,7 +45,7 @@ PASS trans !== null is true Deleted all object stores. createObjectStore(): store = db.createObjectStore('storeName', null) -storeNames = db.objectStores +storeNames = db.objectStoreNames PASS store.name is "storeName" PASS store.keyPath is null PASS storeNames.contains('storeName') is true @@ -54,7 +54,7 @@ Ask for an index that doesn't exist: index = store.index('asdf') PASS Exception thrown. createIndex(): -index = store.createIndex('indexName', 'x', true) +index = store.createIndex('indexName', 'x', {unique: true}) PASS index !== null is true PASS store.indexNames.contains('indexName') is true index = store.index('indexName') @@ -97,6 +97,17 @@ PASS store.indexNames.item(1) is null PASS store.indexNames.item(100) is null transaction = db.transaction() store = transaction.objectStore('storeName') +Try to insert data with a Date key: +store.add({x: 'foo'}, new Date()) +PASS Exception thrown +PASS code is DOMException.TYPE_MISMATCH_ERR +Try to insert a value not handled by structured clone: +store.add({x: 'bar', y: document.getElementById('console')}, 'bar') +PASS Exception thrown +PASS code is DOMException.NOT_SUPPORTED_ERR +Try to insert data where key path yields a Date key: +store.add({x: new Date()}, 'foo') +PASS Adding data where key path yielded Date key resulted in error. store.add({x: 'value'}, 'key') PASS 'onsuccess' in result is true PASS 'onerror' in result is true @@ -137,6 +148,48 @@ PASS event.target.readyState is event.target.DONE PASS event.code is webkitIDBDatabaseException.UNKNOWN_ERR db.transaction() store = transaction.objectStore('storeName') +store.add({x: 'othervalue'}, null) +PASS 'onsuccess' in result is true +PASS 'onerror' in result is true +PASS 'readyState' in result is true +An event should fire shortly... + +addWithNullKeyFailre(): +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 +db.transaction() +store = transaction.objectStore('storeName') +store.add({x: null}, 'validkey') +PASS 'onsuccess' in result is true +PASS 'onerror' in result is true +PASS 'readyState' in result is true +An event should fire shortly... + +addWithNullIndexFailure(): +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 +db.transaction() +store = transaction.objectStore('storeName') store.get('key') PASS 'onsuccess' in result is true PASS 'onerror' in result is true @@ -157,7 +210,7 @@ PASS event.target.readyState is event.target.DONE PASS event.result.x is "value" store = event.source -store.remove('key') +store.delete('key') PASS 'onsuccess' in result is true PASS 'onerror' in result is true PASS 'readyState' in result is true @@ -179,7 +232,7 @@ PASS event.result is null store = event.source Passing an invalid key into store.get(). PASS Caught exception: Error: TYPE_MISMATCH_ERR: DOM Exception 17 -Passing an invalid key into store.remove(). +Passing an invalid key into store.delete(). PASS Caught exception: Error: TYPE_MISMATCH_ERR: DOM Exception 17 Passing an invalid key into store.add(). PASS Caught exception: Error: TYPE_MISMATCH_ERR: DOM Exception 17 diff --git a/LayoutTests/storage/indexeddb/objectstore-basics.html b/LayoutTests/storage/indexeddb/objectstore-basics.html index 005247e..3d2a1d2 100644 --- a/LayoutTests/storage/indexeddb/objectstore-basics.html +++ b/LayoutTests/storage/indexeddb/objectstore-basics.html @@ -16,7 +16,7 @@ if (window.layoutTestController) function test() { - result = evalAndLog("webkitIndexedDB.open('name', 'description')"); + result = evalAndLog("webkitIndexedDB.open('name')"); verifyResult(result); result.onsuccess = openSuccess; result.onerror = unexpectedErrorCallback; @@ -49,7 +49,7 @@ function createObjectStore() { debug("createObjectStore():"); window.store = evalAndLog("store = db.createObjectStore('storeName', null)"); - var storeNames = evalAndLog("storeNames = db.objectStores"); + var storeNames = evalAndLog("storeNames = db.objectStoreNames"); shouldBeEqualToString("store.name", "storeName"); shouldBeNull("store.keyPath"); @@ -73,7 +73,7 @@ function createObjectStore() function createIndex() { debug("createIndex():"); - var index = evalAndLog("index = store.createIndex('indexName', 'x', true)"); // true == unique requirement. + var index = evalAndLog("index = store.createIndex('indexName', 'x', {unique: true})"); // true == unique requirement. shouldBeTrue("index !== null"); shouldBeTrue("store.indexNames.contains('indexName')"); index = evalAndLog("index = store.index('indexName')"); @@ -142,6 +142,41 @@ function addData() var transaction = evalAndLog("transaction = db.transaction()"); transaction.onabort = unexpectedAbortCallback; window.store = evalAndLog("store = transaction.objectStore('storeName')"); + + debug("Try to insert data with a Date key:"); + // FIXME: This should work in the future. + try { + debug("store.add({x: 'foo'}, new Date())"); + store.add({x: 'foo'}, new Date()); + testFailed("Passing a Date as key argument should have thrown."); + } catch (err) { + testPassed("Exception thrown"); + code = err.code; + shouldBe("code", "DOMException.TYPE_MISMATCH_ERR"); + } + + debug("Try to insert a value not handled by structured clone:"); + try { + debug("store.add({x: 'bar', y: document.getElementById('console')}, 'bar')"); + store.add({x: 'bar', y: document.getElementById('console')}, 'bar'); + testFailed("Passing a DOM node as value should have thrown."); + } catch (err) { + testPassed("Exception thrown"); + code = err.code; + shouldBe("code", "DOMException.NOT_SUPPORTED_ERR"); + } + + // FIXME: This should work in the future. + debug("Try to insert data where key path yields a Date key:"); + result = evalAndLog("store.add({x: new Date()}, 'foo')"); + result.onsuccess = unexpectedSuccessCallback; + result.onerror = addKeyPathYieldingDateFailure; +} + +function addKeyPathYieldingDateFailure() +{ + testPassed("Adding data where key path yielded Date key resulted in error."); + result = evalAndLog("store.add({x: 'value'}, 'key')"); verifyResult(result); result.onsuccess = addSuccess; @@ -171,6 +206,38 @@ function addAgainFailure() 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; +} + +function addWithNullKeyFailure() +{ + debug("addWithNullKeyFailre():"); + verifyErrorEvent(event); + shouldBe("event.code", "webkitIDBDatabaseException.DATA_ERR"); + + transaction = evalAndLog("db.transaction()"); + transaction.onabort = unexpectedErrorCallback; + var store = evalAndLog("store = transaction.objectStore('storeName')"); + + result = evalAndLog("store.add({x: null}, 'validkey')"); + verifyResult(result); + result.onsuccess = unexpectedSuccessCallback; + result.onerror = addWithNullIndexFailure; +} + +function addWithNullIndexFailure() +{ + debug("addWithNullIndexFailure():"); + verifyErrorEvent(event); + shouldBe("event.code", "webkitIDBDatabaseException.DATA_ERR"); + + transaction = evalAndLog("db.transaction()"); + transaction.onabort = unexpectedErrorCallback; + var store = evalAndLog("store = transaction.objectStore('storeName')"); + result = evalAndLog("store.get('key')"); verifyResult(result); result.onsuccess = getSuccess; @@ -184,7 +251,7 @@ function getSuccess() shouldBeEqualToString("event.result.x", "value"); var store = evalAndLog("store = event.source"); - result = evalAndLog("store.remove('key')"); + result = evalAndLog("store.delete('key')"); verifyResult(result); result.onsuccess = removeSuccess; result.onerror = unexpectedErrorCallback; @@ -206,8 +273,8 @@ function removeSuccess() } try { - debug("Passing an invalid key into store.remove()."); - store.remove([]); + debug("Passing an invalid key into store.delete()."); + store.delete([]); testFailed("No exception thrown"); } catch (e) { testPassed("Caught exception: " + e.toString()); diff --git a/LayoutTests/storage/indexeddb/objectstore-cursor-expected.txt b/LayoutTests/storage/indexeddb/objectstore-cursor-expected.txt index 1493a80..ea789fa 100644 --- a/LayoutTests/storage/indexeddb/objectstore-cursor-expected.txt +++ b/LayoutTests/storage/indexeddb/objectstore-cursor-expected.txt @@ -3,7 +3,7 @@ Test IndexedDB's objectStore.openCursor + the cursor it produces in depth. On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". -webkitIndexedDB.open('someDB', 'some description') +webkitIndexedDB.open('someDB') PASS 'onsuccess' in result is true PASS 'onerror' in result is true PASS 'readyState' in result is true diff --git a/LayoutTests/storage/indexeddb/objectstore-cursor.html b/LayoutTests/storage/indexeddb/objectstore-cursor.html index d0d786b..3358917 100644 --- a/LayoutTests/storage/indexeddb/objectstore-cursor.html +++ b/LayoutTests/storage/indexeddb/objectstore-cursor.html @@ -16,7 +16,7 @@ if (window.layoutTestController) // In order of how it should be sorted by IndexedDB. window.testData = [ - null, + 1, 2, 3, 10, @@ -28,7 +28,7 @@ window.testData = [ function openDatabase() { - result = evalAndLog("webkitIndexedDB.open('someDB', 'some description')"); + result = evalAndLog("webkitIndexedDB.open('someDB')"); verifyResult(result); result.onsuccess = setVersion; result.onerror = unexpectedErrorCallback; @@ -70,6 +70,7 @@ function addData() result = evalAndLog("objectStore.add('', testData[nextToAdd])"); verifyResult(result); result.onsuccess = ++window.nextToAdd < testData.length ? addData : scheduleTests; + result.onerror = unexpectedErrorCallback; } function scheduleTests() @@ -158,13 +159,13 @@ function runNextTest() var keyRange; if (lower !== null && upper !== null) - keyRange = webkitIDBKeyRange.bound(testData[lower], testData[upper], lowerIsOpen, upperIsOpen); + keyRange = webkitIDBKeyRange.bound(testData[lower], testData[upper], {lowerOpen: lowerIsOpen, upperOpen: upperIsOpen}); else if (lower !== null) - keyRange = webkitIDBKeyRange.leftBound(testData[lower], lowerIsOpen); + keyRange = webkitIDBKeyRange.lowerBound(testData[lower], lowerIsOpen); else - keyRange = webkitIDBKeyRange.rightBound(testData[upper], upperIsOpen); + keyRange = webkitIDBKeyRange.upperBound(testData[upper], upperIsOpen); - var request = objectStore.openCursor(keyRange, ascending ? webkitIDBCursor.NEXT : webkitIDBCursor.PREV); + var request = objectStore.openCursor({range: keyRange, direction: ascending ? webkitIDBCursor.NEXT : webkitIDBCursor.PREV}); request.onsuccess = cursorIteration; request.onerror = unexpectedErrorCallback; } @@ -230,7 +231,7 @@ function testNullKeyRange() debug(""); debug(str); - var request = objectStore.openCursor(null, ascending ? webkitIDBCursor.NEXT : webkitIDBCursor.PREV); + var request = objectStore.openCursor({direction: ascending ? webkitIDBCursor.NEXT : webkitIDBCursor.PREV}); request.onsuccess = cursorIteration; request.onerror = unexpectedErrorCallback; } diff --git a/LayoutTests/storage/indexeddb/objectstore-removeobjectstore-expected.txt b/LayoutTests/storage/indexeddb/objectstore-removeobjectstore-expected.txt index b6b20a2..4e5e562 100644 --- a/LayoutTests/storage/indexeddb/objectstore-removeobjectstore-expected.txt +++ b/LayoutTests/storage/indexeddb/objectstore-removeobjectstore-expected.txt @@ -1,9 +1,9 @@ -Test IndexedDB's webkitIDBObjectStore.removeObjectStore(). +Test IndexedDB's webkitIDBObjectStore.deleteObjectStore(). On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". -webkitIndexedDB.open('name', 'description') +webkitIndexedDB.open('name') PASS 'onsuccess' in result is true PASS 'onerror' in result is true PASS 'readyState' in result is true @@ -100,7 +100,7 @@ PASS event.target.readyState is event.target.DONE trans = event.result PASS trans !== null is true -db.removeObjectStore('storeName') +db.deleteObjectStore('storeName') db.createObjectStore('storeName', null) db.transaction() store = transaction.objectStore('storeName') diff --git a/LayoutTests/storage/indexeddb/objectstore-removeobjectstore.html b/LayoutTests/storage/indexeddb/objectstore-removeobjectstore.html index c4418bc..5f617ca 100644 --- a/LayoutTests/storage/indexeddb/objectstore-removeobjectstore.html +++ b/LayoutTests/storage/indexeddb/objectstore-removeobjectstore.html @@ -10,13 +10,13 @@
+ + + + +

+
+ + + diff --git a/LayoutTests/storage/indexeddb/transaction-basics-expected.txt b/LayoutTests/storage/indexeddb/transaction-basics-expected.txt index b493946..a3bd90a 100644 --- a/LayoutTests/storage/indexeddb/transaction-basics-expected.txt +++ b/LayoutTests/storage/indexeddb/transaction-basics-expected.txt @@ -5,7 +5,7 @@ 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('name', 'description') +webkitIndexedDB.open('name') PASS 'onsuccess' in result is true PASS 'onerror' in result is true PASS 'readyState' in result is true @@ -37,12 +37,12 @@ PASS 'readyState' in event.target is true PASS event.target.readyState is event.target.DONE Deleted all object stores. -PASS window.db.objectStores is [] -PASS window.db.objectStores.length is 0 -PASS window.db.objectStores.contains('storeFail') is false -PASS window.db.objectStores is [] -PASS window.db.objectStores.length is 0 -PASS window.db.objectStores.contains('storeFail') is false +PASS window.db.objectStoreNames is [] +PASS window.db.objectStoreNames.length is 0 +PASS window.db.objectStoreNames.contains('storeFail') is false +PASS window.db.objectStoreNames is [] +PASS window.db.objectStoreNames.length is 0 +PASS window.db.objectStoreNames.contains('storeFail') is false result = startSetVersion('version fail') PASS 'onsuccess' in result is true PASS 'onerror' in result is true @@ -65,11 +65,11 @@ trans = event.result PASS trans !== null is true store = db.createObjectStore('storeFail', null) index = store.createIndex('indexFail', 'x', false) -db.removeObjectStore('storeFail') -store.removeIndex('indexFail') -PASS window.db.objectStores is [] -PASS window.db.objectStores.length is 0 -PASS window.db.objectStores.contains('storeFail') is false +db.deleteObjectStore('storeFail') +store.deleteIndex('indexFail') +PASS window.db.objectStoreNames is [] +PASS window.db.objectStoreNames.length is 0 +PASS window.db.objectStoreNames.contains('storeFail') is false result = startSetVersion('version fail') PASS 'onsuccess' in result is true PASS 'onerror' in result is true @@ -92,13 +92,13 @@ trans = event.result PASS trans !== null is true store = db.createObjectStore('storeFail', null) index = store.createIndex('indexFail', 'x', false) -db.removeObjectStore('storeFail') -store.removeIndex('indexFail') +db.deleteObjectStore('storeFail') +store.deleteIndex('indexFail') store = db.createObjectStore('storeFail', null) index = store.createIndex('indexFail', 'x', false) -PASS window.db.objectStores is [] -PASS window.db.objectStores.length is 0 -PASS window.db.objectStores.contains('storeFail') is false +PASS window.db.objectStoreNames is [] +PASS window.db.objectStoreNames.length is 0 +PASS window.db.objectStoreNames.contains('storeFail') is false result = startSetVersion('version fail') PASS 'onsuccess' in result is true PASS 'onerror' in result is true @@ -121,9 +121,9 @@ trans = event.result PASS trans !== null is true store = db.createObjectStore('storeFail', null) index = store.createIndex('indexFail', 'x', false) -PASS db.objectStores is ['storeFail'] -PASS db.objectStores.length is 1 -PASS db.objectStores.contains('storeFail') is true +PASS db.objectStoreNames is ['storeFail'] +PASS db.objectStoreNames.length is 1 +PASS db.objectStoreNames.contains('storeFail') is true result = startSetVersion('version fail') PASS 'onsuccess' in result is true PASS 'onerror' in result is true @@ -145,11 +145,11 @@ PASS event.target.readyState is event.target.DONE trans = event.result PASS trans !== null is true store = trans.objectStore('storeFail') -store.removeIndex('indexFail') -db.removeObjectStore('storeFail') -PASS db.objectStores is ['storeFail'] -PASS db.objectStores.length is 1 -PASS db.objectStores.contains('storeFail') is true +store.deleteIndex('indexFail') +db.deleteObjectStore('storeFail') +PASS db.objectStoreNames is ['storeFail'] +PASS db.objectStoreNames.length is 1 +PASS db.objectStoreNames.contains('storeFail') is true db.setVersion('new version') PASS 'onsuccess' in result is true PASS 'onerror' in result is true diff --git a/LayoutTests/storage/indexeddb/transaction-basics.html b/LayoutTests/storage/indexeddb/transaction-basics.html index 07fc685..cd42419 100644 --- a/LayoutTests/storage/indexeddb/transaction-basics.html +++ b/LayoutTests/storage/indexeddb/transaction-basics.html @@ -19,7 +19,7 @@ function test() shouldBeTrue("'webkitIndexedDB' in window"); shouldBeFalse("webkitIndexedDB == null"); - result = evalAndLog("webkitIndexedDB.open('name', 'description')"); + result = evalAndLog("webkitIndexedDB.open('name')"); verifyResult(result); result.onsuccess = openSuccess; result.onerror = unexpectedErrorCallback; @@ -61,8 +61,8 @@ function addRemoveIDBObjects() var store = evalAndLog("store = db.createObjectStore('storeFail', null)"); var index = evalAndLog("index = store.createIndex('indexFail', 'x', false)"); - evalAndLog("db.removeObjectStore('storeFail')"); - evalAndLog("store.removeIndex('indexFail')"); + evalAndLog("db.deleteObjectStore('storeFail')"); + evalAndLog("store.deleteIndex('indexFail')"); trans.abort(); } @@ -86,8 +86,8 @@ function addRemoveAddIDBObjects() var store = evalAndLog("store = db.createObjectStore('storeFail', null)"); var index = evalAndLog("index = store.createIndex('indexFail', 'x', false)"); - evalAndLog("db.removeObjectStore('storeFail')"); - evalAndLog("store.removeIndex('indexFail')"); + evalAndLog("db.deleteObjectStore('storeFail')"); + evalAndLog("store.deleteIndex('indexFail')"); var store = evalAndLog("store = db.createObjectStore('storeFail', null)"); var index = evalAndLog("index = store.createIndex('indexFail', 'x', false)"); @@ -160,8 +160,8 @@ function removeIDBObjects() trans.oncomplete = unexpectedCompleteCallback; var store = evalAndLog("store = trans.objectStore('storeFail')"); - evalAndLog("store.removeIndex('indexFail')"); - evalAndLog("db.removeObjectStore('storeFail')"); + evalAndLog("store.deleteIndex('indexFail')"); + evalAndLog("db.deleteObjectStore('storeFail')"); trans.abort(); } @@ -182,16 +182,16 @@ function startSetVersion(versionName) function checkMetadataEmpty() { - shouldBe("window.db.objectStores", "[]"); - shouldBe("window.db.objectStores.length", "0"); - shouldBe("window.db.objectStores.contains('storeFail')", "false"); + shouldBe("window.db.objectStoreNames", "[]"); + shouldBe("window.db.objectStoreNames.length", "0"); + shouldBe("window.db.objectStoreNames.contains('storeFail')", "false"); } function checkMetadataExistingObjectStore() { - shouldBe("db.objectStores", "['storeFail']"); - shouldBe("db.objectStores.length", "1"); - shouldBe("db.objectStores.contains('storeFail')", "true"); + shouldBe("db.objectStoreNames", "['storeFail']"); + shouldBe("db.objectStoreNames.length", "1"); + shouldBe("db.objectStoreNames.contains('storeFail')", "true"); } function setNewVersion() diff --git a/LayoutTests/storage/indexeddb/tutorial.html b/LayoutTests/storage/indexeddb/tutorial.html index db9f2fa..445213c 100644 --- a/LayoutTests/storage/indexeddb/tutorial.html +++ b/LayoutTests/storage/indexeddb/tutorial.html @@ -70,7 +70,7 @@ function start() // "addEventListener" if you'd like, but I'm using the simpler = syntax. Only one or the other // will fire. You're guaranteed that they won't fire until control is returned from JavaScript // execution. - var request = indexedDB.open("myDB", "This is a description of the database."); // Chromium/WebKit doesn't yet require the description, but it will soon. + var request = indexedDB.open("myDB"); request.onsuccess = onOpen; request.onerror = unexpectedError; } @@ -113,7 +113,7 @@ function onOpen() function onSetVersion() { // We are now in a setVersion transaction. Such a transaction is the only place where one - // can add or remove indexes and objectStores. The result (property of event) is an + // 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 // us when the transaction has committed, aborted, or timed out. window.currentTransaction = event.result; @@ -121,8 +121,8 @@ function onSetVersion() currentTransaction.onabort = unexpectedAbort; // Delete existing object stores. - while (db.objectStores.length) - db.removeObjectStore(db.objectStores[0]); + while (db.objectStoreNames.length) + db.deleteObjectStore(db.objectStoreNames[0]); // Now that we have a blank slate, let's create an objectStore. An objectStore is simply an // ordered mapping of keys to values. We can iterate through ranges of keys or do individual @@ -150,13 +150,25 @@ function onSetVersion() // a number attribute and at least one sibling). You can even go wild and say // "foo[0][2].bar[0].baz.test[1][2][3]". It's possible this will change in the future though. // - // If you set autoIncrement (the third optional parameter), IndexedDB will generate a key + // If you set autoIncrement (another optional parameter), IndexedDB will generate a key // for your entry automatically. And if you have a keyPath set, it'll set the value at // the location of the keyPath _in the database_ (i.e. it will not modify the value you pass // in to put/add). Unfortunately autoIncrement is not yet implemented in Chromium/WebKit. // + // Another optional parameter, "evictable" is not yet implemented. When it is, it'll hint + // which data should be deleted first if the browser decides this origin is using too much + // storage. (The alternative is that it'll suggest the user delete everything from the + // origin, so it's in your favor to set it approperately!) This is great for when you have + // some absolutely critical data (like unset emails) and a bunch of less critical, (but + // maybe still important!) data. + // + // All of these options can be passed into createObjectStore via its (optional) second + // parameter. So, if you wanted to define all, You'd do {keyPath: "something", + // evictable: true, autoIncrement: true}. You can also pass in subsets of all three or + // omit the object (since it's optional). + // // Let's now create an objectStore for people. We'll supply a key path in this case. - var objectStore = db.createObjectStore("people", "id"); + var objectStore = db.createObjectStore("people", {keyPath: "id"}); // Notice that it returned synchronously. The rule of thumb is that any call that touches (in // any way) keys or values is asynchronous and any other call (besides setVersion and open) are @@ -170,9 +182,8 @@ function onSetVersion() var fname = objectStore.createIndex("fname", "fname", false); var lname = objectStore.createIndex("lname", "lname", false); - // Note that if you wanted to delete these indexes, you can either call objectStore.removeIndex - // or simply delete the objectStores that own the indexes. (Note that removeObjectStore and - // removeIndex may be changed to deleteObjectStore and deleteIndex in the future.) + // Note that if you wanted to delete these indexes, you can either call objectStore.deleteIndex + // or simply delete the objectStores that own the indexes. // // If we wanted to, we could populate the objectStore with some data here or do anything else // allowed in a normal (i.e. non-setVersion) transaction. This is useful so that data migrations @@ -195,29 +206,29 @@ function unexpectedAbort() 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. All three - // parameters are optional for transaction. + // Transactions (besides those created with setVersion) are created synchronously. Like + // createObjectStore, transaction optionally takes in an object with various optional parameters. // - // The first specifies which object stores to lock. The spec specifies "dynamic transactions" - // which don't require this and which have finer grained locks, but no one yet supports this and - // it may even be dropped from the first version of the spec, so I don't suggest you rely on it. - // Chromium/WebKit also does not yet support anything finer grained than database level locking, - // so in this tutorial we'll just pass in the empty array which means "lock the world". + // 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 + // or pass in null/undefined) we lock the whole database. By specifying locks over fewer + // objectStores you make it possible for browsers to run transactions concurrently. That said, + // Chromium/WebKit does not support this yet. // - // The second parameter specifies the locking mode. The default is READ_ONLY (i.e. a shared lock). + // 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. (Note that - // SNAPSHOT_READ will soon be removed from the spec.) + // Chromium/WebKit pretends every transaction is READ_WRITE, which is kind of bad. // - // The last parameter is the timeout length. At the moment, Chromium/WebKit defaults to 0 which - // means never, but it's possible we'll change this in the future, so set it if you really care. - window.currentTransaction = db.transaction([], IDBTransaction.READ_WRITE, 0); + // 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}); currentTransaction.oncomplete = unexpectedComplete; currentTransaction.onabort = onTransactionAborted; - // Verify that "people" is the only object store in existance. The objectStores attribute is + // Verify that "people" is the only object store in existance. The objectStoreNames attribute is // a DOMStringList which is somewhat like an array. - var objectStoreList = db.objectStores; + var objectStoreList = db.objectStoreNames; if (objectStoreList.length != 1 || !objectStoreList.contains("people") || objectStoreList.item(0) != "people" @@ -258,8 +269,10 @@ function unexpectedComplete() function onTransactionAborted() { - // Now let's make a real transaction and a person to our objectStore. - window.currentTransaction = db.transaction(["people"], IDBTransaction.READ_WRITE, 0); + // 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}); currentTransaction.onabort = unexpectedAbort; var people = currentTransaction.objectStore("people"); @@ -276,7 +289,7 @@ function onTransactionAborted() people.put({fname: 'Jane', lname: 'Doe', id: 2}).onerror = unexpectedError; people.put({fname: 'Philip', lname: 'Fry', id: 3}).onerror = unexpectedError; - // Not shown here are the .remove method (which is soon to be renamed .delete) and .add (which is + // Not shown here are the .delete method and .add (which is // like .put except that it fires an onerror if the element already exists). } @@ -295,8 +308,9 @@ function onPutSuccess() 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. - window.currentTransaction = db.transaction(["people"], IDBTransaction.READ_WRITE, 0); + // 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}); currentTransaction.onabort = unexpectedAbort; var people = currentTransaction.objectStore("people"); @@ -327,7 +341,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(keyRange, IDBCursor.NEXT); + var request = people.openCursor({range: keyRange, direction: IDBCursor.NEXT}); request.onsuccess = onObjectStoreCursor; request.onerror = unexpectedError; } @@ -380,10 +394,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(IDBKeyRange.leftBound("Doe", false), IDBCursor.NEXT_NO_DUPLICATE); - lname.openCursor(null, IDBCursor.PREV_NO_DUPLICATE); - lname.openCursor(IDBKeyRange.rightBound("ZZZZ")); - lname.openCursor(IDBKeyRange.only("Doe"), IDBCursor.PREV); + 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(); lname.openKeyCursor(); @@ -396,7 +410,8 @@ function onIndexGetSuccess() function onAllDone() { log("Everything worked!"); - layoutTestController.notifyDone(); + if (window.layoutTestController) + layoutTestController.notifyDone(); } // The way setVersion is supposed to work: -- cgit v1.1