dom/tests/mochitest/chrome/file_bug830858.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=830858
michael@0 6 -->
michael@0 7 <window title="Mozilla Bug 830858"
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=830858"
michael@0 15 target="_blank">Mozilla Bug 830858</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 830858 **/
michael@0 22
michael@0 23 function runTests() {
michael@0 24 var b = document.getElementById("b");
michael@0 25 var win = b.contentWindow;
michael@0 26 var doc = win.document;
michael@0 27 var wu = win.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
michael@0 28 .getInterface(Components.interfaces.nsIDOMWindowUtils);
michael@0 29
michael@0 30 var docListenerCalled = 0;
michael@0 31 doc.addEventListener("foo", function() { ++docListenerCalled; }, true);
michael@0 32 var winListenerCalled = 0;
michael@0 33 win.addEventListener("foo", function() { ++winListenerCalled; }, true);
michael@0 34 var iframeListenerCalled = 0;
michael@0 35 b.addEventListener("foo", function() { ++iframeListenerCalled; }, true);
michael@0 36
michael@0 37 doc.dispatchEvent(new Event("foo"));
michael@0 38 opener.wrappedJSObject.is(docListenerCalled, 1, "Normal dispatch to Document");
michael@0 39 opener.wrappedJSObject.is(winListenerCalled, 1, "Normal dispatch to Document");
michael@0 40 opener.wrappedJSObject.is(iframeListenerCalled, 1, "Normal dispatch to Document");
michael@0 41
michael@0 42 win.dispatchEvent(new Event("foo"));
michael@0 43 opener.wrappedJSObject.is(docListenerCalled, 1, "Normal dispatch to Window");
michael@0 44 opener.wrappedJSObject.is(winListenerCalled, 2, "Normal dispatch to Window");
michael@0 45 opener.wrappedJSObject.is(iframeListenerCalled, 2, "Normal dispatch to Window");
michael@0 46
michael@0 47 wu.dispatchEventToChromeOnly(doc, new Event("foo"));
michael@0 48 opener.wrappedJSObject.is(docListenerCalled, 1, "Chrome-only dispatch to Document");
michael@0 49 opener.wrappedJSObject.is(winListenerCalled, 2, "Chrome-only dispatch to Document");
michael@0 50 opener.wrappedJSObject.is(iframeListenerCalled, 3, "Chrome-only dispatch to Document");
michael@0 51
michael@0 52 wu.dispatchEventToChromeOnly(win, new Event("foo"));
michael@0 53 opener.wrappedJSObject.is(docListenerCalled, 1, "Chrome-only dispatch to Window");
michael@0 54 opener.wrappedJSObject.is(winListenerCalled, 2, "Chrome-only dispatch to Window");
michael@0 55 opener.wrappedJSObject.is(iframeListenerCalled, 4, "Chrome-only dispatch to Window");
michael@0 56
michael@0 57 window.close();
michael@0 58 opener.wrappedJSObject.finishedTests();
michael@0 59 }
michael@0 60
michael@0 61 SimpleTest.waitForFocus(runTests);
michael@0 62 ]]>
michael@0 63 </script>
michael@0 64 <iframe xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
michael@0 65 id="b" type="content" src="about:blank"
michael@0 66 style="width: 300px; height: 550px; border: 1px solid black;"/>
michael@0 67 </window>

mercurial