OLD | NEW |
| (Empty) |
1 <!DOCTYPE html> | |
2 <html> | |
3 <head> | |
4 <script src="../../../http/tests/inspector-protocol/inspector-protocol-test.js">
</script> | |
5 <script> | |
6 var ws; | |
7 function createSocket() | |
8 { | |
9 ws = new WebSocket("ws://localhost:8080/echo"); | |
10 } | |
11 | |
12 function test() | |
13 { | |
14 InspectorTest.eventHandler["Network.webSocketCreated"] = onWebSocketCreated; | |
15 | |
16 function enableNetwork() | |
17 { | |
18 InspectorTest.log("Test started"); | |
19 InspectorTest.sendCommand("Network.enable", {}, didEnableNetwork); | |
20 } | |
21 | |
22 function didEnableNetwork(messageObject) | |
23 { | |
24 if (messageObject.error) { | |
25 InspectorTest.log("FAIL: Couldn't enable network agent" + messageObj
ect.error.message); | |
26 InspectorTest.completeTest(); | |
27 return; | |
28 } | |
29 InspectorTest.log("Network agent enabled"); | |
30 InspectorTest.sendCommand("Runtime.evaluate", { "expression": "createSoc
ket()"}); | |
31 } | |
32 | |
33 function onWebSocketCreated(event) | |
34 { | |
35 var initiator = event.params.initiator; | |
36 InspectorTest.log(""); | |
37 InspectorTest.log("Initiator Type: " + initiator.type); | |
38 var stackTrace = initiator.stack; | |
39 for (var i = 0; i < stackTrace.callFrames.length; ++i) { | |
40 var frame = stackTrace.callFrames[i]; | |
41 InspectorTest.log("Stack #" + i); | |
42 if (frame.lineNumber) { | |
43 InspectorTest.log(" functionName: " + frame.functionName); | |
44 InspectorTest.log(" url: " + cleanUrl(frame.url)); | |
45 InspectorTest.log(" lineNumber: " + frame.lineNumber); | |
46 | |
47 break; | |
48 } | |
49 } | |
50 InspectorTest.completeTest(); | |
51 } | |
52 | |
53 function cleanUrl(url) | |
54 { | |
55 url = url.match(/\/[^\/]+$/); | |
56 if (url.length) | |
57 return url[0].substr(1); | |
58 return url; | |
59 } | |
60 | |
61 enableNetwork(); | |
62 } | |
63 </script> | |
64 </head> | |
65 <body onload="runTest();"> | |
66 <p>Initiator for Websockets check fixes http://crbug.com/457811</p> | |
67 </body> | |
OLD | NEW |