diff options
Diffstat (limited to 'LayoutTests/storage/statement-success-callback-isolated-world.html')
-rw-r--r-- | LayoutTests/storage/statement-success-callback-isolated-world.html | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/LayoutTests/storage/statement-success-callback-isolated-world.html b/LayoutTests/storage/statement-success-callback-isolated-world.html new file mode 100644 index 0000000..4fac754 --- /dev/null +++ b/LayoutTests/storage/statement-success-callback-isolated-world.html @@ -0,0 +1,52 @@ +<!DOCTYPE html> +<html> +<body> +This test tests that the statement success callback is called in the right world. +<div id="console"></div> +<script> +var statementSuccessCallbacksInvoked = 0; +function done() +{ + if ((++statementSuccessCallbacksInvoked == 2) && (window.layoutTestController)) + layoutTestController.notifyDone(); +} + +function statementSuccessCallback1(tx, data) +{ + alert("FAIL: Visible in isolated world."); + done(); +} + +function statementSuccessCallback2(tx, data) +{ + 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 statementSuccessCallback1(tx, data)\n" + + "{\n" + + " alert(document.body.foo);\n" + + " window.location='javascript:done()';\n" + + "}\n" + + "var db1 = openDatabase('StatementSuccessCallbackIsolatedWorld1', '1.0', '', 1);\n" + + "db1.transaction(function(tx) {\n" + + " tx.executeSql('CREATE TABLE IF NOT EXISTS Test (Foo INT)', [], statementSuccessCallback1);\n" + + "});"); + + var db2 = openDatabase('StatementSuccessCallbackIsolatedWorld2', '1.0', '', 1); + db2.transaction(function(tx) { + tx.executeSql('CREATE TABLE IF NOT EXISTS Test (Foo INT)', [], statementSuccessCallback2); + }); +} +</script> +</body> +</html> |