blob: cd582afdaceddb4486239ef1b0cb7f621c9bfa31 [file] [log] [blame]
<script>
window.onload = function ()
{
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.setShouldStayOnPageAfterHandlingBeforeUnload(true);
testRunner.waitUntilDone();
}
// JavaScript onbeforeunload dialogs require a user gesture.
if (window.eventSender) {
eventSender.mouseMoveTo(5, 5);
eventSender.mouseDown();
eventSender.mouseUp();
}
if (sessionStorage.fail) {
if (window.testRunner)
testRunner.notifyDone();
return;
}
location = location.href + '?done';
window.setTimeout(passTest, 0);
};
window.onbeforeunload = function ()
{
if (sessionStorage.fail)
return;
sessionStorage.fail = true;
location.reload();
return "";
};
function passTest()
{
document.getElementById('status').textContent = 'PASS';
if (window.testRunner)
testRunner.notifyDone();
}
</script>
<body>
This test passes if the FAIL changes to PASS after clicking "Stay on this page".
<div id="status">FAIL</div>
</body>