Hi all,<div><br></div><div>A couple of quick questions about the lifecycle of workers - specifically I'm trying to grok the body of text at section 4.5 of the Web Workers spec. It seems like it's saying that if I create a shared worker, then hand off its port to another window, that shared worker will be orphaned once the original window is closed.</div>
<div><br></div><div>It seems like instead of just using the normal message port reachability algorithm (once a worker's message ports are no longer reachable, it is considered orphaned) we instead have to track the original allocator of all ports, and only count a worker as reachable if the window that allocated the original port is still active.</div>
<div><br></div><div>"[a worker is permissible if] <span class="Apple-style-span" style="font-family: Helvetica; font-size: 16px; ">at some point past or present a <span style="font: 13.0px Courier; color: #ff2e00">MessagePort</span> owned by the worker was entangled with a <span style="font: 13.0px Courier; color: #ff2e00">MessagePort</span> <i>p</i> whose owner is a <span style="font: 13.0px Courier; color: #ff2e00">Window</span> object whose active document is the <span style="font: 13.0px Courier; color: #ff2e00">Document</span> that was that browsing context's active document when <i>p</i> was created, and that <span style="font: 13.0px Courier; color: #ff2e00">Document</span> is fully active"</span></div>
<div><br></div><div>Am I reading this correctly? It just seems wonky that if I create a shared worker from window A, hand the port off to window B, then close window A, that worker is now orphaned despite being reachable from window B. But if I do the same thing, but before window A closes, window B creates a new port and sends it to the worker via the port that window A gave it, the worker won't be orphaned when window A closes.</div>
<div><br></div><div>What's the intent here?</div><div><br></div><div>Also, one other thing: I was previously under the impression that SharedWorkers had a different lifecycle from dedicated Workers - SharedWorkers would not exit as long as there were any windows open to that domain. In retrospect, I'm pretty sure I just made that up - SharedWorkers and dedicated Workers have identical lifecycles, correct?</div>
<div><br></div><div>-atw</div><div><br></div>