Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / storage / indexeddb / transaction-complete-with-js-recursion-cross-frame.html
blob9c6d474615f59da9c4113e5715661d5af217edfb
1 <html>
2 <head>
3 <script src="../../resources/js-test.js"></script>
4 <script src="resources/shared.js"></script>
5 </head>
6 <body>
7 <iframe>
8 <body>
9 </body>
10 </iframe>
11 <script>
13 var transaction;
14 var store;
15 var db;
16 var body = document.getElementsByTagName("iframe")[0].contentDocument.body;
18 description("Test that pending transactions are not completed during recursive JS calls until all JS (in all frames) is finished.");
20 indexedDBTest(prepareDatabase, click);
21 function prepareDatabase()
23 db = event.target.result;
24 store = db.createObjectStore('objectStore', null);
27 function click() {
28 body.onclick = test;
29 var pendingTransaction = evalAndLog("pendingTransaction = db.transaction(['objectStore'], 'readwrite')");
30 pendingTransaction.onerror = unexpectedErrorCallback;
31 pendingTransaction.onabort = unexpectedAbortCallback;
32 pendingTransaction.oncomplete = completeCallback;
33 var event = document.createEvent("MouseEvent");
34 event.initMouseEvent("click", true, true, document.defaultView, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
35 body.dispatchEvent(event);
36 var store = evalAndLog("store = pendingTransaction.objectStore('objectStore')");
37 shouldBeTrue("store !== undefined");
38 body.onclick = undefined;
41 function test()
43 debug("Start re-entrant JS");
44 transaction = evalAndLog("transaction = db.transaction(['objectStore'], 'readwrite')");
45 debug("End re-entrant JS");
49 function completeCallback()
51 debug("Pending transaction completed");
52 finishJSTest();
55 </script>
56 </body>
57 </html>