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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <script src="../../resources/js-test.js"></script> 4 <script src="../../resources/js-test.js"></script>
5 <script> 5 <script>
6 if (window.testRunner) 6 if (window.testRunner)
7 testRunner.setShouldStayOnPageAfterHandlingBeforeUnload(true); 7 testRunner.setShouldStayOnPageAfterHandlingBeforeUnload(true);
8 8
9 var testEvent;
9 window.onload = function() { 10 window.onload = function() {
10 window.location.href = "resources/does-not-exist.html"; 11 window.location.href = "resources/does-not-exist.html";
11 setTimeout(finishJSTest, 0); 12 setTimeout(function() {
13 shouldBeEqualToString("testEvent.returnValue", "");
14 finishJSTest();
15 }, 0);
12 } 16 }
13 17
14 var testEvent; 18 window.addEventListener('beforeunload', function(event) {
15 window.onbeforeunload = function(event) {
16 testEvent = event; 19 testEvent = event;
17 shouldBe("testEvent.__proto__", "BeforeUnloadEvent.prototype"); 20 shouldBe("testEvent.__proto__", "BeforeUnloadEvent.prototype");
18 shouldBeEqualToString("testEvent.returnValue", ""); 21 return "not supposed to be assigned to returnValue";
19 event.returnValue = "This is beforeunload from the top level frame."; 22 }, false);
20 shouldBeEqualToString("testEvent.returnValue", "This is beforeunload from th e top level frame.");
21 }
22 </script> 23 </script>
23 </head> 24 </head>
24 <body> 25 <body>
25 <script> 26 <script>
26 description("Tests the returnValue attribute of the BeforeUnloadEvent."); 27 description("Tests the returnValue attribute of the BeforeUnloadEvent from an ev ent listener.");
27 self.jsTestIsAsync = true; 28 self.jsTestIsAsync = true;
28 </script> 29 </script>
29 </body> 30 </body>
30 </html> 31 </html>
31 32
OLDNEW
« 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