Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / storage / indexeddb / transaction-complete-with-js-recursion.html
blobf95797e0e054cc4a0064733455abb004ebea2c99
1 <html>
2 <head>
3 <script src="../../resources/js-test.js"></script>
4 <script src="resources/shared.js"></script>
5 </head>
6 <body>
7 <script>
9 var transaction;
10 var store;
11 var db;
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);
23 function click()
25 body.onclick = test;
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;
38 function test()
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");
49 finishJSTest();
52 </script>
53 </body>
54 </html>