Hi all,

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).

Specifically:

http://www.whatwg.org/specs/web-apps/current-work/#read-html: After creating 
the Document<http://www.whatwg.org/specs/web-apps/current-work/#document> 
object, but before any script execution, certainly before the parser 
stops<http://www.whatwg.org/specs/web-apps/current-work/#stop-parsing>, 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>."
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<http://www.whatwg.org/specs/web-apps/current-work/#task-queue> of the 
relevant event 
loop<http://www.whatwg.org/specs/web-apps/current-work/#event-loop>."
http://www.whatwg.org/specs/web-apps/current-work/#processing-model-2: "An 
event loop<http://www.whatwg.org/specs/web-apps/current-work/#event-loop> must 
continually run through the following steps for as long as it exists:

  1.  Run the oldest 
task<http://www.whatwg.org/specs/web-apps/current-work/#concept-task> on one of 
the event loop<http://www.whatwg.org/specs/web-apps/current-work/#event-loop>'s 
task queues<http://www.whatwg.org/specs/web-apps/current-work/#task-queue>, 
ignoring tasks whose associated 
Document<http://www.whatwg.org/specs/web-apps/current-work/#document>s are not 
fully active<http://www.whatwg.org/specs/web-apps/current-work/#fully-active>."
http://www.whatwg.org/specs/web-apps/current-work/#fully-active: "A 
Document<http://www.whatwg.org/specs/web-apps/current-work/#document> is said 
to be fully active when it is the active 
document<http://www.whatwg.org/specs/web-apps/current-work/#active-document> of 
its browsing 
context<http://www.whatwg.org/specs/web-apps/current-work/#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?

Thanks,
Ben Lerner

Reply via email to