Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(195)

Unified Diff: LayoutTests/fast/events/before-unload-return-value-from-listener.html

Issue 158783002: Limit beforeunload returnValue propagation to event handlers. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Switch tests to use onbeforeunload event handlers instead. Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | LayoutTests/fast/events/before-unload-return-value-from-listener-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>
« no previous file with comments | « no previous file | LayoutTests/fast/events/before-unload-return-value-from-listener-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698