| <!DOCTYPE html> |
| <html><head><meta charset=utf-8><title>Page Dismissal Modal Dialogs mainFrame</title><script> |
| function showMessages(event) { |
| alert(event + " PASS"); |
| confirm(event + " PASS"); |
| prompt(event + " PASS", "PASS"); |
| } |
| |
| function handleEvent(event, otherFrame) { |
| showMessages(event); |
| var click = otherFrame.document.createEvent("UIEvent"); |
| click.initUIEvent("click", true, false, otherFrame, 1); |
| otherFrame.document.getElementById("anchor").dispatchEvent(click); |
| } |
| |
| function registerEvents(name, thisFrame, otherFrame) { |
| thisFrame.addEventListener("beforeunload", function() { handleEvent(name + " beforeunload", otherFrame) }, false); |
| thisFrame.addEventListener("pagehide", function() { handleEvent(name + " pagehide", otherFrame) }, false); |
| thisFrame.addEventListener("unload", function() { handleEvent(name + " unload", otherFrame) }, false); |
| } |
| |
| addEventListener("load", function() { |
| registerEvents("mainFrame", window, frames[0]); |
| if (window.layoutTestController) { |
| layoutTestController.dumpAsText(); |
| layoutTestController.waitUntilDone(); |
| } |
| location = "resources/pass-and-notify-done.html"; |
| }, false); |
| </script></head><body><div> |
| |
| <span onclick="showMessages('mainFrame click')" id=anchor>anchor</span> |
| <iframe src=resources/page-dismissal-modal-dialogs-iframe.html></iframe> |
| |
| This page registers handlers for various types of unload events and attempts to |
| popup modal dialogs through various JavaScript calls in each of them. Also, it |
| does the same thing in an iframe. In addition, it tries to popup dialogs in the |
| context of one frame when running a handler in the other frame. |
| </div></body></html> |