summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/editing/pasteboard/copy-standalone-image-crash.html
blob: 1a15ff99ffebe83274f5d19a2a2ad8febf185e2f (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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<!DOCTYPE html>
<html>
<head>
<script>

var actionitems;

if (window.testRunner) {
     window.testRunner.dumpAsText();
     window.testRunner.waitUntilDone();
}

function doClick() {
    for (var i = 0; i < actionitems.length; i++)
    {
        var title = actionitems[i].title;

        if (!title)
           break;

        title = title.replace(/_/g,'');

        if (title.match("Copy Image")) {
           actionitems[i].click();
           break;
        }
    }

    document.body.innerHTML = "PASS";

    window.testRunner.notifyDone();
}

function hideDiv() {
    document.getElementById("DIV").style.display="none";
}

function doTest() {
    if (!window.testRunner) {
        document.body.addEventListener('mousedown', function () {setTimeout(hideDiv, 100)}, false);
        return;
    }

    var image = document.getElementById("IMG");

    x = image.offsetLeft + 10;
    y = image.offsetTop + 10;

    eventSender.mouseMoveTo(x, y);
    actionitems = eventSender.contextClick();

    hideDiv();

    setTimeout(doClick, 10);
}

</script>
</head>
<body onload="doTest()">
This is an automated test case for bug <a href="https://bugs.webkit.org/show_bug.cgi?id=31721">31721</a><br>
If you wish to test manually, mouseover to image, activate context menu, wait for the image to disappear and then click copy image.<br>
There should be no crash.
<div ID="DIV">
    <img id="IMG" src="resources/apple.gif"/>
    </div>
</body>

</html>