JS Test Harness: Remove successfullyParsed from more tests
[WebKit-https.git] / LayoutTests / storage / indexeddb / transaction-abort-with-js-recursion.html
1 <html>\r
2 <head>\r
3 <script src="../../fast/js/resources/js-test-pre.js"></script>\r
4 <script src="resources/shared.js"></script>\r
5 </head>\r
6 <body>\r
7 <p id="description"></p>\r
8 <div id="console"></div>\r
9 <script>\r
10 \r
11 var transaction;\r
12 var store;\r
13 var db;\r
14 var body = document.getElementsByTagName("body")[0];\r
15 \r
16 description("Test that pending transactions are not aborted during recursive JS calls until all JS is finished.");\r
17 if (window.layoutTestController)\r
18     layoutTestController.waitUntilDone();\r
19 \r
20 function setup() {\r
21     shouldBeTrue("'webkitIndexedDB' in window");\r
22     shouldBeFalse("webkitIndexedDB == null");\r
23 \r
24     request = evalAndLog("webkitIndexedDB.open('transaction-abort-with-js-recursion')");\r
25     request.onsuccess = setVersion;\r
26     request.onerror = unexpectedErrorCallback;\r
27 }\r
28 \r
29 function setVersion() {\r
30     db = evalAndLog("db = event.target.result");\r
31     request = evalAndLog("db.setVersion('new version')");\r
32     request.onsuccess = click;\r
33     request.onerror = unexpectedErrorCallback;\r
34 }\r
35 \r
36 function click() {\r
37     store = db.createObjectStore('objectStore', null);\r
38     body.onclick = test;\r
39     var pendingTransaction = evalAndLog("pendingTransaction = db.transaction(['objectStore'], webkitIDBTransaction.READ_WRITE)");\r
40     pendingTransaction.onsuccess = unexpectedErrorCallback;\r
41     pendingTransaction.onerror = unexpectedErrorCallback;\r
42     pendingTransaction.onabort = abortCallback;\r
43     var event = document.createEvent("MouseEvent");\r
44     event.initMouseEvent("click", true, true, document.defaultView, 0, 0, 0, 0, 0, false, false, false, false, 0, null);\r
45     body.dispatchEvent(event);\r
46     var store = evalAndLog("store = pendingTransaction.objectStore('objectStore')");\r
47     shouldBeTrue("store !== undefined");\r
48     body.onclick = undefined;\r
49 }\r
50 \r
51 function test()\r
52 {\r
53     debug("Start re-entrant JS");\r
54     transaction = evalAndLog("transaction = db.transaction(['objectStore'], webkitIDBTransaction.READ_WRITE)");\r
55     debug("End re-entrant JS");\r
56 }\r
57 \r
58 \r
59 function abortCallback()\r
60 {\r
61     debug("Pending transaction aborted");\r
62     done();\r
63 }\r
64 \r
65 setup();\r
66 \r
67 </script>\r
68 </body>\r
69 </html>\r