summaryrefslogtreecommitdiffstats
path: root/LayoutTests/storage/transaction-error-callback-isolated-world.html
diff options
context:
space:
mode:
Diffstat (limited to 'LayoutTests/storage/transaction-error-callback-isolated-world.html')
-rw-r--r--LayoutTests/storage/transaction-error-callback-isolated-world.html52
1 files changed, 52 insertions, 0 deletions
diff --git a/LayoutTests/storage/transaction-error-callback-isolated-world.html b/LayoutTests/storage/transaction-error-callback-isolated-world.html
new file mode 100644
index 0000000..521894d
--- /dev/null
+++ b/LayoutTests/storage/transaction-error-callback-isolated-world.html
@@ -0,0 +1,52 @@
+<!DOCTYPE html>
+<html>
+<body>
+This test tests that the transaction error callback is called in the right world.
+<div id="console"></div>
+<script>
+var transactionErrorCallbacksInvoked = 0;
+function done()
+{
+ if ((++transactionErrorCallbacksInvoked == 2) && (window.layoutTestController))
+ layoutTestController.notifyDone();
+}
+
+function transactionErrorCallback1(tx)
+{
+ alert("FAIL: Visible in isolated world.");
+ done();
+}
+
+function transactionErrorCallback2(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 transactionErrorCallback1(tx)\n" +
+ "{\n" +
+ " alert(document.body.foo);\n" +
+ " window.location='javascript:done()';\n" +
+ "}\n" +
+ "var db1 = openDatabase('TransactionErrorCallbackIsolatedWorld1', '1.0', '', 1);\n" +
+ "db1.transaction(function(tx) {\n" +
+ " tx.executeSql('BAD STATEMENT', [], function(tx, data) {}, function(tx, error) { return true; });\n" +
+ "}, transactionErrorCallback1);");
+
+ var db2 = openDatabase('TransactionErrorCallbackIsolatedWorld2', '1.0', '', 1);
+ db2.transaction(function(tx) {
+ tx.executeSql('BAD STATEMENT', [], function(tx, data) {}, function(tx, error) { return true; });
+ }, transactionErrorCallback2);
+}
+</script>
+</body>
+</html>