summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/pointer-lock/bug90391-move-then-window-open-crash.html
blob: 767b6e9c0f3f4d1167bdae67fc453d2ff4f458e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<!DOCTYPE HTML>
<html>
<head>
<script src="../http/tests/resources/js-test-pre.js"></script>
<script src="../http/tests/resources/pointer-lock/pointer-lock-test-harness.js"></script>
</head>
<body>
<div>
  <div id="target1"></div>
</div>
<script>
    description("bug 90391: pointer lock mouse move events then window.open should not crash.")
    window.jsTestIsAsync = true;

    targetdiv1 = document.getElementById("target1");

    todo = [
        function () {
            debug("     Locking targetdiv1.")
            targetdiv1.webkitRequestPointerLock();
            document.onwebkitpointerlockchange = function () {
                document.onwebkitpointerlockchange = null;
                testPassed("document.onwebkitpointerlockchange event received.");
                doNextStep();
            };
        },
        function () {
            debug("     Sending mouse move events.")
            var mouseMoveEvents = 0;
            targetdiv1.onmousemove = function () {
                if (++mouseMoveEvents == 2) {
                    targetdiv1.onmousemove = null;
                    doNextStep();
                }
            }
            if (window.eventSender) {
              eventSender.mouseMoveTo(100, 100);
              eventSender.mouseMoveTo(200, 200);
            }
        },
        function () {
            debug("     Calling window.open.")
            gc();
            window.open();
            testPassed("Didn't crash");
            document.webkitExitPointerLock();
            doNextStep();
        },
    ];
    doNextStepWithUserGesture();
</script>
<script src="../http/tests/resources/js-test-post.js"></script>
</body>
</html>