[whatwg] Navigation maturation and event loops

On Wed, 23 Jun 2010, Ben Lerner wrote:
> 
> I'm trying to figure out the control flow when documents are loaded and 
> navigated, and I think there's a deadlock situation (at least as I'm 
> currently reading the spec).
> 
> http://www.whatwg.org/specs/web-apps/current-work/#read-html: After 
> creating the Document object, but before any script execution, certainly 
> before the parser stops, the user agent must update the session history 
> with the new page."
>
> http://www.whatwg.org/specs/web-apps/current-work/#update-the-session-history-with-the-new-page: 
> ...The user agent must queue a task to ... #3: The navigation algorithm 
> has now matured.
>
> http://www.whatwg.org/specs/web-apps/current-work/#queue-a-task: "When a 
> user agent is to queue a task, it must add the given task to one of the 
> task queues of the relevant event loop."
>
> http://www.whatwg.org/specs/web-apps/current-work/#processing-model-2: 
> "An event loop must continually run through the following steps for as 
> long as it exists:
> 
> 1.  Run the oldest task on one of the event loop's task queues, ignoring 
> tasks whose associated Documents are not fully active."
>
> http://www.whatwg.org/specs/web-apps/current-work/#fully-active: "A 
> Document is said to be fully active when it is the active document of 
> its browsing context, and ..."
> 
> So if I'm reading that chain right: I need to queue a task that will 
> mature the navigation algorithm, which will make the document the active 
> document, except that the task will not run because the document is not 
> yet the active document and hence not fully active.  The loophole here 
> is the phrase "relevant event loop".  Is there an event loop that is 
> relevant and that is also associated with a fully-active document?

The associated document in the case of the task that updates the session 
history with the new page is the previous document, not the new one. I'll 
make that clearer.

Does that leave anything unclear for you?

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Received on Monday, 9 August 2010 16:59:51 UTC