test_bug470212.html (1777B)
1 <html> 2 <!-- 3 https://bugzilla.mozilla.org/show_bug.cgi?id=470212 4 --> 5 <head> 6 <title>Test for Bug 470212 - crash [@ nsContentUtils::ComparePoints]</title> 7 <script src="/tests/SimpleTest/SimpleTest.js"></script> 8 <script src="/tests/SimpleTest/EventUtils.js"></script> 9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 10 </head> 11 <body> 12 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=470212">Mozilla Bug 470212</a> 13 <div style="width: 200px;"> 14 <ca> 15 <canvas style="border: 1px solid black;" id="dragSource"></canvas> 16 </ca> 17 </div> 18 19 <pre id="test"> 20 <script> 21 function doShiftDrag(){ 22 setTimeout(function() { 23 var canvas = document.getElementById("dragSource"); 24 25 // Drag canvas element starts with a mouse down event, combine with shift 26 // key, follows by two mouse move events. 27 28 window.addEventListener("dragstart", e => { 29 e.preventDefault(); 30 e.stopPropagation(); 31 }, { once: true }); 32 33 // Press on left-top corner of the canvas element. 34 synthesizeMouse(canvas, 0, 0, { type: "mousedown", shiftKey: true }); 35 // Move to the center of this cavas element. 36 synthesizeMouseAtCenter(canvas, { type: "mousemove", shiftKey: true }); 37 // move out of cavas's region. 38 var canvasRect = canvas.getBoundingClientRect(); 39 synthesizeMouse(canvas, canvasRect.width / 2, canvasRect.height + 10, 40 { type: "mousemove", shiftKey: true }); 41 42 is(window.getSelection().rangeCount, 0, "rangeCount should be 0"); 43 44 synthesizeMouse(canvas, canvasRect.width / 2, canvasRect.height + 10, 45 { type: "mouseup", shiftKey: true }); 46 47 SimpleTest.finish(); 48 }, 0); 49 } 50 51 SimpleTest.waitForExplicitFinish(); 52 addLoadEvent(doShiftDrag); 53 </script> 54 55 </pre> 56 </body> 57 </html>