W3C home > Mailing lists > Public > public-html@w3.org > July 2008

Re: Workers

From: Ian Hickson <ian@hixie.ch>
Date: Fri, 25 Jul 2008 02:38:05 +0000 (UTC)
To: Jonas Sicking <jonas@sicking.cc>
Cc: public-html@w3.org
Message-ID: <Pine.LNX.4.62.0807250232330.10848@hixie.dreamhostps.com>

On Thu, 24 Jul 2008, Jonas Sicking wrote:
> Ian Hickson wrote:
> > > (why it is "window" btw?)
> > 
> > Because it is implemented by the Window object.
> I don't think this is true.

It's defined to be true at the moment, the way the spec is written.

> Our DOM implementation (which includes the Window object) is not thread 
> safe. We are using a separate object as the global scope for the worker 
> threads.

That's an implementation detail.

> > For legacy reasons the global object is generally called 'window'.  
> > To allow easy porting of code to workers, we have kept the same names.
> I actually found it intensely confusing that it is called Window* since 
> it is a separate object from the Window object.
> I think the name WorkerGlobalScope or some such would be much more 
> intuitive.

Well we need 'window' to be a property of the global object pointing to 
the global object, to allow easy porting of code to workers. It seems 
weird to have 'window' point to an object that isn't a Window.

Note that Window as defined by HTML5 only has a few members:


The majority of the members seen on browsing context global objects are on 
the WindowBrowsingContext interface:


The members on Window are those common to global objects in both browsing 
contexts and workers. It seemed better than duplicating all the members. 
It also allows for the specs to say things like "Objects that implement 
the Window interface must also implement the WindowFoo interface", which 
is how we get WindowWorkerCreators' members in both browsing contexts' and 
workers' global objects:


...and how we get WindowTimers' members in both browsing contexts' and 
workers' global objects:


None of this requires any particular implementation strategy, as all the 
interfaces except Window itself are marked [NoInterfaceObject], and 
browsing contexts and workers are completely script-isolated.

Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Friday, 25 July 2008 02:38:49 UTC

This archive was generated by hypermail 2.4.0 : Saturday, 9 October 2021 18:44:34 UTC