1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/tests/mochitest/whatwg/postMessage_userpass_helper.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,34 @@ 1.4 +<!DOCTYPE html> 1.5 +<html> 1.6 +<head> 1.7 + <title>Username/password page for postMessage tests</title> 1.8 + <script type="application/javascript"> 1.9 + 1.10 +function sendMessage(evt) 1.11 +{ 1.12 + var msg = "child-message"; 1.13 + 1.14 + if (evt.origin !== "http://mochi.test:8888") 1.15 + msg += " wrong-origin(" + evt.origin + ")"; 1.16 + if (evt.data !== "parent-message") 1.17 + msg += " wrong-data(" + evt.data + ")"; 1.18 + if (evt.lastEventId !== "") 1.19 + msg += " wrong-lastEventId(" + evt.lastEventId + ")"; 1.20 + if (evt.source !== window.parent) 1.21 + msg += " wrong-source"; 1.22 + 1.23 + // It would be good to guarantee that we've been opened with a userinfo of 1.24 + // "bobhope:password", but Gecko elides that from the content-visible URL, 1.25 + // and I can't find another way to actually detect this programmatically. 1.26 + 1.27 + window.parent.postMessage(msg, "http://mochi.test:8888"); 1.28 +} 1.29 + 1.30 +window.addEventListener("message", sendMessage, false); 1.31 + </script> 1.32 +</head> 1.33 +<body> 1.34 +<p>Kid iframe</p> 1.35 +</body> 1.36 +</html> 1.37 +