Don't try to restore deleted MemoryIndexes if their owning object store is not restored.
[WebKit-https.git] / LayoutTests / storage / indexeddb / modern / resources / deleteindex-4.js
1 description("This tests deleting an object store with an index, when aborting the transaction would *not* restore that object store, and makes sure the transaction successfully aborts");
2
3 indexedDBTest(prepareDatabase);
4
5 function prepareDatabase(event)
6 {
7     tx = event.target.transaction;
8     tx.onabort = function() {
9         debug("Aborted!");
10         finishJSTest();
11     }
12     tx.onerror = function() {
13         debug("Unexpected error");
14         finishJSTest();
15     }
16     tx.oncomplete = function() {
17         debug("Unexpected completion");
18         finishJSTest();
19     }
20     
21     db = event.target.result;
22     db.createObjectStore("name");
23     db.deleteObjectStore("name");
24     
25     os = db.createObjectStore("name");
26     os.createIndex("index", "foo");
27     os.put("bar", "foo").onsuccess = function() {
28         debug("first put success");
29         db.deleteObjectStore("name");
30         db.createObjectStore("name").put("bar", "foo").onsuccess = function() {
31             debug("second put success");
32             tx.abort();
33         }
34     }
35 }