Changeset 76531 in webkit
- Timestamp:
- Jan 24, 2011 11:01:45 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 33 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r76528 r76531 1 2011-01-24 Andrei Popescu <andreip@google.com> 2 3 Reviewed by Nate Chapin. 4 5 IndexedDatabase methods should not take arguments of type OptionsObject 6 https://bugs.webkit.org/show_bug.cgi?id=53012 7 8 * storage/indexeddb/create-object-store-options-expected.txt: 9 * storage/indexeddb/create-object-store-options.html: 10 * storage/indexeddb/cursor-delete-expected.txt: 11 * storage/indexeddb/cursor-delete.html: 12 * storage/indexeddb/cursor-index-delete-expected.txt: 13 * storage/indexeddb/cursor-index-delete.html: 14 * storage/indexeddb/data-corruption-expected.txt: 15 * storage/indexeddb/data-corruption.html: 16 * storage/indexeddb/database-quota-expected.txt: 17 * storage/indexeddb/database-quota.html: 18 * storage/indexeddb/index-cursor.html: 19 * storage/indexeddb/objectstore-basics-expected.txt: 20 * storage/indexeddb/objectstore-basics.html: 21 * storage/indexeddb/objectstore-cursor.html: 22 * storage/indexeddb/open-cursor-expected.txt: 23 * storage/indexeddb/open-cursor.html: 24 * storage/indexeddb/transaction-and-objectstore-calls-expected.txt: 25 * storage/indexeddb/transaction-and-objectstore-calls.html: 26 * storage/indexeddb/tutorial.html: 27 1 28 2011-01-24 Chang Shu <chang.shu@nokia.com> 2 29 -
trunk/LayoutTests/storage/indexeddb/create-object-store-options-expected.txt
r76126 r76531 18 18 db.createObjectStore('b') 19 19 db.createObjectStore('c', {autoIncrement: true}); 20 trans = db.transaction( {mode: webkitIDBTransaction.READ_WRITE})20 trans = db.transaction([], webkitIDBTransaction.READ_WRITE) 21 21 PASS trans.mode is webkitIDBTransaction.READ_WRITE 22 22 trans.objectStore('a').put({'a': 0}) -
trunk/LayoutTests/storage/indexeddb/create-object-store-options.html
r76126 r76531 48 48 db.createObjectStore('c', {autoIncrement: true}); 49 49 50 trans = evalAndLog("trans = db.transaction( {mode: webkitIDBTransaction.READ_WRITE})");50 trans = evalAndLog("trans = db.transaction([], webkitIDBTransaction.READ_WRITE)"); 51 51 shouldBe("trans.mode", "webkitIDBTransaction.READ_WRITE"); 52 52 -
trunk/LayoutTests/storage/indexeddb/cursor-delete-expected.txt
r76217 r76531 49 49 objectStore.add('myValue4', 'myKey4') 50 50 openCursor1 51 trans = db.transaction( {objectStoreNames: 'test', mode: webkitIDBTransaction.READ_WRITE})51 trans = db.transaction(['test'], webkitIDBTransaction.READ_WRITE) 52 52 trans.objectStore('test').openCursor({range: keyRange}) 53 53 PASS 'onsuccess' in result is true … … 69 69 event.result.continue() 70 70 PASS counter is 5 71 trans.objectStore('test').openCursor( {range: keyRange})71 trans.objectStore('test').openCursor(keyRange) 72 72 PASS 'onsuccess' in result is true 73 73 PASS 'onerror' in result is true … … 87 87 88 88 PASS event.result is null 89 trans = db.transaction( {objectStoreNames: 'test', mode: webkitIDBTransaction.READ_WRITE})89 trans = db.transaction(['test'], webkitIDBTransaction.READ_WRITE) 90 90 objectStore = trans.objectStore('test') 91 91 objectStore.add('myValue1', 'myKey1') … … 96 96 97 97 openCursor2 98 objectStore.openCursor( {range: keyRange})98 objectStore.openCursor(keyRange) 99 99 PASS 'onsuccess' in result is true 100 100 PASS 'onerror' in result is true -
trunk/LayoutTests/storage/indexeddb/cursor-delete.html
r76217 r76531 60 60 { 61 61 debug("openCursor1"); 62 evalAndLog("trans = db.transaction( {objectStoreNames: 'test', mode: webkitIDBTransaction.READ_WRITE})");62 evalAndLog("trans = db.transaction(['test'], webkitIDBTransaction.READ_WRITE)"); 63 63 keyRange = webkitIDBKeyRange.lowerBound("myKey1"); 64 64 result = evalAndLog("trans.objectStore('test').openCursor({range: keyRange})"); … … 73 73 if (event.result == null) { 74 74 shouldBe("counter", "5"); 75 result = evalAndLog("trans.objectStore('test').openCursor( {range: keyRange})");75 result = evalAndLog("trans.objectStore('test').openCursor(keyRange)"); 76 76 verifyResult(result); 77 77 result.onsuccess = cursorEmpty; … … 93 93 function addObject() 94 94 { 95 evalAndLog("trans = db.transaction( {objectStoreNames: 'test', mode: webkitIDBTransaction.READ_WRITE})");95 evalAndLog("trans = db.transaction(['test'], webkitIDBTransaction.READ_WRITE)"); 96 96 objectStore = evalAndLog("objectStore = trans.objectStore('test')"); 97 97 result = evalAndLog("objectStore.add('myValue1', 'myKey1')"); … … 104 104 { 105 105 debug("openCursor2"); 106 result = evalAndLog("objectStore.openCursor( {range: keyRange})");106 result = evalAndLog("objectStore.openCursor(keyRange)"); 107 107 verifyResult(result); 108 108 result.onsuccess = deleteObject; -
trunk/LayoutTests/storage/indexeddb/cursor-index-delete-expected.txt
r75596 r76531 50 50 objectStore.add({x: 4}, 'myKey4') 51 51 openCursor1 52 trans = db.transaction( {objectStoreNames: 'test', mode: webkitIDBTransaction.READ_WRITE})53 trans.objectStore('test').index('testIndex').openCursor( {range: keyRange})52 trans = db.transaction(['test'], webkitIDBTransaction.READ_WRITE) 53 trans.objectStore('test').index('testIndex').openCursor(keyRange) 54 54 PASS 'onsuccess' in result is true 55 55 PASS 'onerror' in result is true … … 70 70 event.result.continue() 71 71 PASS counter is 5 72 trans.objectStore('test').index('testIndex').openCursor( {range: keyRange})72 trans.objectStore('test').index('testIndex').openCursor(keyRange) 73 73 PASS 'onsuccess' in result is true 74 74 PASS 'onerror' in result is true … … 88 88 89 89 PASS event.result is null 90 trans = db.transaction( {objectStoreNames: 'test', mode: webkitIDBTransaction.READ_WRITE})90 trans = db.transaction(['test'], webkitIDBTransaction.READ_WRITE) 91 91 objectStore = trans.objectStore('test') 92 92 objectStore.add({x: 1}, 'myKey1') … … 98 98 openCursor2 99 99 index = event.source.index('testIndex') 100 index.openCursor( {range: keyRange})100 index.openCursor(keyRange) 101 101 PASS 'onsuccess' in result is true 102 102 PASS 'onerror' in result is true -
trunk/LayoutTests/storage/indexeddb/cursor-index-delete.html
r75596 r76531 62 62 { 63 63 debug("openCursor1"); 64 evalAndLog("trans = db.transaction( {objectStoreNames: 'test', mode: webkitIDBTransaction.READ_WRITE})");64 evalAndLog("trans = db.transaction(['test'], webkitIDBTransaction.READ_WRITE)"); 65 65 keyRange = webkitIDBKeyRange.lowerBound(1); 66 result = evalAndLog("trans.objectStore('test').index('testIndex').openCursor( {range: keyRange})");66 result = evalAndLog("trans.objectStore('test').index('testIndex').openCursor(keyRange)"); 67 67 verifyResult(result); 68 68 result.onsuccess = cursorSuccess; … … 75 75 if (event.result == null) { 76 76 shouldBe("counter", "5"); 77 result = evalAndLog("trans.objectStore('test').index('testIndex').openCursor( {range: keyRange})");77 result = evalAndLog("trans.objectStore('test').index('testIndex').openCursor(keyRange)"); 78 78 verifyResult(result); 79 79 result.onsuccess = cursorEmpty; … … 96 96 function addObject() 97 97 { 98 evalAndLog("trans = db.transaction( {objectStoreNames: 'test', mode: webkitIDBTransaction.READ_WRITE})");98 evalAndLog("trans = db.transaction(['test'], webkitIDBTransaction.READ_WRITE)"); 99 99 objectStore = evalAndLog("objectStore = trans.objectStore('test')"); 100 100 result = evalAndLog("objectStore.add({x: 1}, 'myKey1')"); … … 108 108 debug("openCursor2"); 109 109 evalAndLog("index = event.source.index('testIndex')"); 110 result = evalAndLog("index.openCursor( {range: keyRange})");110 result = evalAndLog("index.openCursor(keyRange)"); 111 111 verifyResult(result); 112 112 result.onsuccess = deleteObject; -
trunk/LayoutTests/storage/indexeddb/data-corruption-expected.txt
r76448 r76531 47 47 db.createObjectStore('storeName') 48 48 addData(): 49 transaction = db.transaction( {mode: webkitIDBTransaction.READ_WRITE})49 transaction = db.transaction([], webkitIDBTransaction.READ_WRITE) 50 50 result = transaction.objectStore('storeName').add({x: testDate}, 'key') 51 51 addData(): 52 transaction = db.transaction( {mode: webkitIDBTransaction.READ_ONLY})52 transaction = db.transaction([], webkitIDBTransaction.READ_ONLY) 53 53 result = transaction.objectStore('storeName').get('key') 54 54 Success event fired: -
trunk/LayoutTests/storage/indexeddb/data-corruption.html
r76448 r76531 58 58 { 59 59 debug("addData():"); 60 var transaction = evalAndLog("transaction = db.transaction( {mode: webkitIDBTransaction.READ_WRITE})");60 var transaction = evalAndLog("transaction = db.transaction([], webkitIDBTransaction.READ_WRITE)"); 61 61 var result = evalAndLog("result = transaction.objectStore('storeName').add({x: testDate}, 'key')"); 62 62 result.onerror = unexpectedErrorCallback; … … 67 67 { 68 68 debug("addData():"); 69 var transaction = evalAndLog("transaction = db.transaction( {mode: webkitIDBTransaction.READ_ONLY})");69 var transaction = evalAndLog("transaction = db.transaction([], webkitIDBTransaction.READ_ONLY)"); 70 70 var result = evalAndLog("result = transaction.objectStore('storeName').get('key')"); 71 71 result.onerror = unexpectedErrorCallback; -
trunk/LayoutTests/storage/indexeddb/database-quota-expected.txt
r75596 r76531 65 65 PASS db.objectStoreNames.contains('test456') is false 66 66 PASS db.objectStoreNames.contains('test123') is true 67 trans = db.transaction( {mode: webkitIDBTransaction.READ_WRITE})67 trans = db.transaction([], webkitIDBTransaction.READ_WRITE) 68 68 Creating 'data' which contains 64K of data 69 69 PASS data.length is 65536 -
trunk/LayoutTests/storage/indexeddb/database-quota.html
r75596 r76531 75 75 function checkQuotaEnforcing() 76 76 { 77 var trans = evalAndLog("trans = db.transaction( {mode: webkitIDBTransaction.READ_WRITE})");77 var trans = evalAndLog("trans = db.transaction([], webkitIDBTransaction.READ_WRITE)"); 78 78 trans.onabort = testComplete; 79 79 trans.oncomplete = unexpectedCompleteCallback; -
trunk/LayoutTests/storage/indexeddb/index-cursor.html
r73697 r76531 188 188 keyRange = webkitIDBKeyRange.upperBound(testData[upper], upperIsOpen); 189 189 190 var request = indexObject.openKeyCursor( {range: keyRange, direction: ascending ? webkitIDBCursor.NEXT : webkitIDBCursor.PREV});190 var request = indexObject.openKeyCursor(keyRange, ascending ? webkitIDBCursor.NEXT : webkitIDBCursor.PREV); 191 191 request.onsuccess = cursorIteration; 192 192 request.onerror = unexpectedErrorCallback; … … 255 255 debug(str); 256 256 257 var request = indexObject.openKeyCursor( {direction: ascending ? webkitIDBCursor.NEXT : webkitIDBCursor.PREV});257 var request = indexObject.openKeyCursor(null, ascending ? webkitIDBCursor.NEXT : webkitIDBCursor.PREV); 258 258 request.onsuccess = cursorIteration; 259 259 request.onerror = unexpectedErrorCallback; -
trunk/LayoutTests/storage/indexeddb/objectstore-basics-expected.txt
r75596 r76531 96 96 PASS store.indexNames.item(1) is null 97 97 PASS store.indexNames.item(100) is null 98 transaction = db.transaction( {mode: webkitIDBTransaction.READ_WRITE})98 transaction = db.transaction([], webkitIDBTransaction.READ_WRITE) 99 99 store = transaction.objectStore('storeName') 100 100 Try to insert data with a Date key: … … 138 138 139 139 PASS event.code is webkitIDBDatabaseException.UNKNOWN_ERR 140 db.transaction( {mode: webkitIDBTransaction.READ_WRITE})140 db.transaction([], webkitIDBTransaction.READ_WRITE) 141 141 store = transaction.objectStore('storeName') 142 142 store.add({x: 'othervalue'}, null) … … 159 159 160 160 PASS event.code is webkitIDBDatabaseException.DATA_ERR 161 db.transaction( {mode: webkitIDBTransaction.READ_WRITE})161 db.transaction([], webkitIDBTransaction.READ_WRITE) 162 162 store = transaction.objectStore('storeName') 163 163 store.add({x: null}, 'validkey') … … 180 180 181 181 PASS event.code is webkitIDBDatabaseException.DATA_ERR 182 db.transaction( {mode: webkitIDBTransaction.READ_WRITE})182 db.transaction([], webkitIDBTransaction.READ_WRITE) 183 183 store = transaction.objectStore('storeName') 184 184 store.get('key') -
trunk/LayoutTests/storage/indexeddb/objectstore-basics.html
r75596 r76531 142 142 function addData() 143 143 { 144 var transaction = evalAndLog("transaction = db.transaction( {mode: webkitIDBTransaction.READ_WRITE})");144 var transaction = evalAndLog("transaction = db.transaction([], webkitIDBTransaction.READ_WRITE)"); 145 145 transaction.onabort = unexpectedAbortCallback; 146 146 window.store = evalAndLog("store = transaction.objectStore('storeName')"); … … 190 190 shouldBe("event.code", "webkitIDBDatabaseException.UNKNOWN_ERR"); 191 191 192 transaction = evalAndLog("db.transaction( {mode: webkitIDBTransaction.READ_WRITE})");192 transaction = evalAndLog("db.transaction([], webkitIDBTransaction.READ_WRITE)"); 193 193 transaction.onabort = unexpectedErrorCallback; 194 194 var store = evalAndLog("store = transaction.objectStore('storeName')"); … … 206 206 shouldBe("event.code", "webkitIDBDatabaseException.DATA_ERR"); 207 207 208 transaction = evalAndLog("db.transaction( {mode: webkitIDBTransaction.READ_WRITE})");208 transaction = evalAndLog("db.transaction([], webkitIDBTransaction.READ_WRITE)"); 209 209 transaction.onabort = unexpectedErrorCallback; 210 210 var store = evalAndLog("store = transaction.objectStore('storeName')"); … … 222 222 shouldBe("event.code", "webkitIDBDatabaseException.DATA_ERR"); 223 223 224 transaction = evalAndLog("db.transaction( {mode: webkitIDBTransaction.READ_WRITE})");224 transaction = evalAndLog("db.transaction([], webkitIDBTransaction.READ_WRITE)"); 225 225 transaction.onabort = unexpectedErrorCallback; 226 226 var store = evalAndLog("store = transaction.objectStore('storeName')"); -
trunk/LayoutTests/storage/indexeddb/objectstore-cursor.html
r73697 r76531 166 166 keyRange = webkitIDBKeyRange.upperBound(testData[upper], upperIsOpen); 167 167 168 var request = objectStore.openCursor( {range: keyRange, direction: ascending ? webkitIDBCursor.NEXT : webkitIDBCursor.PREV});168 var request = objectStore.openCursor(keyRange, ascending ? webkitIDBCursor.NEXT : webkitIDBCursor.PREV); 169 169 request.onsuccess = cursorIteration; 170 170 request.onerror = unexpectedErrorCallback; … … 232 232 debug(str); 233 233 234 var request = objectStore.openCursor( {direction: ascending ? webkitIDBCursor.NEXT : webkitIDBCursor.PREV});234 var request = objectStore.openCursor(null, ascending ? webkitIDBCursor.NEXT : webkitIDBCursor.PREV); 235 235 request.onsuccess = cursorIteration; 236 236 request.onerror = unexpectedErrorCallback; -
trunk/LayoutTests/storage/indexeddb/open-cursor-expected.txt
r72766 r76531 51 51 52 52 Opening cursor 53 event.source.openCursor( {range: keyRange})53 event.source.openCursor(keyRange) 54 54 PASS 'onsuccess' in result is true 55 55 PASS 'onerror' in result is true … … 77 77 78 78 Opening an empty cursor. 79 objectStore.openCursor( {range: keyRange})79 objectStore.openCursor(keyRange) 80 80 PASS 'onsuccess' in result is true 81 81 PASS 'onerror' in result is true -
trunk/LayoutTests/storage/indexeddb/open-cursor.html
r72767 r76531 27 27 debug("Opening an empty cursor."); 28 28 keyRange = webkitIDBKeyRange.lowerBound("InexistentKey"); 29 result = evalAndLog("objectStore.openCursor( {range: keyRange})");29 result = evalAndLog("objectStore.openCursor(keyRange)"); 30 30 verifyResult(result); 31 31 result.onsuccess = emptyCursorSuccess; … … 57 57 debug("Opening cursor"); 58 58 keyRange = webkitIDBKeyRange.lowerBound("myKey"); 59 result = evalAndLog("event.source.openCursor( {range: keyRange})");59 result = evalAndLog("event.source.openCursor(keyRange)"); 60 60 verifyResult(result); 61 61 result.onsuccess = cursorSuccess; -
trunk/LayoutTests/storage/indexeddb/transaction-and-objectstore-calls-expected.txt
r72765 r76531 20 20 trans.oncomplete = created 21 21 22 trans = db.transaction( {objectStoreNames: 'a'})22 trans = db.transaction(['a']) 23 23 trans.objectStore('a') 24 24 Expecting exception from trans.objectStore('b') … … 27 27 PASS code is webkitIDBDatabaseException.NOT_FOUND_ERR 28 28 29 trans = db.transaction( {objectStoreNames: ['a']})29 trans = db.transaction(['a']) 30 30 trans.objectStore('a') 31 31 Expecting exception from trans.objectStore('b') … … 34 34 PASS code is webkitIDBDatabaseException.NOT_FOUND_ERR 35 35 36 trans = db.transaction( {objectStoreNames: ['b']})36 trans = db.transaction(['b']) 37 37 trans.objectStore('b') 38 38 Expecting exception from trans.objectStore('a') … … 41 41 PASS code is webkitIDBDatabaseException.NOT_FOUND_ERR 42 42 43 trans = db.transaction( {objectStoreNames: ['a', 'b']})43 trans = db.transaction(['a', 'b']) 44 44 trans.objectStore('a') 45 45 trans.objectStore('b') … … 47 47 PASS code is webkitIDBDatabaseException.NOT_FOUND_ERR 48 48 49 trans = db.transaction( {objectStoreNames: ['b', 'a']})49 trans = db.transaction(['b', 'a']) 50 50 trans.objectStore('a') 51 51 trans.objectStore('b') … … 53 53 PASS code is webkitIDBDatabaseException.NOT_FOUND_ERR 54 54 55 trans = db.transaction( {objectStoreNames: []})55 trans = db.transaction([]) 56 56 trans.objectStore('a') 57 57 trans.objectStore('b') … … 65 65 PASS code is webkitIDBDatabaseException.NOT_FOUND_ERR 66 66 67 Expecting exception from db.transaction( {objectStoreNames: 'x'})67 Expecting exception from db.transaction(['x']) 68 68 PASS code is webkitIDBDatabaseException.NOT_FOUND_ERR 69 Expecting exception from db.transaction( {objectStoreNames: ['x']})69 Expecting exception from db.transaction(['x']) 70 70 PASS code is webkitIDBDatabaseException.NOT_FOUND_ERR 71 Expecting exception from db.transaction( {objectStoreNames: ['a', 'x']})71 Expecting exception from db.transaction(['a', 'x']) 72 72 PASS code is webkitIDBDatabaseException.NOT_FOUND_ERR 73 Expecting exception from db.transaction( {objectStoreNames: ['x', 'x']})73 Expecting exception from db.transaction(['x', 'x']) 74 74 PASS code is webkitIDBDatabaseException.NOT_FOUND_ERR 75 Expecting exception from db.transaction( {objectStoreNames: ['a', 'x', 'b']})75 Expecting exception from db.transaction(['a', 'x', 'b']) 76 76 PASS code is webkitIDBDatabaseException.NOT_FOUND_ERR 77 77 -
trunk/LayoutTests/storage/indexeddb/transaction-and-objectstore-calls.html
r72765 r76531 50 50 function created() 51 51 { 52 trans = evalAndLog("trans = db.transaction( {objectStoreNames: 'a'})");52 trans = evalAndLog("trans = db.transaction(['a'])"); 53 53 evalAndLog("trans.objectStore('a')"); 54 54 evalAndExpectException("trans.objectStore('b')", "webkitIDBDatabaseException.NOT_FOUND_ERR"); … … 56 56 debug(""); 57 57 58 trans = evalAndLog("trans = db.transaction( {objectStoreNames: ['a']})");58 trans = evalAndLog("trans = db.transaction(['a'])"); 59 59 evalAndLog("trans.objectStore('a')"); 60 60 evalAndExpectException("trans.objectStore('b')", "webkitIDBDatabaseException.NOT_FOUND_ERR"); … … 62 62 debug(""); 63 63 64 trans = evalAndLog("trans = db.transaction( {objectStoreNames: ['b']})");64 trans = evalAndLog("trans = db.transaction(['b'])"); 65 65 evalAndLog("trans.objectStore('b')"); 66 66 evalAndExpectException("trans.objectStore('a')", "webkitIDBDatabaseException.NOT_FOUND_ERR"); … … 68 68 debug(""); 69 69 70 trans = evalAndLog("trans = db.transaction( {objectStoreNames: ['a', 'b']})");70 trans = evalAndLog("trans = db.transaction(['a', 'b'])"); 71 71 evalAndLog("trans.objectStore('a')"); 72 72 evalAndLog("trans.objectStore('b')"); … … 74 74 debug(""); 75 75 76 trans = evalAndLog("trans = db.transaction( {objectStoreNames: ['b', 'a']})");76 trans = evalAndLog("trans = db.transaction(['b', 'a'])"); 77 77 evalAndLog("trans.objectStore('a')"); 78 78 evalAndLog("trans.objectStore('b')"); … … 80 80 debug(""); 81 81 82 trans = evalAndLog("trans = db.transaction( {objectStoreNames: []})");82 trans = evalAndLog("trans = db.transaction([])"); 83 83 evalAndLog("trans.objectStore('a')"); 84 84 evalAndLog("trans.objectStore('b')"); … … 92 92 debug(""); 93 93 94 evalAndExpectException("db.transaction( {objectStoreNames: 'x'})", "webkitIDBDatabaseException.NOT_FOUND_ERR");95 evalAndExpectException("db.transaction( {objectStoreNames: ['x']})", "webkitIDBDatabaseException.NOT_FOUND_ERR");96 evalAndExpectException("db.transaction( {objectStoreNames: ['a', 'x']})", "webkitIDBDatabaseException.NOT_FOUND_ERR");97 evalAndExpectException("db.transaction( {objectStoreNames: ['x', 'x']})", "webkitIDBDatabaseException.NOT_FOUND_ERR");98 evalAndExpectException("db.transaction( {objectStoreNames: ['a', 'x', 'b']})", "webkitIDBDatabaseException.NOT_FOUND_ERR");94 evalAndExpectException("db.transaction(['x'])", "webkitIDBDatabaseException.NOT_FOUND_ERR"); 95 evalAndExpectException("db.transaction(['x'])", "webkitIDBDatabaseException.NOT_FOUND_ERR"); 96 evalAndExpectException("db.transaction(['a', 'x'])", "webkitIDBDatabaseException.NOT_FOUND_ERR"); 97 evalAndExpectException("db.transaction(['x', 'x'])", "webkitIDBDatabaseException.NOT_FOUND_ERR"); 98 evalAndExpectException("db.transaction(['a', 'x', 'b'])", "webkitIDBDatabaseException.NOT_FOUND_ERR"); 99 99 debug(""); 100 100 -
trunk/LayoutTests/storage/indexeddb/tutorial.html
r72785 r76531 208 208 // Lets create a new transaction and then not schedule any work on it to watch it abort itself. 209 209 // Transactions (besides those created with setVersion) are created synchronously. Like 210 // createObjectStore, transaction optionally takes in an object withvarious optional parameters.210 // createObjectStore, transaction optionally takes in various optional parameters. 211 211 // 212 212 // First of all is the parameter "objectStoreNames". If you pass in a string, we lock just that … … 223 223 // means never, but it's possible we'll change this in the future and other implementations may 224 224 // use something different, so set it if you really care. 225 window.currentTransaction = db.transaction( {mode: IDBTransaction.READ_WRITE, timeout: 0});225 window.currentTransaction = db.transaction([], IDBTransaction.READ_WRITE, 0); 226 226 currentTransaction.oncomplete = unexpectedComplete; 227 227 currentTransaction.onabort = onTransactionAborted; … … 273 273 // we'll omit the objectStoreNames parameter which means we'll lock everything even though we only 274 274 // ever access "people". 275 window.currentTransaction = db.transaction( {mode: IDBTransaction.READ_WRITE});275 window.currentTransaction = db.transaction([], IDBTransaction.READ_WRITE); 276 276 currentTransaction.onabort = unexpectedAbort; 277 277 … … 311 311 // It simply takes in a key and returns a request whose result will be the value. Note that here 312 312 // we're passing in an array for objectStoreNames rather than a simple string. 313 window.currentTransaction = db.transaction( {objectStoreNames: ["people"], mode: IDBTransaction.READ_WRITE, timeout: 0});313 window.currentTransaction = db.transaction(["people"], IDBTransaction.READ_WRITE, 0); 314 314 currentTransaction.onabort = unexpectedAbort; 315 315 … … 342 342 // and PREV_NO_DUPLICATE. 343 343 var keyRange = IDBKeyRange.bound(1, 3, true, false); 344 var request = people.openCursor( {range: keyRange, direction: IDBCursor.NEXT});344 var request = people.openCursor(keyRange, IDBCursor.NEXT); 345 345 request.onsuccess = onObjectStoreCursor; 346 346 request.onerror = unexpectedError; … … 395 395 // the onsuccess conditions. 396 396 var lname = event.source; 397 lname.openCursor( {range: IDBKeyRange.lowerBound("Doe", false), direction: IDBCursor.NEXT_NO_DUPLICATE});398 lname.openCursor( {direction: IDBCursor.PREV_NO_DUPLICATE});399 lname.openCursor( {range: IDBKeyRange.upperBound("ZZZZ")});400 lname.openCursor( {range: IDBKeyRange.only("Doe"), direction: IDBCursor.PREV});397 lname.openCursor(IDBKeyRange.lowerBound("Doe", false), IDBCursor.NEXT_NO_DUPLICATE); 398 lname.openCursor(null, IDBCursor.PREV_NO_DUPLICATE); 399 lname.openCursor(IDBKeyRange.upperBound("ZZZZ")); 400 lname.openCursor(IDBKeyRange.only("Doe"), IDBCursor.PREV); 401 401 lname.openCursor(); 402 402 lname.openKeyCursor(); -
trunk/Source/WebCore/ChangeLog
r76519 r76531 1 2011-01-24 Andrei Popescu <andreip@google.com> 2 3 Reviewed by Nate Chapin. 4 5 IndexedDatabase methods should not take arguments of type OptionsObject 6 https://bugs.webkit.org/show_bug.cgi?id=53012 7 8 This patch reverts all IDB methods, except IDBDatabase::createObjectStore and 9 IDBObjectStore::createIndex, to using a plain list of arguments instead of 10 grouping the various parameters inside a single OptionsObject argument. 11 This decision was made on public-webapps@w3.org mailing list. 12 13 We also add support (v8 only for now) for passing DOMStringList objects as arguments to native 14 methods. The code for obtaining a DOMStringList object from a JS array of strings existed already 15 in OptionsObject.cpp, I just copied it to V8Bindings.cpp and taught the v8 code generator how to 16 use it. 17 18 * bindings/scripts/CodeGeneratorV8.pm: 19 * bindings/v8/V8Binding.cpp: 20 (WebCore::v8ValueToWebCoreDOMStringList): 21 * bindings/v8/V8Binding.h: 22 * storage/IDBDatabase.cpp: 23 (WebCore::IDBDatabase::transaction): 24 * storage/IDBDatabase.h: 25 (WebCore::IDBDatabase::transaction): 26 * storage/IDBDatabase.idl: 27 * storage/IDBIndex.cpp: 28 (WebCore::IDBIndex::openCursor): 29 (WebCore::IDBIndex::openKeyCursor): 30 * storage/IDBIndex.h: 31 (WebCore::IDBIndex::openCursor): 32 (WebCore::IDBIndex::openKeyCursor): 33 * storage/IDBIndex.idl: 34 * storage/IDBObjectStore.cpp: 35 (WebCore::IDBObjectStore::openCursor): 36 * storage/IDBObjectStore.h: 37 (WebCore::IDBObjectStore::openCursor): 38 * storage/IDBObjectStore.idl: 39 1 40 2011-01-24 Pavel Feldman <pfeldman@chromium.org> 2 41 -
trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm
r76277 r76531 2833 2833 return "RefPtr<MediaQueryListListener>" if $type eq "MediaQueryListListener"; 2834 2834 2835 return "RefPtr<DOMStringList>" if $type eq "DOMStringList"; 2836 2835 2837 # Default, assume native type is a pointer with same type name as idl type 2836 2838 return "${type}*"; … … 2886 2888 return "static_cast<SVGPaint::SVGPaintType>($value->ToInt32()->Int32Value())" if $type eq "SVGPaintType"; 2887 2889 return "toWebCoreDate($value)" if $type eq "Date"; 2890 return "v8ValueToWebCoreDOMStringList($value)" if $type eq "DOMStringList"; 2888 2891 2889 2892 if ($type eq "DOMString" or $type eq "DOMUserData") { -
trunk/Source/WebCore/bindings/v8/V8Binding.cpp
r72354 r76531 32 32 #include "V8Binding.h" 33 33 34 #include "DOMStringList.h" 34 35 #include "Element.h" 35 36 #include "MathExtras.h" … … 579 580 } 580 581 582 PassRefPtr<DOMStringList> v8ValueToWebCoreDOMStringList(v8::Handle<v8::Value> value) 583 { 584 v8::Local<v8::Value> v8Value(v8::Local<v8::Value>::New(value)); 585 if (!v8Value->IsArray()) 586 return 0; 587 588 RefPtr<DOMStringList> ret = DOMStringList::create(); 589 v8::Local<v8::Array> v8Array = v8::Local<v8::Array>::Cast(v8Value); 590 for (size_t i = 0; i < v8Array->Length(); ++i) { 591 v8::Local<v8::Value> indexedValue = v8Array->Get(v8::Integer::New(i)); 592 ret->append(v8ValueToWebCoreString(indexedValue)); 593 } 594 return ret.release(); 595 } 596 581 597 } // namespace WebCore -
trunk/Source/WebCore/bindings/v8/V8Binding.h
r74833 r76531 42 42 namespace WebCore { 43 43 44 class DOMStringList; 44 45 class EventListener; 45 46 class EventTarget; … … 207 208 String int32ToWebCoreString(int value); 208 209 210 PassRefPtr<DOMStringList> v8ValueToWebCoreDOMStringList(v8::Handle<v8::Value>); 211 209 212 class V8ParameterBase { 210 213 public: -
trunk/Source/WebCore/storage/IDBDatabase.cpp
r76126 r76531 99 99 } 100 100 101 PassRefPtr<IDBTransaction> IDBDatabase::transaction(ScriptExecutionContext* context, const OptionsObject& options, ExceptionCode& ec)101 PassRefPtr<IDBTransaction> IDBDatabase::transaction(ScriptExecutionContext* context, PassRefPtr<DOMStringList> prpStoreNames, unsigned short mode, unsigned long timeout, ExceptionCode& ec) 102 102 { 103 RefPtr<DOMStringList> storeNames = options.getKeyDOMStringList("objectStoreNames");104 if (!storeNames) {103 RefPtr<DOMStringList> storeNames = prpStoreNames; 104 if (!storeNames) 105 105 storeNames = DOMStringList::create(); 106 String storeName;107 if (options.getKeyString("objectStoreNames", storeName))108 storeNames->append(storeName);109 }110 106 111 // Gets cast to an unsigned short.112 int32_t mode = IDBTransaction::READ_ONLY;113 options.getKeyInt32("mode", mode);114 107 if (mode != IDBTransaction::READ_WRITE && mode != IDBTransaction::READ_ONLY) { 115 108 // FIXME: May need to change when specced: http://www.w3.org/Bugs/Public/show_bug.cgi?id=11406 … … 117 110 return 0; 118 111 } 119 120 // Gets cast to an unsigned long.121 // FIXME: The spec needs to be updated on this. It should probably take a double.122 int32_t timeout = defaultTimeout;123 options.getKeyInt32("timeout", timeout);124 int64_t unsignedLongMax = std::numeric_limits<unsigned long>::max();125 if (timeout < 0 || timeout > unsignedLongMax)126 timeout = defaultTimeout; // Ignore illegal values.127 112 128 113 // We need to create a new transaction synchronously. Locks are acquired asynchronously. Operations -
trunk/Source/WebCore/storage/IDBDatabase.h
r72771 r76531 62 62 // FIXME: Try to modify the code generator so this is unneeded. 63 63 PassRefPtr<IDBObjectStore> createObjectStore(const String& name, ExceptionCode& ec) { return createObjectStore(name, OptionsObject(), ec); } 64 PassRefPtr<IDBTransaction> transaction(ScriptExecutionContext* context, ExceptionCode& ec) { return transaction(context, OptionsObject(), ec); } 64 PassRefPtr<IDBTransaction> transaction(ScriptExecutionContext* context, ExceptionCode& ec) { return transaction(context, 0, ec); } 65 PassRefPtr<IDBTransaction> transaction(ScriptExecutionContext* context, PassRefPtr<DOMStringList> storeNames, ExceptionCode& ec) { return transaction(context, storeNames, IDBTransaction::READ_ONLY, ec); } 66 PassRefPtr<IDBTransaction> transaction(ScriptExecutionContext* context, PassRefPtr<DOMStringList> storeNames, unsigned short mode, ExceptionCode& ec) { return transaction(context, storeNames, mode, 0, ec); } 67 PassRefPtr<IDBTransaction> transaction(ScriptExecutionContext*, PassRefPtr<DOMStringList>, unsigned short mode, unsigned long timeout, ExceptionCode&); 65 68 66 69 PassRefPtr<IDBObjectStore> createObjectStore(const String& name, const OptionsObject&, ExceptionCode&); 67 70 void deleteObjectStore(const String& name, ExceptionCode&); 68 71 PassRefPtr<IDBRequest> setVersion(ScriptExecutionContext*, const String& version, ExceptionCode&); 69 PassRefPtr<IDBTransaction> transaction(ScriptExecutionContext*, const OptionsObject&, ExceptionCode&);70 72 void close(); 71 73 -
trunk/Source/WebCore/storage/IDBDatabase.idl
r75596 r76531 39 39 [CallWith=ScriptExecutionContext] IDBRequest setVersion(in DOMString version) 40 40 raises (IDBDatabaseException); 41 [CallWith=ScriptExecutionContext] IDBTransaction transaction(in [Optional] OptionsObject optionsObject)41 [CallWith=ScriptExecutionContext] IDBTransaction transaction(in [Optional] DOMStringList storeNames, in [Optional] unsigned short mode, in [Optional] unsigned long timeout) 42 42 raises (IDBDatabaseException); 43 43 // FIXME: Implement. -
trunk/Source/WebCore/storage/IDBIndex.cpp
r72769 r76531 53 53 } 54 54 55 PassRefPtr<IDBRequest> IDBIndex::openCursor(ScriptExecutionContext* context, const OptionsObject& options, ExceptionCode& ec)55 PassRefPtr<IDBRequest> IDBIndex::openCursor(ScriptExecutionContext* context, PassRefPtr<IDBKeyRange> keyRange, unsigned short direction, ExceptionCode& ec) 56 56 { 57 RefPtr<IDBKeyRange> keyRange = options.getKeyKeyRange("range");58 59 // Converted to an unsigned short.60 int32_t direction = defaultDirection;61 options.getKeyInt32("direction", direction);62 57 if (direction != IDBCursor::NEXT && direction != IDBCursor::NEXT_NO_DUPLICATE && direction != IDBCursor::PREV && direction != IDBCursor::PREV_NO_DUPLICATE) { 63 58 // FIXME: May need to change when specced: http://www.w3.org/Bugs/Public/show_bug.cgi?id=11406 … … 73 68 } 74 69 75 PassRefPtr<IDBRequest> IDBIndex::openKeyCursor(ScriptExecutionContext* context, const OptionsObject& options, ExceptionCode& ec)70 PassRefPtr<IDBRequest> IDBIndex::openKeyCursor(ScriptExecutionContext* context, PassRefPtr<IDBKeyRange> keyRange, unsigned short direction, ExceptionCode& ec) 76 71 { 77 RefPtr<IDBKeyRange> keyRange = options.getKeyKeyRange("range");78 79 // Converted to an unsigned short.80 int32_t direction = defaultDirection;81 options.getKeyInt32("direction", direction);82 72 if (direction != IDBCursor::NEXT && direction != IDBCursor::NEXT_NO_DUPLICATE && direction != IDBCursor::PREV && direction != IDBCursor::PREV_NO_DUPLICATE) { 83 73 // FIXME: May need to change when specced: http://www.w3.org/Bugs/Public/show_bug.cgi?id=11406 -
trunk/Source/WebCore/storage/IDBIndex.h
r72766 r76531 31 31 #include "IDBKeyRange.h" 32 32 #include "IDBRequest.h" 33 #include "OptionsObject.h"34 33 #include "PlatformString.h" 35 34 #include <wtf/Forward.h> … … 54 53 55 54 // FIXME: Try to modify the code generator so this is unneeded. 56 PassRefPtr<IDBRequest> openCursor(ScriptExecutionContext* context, ExceptionCode& ec) { return openCursor(context, OptionsObject(), ec); } 57 PassRefPtr<IDBRequest> openKeyCursor(ScriptExecutionContext* context, ExceptionCode& ec) { return openKeyCursor(context, OptionsObject(), ec); } 55 PassRefPtr<IDBRequest> openCursor(ScriptExecutionContext* context, ExceptionCode& ec) { return openCursor(context, 0, ec); } 56 PassRefPtr<IDBRequest> openCursor(ScriptExecutionContext* context, PassRefPtr<IDBKeyRange> keyRange, ExceptionCode& ec) { return openCursor(context, keyRange, IDBCursor::NEXT, ec); } 57 PassRefPtr<IDBRequest> openCursor(ScriptExecutionContext*, PassRefPtr<IDBKeyRange>, unsigned short direction, ExceptionCode&); 58 58 59 PassRefPtr<IDBRequest> openCursor(ScriptExecutionContext*, const OptionsObject&, ExceptionCode&); 60 PassRefPtr<IDBRequest> openKeyCursor(ScriptExecutionContext*, const OptionsObject&, ExceptionCode&); 59 PassRefPtr<IDBRequest> openKeyCursor(ScriptExecutionContext* context, ExceptionCode& ec) { return openKeyCursor(context, 0, ec); } 60 PassRefPtr<IDBRequest> openKeyCursor(ScriptExecutionContext* context, PassRefPtr<IDBKeyRange> keyRange, ExceptionCode& ec) { return openKeyCursor(context, keyRange, IDBCursor::NEXT, ec); } 61 PassRefPtr<IDBRequest> openKeyCursor(ScriptExecutionContext*, PassRefPtr<IDBKeyRange>, unsigned short direction, ExceptionCode&); 62 61 63 PassRefPtr<IDBRequest> get(ScriptExecutionContext*, PassRefPtr<IDBKey>, ExceptionCode&); 62 64 PassRefPtr<IDBRequest> getKey(ScriptExecutionContext*, PassRefPtr<IDBKey>, ExceptionCode&); -
trunk/Source/WebCore/storage/IDBIndex.idl
r72766 r76531 34 34 readonly attribute boolean unique; 35 35 36 [CallWith=ScriptExecutionContext] IDBRequest openCursor(in [Optional] OptionsObject options)36 [CallWith=ScriptExecutionContext] IDBRequest openCursor(in [Optional] IDBKeyRange range, in [Optional] unsigned short direction) 37 37 raises (IDBDatabaseException); 38 [CallWith=ScriptExecutionContext] IDBRequest openKeyCursor(in [Optional] OptionsObject options)38 [CallWith=ScriptExecutionContext] IDBRequest openKeyCursor(in [Optional] IDBKeyRange range, in [Optional] unsigned short direction)) 39 39 raises (IDBDatabaseException); 40 40 [CallWith=ScriptExecutionContext] IDBRequest get(in IDBKey key) -
trunk/Source/WebCore/storage/IDBObjectStore.cpp
r72771 r76531 130 130 } 131 131 132 PassRefPtr<IDBRequest> IDBObjectStore::openCursor(ScriptExecutionContext* context, const OptionsObject& options, ExceptionCode& ec)132 PassRefPtr<IDBRequest> IDBObjectStore::openCursor(ScriptExecutionContext* context, PassRefPtr<IDBKeyRange> range, unsigned short direction, ExceptionCode& ec) 133 133 { 134 RefPtr<IDBKeyRange> range = options.getKeyKeyRange("range");135 136 // Converted to an unsigned short.137 int32_t direction = defaultDirection;138 options.getKeyInt32("direction", direction);139 134 if (direction != IDBCursor::NEXT && direction != IDBCursor::NEXT_NO_DUPLICATE && direction != IDBCursor::PREV && direction != IDBCursor::PREV_NO_DUPLICATE) { 140 135 // FIXME: May need to change when specced: http://www.w3.org/Bugs/Public/show_bug.cgi?id=11406 -
trunk/Source/WebCore/storage/IDBObjectStore.h
r72771 r76531 64 64 PassRefPtr<IDBRequest> put(ScriptExecutionContext* context, PassRefPtr<SerializedScriptValue> value, ExceptionCode& ec) { return put(context, value, 0, ec); } 65 65 PassRefPtr<IDBIndex> createIndex(const String& name, const String& keyPath, ExceptionCode& ec) { return createIndex(name, keyPath, OptionsObject(), ec); } 66 PassRefPtr<IDBRequest> openCursor(ScriptExecutionContext* context, ExceptionCode& ec) { return openCursor(context, OptionsObject(), ec); } 66 PassRefPtr<IDBRequest> openCursor(ScriptExecutionContext* context, ExceptionCode& ec) { return openCursor(context, 0, ec); } 67 PassRefPtr<IDBRequest> openCursor(ScriptExecutionContext* context, PassRefPtr<IDBKeyRange> keyRange, ExceptionCode& ec) { return openCursor(context, keyRange, IDBCursor::NEXT, ec); } 67 68 68 69 PassRefPtr<IDBRequest> get(ScriptExecutionContext*, PassRefPtr<IDBKey>, ExceptionCode&); … … 75 76 void deleteIndex(const String& name, ExceptionCode&); 76 77 77 PassRefPtr<IDBRequest> openCursor(ScriptExecutionContext*, const OptionsObject&, ExceptionCode&);78 PassRefPtr<IDBRequest> openCursor(ScriptExecutionContext*, PassRefPtr<IDBKeyRange>, unsigned short direction, ExceptionCode&); 78 79 79 80 private: -
trunk/Source/WebCore/storage/IDBObjectStore.idl
r72771 r76531 41 41 [CallWith=ScriptExecutionContext] IDBRequest get(in IDBKey key) 42 42 raises (IDBDatabaseException); 43 [CallWith=ScriptExecutionContext] IDBRequest openCursor(in [Optional] OptionsObject options)43 [CallWith=ScriptExecutionContext] IDBRequest openCursor(in [Optional] IDBKeyRange range, in [Optional] unsigned short direction) 44 44 raises (IDBDatabaseException); 45 45 IDBIndex createIndex(in DOMString name, in [ConvertNullToNullString] DOMString keyPath, in [Optional] OptionsObject options)
Note: See TracChangeset
for help on using the changeset viewer.