• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1Test closing a database connection in IndexedDB.
2
3On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
4
5
6PASS 'webkitIndexedDB' in window is true
7PASS webkitIndexedDB == null is false
8webkitIndexedDB.open('transaction-after-close')
9openSuccess():
10db = event.target.result
11request = db.setVersion('version 1')
12Deleted all object stores.
13store = db.createObjectStore('store')
14request = store.put('x', 'y')
15PASS Put success
16running first transaction
17currentTransaction = db.transaction([], webkitIDBTransaction.READ_WRITE)
18objectStore.put('a', 'b')
19db.close()
20Expecting exception from db.transaction([], webkitIDBTransaction.READ_WRITE)
21PASS Exception was thrown.
22PASS code is webkitIDBDatabaseException.NOT_ALLOWED_ERR
23
24verify that we can reopen the db after calling close
25webkitIndexedDB.open('transaction-after-close')
26second_db = event.target.result
27currentTransaction = second_db.transaction([], webkitIDBTransaction.READ_WRITE)
28request = store.put('1', '2')
29PASS final put success
30PASS successfullyParsed is true
31
32TEST COMPLETE
33
34