OLD | NEW |
---|---|
(Empty) | |
1 function reportResult(msg) { | |
2 if ("opener" in self) | |
3 self.opener.postMessage(msg, "*"); | |
4 else | |
5 postMessage(msg); | |
6 } | |
7 | |
8 new Promise(function (resolve, reject) { | |
9 var ws = new WebSocket("ws://127.0.0.1:8880/echo"); | |
10 ws.onopen = function () { | |
11 resolve(); | |
12 }; | |
13 ws.onmessage = function () { | |
14 reject("Unexpected error event"); | |
yhirano
2014/04/15 04:19:39
message event
tyoshino (SeeGerritForStatus)
2014/04/15 05:14:57
Done.
| |
15 }; | |
16 ws.onerror = function () { | |
17 reject("Unexpected error event"); | |
18 }; | |
19 ws.onclose = function () { | |
20 reject("Unexpected close event before open event"); | |
21 }; | |
22 }).then( | |
23 function () { | |
24 reportResult("DONE"); | |
25 }, | |
26 function (reason) { | |
27 reportResult("FAIL: " + reason); | |
28 } | |
29 ); | |
OLD | NEW |