[whatwg] Terminate a Worker algorithm

Alexey Proskuryakov ap at webkit.org
Mon Nov 24 06:39:32 PST 2008


1) The algorithm assumes that a WorkerGlobalScope exists, and doesn't  
specify what happens if it is invoked before WorkerGlobalScope is  
created (e.g. if the script is still being loaded, or the scope is  
being created, but Worker.terminate() is called from JS). I think that  
the right behavior is to re-invoke the algorithm after the scope is  
created, because it may be too late to prevent its creation.

2) Events in WorkerGlobalScope event queue are dropped when  
terminating a worker, but messages posted to Worker are not. I think  
that the expected behavior is that after calling Worker.terminate(),  
no messages will be dispatched to worker's event listeners.

3) "If there are any events in the queue of events other than the  
close event that this algorithm just added, discard them without  
dispatching them." - I don't see where the close event is added for  
terminate algorithm, and this looks like a copy/paste mistake, because  
the event won't be dispatched anyway.

- WBR, Alexey Proskuryakov





More information about the whatwg mailing list