OLD | NEW |
1 Test closing a database connection in IndexedDB. | 1 Test closing a database connection in IndexedDB. |
2 | 2 |
3 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
". | 3 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
". |
4 | 4 |
5 | 5 |
6 indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.
msIndexedDB || self.OIndexedDB; | |
7 | |
8 dbname = "transaction-after-close.html" | 6 dbname = "transaction-after-close.html" |
9 indexedDB.deleteDatabase(dbname) | 7 indexedDB.deleteDatabase(dbname) |
10 indexedDB.open(dbname) | 8 indexedDB.open(dbname) |
11 store = db.createObjectStore('store') | 9 store = db.createObjectStore('store') |
12 request = store.put('x', 'y') | 10 request = store.put('x', 'y') |
13 PASS Put success | 11 PASS Put success |
14 running first transaction | 12 running first transaction |
15 currentTransaction = db.transaction(['store'], 'readwrite') | 13 currentTransaction = db.transaction(['store'], 'readwrite') |
16 objectStore.put('a', 'b') | 14 objectStore.put('a', 'b') |
17 db.close() | 15 db.close() |
18 Expecting exception from db.transaction(['store'], 'readwrite') | 16 Expecting exception from db.transaction(['store'], 'readwrite') |
19 PASS Exception was thrown. | 17 PASS Exception was thrown. |
20 PASS code is DOMException.INVALID_STATE_ERR | 18 PASS code is DOMException.INVALID_STATE_ERR |
21 PASS ename is 'InvalidStateError' | 19 PASS ename is 'InvalidStateError' |
22 Exception message: Failed to execute 'transaction' on 'IDBDatabase': The databas
e connection is closing. | 20 Exception message: Failed to execute 'transaction' on 'IDBDatabase': The databas
e connection is closing. |
23 | 21 |
24 verify that we can reopen the db after calling close | 22 verify that we can reopen the db after calling close |
25 indexedDB.open(dbname) | 23 indexedDB.open(dbname) |
26 second_db = event.target.result | 24 second_db = event.target.result |
27 currentTransaction = second_db.transaction(['store'], 'readwrite') | 25 currentTransaction = second_db.transaction(['store'], 'readwrite') |
28 request = store.put('1', '2') | 26 request = store.put('1', '2') |
29 PASS final put success | 27 PASS final put success |
30 PASS successfullyParsed is true | 28 PASS successfullyParsed is true |
31 | 29 |
32 TEST COMPLETE | 30 TEST COMPLETE |
33 | 31 |
OLD | NEW |