Adding missing files from my previous commit.
authorJohnny Stenback <jst@mozilla.com>
Tue, 06 Oct 2009 17:25:56 -0700
changeset 33526 d96ffc8c27498f2a986a048b1b9d43cd612ce167
parent 33525 526f516cbd4669c288eb0c4dc24ac4b98bc552e7
child 33527 1db61f2dfded462394b61ac40ca660154a650c4e
push idunknown
push userunknown
push dateunknown
milestone1.9.3a1pre
Adding missing files from my previous commit.
dom/tests/mochitest/bugs/file_bug504862.html
dom/tests/mochitest/bugs/test_bug504862.html
new file mode 100644
--- /dev/null
+++ b/dom/tests/mochitest/bugs/file_bug504862.html
@@ -0,0 +1,22 @@
+<html>
+<body>
+<script>
+window.returnValue = 3;
+
+if (location.toString().match(/^http:\/\/localhost:8888/)) {
+  // Test that we got the right arguments.
+  opener.is(window.dialogArguments, "my args",
+            "dialog did not get the right arguments.");
+
+  // Load a different url, and test that it doesn't see the arguments.
+  window.location="data:text/html,<html><body onload=\"opener.is(window.dialogArguments, null, 'subsequent dialog document did not get the right arguments.'); close();\">';";
+} else {
+  // Post a message containing our arguments to the opener to test
+  // that this cross origing dialog does *not* see the passed in
+  // arguments.
+  opener.postMessage("args: " + window.dialogArguments,
+                     "http://localhost:8888");
+
+  close();
+}
+</script>
new file mode 100644
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug504862.html
@@ -0,0 +1,37 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=504862
+-->
+<head>
+  <title>Test for Bug 504862</title>
+  <script type="text/javascript" src="/MochiKit/packed.js"></script>
+  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=504862">Mozilla Bug 504862</a>
+<script class="testbody" type="text/javascript">
+
+/** Test for Bug 504862 **/
+
+function onMsgRcv(event)
+{
+  is(event.data, "args: undefined", "Unexpected cross origin dialog arguments.");
+}
+
+window.addEventListener("message", onMsgRcv, false);
+
+var subsequentDlg = "data:text/html,<html><body onload='opener.is(window.dialogArguments, \'my args\', \'subsequent dialog document did not get the right arguments.\'); close();'>";
+
+var result = window.showModalDialog("file_bug504862.html", "my args");
+is(result, null, "window sees previous dialog documents return value.");
+
+result = window.showModalDialog("http://test1.example.com/tests/dom/tests/mochitest/bugs/file_bug504862.html", "my args");
+
+is(result, null, "Able to see return value from cross origin dialog.");
+
+</script>
+</pre>
+</body>
+</html>