Torne (Richard Coles) | 5c87bf8 | 2012-11-14 11:46:17 +0000 | [diff] [blame] | 1 | <!doctype html> |
| 2 | <html> |
| 3 | <head> |
| 4 | <script> |
| 5 | var db; |
| 6 | |
| 7 | try { |
| 8 | if (window.openDatabase) { |
| 9 | db = openDatabase("StressTest2", "1.0", "Database stress test", 200000); |
| 10 | if (!db) |
| 11 | alert("Failed to open the database on disk. This is probably because the version was bad or there is not enough space left in this domain's quota"); |
| 12 | } else |
| 13 | alert("Couldn't open the database. Please try with a WebKit nightly with this feature enabled"); |
| 14 | } catch(err) { } |
| 15 | |
| 16 | function loaded() |
| 17 | { |
| 18 | db.transaction(function(tx) { |
| 19 | tx.executeSql("SELECT COUNT(*) FROM WebkitStickyNotes", [], function(result) { |
| 20 | loadNotes(); |
| 21 | }, function(tx, error) { |
| 22 | tx.executeSql("CREATE TABLE WebKitStickyNotes (id REAL UNIQUE, note TEXT)", [], function(result) { |
| 23 | tx.executeSql("INSERT INTO WebKitStickyNotes (id, note) VALUES (?, ?)", [1, 'Text'], function(result) { |
| 24 | tx.executeSql("INSERT INTO WebKitStickyNotes (id, note) VALUES (?, ?)", [2, 'More Text'], function(result) { |
| 25 | loadNotes(); |
| 26 | }); |
| 27 | }); |
| 28 | }); |
| 29 | }); |
| 30 | }); |
| 31 | } |
| 32 | |
| 33 | function loadNotes() |
| 34 | { |
| 35 | db.transaction(function(tx) { |
| 36 | tx.executeSql("SELECT id, note FROM WebKitStickyNotes", [], function(tx, result) { |
| 37 | loadNotes(); |
| 38 | }, function(tx, error) { |
| 39 | alert('Failed to retrieve notes from database - ' + error.message); |
| 40 | return; |
| 41 | }); |
| 42 | }); |
| 43 | } |
| 44 | |
| 45 | addEventListener('load', loaded, false); |
| 46 | </script> |
| 47 | </head> |
| 48 | <body> |
| 49 | <p>This test needs to run without crashes and assertion failures for a while.<p> |
| 50 | </body> |
| 51 | </html> |