2 <html><head><meta charset=utf-
8><title>Page Dismissal Modal Dialogs mainFrame
</title><script>
3 function showMessages(event
) {
4 alert(event
+ " PASS");
5 confirm(event
+ " PASS");
6 prompt(event
+ " PASS", "PASS");
9 function handleEvent(event
, otherFrame
) {
11 var click
= otherFrame
.document
.createEvent("UIEvent");
12 click
.initUIEvent("click", true, false, otherFrame
, 1);
13 otherFrame
.document
.getElementById("anchor").dispatchEvent(click
);
16 function registerEvents(name
, thisFrame
, otherFrame
) {
17 thisFrame
.addEventListener("beforeunload", function() { handleEvent(name
+ " beforeunload", otherFrame
) }, false);
18 thisFrame
.addEventListener("pagehide", function() { handleEvent(name
+ " pagehide", otherFrame
) }, false);
19 thisFrame
.addEventListener("unload", function() { handleEvent(name
+ " unload", otherFrame
) }, false);
22 addEventListener("load", function() {
23 registerEvents("mainFrame", window
, frames
[0]);
24 if (window
.testRunner
) {
25 testRunner
.dumpAsText();
26 testRunner
.waitUntilDone();
28 location
= "resources/pass-and-notify-done.html";
30 </script></head><body><div>
32 <span onclick=
"showMessages('mainFrame click')" id=anchor
>anchor
</span>
33 <iframe src=resources/page-dismissal-modal-dialogs-iframe.html
></iframe>
35 This page registers handlers for various types of unload events and attempts to
36 popup modal dialogs through various JavaScript calls in each of them. Also, it
37 does the same thing in an iframe. In addition, it tries to popup dialogs in the
38 context of one frame when running a handler in the other frame.