Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / pointer-lock / bug90391-move-then-window-open-crash.html
1 <!DOCTYPE HTML>
2 <html>
3 <head>
4 <script src="../resources/js-test.js"></script>
5 <script src="../http/tests/resources/pointer-lock/pointer-lock-test-harness.js"></script>
6 </head>
7 <body>
8 <div>
9   <div id="target1"></div>
10 </div>
11 <script>
12     description("bug 90391: pointer lock mouse move events then window.open should not crash.")
13     window.jsTestIsAsync = true;
14
15     targetdiv1 = document.getElementById("target1");
16
17     todo = [
18         function () {
19             debug("     Locking targetdiv1.")
20             targetdiv1.webkitRequestPointerLock();
21             document.onpointerlockchange = function () {
22                 document.onpointerlockchange = null;
23                 testPassed("document.onpointerlockchange event received.");
24                 doNextStep();
25             };
26         },
27         function () {
28             debug("     Sending mouse move events.")
29             var mouseMoveEvents = 0;
30             targetdiv1.onmousemove = function () {
31                 if (++mouseMoveEvents == 2) {
32                     targetdiv1.onmousemove = null;
33                     doNextStep();
34                 }
35             }
36             if (window.eventSender) {
37               eventSender.mouseMoveTo(100, 100);
38               eventSender.mouseMoveTo(200, 200);
39             }
40         },
41         function () {
42             debug("     Calling window.open.")
43             gc();
44             window.open();
45             testPassed("Didn't crash");
46             document.webkitExitPointerLock();
47             doNextStep();
48         },
49     ];
50     doNextStepWithUserGesture();
51 </script>
52 </body>
53 </html>