Index: LayoutTests/fast/events/before-unload-return-value-from-listener.html |
diff --git a/LayoutTests/fast/events/before-unload-returnValue.html b/LayoutTests/fast/events/before-unload-return-value-from-listener.html |
similarity index 62% |
copy from LayoutTests/fast/events/before-unload-returnValue.html |
copy to LayoutTests/fast/events/before-unload-return-value-from-listener.html |
index 979567c439a00997a5675087c56071152abe65f0..642a0fa8d34953fd1ace72ffe0a353ec742535da 100644 |
--- a/LayoutTests/fast/events/before-unload-returnValue.html |
+++ b/LayoutTests/fast/events/before-unload-return-value-from-listener.html |
@@ -6,24 +6,25 @@ |
if (window.testRunner) |
testRunner.setShouldStayOnPageAfterHandlingBeforeUnload(true); |
+var testEvent; |
window.onload = function() { |
window.location.href = "resources/does-not-exist.html"; |
- setTimeout(finishJSTest, 0); |
+ setTimeout(function() { |
+ shouldBeEqualToString("testEvent.returnValue", ""); |
+ finishJSTest(); |
+ }, 0); |
} |
-var testEvent; |
-window.onbeforeunload = function(event) { |
+window.addEventListener('beforeunload', 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."); |
-} |
+ return "not supposed to be assigned to returnValue"; |
+}, false); |
</script> |
</head> |
<body> |
<script> |
-description("Tests the returnValue attribute of the BeforeUnloadEvent."); |
+description("Tests the returnValue attribute of the BeforeUnloadEvent from an event listener."); |
self.jsTestIsAsync = true; |
</script> |
</body> |