3 <script src=
"../../resources/js-test.js"></script>
4 <script src=
"resources/shared.js"></script>
12 var body
= document
.getElementsByTagName("body")[0];
14 description("Test that pending transactions are not completed during recursive JS calls until all JS is finished.");
16 indexedDBTest(prepareDatabase
, click
);
17 function prepareDatabase()
19 db
= event
.target
.result
;
20 store
= db
.createObjectStore('objectStore', null);
26 var pendingTransaction
= evalAndLog("pendingTransaction = db.transaction(['objectStore'], 'readwrite')");
27 pendingTransaction
.onsuccess
= unexpectedErrorCallback
;
28 pendingTransaction
.onerror
= unexpectedErrorCallback
;
29 pendingTransaction
.oncomplete
= completeCallback
;
30 var event
= document
.createEvent("MouseEvent");
31 event
.initMouseEvent("click", true, true, document
.defaultView
, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
32 body
.dispatchEvent(event
);
33 var store
= evalAndLog("store = pendingTransaction.objectStore('objectStore')");
34 shouldBeTrue("store !== undefined");
35 body
.onclick
= undefined;
40 debug("Start re-entrant JS");
41 transaction
= evalAndLog("transaction = db.transaction(['objectStore'], 'readwrite')");
42 debug("End re-entrant JS");
46 function completeCallback()
48 testPassed("Pending transaction completed");