Thu, 15 Jan 2015 15:55:04 +0100
Back out 97036ab72558 which inappropriately compared turds to third parties.
1 <?xml version="1.0"?>
2 <?xml-stylesheet type="text/css" href="chrome://global/skin"?>
3 <?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
4 <!--
5 https://bugzilla.mozilla.org/show_bug.cgi?id=799299
6 -->
7 <window title="Mozilla Bug 799299"
8 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
9 <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
10 <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
12 <!-- test results are displayed in the html:body -->
13 <body xmlns="http://www.w3.org/1999/xhtml">
14 <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=799299"
15 target="_blank">Mozilla Bug 799299</a>
16 </body>
18 <!-- test code goes here -->
19 <script type="application/javascript">
20 <![CDATA[
21 /** Test for Bug 799299 **/
23 function sendClick(win) {
24 var wu = win.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
25 .getInterface(Components.interfaces.nsIDOMWindowUtils);
26 wu.sendMouseEventToWindow("mousedown", 10, 10, 0, 0, 0);
27 wu.sendMouseEventToWindow("mouseup", 10, 10, 0, 0, 0);
28 }
30 function runTests() {
31 var b1 = document.getElementById("b1");
32 var b2 = document.getElementById("b2");
33 b1.contentWindow.focus();
34 opener.wrappedJSObject.is(document.activeElement, b1,
35 "Focused first iframe");
37 var didCallDummy = false;
38 b2.contentWindow.addEventListener("mousedown", function(e) { didCallDummy = true; });
39 sendClick(b2.contentWindow);
40 opener.wrappedJSObject.ok(didCallDummy, "dummy mousedown handler should fire");
41 opener.wrappedJSObject.is(document.activeElement, b2,
42 "Focus shifted to second iframe");
44 b1.contentWindow.focus();
45 opener.wrappedJSObject.is(document.activeElement, b1,
46 "Re-focused first iframe for the first time");
48 var didCallListener = false;
49 b2.contentWindow.addEventListener("mousedown", function(e) { didCallListener = true; e.preventDefault(); });
50 sendClick(b2.contentWindow);
51 opener.wrappedJSObject.ok(didCallListener, "mousedown handler should fire");
52 opener.wrappedJSObject.is(document.activeElement, b2,
53 "focus should move to the second iframe");
55 window.close();
56 opener.wrappedJSObject.SimpleTest.finish();
57 }
59 SimpleTest.waitForFocus(runTests);
60 ]]>
61 </script>
62 <hbox flex="1">
63 <browser id="b1" type="content" src="about:blank" flex="1" style="border: 1px solid black;"/>
64 <browser id="b2" type="content" src="about:blank" flex="1" style="border: 1px solid black;"/>
65 </hbox>
66 </window>