|
1 <html xmlns="http://www.w3.org/1999/xhtml"> |
|
2 <!-- |
|
3 https://bugzilla.mozilla.org/show_bug.cgi?id=403162 |
|
4 --> |
|
5 <head> |
|
6 <title>Test for Bug 639338</title> |
|
7 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
|
8 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> |
|
9 <bindings xmlns="http://www.mozilla.org/xbl"> |
|
10 <binding id="test"> |
|
11 <handlers> |
|
12 <handler event="DOMMouseScroll" action="XPCNativeWrapper.unwrap(window).triggerCount++" allowuntrusted="true"/> |
|
13 <handler event="DOMMouseScroll" modifiers="shift" action="XPCNativeWrapper.unwrap(window).shiftCount++" allowuntrusted="true"/> |
|
14 <handler event="DOMMouseScroll" modifiers="control" action="XPCNativeWrapper.unwrap(window).controlCount++" allowuntrusted="true"/> |
|
15 </handlers> |
|
16 </binding> |
|
17 </bindings> |
|
18 </head> |
|
19 <body> |
|
20 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=639338">Mozilla Bug 639338</a> |
|
21 <p id="display" style="-moz-binding: url(#test)"></p> |
|
22 <div id="content" style="display: none"> |
|
23 |
|
24 </div> |
|
25 <pre id="test"> |
|
26 <script class="testbody" type="text/javascript"> |
|
27 <![CDATA[ |
|
28 var triggerCount = 0; |
|
29 var shiftCount = 0; |
|
30 var controlCount = 0; |
|
31 |
|
32 function dispatchEvent(t, controlKey, shiftKey) { |
|
33 var ev = document.createEvent("MouseScrollEvents"); |
|
34 ev.initMouseScrollEvent("DOMMouseScroll", true, true, window, 0, 0, 0, 0, 0, controlKey, false, shiftKey, false, 0, null, 0); |
|
35 t.dispatchEvent(ev); |
|
36 } |
|
37 |
|
38 /** Test for Bug 403162 **/ |
|
39 SimpleTest.waitForExplicitFinish(); |
|
40 addLoadEvent(function() { |
|
41 var t = $("display"); |
|
42 is(triggerCount, 0, "Haven't dispatched event"); |
|
43 |
|
44 dispatchEvent(t, false, false); |
|
45 is(triggerCount, 1, "Dispatched once"); |
|
46 is(shiftCount, 0, "Not shift"); |
|
47 is(controlCount, 0, "Not control"); |
|
48 |
|
49 dispatchEvent(t, false, true); |
|
50 is(triggerCount, 2, "Dispatched twice"); |
|
51 is(shiftCount, 1, "Shift"); |
|
52 is(controlCount, 0, "Not control"); |
|
53 |
|
54 dispatchEvent(t, true, false); |
|
55 is(triggerCount, 3, "Dispatched thrice"); |
|
56 is(shiftCount, 1, "Not shift"); |
|
57 is(controlCount, 1, "Control"); |
|
58 |
|
59 SimpleTest.finish(); |
|
60 }); |
|
61 ]]> |
|
62 </script> |
|
63 </pre> |
|
64 </body> |
|
65 </html> |
|
66 |