3 <script type=
"text/javascript" src=
"../../http/tests/inspector-protocol/inspector-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 dialog: type=" + event
.params
.type
+ "; message=" + event
.params
.message
);
25 function onClosed(event
)
27 InspectorTest
.log("Closed dialog: result=" + event
.params
.result
);
30 InspectorTest
.sendCommand("Page.navigate", { "url": "http://nosuchurl" });
31 InspectorTest
.sendCommand("Runtime.evaluate", { "expression": "alert('alert')" }, onDoneAlert
);
33 function onDoneAlert()
35 InspectorTest
.sendCommand("Runtime.evaluate", { "expression": "confirm('confirm')" }, onDoneConfirm
);
38 function onDoneConfirm()
40 InspectorTest
.sendCommand("Runtime.evaluate", { "expression": "prompt('prompt')" }, onDone
);
45 InspectorTest
.completeTest();
51 <body onload=
"runTest()">