003.html (957B)
1 <!doctype html> 2 <meta charset=utf-8> 3 <title>WebSockets: origin</title> 4 <meta name="timeout" content="long"> 5 <script src=/resources/testharness.js></script> 6 <script src=/resources/testharnessreport.js></script> 7 <script src=../constants.sub.js></script> 8 <meta name="variant" content="?default"> 9 <meta name="variant" content="?wss"> 10 <div id=log></div> 11 <script> 12 async_test(function(t) { 13 const url = SCHEME_DOMAIN_PORT+'/origin', 14 ws = new WebSocket(url.replace("://", "://天気の良い日.")); 15 ws.onmessage = t.step_func(function(e) { 16 assert_equals(e.origin, new URL(url).origin.replace("://", "://xn--n8j6ds53lwwkrqhv28a.")) 17 assert_equals(e.data, location.protocol+'//'+location.host); 18 ws.onclose = t.step_func(function(e) { 19 assert_equals(e.wasClean, true); 20 ws.onclose = t.unreached_func(); 21 t.step_timeout(() => t.done(), 50); 22 }) 23 ws.close(); 24 }) 25 ws.onerror = ws.onclose = t.unreached_func(); 26 }); 27 </script>