Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | <!DOCTYPE HTML> |
michael@0 | 2 | <html> |
michael@0 | 3 | <!-- |
michael@0 | 4 | https://bugzilla.mozilla.org/show_bug.cgi?id=402089 |
michael@0 | 5 | --> |
michael@0 | 6 | <head> |
michael@0 | 7 | <title>Test for Bug 402089</title> |
michael@0 | 8 | <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 9 | <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script> |
michael@0 | 10 | <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> |
michael@0 | 11 | </head> |
michael@0 | 12 | <!-- setTimeout so that the test starts after paint suppression ends --> |
michael@0 | 13 | <body onload="setTimeout(doTest,0);"> |
michael@0 | 14 | <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=402089">Mozilla Bug 402089</a> |
michael@0 | 15 | <p id="display"></p> |
michael@0 | 16 | <div id="content"> |
michael@0 | 17 | <pre id="result1"></pre> |
michael@0 | 18 | <pre id="result2"></pre> |
michael@0 | 19 | </div> |
michael@0 | 20 | <pre id="test"> |
michael@0 | 21 | <script class="testbody" type="text/javascript"> |
michael@0 | 22 | |
michael@0 | 23 | /** Test for Bug 402089 **/ |
michael@0 | 24 | |
michael@0 | 25 | var cachedEvent = null; |
michael@0 | 26 | |
michael@0 | 27 | function testCachedEvent() { |
michael@0 | 28 | testEvent('result2'); |
michael@0 | 29 | ok((document.getElementById('result1').textContent == |
michael@0 | 30 | document.getElementById('result2').textContent), |
michael@0 | 31 | "Event coordinates should be the same after dispatching."); |
michael@0 | 32 | SimpleTest.finish(); |
michael@0 | 33 | } |
michael@0 | 34 | |
michael@0 | 35 | function testEvent(res) { |
michael@0 | 36 | var s = cachedEvent.type + "\n"; |
michael@0 | 37 | s += "clientX: " + cachedEvent.clientX + ", clientY: " + cachedEvent.clientY + "\n"; |
michael@0 | 38 | s += "screenX: " + cachedEvent.screenX + ", screenY: " + cachedEvent.screenY + "\n"; |
michael@0 | 39 | s += "layerX: " + cachedEvent.layerX + ", layerY: " + cachedEvent.layerY + "\n"; |
michael@0 | 40 | s += "pageX: " + cachedEvent.pageX + ", pageY: " + cachedEvent.pageY + "\n"; |
michael@0 | 41 | document.getElementById(res).textContent += s; |
michael@0 | 42 | } |
michael@0 | 43 | |
michael@0 | 44 | function clickHandler(e) { |
michael@0 | 45 | cachedEvent = e; |
michael@0 | 46 | testEvent('result1'); |
michael@0 | 47 | e.stopPropagation(); |
michael@0 | 48 | e.preventDefault(); |
michael@0 | 49 | window.removeEventListener("click", clickHandler, true); |
michael@0 | 50 | setTimeout(testCachedEvent, 10); |
michael@0 | 51 | } |
michael@0 | 52 | |
michael@0 | 53 | function doTest() { |
michael@0 | 54 | window.addEventListener("click", clickHandler, true); |
michael@0 | 55 | var utils = SpecialPowers.getDOMWindowUtils(window); |
michael@0 | 56 | utils.sendMouseEvent("mousedown", 1, 1, 0, 1, 0); |
michael@0 | 57 | utils.sendMouseEvent("mouseup", 1, 1, 0, 1, 0); |
michael@0 | 58 | |
michael@0 | 59 | } |
michael@0 | 60 | |
michael@0 | 61 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 62 | </script> |
michael@0 | 63 | </pre> |
michael@0 | 64 | </body> |
michael@0 | 65 | </html> |
michael@0 | 66 |