| OLD | NEW |
| (Empty) | |
| 1 <html> |
| 2 <head> |
| 3 <script type="text/javascript"> |
| 4 var gl; |
| 5 // For some reason, when running this test in automated fashion, it |
| 6 // triggers the bug reliably if the first frame with back-to-back |
| 7 // events happens a certain number of frames into the test execution. |
| 8 var numFrames = 202; |
| 9 var intensity = 255; |
| 10 var contextWasLost = false; |
| 11 |
| 12 function contextLostHandler(e) { |
| 13 contextWasLost = true; |
| 14 } |
| 15 |
| 16 function draw() { |
| 17 if (--intensity == 0) { |
| 18 intensity = 255; |
| 19 } |
| 20 |
| 21 gl.clearColor(intensity / 255.0, 0, 0, 1); |
| 22 gl.clear(gl.COLOR_BUFFER_BIT); |
| 23 |
| 24 if (numFrames % 2 == 0) { |
| 25 // Toggle the state of the drop-down every other frame. Every now |
| 26 // and then, dispatch two events back to back. This really seems to |
| 27 // trigger the bug. |
| 28 var maxIteration = 1; |
| 29 if (numFrames % 6 == 0) { |
| 30 maxIteration = 2; |
| 31 } |
| 32 for (var ii = 0; ii < maxIteration; ++ii) { |
| 33 var e = document.createEvent('MouseEvent'); |
| 34 e.initMouseEvent('mousedown', true, true, window); |
| 35 var s = document.getElementById('dropdown'); |
| 36 s.dispatchEvent(e); |
| 37 } |
| 38 } |
| 39 |
| 40 if (--numFrames > 0) { |
| 41 requestAnimationFrame(draw); |
| 42 } else { |
| 43 if (contextWasLost) { |
| 44 window.domAutomationController.send("FAILED"); |
| 45 } else { |
| 46 window.domAutomationController.send("SUCCESS"); |
| 47 } |
| 48 } |
| 49 } |
| 50 |
| 51 function onLoad() { |
| 52 window.domAutomationController.send("LOADED"); |
| 53 |
| 54 var canvas = document.getElementById("canvas1"); |
| 55 if (!canvas) |
| 56 return; |
| 57 canvas.addEventListener("webglcontextlost", contextLostHandler, false); |
| 58 |
| 59 gl = canvas.getContext("webgl"); |
| 60 if (!gl) |
| 61 return; |
| 62 |
| 63 requestAnimationFrame(draw); |
| 64 } |
| 65 </script> |
| 66 </head> |
| 67 <body onload="onLoad()"> |
| 68 <select id="dropdown"> |
| 69 <option value="option1">option1</option> |
| 70 <option value="option2">option2</option> |
| 71 <option value="option3">option3</option> |
| 72 <option value="option4">option4</option> |
| 73 </select> |
| 74 <canvas id="canvas1" width="32px" height="32px"> |
| 75 </canvas> |
| 76 </body> |
| 77 </html> |
| OLD | NEW |