4 <title>test to close hanging wss connection
</title>
5 <script type=
"text/javascript">
7 var href
= window
.location
.href
;
8 var hostBegin
= href
.indexOf('/') + 2;
9 var hostEnd
= href
.lastIndexOf(':');
10 var host
= href
.slice(hostBegin
, hostEnd
);
11 var queryBegin
= href
.lastIndexOf('?') + 1;
12 var port
= href
.slice(queryBegin
);
13 var url
= 'wss://' + host
+ ':' + port
;
15 // Do connection test.
16 var ws
= new WebSocket(url
);
17 ws
.onopen = function() {
18 // Set document title to 'FAIL'. The test observer catches this title change
19 // to know the result.
20 document
.title
= 'FAIL';
22 ws
.onclose = function() {
23 // Set document title to 'PASS'. The test observer catches this title change
24 // to know the result.
25 document
.title
= 'PASS';