1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/xbl/test/test_bug639338.xhtml Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,66 @@ 1.4 +<html xmlns="http://www.w3.org/1999/xhtml"> 1.5 +<!-- 1.6 +https://bugzilla.mozilla.org/show_bug.cgi?id=403162 1.7 +--> 1.8 +<head> 1.9 + <title>Test for Bug 639338</title> 1.10 + <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 1.11 + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 1.12 + <bindings xmlns="http://www.mozilla.org/xbl"> 1.13 + <binding id="test"> 1.14 + <handlers> 1.15 + <handler event="DOMMouseScroll" action="XPCNativeWrapper.unwrap(window).triggerCount++" allowuntrusted="true"/> 1.16 + <handler event="DOMMouseScroll" modifiers="shift" action="XPCNativeWrapper.unwrap(window).shiftCount++" allowuntrusted="true"/> 1.17 + <handler event="DOMMouseScroll" modifiers="control" action="XPCNativeWrapper.unwrap(window).controlCount++" allowuntrusted="true"/> 1.18 + </handlers> 1.19 + </binding> 1.20 + </bindings> 1.21 +</head> 1.22 +<body> 1.23 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=639338">Mozilla Bug 639338</a> 1.24 +<p id="display" style="-moz-binding: url(#test)"></p> 1.25 +<div id="content" style="display: none"> 1.26 + 1.27 +</div> 1.28 +<pre id="test"> 1.29 +<script class="testbody" type="text/javascript"> 1.30 +<![CDATA[ 1.31 +var triggerCount = 0; 1.32 +var shiftCount = 0; 1.33 +var controlCount = 0; 1.34 + 1.35 +function dispatchEvent(t, controlKey, shiftKey) { 1.36 + var ev = document.createEvent("MouseScrollEvents"); 1.37 + ev.initMouseScrollEvent("DOMMouseScroll", true, true, window, 0, 0, 0, 0, 0, controlKey, false, shiftKey, false, 0, null, 0); 1.38 + t.dispatchEvent(ev); 1.39 +} 1.40 + 1.41 +/** Test for Bug 403162 **/ 1.42 +SimpleTest.waitForExplicitFinish(); 1.43 +addLoadEvent(function() { 1.44 + var t = $("display"); 1.45 + is(triggerCount, 0, "Haven't dispatched event"); 1.46 + 1.47 + dispatchEvent(t, false, false); 1.48 + is(triggerCount, 1, "Dispatched once"); 1.49 + is(shiftCount, 0, "Not shift"); 1.50 + is(controlCount, 0, "Not control"); 1.51 + 1.52 + dispatchEvent(t, false, true); 1.53 + is(triggerCount, 2, "Dispatched twice"); 1.54 + is(shiftCount, 1, "Shift"); 1.55 + is(controlCount, 0, "Not control"); 1.56 + 1.57 + dispatchEvent(t, true, false); 1.58 + is(triggerCount, 3, "Dispatched thrice"); 1.59 + is(shiftCount, 1, "Not shift"); 1.60 + is(controlCount, 1, "Control"); 1.61 + 1.62 + SimpleTest.finish(); 1.63 +}); 1.64 +]]> 1.65 +</script> 1.66 +</pre> 1.67 +</body> 1.68 +</html> 1.69 +