008.html (685B)
1 <!doctype html> 2 <title>WebSockets: getting readyState in closed</title> 3 <script src=/resources/testharness.js></script> 4 <script src=/resources/testharnessreport.js></script> 5 <script src=../../../constants.sub.js></script> 6 <meta name="variant" content="?default"> 7 <meta name="variant" content="?wss"> 8 <div id=log></div> 9 <script> 10 async_test(function(t) { 11 var ws = new WebSocket(SCHEME_DOMAIN_PORT+'/echo'); 12 ws.onopen = t.step_func(function(e) { 13 ws.onclose = t.step_func(function(e) { 14 assert_equals(ws.readyState, ws.CLOSED); 15 t.done(); 16 }) 17 ws.close(); 18 }); 19 ws.onerror = ws.onmessage = ws.onclose = t.step_func(function() {assert_unreached()}); 20 }); 21 </script>