1 <html> 2 <head> 3 <script> 4 5 function log(message) 6 { 7 document.getElementById("console").innerHTML += message + "<br>"; 8 } 9 10 function finishTest() 11 { 12 log("Test Complete"); 13 if (window.layoutTestController) 14 layoutTestController.notifyDone(); 15 } 16 17 function errorFunction(error) 18 { 19 log("Test failed - " + error.message); 20 finishTest(); 21 } 22 23 var successCount = 0; 24 25 function successFunction(message) 26 { 27 log("Transaction succeeded - " + message); 28 if (++successCount == 2) 29 finishTest(); 30 } 31 32 function runTest() 33 { 34 if (window.layoutTestController) { 35 layoutTestController.clearAllDatabases(); 36 layoutTestController.dumpAsText(); 37 layoutTestController.waitUntilDone(); 38 } 39 40 var database = openDatabase("SuccessCallbackDatabase", "1.0", "Test for success callback <rdar://5737692>", 1); 41 database.transaction(function(tx) { tx.executeSql("CREATE TABLE IF NOT EXISTS SuccessCallbackTest (randomData)", []); }, errorFunction, function() { successFunction("Transaction with one statement"); }); 42 database.transaction(function(tx) { }, errorFunction, function() { successFunction("Empty transaction"); }); 43 } 44 45 </script> 46 </head> 47 48 <body onload="runTest()"> 49 This test confirms that a successful transaction - both with and without a statement - receives its successCallback 50 <pre id="console"> 51 </pre> 52 </body> 53 54 </html> 55