OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <title>Transaction from removed execution context</title> | 2 <title>Transaction from removed execution context</title> |
3 <script> | 3 <script> |
4 if (window.testRunner) { | 4 if (window.testRunner) { |
5 testRunner.dumpAsText(); | 5 testRunner.dumpAsText(); |
6 testRunner.waitUntilDone(); | 6 testRunner.waitUntilDone(); |
7 } | 7 } |
8 | 8 |
9 var script = ` | 9 var script = ` |
10 var db = openDatabase('db' + Math.random() + Date.now(), '1.0', 'test database',
2*1024); | 10 var db = openDatabase('db' + Math.random() + Date.now(), '1.0', 'test database',
2*1024); |
11 db.transaction(tx => { | 11 db.transaction(tx => { |
12 tx.executeSql('DROP TABLE IF EXISTS TestTable'); | 12 tx.executeSql('DROP TABLE IF EXISTS TestTable'); |
13 tx.executeSql('CREATE TABLE IF NOT EXISTS TestTable (id unique,text)'); | 13 tx.executeSql('CREATE TABLE IF NOT EXISTS TestTable (id unique,text)'); |
14 tx.executeSql('DELETE FROM TestTable WHERE id=?', [1]); | 14 tx.executeSql('DELETE FROM TestTable WHERE id=?', [1]); |
15 frameElement.parentNode.removeChild(frameElement); | 15 frameElement.remove(); |
16 }); | 16 }); |
17 `; | 17 `; |
18 | 18 |
19 window.addEventListener('DOMContentLoaded', e => { | 19 window.addEventListener('DOMContentLoaded', e => { |
20 var blob = new Blob(['<script>' + script + '<\/script>'], {'type': 'text/htm
l'}); | 20 var srcdoc = '<script>' + script + '<\/script>'; |
21 var iframe = document.createElement('iframe'); | 21 var iframe = document.createElement('iframe'); |
22 document.body.appendChild(iframe); | 22 document.body.appendChild(iframe); |
23 iframe.src = URL.createObjectURL(blob); | 23 iframe.srcdoc = srcdoc; |
24 if (window.testRunner) { | 24 waitUntil( |
25 waitUntil( | 25 () => iframe.parentNode === null, |
26 () => iframe.parentNode === null, | 26 () => window.testRunner && testRunner.notifyDone() |
27 () => testRunner.notifyDone() | 27 ); |
28 ); | |
29 } | |
30 }); | 28 }); |
31 | 29 |
32 // Poll (10ms) until testFunc returns true, then execute callback(). | 30 // Poll (10ms) until testFunc returns true, then execute callback(). |
33 function waitUntil(testFunc, callback) { | 31 function waitUntil(testFunc, callback) { |
34 setTimeout(() => { | 32 setTimeout(() => { |
35 if (testFunc()) | 33 if (testFunc()) |
36 callback(); | 34 callback(); |
37 else | 35 else |
38 waitUntil(testFunc, callback); | 36 waitUntil(testFunc, callback); |
39 }, 10); | 37 }, 10); |
40 } | 38 } |
41 </script> | 39 </script> |
42 <body> | 40 <body> |
43 If it doesn't crash, this test has passed. | 41 If it doesn't crash, this test has passed. |
44 </body> | 42 </body> |
OLD | NEW |