2010-05-28 Eric Uhrhane <ericu@chromium.org>
authoreric@webkit.org <eric@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 29 May 2010 03:33:43 +0000 (03:33 +0000)
committereric@webkit.org <eric@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 29 May 2010 03:33:43 +0000 (03:33 +0000)
        Reviewed by Dmitry Titov.

        We don't test the async DB success callback in an isolated world.
        https://bugs.webkit.org/show_bug.cgi?id=39849

        This pretty much a copy of transaction-error-callback-isolated-world.html.
        * storage/transaction-success-callback-isolated-world-expected.txt: Added.
        * storage/transaction-success-callback-isolated-world.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@60386 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/storage/transaction-success-callback-isolated-world-expected.txt [new file with mode: 0644]
LayoutTests/storage/transaction-success-callback-isolated-world.html [new file with mode: 0644]

index 8776274..39be8c9 100644 (file)
@@ -1,3 +1,14 @@
+2010-05-28  Eric Uhrhane  <ericu@chromium.org>
+
+        Reviewed by Dmitry Titov.
+
+        We don't test the async DB success callback in an isolated world.
+        https://bugs.webkit.org/show_bug.cgi?id=39849
+
+        This pretty much a copy of transaction-error-callback-isolated-world.html.
+        * storage/transaction-success-callback-isolated-world-expected.txt: Added.
+        * storage/transaction-success-callback-isolated-world.html: Added.
+
 2010-05-28  Chang Shu  <Chang.Shu@nokia.com>
 
         Reviewed by Kenneth Rohde Christiansen.
diff --git a/LayoutTests/storage/transaction-success-callback-isolated-world-expected.txt b/LayoutTests/storage/transaction-success-callback-isolated-world-expected.txt
new file mode 100644 (file)
index 0000000..e427f4a
--- /dev/null
@@ -0,0 +1,4 @@
+ALERT: undefined
+ALERT: PASS: document.body.bar visible in a callback created in this world.
+This test tests that the transaction success callback is called in the right world.
+
diff --git a/LayoutTests/storage/transaction-success-callback-isolated-world.html b/LayoutTests/storage/transaction-success-callback-isolated-world.html
new file mode 100644 (file)
index 0000000..ca2df94
--- /dev/null
@@ -0,0 +1,48 @@
+<!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>