003-sets-origin.worker.js (549B)
1 importScripts("/resources/testharness.js"); 2 importScripts('../constants.sub.js'); 3 4 async_test(function(t) { 5 var ws = new WebSocket(SCHEME_DOMAIN_PORT+'/origin'); 6 ws.onmessage = t.step_func(function(e) { 7 assert_equals(e.data, location.protocol+'//'+location.host); 8 ws.onclose = t.step_func(function(e) { 9 assert_equals(e.wasClean, true); 10 ws.onclose = t.unreached_func(); 11 t.step_timeout(() => t.done(), 50); 12 }) 13 ws.close(); 14 }) 15 ws.onerror = ws.onclose = t.unreached_func(); 16 }, "origin set in a Worker"); 17 done();