| OLD | NEW |
| 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 // JavaScript onbeforeunload dialogs require a user gesture. |
| 10 if (window.eventSender) { |
| 11 eventSender.mouseMoveTo(5, 5); |
| 12 eventSender.mouseDown(); |
| 13 eventSender.mouseUp(); |
| 14 } |
| 15 |
| 9 window.onload = function() { | 16 window.onload = function() { |
| 10 window.location.href = "resources/does-not-exist.html"; | 17 window.location.href = "resources/does-not-exist.html"; |
| 11 setTimeout(finishJSTest, 0); | 18 setTimeout(finishJSTest, 0); |
| 12 } | 19 } |
| 13 | 20 |
| 14 var testEvent; | 21 var testEvent; |
| 15 window.onbeforeunload = function(event) { | 22 window.onbeforeunload = function(event) { |
| 16 testEvent = event; | 23 testEvent = event; |
| 17 shouldBe("testEvent.__proto__", "BeforeUnloadEvent.prototype"); | 24 shouldBe("testEvent.__proto__", "BeforeUnloadEvent.prototype"); |
| 18 shouldBeEqualToString("testEvent.returnValue", ""); | 25 shouldBeEqualToString("testEvent.returnValue", ""); |
| 19 event.returnValue = "This is beforeunload from the top level frame."; | 26 event.returnValue = "This is beforeunload from the top level frame."; |
| 20 shouldBeEqualToString("testEvent.returnValue", "This is beforeunload from th
e top level frame."); | 27 shouldBeEqualToString("testEvent.returnValue", "This is beforeunload from th
e top level frame."); |
| 21 } | 28 } |
| 22 </script> | 29 </script> |
| 23 </head> | 30 </head> |
| 24 <body> | 31 <body> |
| 25 <script> | 32 <script> |
| 26 description("Tests the returnValue attribute of the BeforeUnloadEvent."); | 33 description("Tests the returnValue attribute of the BeforeUnloadEvent."); |
| 27 self.jsTestIsAsync = true; | 34 self.jsTestIsAsync = true; |
| 28 </script> | 35 </script> |
| 29 </body> | 36 </body> |
| 30 </html> | 37 </html> |
| 31 | 38 |
| OLD | NEW |