[whatwg] Terminate a Worker algorithm
ian at hixie.ch
Mon Dec 15 22:43:04 PST 2008
On Mon, 24 Nov 2008, Alexey Proskuryakov wrote:
> 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.
It can't be invoked before the WorkerGlobalScope is created. The
WorkerGlobalScope is created before the constructor returns the Worker
> 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.
Once 'closing' is set to true, the queue discards any additional tasks.
> 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.
Ian Hickson U+1047E )\._.,--....,'``. fL
http://ln.hixie.ch/ U+263A /, _.. \ _\ ;`._ ,.
Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'
More information about the whatwg