| <html> |
| <head> |
| <script type="text/javascript" src="../../http/tests/inspector-protocol/inspector-protocol-test.js"></script> |
| <script> |
| |
| testRunner.setShouldStayOnPageAfterHandlingBeforeUnload(true); |
| |
| window.onbeforeunload = onBeforeUnload; |
| |
| function onBeforeUnload() |
| { |
| window.removeEventListener("beforeunload", onBeforeUnload); |
| return "beforeunload in javascriptDialogEvents"; |
| } |
| |
| function test() |
| { |
| InspectorTest.eventHandler["Page.javascriptDialogOpening"] = onOpening; |
| InspectorTest.eventHandler["Page.javascriptDialogClosed"] = onClosed; |
| InspectorTest.sendCommand("Page.enable", {}); |
| |
| function onOpening(event) |
| { |
| InspectorTest.log("Opening dialog: type=" + event.params.type + "; message=" + event.params.message); |
| } |
| |
| function onClosed(event) |
| { |
| InspectorTest.log("Closed dialog: result=" + event.params.result); |
| } |
| |
| InspectorTest.sendCommand("Page.navigate", { "url": "http://nosuchurl" }); |
| InspectorTest.sendCommand("Runtime.evaluate", { "expression": "alert('alert')" }, onDoneAlert); |
| |
| function onDoneAlert() |
| { |
| InspectorTest.sendCommand("Runtime.evaluate", { "expression": "confirm('confirm')" }, onDoneConfirm); |
| } |
| |
| function onDoneConfirm() |
| { |
| InspectorTest.sendCommand("Runtime.evaluate", { "expression": "prompt('prompt')" }, onDone); |
| } |
| |
| function onDone() |
| { |
| InspectorTest.completeTest(); |
| } |
| } |
| |
| </script> |
| </head> |
| <body onload="runTest()"> |
| </body> |
| </html> |