Commit f86bef17 authored by andreip@google.com's avatar andreip@google.com

2011-01-24 Andrei Popescu <andreip@google.com>

        Reviewed by Nate Chapin.

        IndexedDatabase methods should not take arguments of type OptionsObject
        https://bugs.webkit.org/show_bug.cgi?id=53012

        * storage/indexeddb/create-object-store-options-expected.txt:
        * storage/indexeddb/create-object-store-options.html:
        * storage/indexeddb/cursor-delete-expected.txt:
        * storage/indexeddb/cursor-delete.html:
        * storage/indexeddb/cursor-index-delete-expected.txt:
        * storage/indexeddb/cursor-index-delete.html:
        * storage/indexeddb/data-corruption-expected.txt:
        * storage/indexeddb/data-corruption.html:
        * storage/indexeddb/database-quota-expected.txt:
        * storage/indexeddb/database-quota.html:
        * storage/indexeddb/index-cursor.html:
        * storage/indexeddb/objectstore-basics-expected.txt:
        * storage/indexeddb/objectstore-basics.html:
        * storage/indexeddb/objectstore-cursor.html:
        * storage/indexeddb/open-cursor-expected.txt:
        * storage/indexeddb/open-cursor.html:
        * storage/indexeddb/transaction-and-objectstore-calls-expected.txt:
        * storage/indexeddb/transaction-and-objectstore-calls.html:
        * storage/indexeddb/tutorial.html:
2011-01-24  Andrei Popescu  <andreip@google.com>

        Reviewed by Nate Chapin.

        IndexedDatabase methods should not take arguments of type OptionsObject
        https://bugs.webkit.org/show_bug.cgi?id=53012

        This patch reverts all IDB methods, except IDBDatabase::createObjectStore and
        IDBObjectStore::createIndex, to using a plain list of arguments instead of
        grouping the various parameters inside a single OptionsObject argument.
        This decision was made on public-webapps@w3.org mailing list.

        We also add support (v8 only for now) for passing DOMStringList objects as arguments to native
        methods. The code for obtaining a DOMStringList object from a JS array of strings existed already
        in OptionsObject.cpp, I just copied it to V8Bindings.cpp and taught the v8 code generator how to
        use it.

        * bindings/scripts/CodeGeneratorV8.pm:
        * bindings/v8/V8Binding.cpp:
        (WebCore::v8ValueToWebCoreDOMStringList):
        * bindings/v8/V8Binding.h:
        * storage/IDBDatabase.cpp:
        (WebCore::IDBDatabase::transaction):
        * storage/IDBDatabase.h:
        (WebCore::IDBDatabase::transaction):
        * storage/IDBDatabase.idl:
        * storage/IDBIndex.cpp:
        (WebCore::IDBIndex::openCursor):
        (WebCore::IDBIndex::openKeyCursor):
        * storage/IDBIndex.h:
        (WebCore::IDBIndex::openCursor):
        (WebCore::IDBIndex::openKeyCursor):
        * storage/IDBIndex.idl:
        * storage/IDBObjectStore.cpp:
        (WebCore::IDBObjectStore::openCursor):
        * storage/IDBObjectStore.h:
        (WebCore::IDBObjectStore::openCursor):
        * storage/IDBObjectStore.idl:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@76531 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent a91fd125
2011-01-24 Andrei Popescu <andreip@google.com>
Reviewed by Nate Chapin.
IndexedDatabase methods should not take arguments of type OptionsObject
https://bugs.webkit.org/show_bug.cgi?id=53012
* storage/indexeddb/create-object-store-options-expected.txt:
* storage/indexeddb/create-object-store-options.html:
* storage/indexeddb/cursor-delete-expected.txt:
* storage/indexeddb/cursor-delete.html:
* storage/indexeddb/cursor-index-delete-expected.txt:
* storage/indexeddb/cursor-index-delete.html:
* storage/indexeddb/data-corruption-expected.txt:
* storage/indexeddb/data-corruption.html:
* storage/indexeddb/database-quota-expected.txt:
* storage/indexeddb/database-quota.html:
* storage/indexeddb/index-cursor.html:
* storage/indexeddb/objectstore-basics-expected.txt:
* storage/indexeddb/objectstore-basics.html:
* storage/indexeddb/objectstore-cursor.html:
* storage/indexeddb/open-cursor-expected.txt:
* storage/indexeddb/open-cursor.html:
* storage/indexeddb/transaction-and-objectstore-calls-expected.txt:
* storage/indexeddb/transaction-and-objectstore-calls.html:
* storage/indexeddb/tutorial.html:
2011-01-24 Chang Shu <chang.shu@nokia.com>
Reviewed by Darin Adler.
......
......@@ -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)
......
......@@ -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})");
......
......@@ -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
......
......@@ -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;
......
......@@ -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
......
......@@ -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;
......
......@@ -46,10 +46,10 @@ Deleted all object stores.
createObjectStore():
db.createObjectStore('storeName')
addData():
transaction = db.transaction({mode: webkitIDBTransaction.READ_WRITE})
transaction = db.transaction([], webkitIDBTransaction.READ_WRITE)
result = transaction.objectStore('storeName').add({x: testDate}, 'key')
addData():
transaction = db.transaction({mode: webkitIDBTransaction.READ_ONLY})
transaction = db.transaction([], webkitIDBTransaction.READ_ONLY)
result = transaction.objectStore('storeName').get('key')
Success event fired:
PASS 'result' in event is true
......
......@@ -57,7 +57,7 @@ var testDate = new Date('February 24, 1955 12:00:08');
function addData()
{
debug("addData():");
var transaction = evalAndLog("transaction = db.transaction({mode: webkitIDBTransaction.READ_WRITE})");
var transaction = evalAndLog("transaction = db.transaction([], webkitIDBTransaction.READ_WRITE)");
var result = evalAndLog("result = transaction.objectStore('storeName').add({x: testDate}, 'key')");
result.onerror = unexpectedErrorCallback;
transaction.oncomplete = getData;
......@@ -66,7 +66,7 @@ function addData()
function getData()
{
debug("addData():");
var transaction = evalAndLog("transaction = db.transaction({mode: webkitIDBTransaction.READ_ONLY})");
var transaction = evalAndLog("transaction = db.transaction([], webkitIDBTransaction.READ_ONLY)");
var result = evalAndLog("result = transaction.objectStore('storeName').get('key')");
result.onerror = unexpectedErrorCallback;
result.onsuccess = doCheck;
......
......@@ -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')
......
......@@ -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");
......
......@@ -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;
}
......
......@@ -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,7 @@ 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})
db.transaction([], webkitIDBTransaction.READ_WRITE)
store = transaction.objectStore('storeName')
store.add({x: 'othervalue'}, null)
PASS 'onsuccess' in result is true
......@@ -158,7 +158,7 @@ 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})
db.transaction([], webkitIDBTransaction.READ_WRITE)
store = transaction.objectStore('storeName')
store.add({x: null}, 'validkey')
PASS 'onsuccess' in result is true
......@@ -179,7 +179,7 @@ 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})
db.transaction([], webkitIDBTransaction.READ_WRITE)
store = transaction.objectStore('storeName')
store.get('key')
PASS 'onsuccess' in result is true
......
......@@ -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')");
......@@ -189,7 +189,7 @@ function addAgainFailure()
// FIXME: This error code needs to be specced.
shouldBe("event.code", "webkitIDBDatabaseException.UNKNOWN_ERR");
transaction = evalAndLog("db.transaction({mode: webkitIDBTransaction.READ_WRITE})");
transaction = evalAndLog("db.transaction([], webkitIDBTransaction.READ_WRITE)");
transaction.onabort = unexpectedErrorCallback;
var store = evalAndLog("store = transaction.objectStore('storeName')");
......@@ -205,7 +205,7 @@ function addWithNullKeyFailure()
verifyErrorEvent(event);
shouldBe("event.code", "webkitIDBDatabaseException.DATA_ERR");
transaction = evalAndLog("db.transaction({mode: webkitIDBTransaction.READ_WRITE})");
transaction = evalAndLog("db.transaction([], webkitIDBTransaction.READ_WRITE)");
transaction.onabort = unexpectedErrorCallback;
var store = evalAndLog("store = transaction.objectStore('storeName')");
......@@ -221,7 +221,7 @@ function addWithNullIndexFailure()
verifyErrorEvent(event);
shouldBe("event.code", "webkitIDBDatabaseException.DATA_ERR");
transaction = evalAndLog("db.transaction({mode: webkitIDBTransaction.READ_WRITE})");
transaction = evalAndLog("db.transaction([], webkitIDBTransaction.READ_WRITE)");
transaction.onabort = unexpectedErrorCallback;
var store = evalAndLog("store = transaction.objectStore('storeName')");
......
......@@ -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;
}
......
......@@ -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
......
......@@ -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;
......
......@@ -19,40 +19,40 @@ db.createObjectStore('a')
db.createObjectStore('b')
trans.oncomplete = created
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
......
......@@ -49,37 +49,37 @@ function cleaned()
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();
......
......@@ -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
......@@ -222,7 +222,7 @@ function onSetVersionComplete()
// 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, 0);
currentTransaction.oncomplete = unexpectedComplete;
currentTransaction.onabort = onTransactionAborted;
......@@ -272,7 +272,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 +310,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 +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({range: keyRange, direction: IDBCursor.NEXT});
var request = people.openCursor(keyRange, IDBCursor.NEXT);
request.onsuccess = onObjectStoreCursor;
request.onerror = unexpectedError;
}
......@@ -394,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({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();
......
2011-01-24 Andrei Popescu <andreip@google.com>
Reviewed by Nate Chapin.
IndexedDatabase methods should not take arguments of type OptionsObject
https://bugs.webkit.org/show_bug.cgi?id=53012
This patch reverts all IDB methods, except IDBDatabase::createObjectStore and
IDBObjectStore::createIndex, to using a plain list of arguments instead of
grouping the various parameters inside a single OptionsObject argument.
This decision was made on public-webapps@w3.org mailing list.
We also add support (v8 only for now) for passing DOMStringList objects as arguments to native
methods. The code for obtaining a DOMStringList object from a JS array of strings existed already
in OptionsObject.cpp, I just copied it to V8Bindings.cpp and taught the v8 code generator how to
use it.
* bindings/scripts/CodeGeneratorV8.pm:
* bindings/v8/V8Binding.cpp:
(WebCore::v8ValueToWebCoreDOMStringList):
* bindings/v8/V8Binding.h:
* storage/IDBDatabase.cpp:
(WebCore::IDBDatabase::transaction):
* storage/IDBDatabase.h:
(WebCore::IDBDatabase::transaction):
* storage/IDBDatabase.idl:
* storage/IDBIndex.cpp:
(WebCore::IDBIndex::openCursor):
(WebCore::IDBIndex::openKeyCursor):
* storage/IDBIndex.h: