dom/tests/mochitest/chrome/file_bug800817.xul

Thu, 15 Jan 2015 15:55:04 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:55:04 +0100
branch
TOR_BUG_9701
changeset 9
a63d609f5ebe
permissions
-rw-r--r--

Back out 97036ab72558 which inappropriately compared turds to third parties.

michael@0 1 <?xml version="1.0"?>
michael@0 2 <?xml-stylesheet type="text/css" href="chrome://global/skin"?>
michael@0 3 <?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
michael@0 4 <!--
michael@0 5 https://bugzilla.mozilla.org/show_bug.cgi?id=800817
michael@0 6 -->
michael@0 7 <window title="Mozilla Bug 800817"
michael@0 8 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
michael@0 9 <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
michael@0 10 <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
michael@0 11
michael@0 12 <!-- test results are displayed in the html:body -->
michael@0 13 <body xmlns="http://www.w3.org/1999/xhtml">
michael@0 14 <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=800817"
michael@0 15 target="_blank">Mozilla Bug 800817</a>
michael@0 16 </body>
michael@0 17
michael@0 18 <!-- test code goes here -->
michael@0 19 <script type="application/javascript">
michael@0 20 <![CDATA[
michael@0 21 /** Test for Bug 800817 **/
michael@0 22
michael@0 23 function sendClick(win) {
michael@0 24 var wu = win.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
michael@0 25 .getInterface(Components.interfaces.nsIDOMWindowUtils);
michael@0 26 wu.sendMouseEventToWindow("mousedown", 10, 10, 0, 0, 0);
michael@0 27 wu.sendMouseEventToWindow("mouseup", 10, 10, 0, 0, 0);
michael@0 28 }
michael@0 29
michael@0 30 function runTests() {
michael@0 31 var b1 = document.getElementById("b1");
michael@0 32 var b2 = document.getElementById("b2");
michael@0 33
michael@0 34 var testMozBrowser = opener.wrappedJSObject.testMozBrowser;
michael@0 35 if (testMozBrowser) {
michael@0 36 b1.setAttribute("mozbrowser", "true");
michael@0 37 b2.setAttribute("mozbrowser", "true");
michael@0 38 }
michael@0 39
michael@0 40 if (testMozBrowser)
michael@0 41 opener.wrappedJSObject.info("Testing with mozbrowser=true");
michael@0 42 else
michael@0 43 opener.wrappedJSObject.info("Testing without mozbrowser");
michael@0 44
michael@0 45 b1.contentWindow.focus();
michael@0 46 opener.wrappedJSObject.is(document.activeElement, b1,
michael@0 47 "Focused first iframe");
michael@0 48
michael@0 49 var didCallDummy = false;
michael@0 50 b2.contentWindow.addEventListener("mousedown", function(e) { didCallDummy = true; });
michael@0 51 sendClick(b2.contentWindow);
michael@0 52 opener.wrappedJSObject.ok(didCallDummy, "dummy mousedown handler should fire");
michael@0 53 opener.wrappedJSObject.is(document.activeElement, b2,
michael@0 54 "Focus shifted to second iframe");
michael@0 55
michael@0 56 b1.contentWindow.focus();
michael@0 57 opener.wrappedJSObject.is(document.activeElement, b1,
michael@0 58 "Re-focused first iframe for the first time");
michael@0 59
michael@0 60 var didCallListener = false;
michael@0 61 b2.contentWindow.addEventListener("mousedown", function(e) { didCallListener = true; e.preventDefault(); });
michael@0 62 sendClick(b2.contentWindow);
michael@0 63 opener.wrappedJSObject.ok(didCallListener, "mousedown handler should fire");
michael@0 64 opener.wrappedJSObject.is(document.activeElement, b1,
michael@0 65 "Did not move focus to the second iframe");
michael@0 66
michael@0 67 window.close();
michael@0 68 opener.wrappedJSObject.finishedTests();
michael@0 69 }
michael@0 70
michael@0 71 SimpleTest.waitForFocus(runTests);
michael@0 72 ]]>
michael@0 73 </script>
michael@0 74 <iframe xmlns="http://www.w3.org/1999/xhtml"
michael@0 75 id="b1" type="content" src="about:blank"
michael@0 76 style="width: 300px; height: 550px; border: 1px solid black;"/>
michael@0 77 <iframe xmlns="http://www.w3.org/1999/xhtml"
michael@0 78 id="b2" type="content" src="about:blank"
michael@0 79 style="width: 300px; height: 550px; border: 1px solid black;"/>
michael@0 80 </window>

mercurial