1<!DOCTYPE html> 2<html> 3<body> 4This test tests that the transaction callback is called in the right world. 5<div id="console"></div> 6<script> 7var transactionCallbacksInvoked = 0; 8function done() 9{ 10 if ((++transactionCallbacksInvoked == 2) && (window.layoutTestController)) 11 layoutTestController.notifyDone(); 12} 13 14function transactionCallback1(tx) 15{ 16 alert("FAIL: Visible in isolated world."); 17 done(); 18} 19 20function transactionCallback2(tx) 21{ 22 alert(document.body.bar); 23 done(); 24} 25 26document.body.foo = "FAIL: document.body.foo visible in isolated world."; 27document.body.bar = "PASS: document.body.bar visible in a callback created in this world."; 28 29if (window.layoutTestController) { 30 layoutTestController.clearAllDatabases(); 31 layoutTestController.dumpAsText(); 32 layoutTestController.waitUntilDone(); 33 layoutTestController.evaluateScriptInIsolatedWorld( 34 0, 35 "function transactionCallback1(tx)\n" + 36 "{\n" + 37 " alert(document.body.foo);\n" + 38 " window.location='javascript:done()';\n" + 39 "}\n" + 40 "var db1 = openDatabase('TransactionCallbackIsolatedWorld1', '1.0', '', 1);\n" + 41 "db1.transaction(transactionCallback1);"); 42 43 var db2 = openDatabase('TransactionCallbackIsolatedWorld2', '1.0', '', 1); 44 db2.transaction(transactionCallback2); 45} 46</script> 47</body> 48</html> 49