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