| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <script type="text/javascript" src="../../http/tests/inspector-protocol/inspecto
r-protocol-test.js"></script> | 3 <script type="text/javascript" src="../../http/tests/inspector-protocol/inspecto
r-protocol-test.js"></script> |
| 4 <script> | 4 <script> |
| 5 | 5 |
| 6 window.onbeforeunload = onBeforeUnload; | 6 window.onbeforeunload = onBeforeUnload; |
| 7 | 7 |
| 8 function onBeforeUnload() | 8 function onBeforeUnload() |
| 9 { | 9 { |
| 10 window.removeEventListener("beforeunload", onBeforeUnload); | 10 window.removeEventListener("beforeunload", onBeforeUnload); |
| 11 return "beforeunload in javascriptDialogEvents"; | 11 return "beforeunload in javascriptDialogEvents"; |
| 12 } | 12 } |
| 13 | 13 |
| 14 function test() | 14 function test() |
| 15 { | 15 { |
| 16 InspectorTest.eventHandler["Page.javascriptDialogOpening"] = onOpening; | 16 InspectorTest.eventHandler["Page.javascriptDialogOpening"] = onOpening; |
| 17 InspectorTest.eventHandler["Page.javascriptDialogClosed"] = onClosed; | 17 InspectorTest.eventHandler["Page.javascriptDialogClosed"] = onClosed; |
| 18 InspectorTest.sendCommand("Page.enable", {}); | 18 InspectorTest.sendCommand("Page.enable", {}); |
| 19 | 19 |
| 20 function onOpening(event) | 20 function onOpening(event) |
| 21 { | 21 { |
| 22 InspectorTest.log("Opening with message: " + event.params.message); | 22 InspectorTest.log("Opening dialog: type=" + event.params.type + "; messa
ge=" + event.params.message); |
| 23 } | 23 } |
| 24 function onClosed() | 24 |
| 25 function onClosed(event) |
| 25 { | 26 { |
| 26 InspectorTest.log("Closed"); | 27 InspectorTest.log("Closed dialog: result=" + event.params.result); |
| 27 } | 28 } |
| 28 | 29 |
| 29 InspectorTest.sendCommand("Page.navigate", { "url": "http://nosuchurl" }); | 30 InspectorTest.sendCommand("Page.navigate", { "url": "http://nosuchurl" }); |
| 30 InspectorTest.sendCommand("Runtime.evaluate", { "expression": "alert('alert'
)" }, onDoneAlert); | 31 InspectorTest.sendCommand("Runtime.evaluate", { "expression": "alert('alert'
)" }, onDoneAlert); |
| 31 | 32 |
| 32 function onDoneAlert() | 33 function onDoneAlert() |
| 33 { | 34 { |
| 34 InspectorTest.sendCommand("Runtime.evaluate", { "expression": "confirm('
confirm')" }, onDoneConfirm); | 35 InspectorTest.sendCommand("Runtime.evaluate", { "expression": "confirm('
confirm')" }, onDoneConfirm); |
| 35 } | 36 } |
| 36 | 37 |
| 37 function onDoneConfirm() | 38 function onDoneConfirm() |
| 38 { | 39 { |
| 39 InspectorTest.sendCommand("Runtime.evaluate", { "expression": "prompt('p
rompt')" }, onDone); | 40 InspectorTest.sendCommand("Runtime.evaluate", { "expression": "prompt('p
rompt')" }, onDone); |
| 40 } | 41 } |
| 41 | 42 |
| 42 function onDone() | 43 function onDone() |
| 43 { | 44 { |
| 44 InspectorTest.completeTest(); | 45 InspectorTest.completeTest(); |
| 45 } | 46 } |
| 46 } | 47 } |
| 47 | 48 |
| 48 </script> | 49 </script> |
| 49 </head> | 50 </head> |
| 50 <body onload="runTest()"> | 51 <body onload="runTest()"> |
| 51 </body> | 52 </body> |
| 52 </html> | 53 </html> |
| OLD | NEW |