summaryrefslogtreecommitdiffstats
path: root/dom/tests/mochitest/whatwg/test_postMessage_structured_clone.html
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /dom/tests/mochitest/whatwg/test_postMessage_structured_clone.html
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/tests/mochitest/whatwg/test_postMessage_structured_clone.html')
-rw-r--r--dom/tests/mochitest/whatwg/test_postMessage_structured_clone.html68
1 files changed, 68 insertions, 0 deletions
diff --git a/dom/tests/mochitest/whatwg/test_postMessage_structured_clone.html b/dom/tests/mochitest/whatwg/test_postMessage_structured_clone.html
new file mode 100644
index 000000000..ec0941227
--- /dev/null
+++ b/dom/tests/mochitest/whatwg/test_postMessage_structured_clone.html
@@ -0,0 +1,68 @@
+<!DOCTYPE html>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=553125
+-->
+<head>
+ <title>postMessage uses structured clone</title>
+ <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="application/javascript;version=1.7"
+ src="postMessage_structured_clone_helper.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=553125">Mozilla Bug 553125</a>
+<p id="display"></p>
+<div id="content" style="display: none"></div>
+
+<iframe src="http://mochi.test:8888/tests/dom/tests/mochitest/whatwg/postMessage_structured_clone_helper.html"
+ name="sameDomain"></iframe>
+<iframe src="http://example.org:8000/tests/dom/tests/mochitest/whatwg/postMessage_structured_clone_helper.html"
+ name="crossDomain"></iframe>
+
+
+<pre id="test">
+<script class="testbody" type="application/javascript">
+/** Test for Bug 553125 **/
+
+SimpleTest.waitForExplicitFinish();
+
+var lastMessage = null;
+var crossOrigin = false;
+var generator = new getTestContent();
+
+function runNextSameOrigin() {
+ try {
+ lastMessage = generator.next();
+ } catch (e) {
+ generator = new getTestContent();
+ crossOrigin = true;
+ runNextCrossOrigin();
+ }
+ window.frames.sameDomain.postMessage(lastMessage, "http://mochi.test:8888");
+}
+
+function runNextCrossOrigin() {
+ try {
+ lastMessage = generator.next();
+ } catch (e) {
+ SimpleTest.finish();
+ }
+ window.frames.crossDomain.postMessage(lastMessage, "http://example.org:8000");
+}
+
+function receiveMessage(evt) {
+ if (evt.data == "TEST-PASS")
+ SimpleTest.ok(true, "structured clone of | " + lastMessage + " | succeeded");
+ else
+ SimpleTest.ok(false, "structured clone of | " + lastMessage + " | failed");
+ setTimeout(crossOrigin ? runNextCrossOrigin : runNextSameOrigin, 0);
+}
+
+window.addEventListener("message", receiveMessage, false);
+window.addEventListener("load", runNextSameOrigin, false);
+
+</script>
+</pre>
+</body>
+</html>