<p>This tests that context menu events are sent to the correct frame when a
page is scrolled. To test manually, scroll the page so that the top of the
iframe is flush with the top of the web page area, then right-click just below
the iframe. You should get a context menu that does not contain any mention of
frames.</p>
<iframe src="about:blank"></iframe>
<pre id="log"></pre>
<div style="height: 150%"></div>
<script>
    function log(msg)
    {
        document.getElementById('log').appendChild(document.createTextNode(msg + "\n"));
    }

    if (window.testRunner)
        testRunner.dumpAsText();

    var frame = document.getElementsByTagName('iframe')[0];

    document.oncontextmenu = function() { log('PASS: main document received a context menu event'); }
    frame.contentDocument.oncontextmenu = function() { log('FAIL: subframe document received a context menu event'); }

    if (window.eventSender) {
        window.scrollTo(0, frame.offsetTop);
        eventSender.mouseMoveTo(frame.offsetLeft + (frame.offsetWidth / 2), frame.offsetHeight + 5);
        eventSender.contextClick();
    }
</script>
