Re: Workers

Ian Hickson wrote:
> On Sun, 20 Jul 2008, Andrew Fedoniouk wrote:
>>> They mean exactly what they say; Workers are "isolated" in a 
>>> JavaScript sense but this doesn't preclude them being associated with 
>>> a particular JavaScript browsing context.
>> Sorry but what exactly is that "browsing context"? Is it set of objects, 
>> interfaces or just such a smell?
>>
>> (For some reasons I found difficult for myself to understand language 
>> used in http://www.whatwg.org/specs/web-workers/ ,sorry again)
> 
> The Workers spec assumes knowledge of the terminology in HTML5. In 
> particular, anything with a faint thick green underline is a term defined 
> in HTML5. For example browsing contexts are defined here:
> 
>    http://www.whatwg.org/specs/web-apps/current-work/#browsing1
> 

That is what I am reading there:

"A browsing context is a collection of one or more Document objects, and 
one or more views."

Here: http://www.whatwg.org/specs/web-workers/current-work/#processing
you have written following:
"Let script's script browsing context be owner browsing context."

If you will combine these two you will have something like this:
"Let script's Document object [inside Worker] be owner Document object."

Document object is the DOM according to
http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#i-Document

But intention is to isolate Worker from the Document and rest of the
DOM, correct?

It appears as I am getting term "browsing context" wrong.
Is it something that can be expressed in terms of formal interface 
definition like:
    interface BrowsingCtx { ... }
or is it some abstraction behind the scene?

Say 'document' variable, is it part
of that BrowsingCtx or any other context available for the script?

> 
>>> It is downloaded in step 1 of the "run a worker" algorithm.
>> Is it list item #1 in:
>> http://www.whatwg.org/specs/web-workers/current-work/#processing ?
>>
>> If "yes" then for me it contains only this:
>>
>> "Attempt to fetch the resource identified by url.
>>  If the attempt fails,....
>>  If the attempt succeeds, then ...."
>>
>> Question is: how that Attempt is made exactly?
>> Synchronously or asynchronously?
> 
> I don't know what the distinction would be -- there's nothing else running 
> on that execution content at that time, how could one distinguish an 
> asychronous fetch from a synchronous one?
> 

Ah, OK. I have missed "it must run the following steps in a completely 
separate and parallel execution environment".

So script retrieval is executed in that thread. Indeed synchronously or 
asynchronous is not relevant as no script is running yet in that thread.

I think that term 'thread' shall be used in the specification instead of
"completely separate and parallel execution environment". Thread is well 
established and universally understood term. Anyway that specification 
is targeted on developers. I doubt that any non-technical person will 
even try to read that.

-- 
Andrew Fedoniouk.

http://terrainformatica.com

Received on Sunday, 20 July 2008 19:45:50 UTC