1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/tests/mochitest/whatwg/test_postMessage_joined.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,58 @@ 1.4 +<!DOCTYPE html> 1.5 +<html> 1.6 +<!-- 1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=postMessage 1.8 +--> 1.9 +<head> 1.10 + <title>postMessage with document.domain setting to join origins</title> 1.11 + <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 1.12 + <script type="text/javascript" src="browserFu.js"></script> 1.13 + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 1.14 +</head> 1.15 +<body> 1.16 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=postMessage">Mozilla Bug 387706</a> 1.17 +<p id="display"></p> 1.18 +<div id="content" style="display: none"></div> 1.19 + 1.20 +<iframe src="http://sub1.test1.example.org/tests/dom/tests/mochitest/whatwg/postMessage_joined_helper.html" 1.21 + name="container"></iframe> 1.22 + 1.23 + 1.24 +<pre id="test"> 1.25 +<script class="testbody" type="application/javascript"> 1.26 +/** Test for Bug 387706 **/ 1.27 + 1.28 +SimpleTest.waitForExplicitFinish(); 1.29 + 1.30 +function receiveTestResult(evt) 1.31 +{ 1.32 + ok(evt instanceof MessageEvent, "umm, how did we get this?"); 1.33 + is(evt.type, "message", "expected events of type 'message'"); 1.34 + 1.35 + if (isMozilla) 1.36 + { 1.37 + ok(evt.isTrusted === false, "shouldn't have been a trusted event"); 1.38 + } 1.39 + 1.40 + is(evt.lastEventId, "", "postMessage creates events with empty lastEventId"); 1.41 + 1.42 + // Either we passed the test or we failed it. The message's 1.43 + // contents should help to diagnose the failure. Either way, 1.44 + // consider this the end of the test. 1.45 + is(evt.data, "test-passed", "unexpected test result"); 1.46 + SimpleTest.finish(); 1.47 +} 1.48 + 1.49 +function setup() 1.50 +{ 1.51 + window.addEventListener("message", receiveTestResult, false); 1.52 + window.frames.container.postMessage("start-test", 1.53 + "http://sub1.test1.example.org"); 1.54 +} 1.55 + 1.56 +addLoadEvent(setup); 1.57 + 1.58 +</script> 1.59 +</pre> 1.60 +</body> 1.61 +</html>