007.html (847B)
1 <!doctype html> 2 <title>WebSockets: close() followed by send()</title> 3 4 <script src=/resources/testharness.js></script> 5 <script src=/resources/testharnessreport.js></script> 6 <script src=../../../constants.sub.js></script> 7 <meta name="variant" content="?default"> 8 <meta name="variant" content="?wss"> 9 <meta name="variant" content="?wpt_flags=h2"> 10 <div id=log></div> 11 <script> 12 13 async_test(function(t) { 14 var ws = new WebSocket(SCHEME_DOMAIN_PORT+'/echo'); 15 ws.onopen = t.step_func(function(e) { 16 // test that nothing strange happens if we send something after close() 17 ws.close(); 18 var sent = ws.send('test'); 19 assert_equals(sent, undefined); 20 }); 21 ws.onclose = t.step_func(function(e) { 22 ws.onclose = t.unreached_func(); 23 t.step_timeout(() => t.done(), 50); 24 }); 25 ws.onerror = ws.onmessage = t.unreached_func(); 26 }); 27 </script>