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.)
michael@0 | 1 | <!DOCTYPE HTML> |
michael@0 | 2 | <html> |
michael@0 | 3 | <!-- |
michael@0 | 4 | https://bugzilla.mozilla.org/show_bug.cgi?id=560780 |
michael@0 | 5 | --> |
michael@0 | 6 | <head> |
michael@0 | 7 | <title>Test for Bug 560780</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 | |
michael@0 | 12 | <script type="text/javascript"> |
michael@0 | 13 | function init() { |
michael@0 | 14 | var elem = document.getElementById('body'); |
michael@0 | 15 | elem.addEventListener('mousedown', mousedown, true); |
michael@0 | 16 | } |
michael@0 | 17 | var seen_mousedown = 0; |
michael@0 | 18 | function mousedown(event) { |
michael@0 | 19 | var doc = event.target.ownerDocument; |
michael@0 | 20 | var win = doc.defaultView; |
michael@0 | 21 | var elem = doc.getElementById('body'); |
michael@0 | 22 | var selection = win.getSelection(); |
michael@0 | 23 | if (selection.rangeCount>0) { |
michael@0 | 24 | var ragne = selection.getRangeAt(0); |
michael@0 | 25 | var rect = ragne.getBoundingClientRect(); |
michael@0 | 26 | var p = elem.parentNode.appendChild(doc.createElement('p')); |
michael@0 | 27 | p.textContent = "width: " + (rect.right -rect.left); |
michael@0 | 28 | } |
michael@0 | 29 | ++seen_mousedown; |
michael@0 | 30 | } |
michael@0 | 31 | </script> |
michael@0 | 32 | |
michael@0 | 33 | </head> |
michael@0 | 34 | <body id="body"> |
michael@0 | 35 | <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=560780">Mozilla Bug 560780</a> |
michael@0 | 36 | <p id="display" style="margin:0;padding:0;border:0"><a id="testlink" href="#aaaaaaaaaaaaaaaaaaaaaa">abcdefghijklmnabcdefghijklmn</a></p> |
michael@0 | 37 | <div id="content" style="display: none"> |
michael@0 | 38 | |
michael@0 | 39 | </div> |
michael@0 | 40 | <pre id="test"> |
michael@0 | 41 | 1.Start Minefield with New Profile. |
michael@0 | 42 | 2.Select texts by alt + mouse dragging horizontaly from 'd' in the link above to far right of window. |
michael@0 | 43 | 3.Click on the selected text |
michael@0 | 44 | 4.Click empty area of page |
michael@0 | 45 | 5.Repeat STEP 2 to 4 till browser crashes. (at least 5 times) |
michael@0 | 46 | |
michael@0 | 47 | <script type="application/javascript"> |
michael@0 | 48 | |
michael@0 | 49 | /** Test for Bug 560780 **/ |
michael@0 | 50 | |
michael@0 | 51 | function selectByMouseThenClick(elm,startx,starty) { |
michael@0 | 52 | // select some text |
michael@0 | 53 | var ctrl = navigator.platform.indexOf("Linux") ? true : false; |
michael@0 | 54 | var alt = true; |
michael@0 | 55 | var x = startx; |
michael@0 | 56 | synthesizeMouse(elm, x, starty, { type:"mousedown", ctrlKey:ctrl, altKey:alt }); |
michael@0 | 57 | synthesizeMouse(elm, x += 100, starty, { type:"mousemove", ctrlKey:ctrl, altKey:alt }); |
michael@0 | 58 | synthesizeMouse(elm, x += 100, starty, { type:"mousemove", ctrlKey:ctrl, altKey:alt }); |
michael@0 | 59 | synthesizeMouse(elm, x += 100, starty, { type:"mousemove", ctrlKey:ctrl, altKey:alt }); |
michael@0 | 60 | synthesizeMouse(elm, x += 100, starty, { type:"mousemove", ctrlKey:ctrl, altKey:alt }); |
michael@0 | 61 | synthesizeMouse(elm, x += 100, starty, { type:"mousemove", ctrlKey:ctrl, altKey:alt }); |
michael@0 | 62 | synthesizeMouse(elm, x += 100, starty, { type:"mousemove", ctrlKey:ctrl, altKey:alt }); |
michael@0 | 63 | synthesizeMouse(elm, x += 100, starty, { type:"mousemove", ctrlKey:ctrl, altKey:alt }); |
michael@0 | 64 | synthesizeMouse(elm, x += 100, starty, { type:"mousemove", ctrlKey:ctrl, altKey:alt }); |
michael@0 | 65 | synthesizeMouse(elm, x, starty, { type:"mouseup", ctrlKey:ctrl, altKey:alt }); |
michael@0 | 66 | |
michael@0 | 67 | // click on the selection |
michael@0 | 68 | synthesizeMouse(elm, startx + 10, starty + 1, {}); |
michael@0 | 69 | |
michael@0 | 70 | // click empty area of the page |
michael@0 | 71 | synthesizeMouse(document.getElementById('body'), 800, 800, {}); |
michael@0 | 72 | } |
michael@0 | 73 | |
michael@0 | 74 | function runTest() { |
michael@0 | 75 | var e = document.getElementById('testlink'); |
michael@0 | 76 | selectByMouseThenClick(e,110,5); |
michael@0 | 77 | selectByMouseThenClick(e,90,5); |
michael@0 | 78 | selectByMouseThenClick(e,70,5); |
michael@0 | 79 | selectByMouseThenClick(e,50,5); |
michael@0 | 80 | selectByMouseThenClick(e,30,5); |
michael@0 | 81 | selectByMouseThenClick(e,10,5); |
michael@0 | 82 | is(seen_mousedown, 12, "got the mousedown events"); |
michael@0 | 83 | SimpleTest.finish(); |
michael@0 | 84 | } |
michael@0 | 85 | |
michael@0 | 86 | function doTest() { |
michael@0 | 87 | init(); |
michael@0 | 88 | runTest(); |
michael@0 | 89 | } |
michael@0 | 90 | |
michael@0 | 91 | SimpleTest.waitForFocus(doTest, window); |
michael@0 | 92 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 93 | |
michael@0 | 94 | |
michael@0 | 95 | |
michael@0 | 96 | </script> |
michael@0 | 97 | </pre> |
michael@0 | 98 | </body> |
michael@0 | 99 | </html> |