Torne (Richard Coles) | 5c87bf8 | 2012-11-14 11:46:17 +0000 | [diff] [blame] | 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" |
| 2 | "http://www.w3.org/TR/html4/strict.dtd"> |
| 3 | <html lang="en"> |
| 4 | <head> |
| 5 | <script language="JavaScript"> |
| 6 | function openWindow() { |
| 7 | window.open("./onbeforeunload-close_with_javascript.html","name","width=700px,height=500px"); |
| 8 | } |
| 9 | </script> |
| 10 | </head> |
| 11 | <BODY onbeforeunload="return 'onBeforeUnloadHandler return string is displayed here.';"> |
| 12 | <p><b>BUG ID:</b> <a href="rdar://problem/4394910">4394910</a> calling Javascript window.close() does not trigger onbeforeunload event</p> |
| 13 | |
| 14 | <p id="test" style="background-color:skyblue; padding:3px;"><b>STEPS TO TEST:</b> |
| 15 | <ol> |
| 16 | <li>Click the "Open" button below. |
| 17 | <li>In the window that opens, click the "Close" button. |
| 18 | </ol> |
| 19 | </p> |
| 20 | |
| 21 | <p id="success" style="background-color:palegreen; padding:3px;"><b>TEST PASS:</b> |
| 22 | After the close button is clicked, you should see a dialog that reads:</p> |
| 23 | <pre>Are you sure you want to navigate away from this page? |
| 24 | |
| 25 | onBeforeUnloadHandler return string is displayed here. |
| 26 | |
| 27 | Press OK to continue or Cancel to stay on the current page.</pre> |
| 28 | <p id="success" style="background-color:palegreen; padding:3px;">You should see the same dialog if you click the "Close" button in the main window. |
| 29 | </p> |
| 30 | |
| 31 | <p id="failure" style="background-color:#FF3300; padding:3px;"><b>TEST FAIL:</b> |
| 32 | No dialog (as described above) after clicking the "Close" button in the newly opened window, or in the main window. |
| 33 | </p> |
| 34 | |
| 35 | <BODY onbeforeunload="return 'onBeforeUnloadHandler return string is displayed here.';"> |
| 36 | <input type=button value="Open Window" onclick="openWindow()"><br> |
| 37 | <input type=button value="Close Window" onclick="window.close();"><br> |
| 38 | <p>Click the Open Window button. Once the new window is opened, close the new window by clicking the Close Window button (not the browser's close window icon).</p> |
| 39 | </body> |
| 40 | </html> |