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=549170 |
michael@0 | 5 | --> |
michael@0 | 6 | <head> |
michael@0 | 7 | <title>Test for Bug 549170</title> |
michael@0 | 8 | <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 9 | <script type="application/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 | <body onload="window.setTimeout(runTests, 0);"> |
michael@0 | 13 | <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=549170">Mozilla Bug 549170</a> |
michael@0 | 14 | <p id="display"></p> |
michael@0 | 15 | <div id="content" style="display: none"> |
michael@0 | 16 | </div> |
michael@0 | 17 | <input id='i' |
michael@0 | 18 | onmouseup="mouseHandler(event);" |
michael@0 | 19 | onmousedown="mouseHandler(event);"> |
michael@0 | 20 | <textarea id='t' |
michael@0 | 21 | onmouseup="mouseHandler(event);" |
michael@0 | 22 | onmousedown="mouseHandler(event);"></textarea><br> |
michael@0 | 23 | <input id='ip' placeholder='foo' |
michael@0 | 24 | onmouseup="mouseHandler(event);" |
michael@0 | 25 | onmousedown="mouseHandler(event);"> |
michael@0 | 26 | <textarea id='tp' placeholder='foo' |
michael@0 | 27 | onmouseup="mouseHandler(event);" |
michael@0 | 28 | onmousedown="mouseHandler(event);"></textarea> |
michael@0 | 29 | <pre id="test"> |
michael@0 | 30 | |
michael@0 | 31 | <script type="application/javascript"> |
michael@0 | 32 | |
michael@0 | 33 | /** Test for Bug 549170 **/ |
michael@0 | 34 | |
michael@0 | 35 | var gNumberOfMouseEventsCatched = 0; |
michael@0 | 36 | |
michael@0 | 37 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 38 | |
michael@0 | 39 | function mouseHandler(aEvent) |
michael@0 | 40 | { |
michael@0 | 41 | gNumberOfMouseEventsCatched++; |
michael@0 | 42 | is(SpecialPowers.wrap(aEvent).originalTarget.nodeName, "DIV", "An inner div should be the target of the event"); |
michael@0 | 43 | ok(SpecialPowers.wrap(aEvent).originalTarget.classList.contains("anonymous-div"), "the target div should be the editor div"); |
michael@0 | 44 | } |
michael@0 | 45 | |
michael@0 | 46 | function checkMouseEvents(element) |
michael@0 | 47 | { |
michael@0 | 48 | gNumberOfMouseEventsCatched = 0; |
michael@0 | 49 | |
michael@0 | 50 | synthesizeMouse(element, 5, 5, {type: "mousedown", button: 0}); |
michael@0 | 51 | synthesizeMouse(element, 5, 5, {type: "mouseup", button: 0}); |
michael@0 | 52 | synthesizeMouse(element, 5, 5, {type: "mousedown", button: 1}); |
michael@0 | 53 | // NOTE: this event is going to copy the buffer on linux, this should not be a problem |
michael@0 | 54 | synthesizeMouse(element, 5, 5, {type: "mouseup", button: 1}); |
michael@0 | 55 | synthesizeMouse(element, 5, 5, {type: "mousedown", button: 2}); |
michael@0 | 56 | synthesizeMouse(element, 5, 5, {type: "mouseup", button: 2}); |
michael@0 | 57 | |
michael@0 | 58 | is(gNumberOfMouseEventsCatched, 6, "Some mouse events have not been catched"); |
michael@0 | 59 | } |
michael@0 | 60 | |
michael@0 | 61 | function runTests() |
michael@0 | 62 | { |
michael@0 | 63 | checkMouseEvents(document.getElementById('i')); |
michael@0 | 64 | checkMouseEvents(document.getElementById('t')); |
michael@0 | 65 | checkMouseEvents(document.getElementById('ip')); |
michael@0 | 66 | checkMouseEvents(document.getElementById('tp')); |
michael@0 | 67 | |
michael@0 | 68 | SimpleTest.finish(); |
michael@0 | 69 | } |
michael@0 | 70 | |
michael@0 | 71 | </script> |
michael@0 | 72 | </pre> |
michael@0 | 73 | </body> |
michael@0 | 74 | </html> |