2008-11-04 Anders Carlsson <andersca@apple.com>
[webkit/qt.git] / WebCore / manual-tests / database-threading-stress-test-2.html
blobb99af3c7961f427a87a6ef7faaf0d14b289bc722
1 <!doctype html>
2 <html>
3 <head>
4 <script>
5 var db;
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) { }
16 function loaded()
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 });
33 function loadNotes()
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 });
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>