worker-with-script-src-none-set-timeout.js (467B)
1 var id = 0; 2 try { 3 id = setTimeout("postMessage('handler invoked')", 100); 4 } catch (e) {} 5 var message = id === 0 ? "setTimeout blocked" : "setTimeout allowed"; 6 7 if (typeof SharedWorkerGlobalScope === "function") { 8 onconnect = function (e) { 9 var port = e.ports[0]; 10 11 port.onmessage = function () { port.postMessage(message); }; 12 port.postMessage(message); 13 }; 14 } else if (typeof DedicatedWorkerGlobalScope === "function") { 15 self.postMessage(message); 16 }