W3C home > Mailing lists > Public > whatwg@whatwg.org > December 2008

[whatwg] Terminate a Worker algorithm

From: Ian Hickson <ian@hixie.ch>
Date: Tue, 16 Dec 2008 06:43:04 +0000 (UTC)
Message-ID: <Pine.LNX.4.62.0812160640590.30225@hixie.dreamhostps.com>
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.   `._.-(,_..'--(,_..'`-.;.'
Received on Monday, 15 December 2008 22:43:04 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:08 UTC