1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/tests/mochitest/whatwg/test_postMessage_userpass.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,46 @@ 1.4 +<!DOCTYPE html> 1.5 +<html> 1.6 +<!-- 1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=417075 1.8 +--> 1.9 +<head> 1.10 + <title>postMessage from a page with username/password in its URI</title> 1.11 + <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 1.12 + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 1.13 +</head> 1.14 +<body> 1.15 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=417075">Mozilla Bug 417075</a> 1.16 +<p id="display"></p> 1.17 +<div id="content" style="display: none"></div> 1.18 + 1.19 +<iframe src="http://bobhope:password@example.org/tests/dom/tests/mochitest/whatwg/postMessage_userpass_helper.html" 1.20 + name="userPassKid"></iframe> 1.21 + 1.22 + 1.23 +<pre id="test"> 1.24 +<script class="testbody" type="application/javascript"> 1.25 +/** Test for Bug 417075 **/ 1.26 + 1.27 +SimpleTest.waitForExplicitFinish(); 1.28 + 1.29 +function receiveMessage(evt) 1.30 +{ 1.31 + is(evt.origin, "http://example.org", "wrong origin"); 1.32 + is(evt.data, "child-message", "wrong data"); 1.33 + is(evt.lastEventId, "", "postMessage creates events with empty lastEventId"); 1.34 + ok(evt.source === window.frames.userPassKid, "wrong source"); 1.35 + SimpleTest.finish(); 1.36 +} 1.37 + 1.38 +window.addEventListener("message", receiveMessage, false); 1.39 + 1.40 +function sendMessage(evt) 1.41 +{ 1.42 + window.frames.userPassKid.postMessage("parent-message", "http://example.org"); 1.43 +} 1.44 + 1.45 +window.addEventListener("load", sendMessage, false); 1.46 +</script> 1.47 +</pre> 1.48 +</body> 1.49 +</html>