summaryrefslogtreecommitdiffstats
path: root/LayoutTests/storage/open-database-creation-callback-isolated-world.html
diff options
context:
space:
mode:
Diffstat (limited to 'LayoutTests/storage/open-database-creation-callback-isolated-world.html')
-rw-r--r--LayoutTests/storage/open-database-creation-callback-isolated-world.html46
1 files changed, 46 insertions, 0 deletions
diff --git a/LayoutTests/storage/open-database-creation-callback-isolated-world.html b/LayoutTests/storage/open-database-creation-callback-isolated-world.html
new file mode 100644
index 0000000..98a4664
--- /dev/null
+++ b/LayoutTests/storage/open-database-creation-callback-isolated-world.html
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<html>
+<body>
+This test tests that the openDatabase() creation callback is called in the right world.
+<div id="console"></div>
+<script>
+var creationCallbacksExecuted = 0;
+function done()
+{
+ if ((++creationCallbacksExecuted == 2) && (window.layoutTestController))
+ layoutTestController.notifyDone();
+}
+
+function creationCallback1(db)
+{
+ alert("FAIL: Visible in isolated world.");
+ done();
+}
+
+function creationCallback2(db)
+{
+ 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 creationCallback1(db)\n" +
+ "{\n" +
+ " alert(document.body.foo);\n" +
+ " window.location='javascript:done()';\n" +
+ "}\n" +
+ "var db1 = openDatabase('OpenDatabaseCreationCallbackIsolatedWorld', '1.0', '', 1, creationCallback1);");
+
+ var db2 = openDatabase('OpenDatabaseCreationCallbackIsolatedWorld2', '1.0', '', 1, creationCallback2);
+}
+</script>
+</body>
+</html>