Thu, 15 Jan 2015 21:03:48 +0100
Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=333198
5 -->
6 <head>
7 <title>Test for Bug 333198</title>
8 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
10 </head>
11 <!-- setTimeout so that the test starts after paint suppression ends -->
12 <body onload="setTimeout(runTest,0);">
13 <iframe id="ifr"></iframe><br>
14 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=333198">Mozilla Bug 333198</a>
15 <p id="display"></p>
16 <div id="content" style="display: none">
18 </div>
19 <pre id="test">
20 <script type="application/javascript">
22 /** Test for Bug 333198 **/
24 var focusTester;
25 var focusTester2;
26 var focusCount = 0;
27 var eventCount = 0;
28 function clickHandler() {
29 ++eventCount;
30 }
32 function suppressEvents(suppress) {
33 SpecialPowers.DOMWindowUtils.suppressEventHandling(suppress);
34 }
36 function sendEvents() {
37 windowUtils = SpecialPowers.getDOMWindowUtils(window);
38 windowUtils.sendMouseEvent("mousedown", 1, 1, 0, 1, 0);
39 windowUtils.sendMouseEvent("mouseup", 1, 1, 0, 1, 0);
41 iframeUtils = SpecialPowers.getDOMWindowUtils(document.getElementById("ifr").contentWindow);
42 iframeUtils.sendMouseEvent("mousedown", 1, 1, 0, 1, 0);
43 iframeUtils.sendMouseEvent("mouseup", 1, 1, 0, 1, 0);
44 }
46 function runTest() {
47 window.focus();
48 focusTester = document.getElementsByTagName("input")[0];
49 focusTester.blur();
50 window.addEventListener("click", clickHandler, true);
51 var ifr = document.getElementById("ifr")
52 ifr.contentWindow.addEventListener("click", clickHandler, true);
53 sendEvents();
54 is(eventCount, 2, "Wrong event count(1)");
55 suppressEvents(true);
56 sendEvents();
57 is(eventCount, 2, "Wrong event count(2)");
58 suppressEvents(false);
59 sendEvents();
60 is(eventCount, 4, "Wrong event count(2)");
62 is(focusCount, 0, "Wrong focus count (1)");
63 var xhr = new XMLHttpRequest();
64 xhr.open("GET", window.location, false);
65 xhr.onload = function() {
66 focusTester.focus();
67 is(focusCount, 1, "Wrong focus count (2)");
68 focusTester.blur();
69 }
70 xhr.send();
72 focusTester.focus();
73 is(focusCount, 2, "Wrong focus count (3)");
75 SimpleTest.finish();
76 }
78 SimpleTest.waitForExplicitFinish();
80 </script>
81 </pre>
82 <input type="text" onfocus="++focusCount;">
83 </body>
84 </html>