| 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.parentNode.removeChild(frameElement); |
| 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/ht
ml'}); | 20 var blob = new Blob(['<script>' + script + '<\/script>'], {'type': 'text/htm
l'}); |
| 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.src = URL.createObjectURL(blob); |
| 24 if (window.testRunner) | 24 if (window.testRunner) { |
| 25 window.setTimeout(() => { testRunner.notifyDone() }, 250); | 25 waitUntil( |
| 26 () => iframe.parentNode === null, |
| 27 () => testRunner.notifyDone() |
| 28 ); |
| 29 } |
| 26 }); | 30 }); |
| 31 |
| 32 // Poll (10ms) until testFunc returns true, then execute callback(). |
| 33 function waitUntil(testFunc, callback) { |
| 34 setTimeout(() => { |
| 35 if (testFunc()) |
| 36 callback(); |
| 37 else |
| 38 waitUntil(testFunc, callback); |
| 39 }, 10); |
| 40 } |
| 27 </script> | 41 </script> |
| 28 <body> | 42 <body> |
| 29 If it doesn't crash, this test has passed. | 43 If it doesn't crash, this test has passed. |
| 30 </body> | 44 </body> |
| OLD | NEW |