Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(173)

Side by Side Diff: third_party/WebKit/LayoutTests/storage/websql/transaction-removed-context-crash.html

Issue 2398313002: WebSQL: Add missing getExecutionContext() null check (Closed)
Patch Set: Use newfangled remove() method to simplify repro Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698