blob: ca2df94b34ad586b40763420c0c703693d21782b [file] [log] [blame]
<!DOCTYPE html>
<html>
<body>
This test tests that the transaction success callback is called in the right world.
<div id="console"></div>
<script>
var transactionSuccessCallbacksInvoked = 0;
function done()
{
if ((++transactionSuccessCallbacksInvoked == 2) && (window.layoutTestController))
layoutTestController.notifyDone();
}
function transactionSuccessCallback1(tx)
{
alert("FAIL: Visible in isolated world.");
done();
}
function transactionSuccessCallback2(tx)
{
alert(document.body.bar);
done();
}
document.body.foo = "FAIL: document.body.foo visible in isolated world.";
document.body.bar = "PASS: document.body.bar visible in a callback created in this world.";
if (window.layoutTestController) {
layoutTestController.clearAllDatabases();
layoutTestController.dumpAsText();
layoutTestController.waitUntilDone();
layoutTestController.evaluateScriptInIsolatedWorld(
0,
"function transactionSuccessCallback1(tx)\n" +
"{\n" +
" alert(document.body.foo);\n" +
" window.location='javascript:done()';\n" +
"}\n" +
"var db1 = openDatabase('TransactionSuccessCallbackIsolatedWorld1', '1.0', '', 1);\n" +
"db1.transaction(function(tx) { }, null, transactionSuccessCallback1);");
var db2 = openDatabase('TransactionSuccessCallbackIsolatedWorld2', '1.0', '', 1);
db2.transaction(function(tx) { }, null, transactionSuccessCallback2);
}
</script>
</body>
</html>