3 <script type="text/javascript" src="../../http/tests/inspector-protocol/resources/protocol-test.js"></script>
6 window.onbeforeunload = onBeforeUnload;
8 function onBeforeUnload()
10 window.removeEventListener("beforeunload", onBeforeUnload);
11 return "beforeunload in javascriptDialogEvents";
16 InspectorTest.eventHandler["Page.javascriptDialogOpening"] = onOpening;
17 InspectorTest.eventHandler["Page.javascriptDialogClosed"] = onClosed;
18 InspectorTest.sendCommand("Page.enable", {});
20 function onOpening(event)
22 InspectorTest.log("Opening with message: " + event.params.message);
26 InspectorTest.log("Closed");
29 InspectorTest.sendCommand("Page.navigate", { "url": "nosuchurl" });
30 InspectorTest.sendCommand("Runtime.evaluate", { "expression": "alert('alert')" }, onDoneAlert);
32 function onDoneAlert()
34 InspectorTest.sendCommand("Runtime.evaluate", { "expression": "confirm('confirm')" }, onDoneConfirm);
37 function onDoneConfirm()
39 InspectorTest.sendCommand("Runtime.evaluate", { "expression": "prompt('prompt')" }, onDone);
44 InspectorTest.completeTest();
50 <body onload="runTest()">