blob: 190cbc40530ec06e8ecc91aed681f4474806d511 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../../resources/js-test.js"></script>
<script>
if (window.testRunner)
testRunner.setShouldStayOnPageAfterHandlingBeforeUnload(true);
// JavaScript onbeforeunload dialogs require a user gesture.
if (window.eventSender) {
eventSender.mouseMoveTo(5, 5);
eventSender.mouseDown();
eventSender.mouseUp();
}
window.onload = function() {
window.location.href = "resources/does-not-exist.html";
setTimeout(finishJSTest, 0);
}
var testEvent;
window.onbeforeunload = function(event) {
testEvent = event;
shouldBe("testEvent.__proto__", "BeforeUnloadEvent.prototype");
shouldBeEqualToString("testEvent.returnValue", "");
event.returnValue = "This is beforeunload from the top level frame.";
shouldBeEqualToString("testEvent.returnValue", "This is beforeunload from the top level frame.");
}
</script>
</head>
<body>
<script>
description("Tests the returnValue attribute of the BeforeUnloadEvent.");
self.jsTestIsAsync = true;
</script>
</body>
</html>