| <script src="../../resources/js-test-pre.js"></script> |
| testRunner.setShouldStayOnPageAfterHandlingBeforeUnload(true); |
| if (testRunner.setShouldDecideNavigationPolicyAfterDelay) |
| testRunner.setShouldDecideNavigationPolicyAfterDelay(true); |
| iframe.contentWindow.onbeforeunload = function(event) { |
| shouldBe("testEvent.__proto__", "iframe.contentWindow.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."); |
| testRunner.setShouldStayOnPageAfterHandlingBeforeUnload(false); |
| iframe.contentWindow.location.href = "resources/does-not-exist.html"; |
| iframe.contentWindow.location.href = "resources/does-not-exist.html"; |
| <iframe id="iframe" onload="test(this)" src="resources/onclick.html"></iframe> |
| description("Tests the returnValue attribute of the BeforeUnloadEvent."); |
| self.jsTestIsAsync = true; |
| <script src="../../resources/js-test-post.js"></script> |