Race conditions in HTML 5?

Hi,

I see several places in the HTML 5 spec, where a UA is required
to start executing something once all other scripts have stopped
executing. It seems possible that this could lead to race 
conditions, or deadlock, depending on use.

I didn't find any discussion of this in the archives, but please
enlighten me if I missed it. If this is a new point, I would
encourage adding some text to the specification for HTML authors 
pointing out this potential problem.

A partial list of "when all other scripts have stopped" musts:

3.12.9 The source element
   ...
   If a source element is inserted into a media element that is 
   already in a document and whose networkState is in the EMPTY
   state, the user agent must implicitly invoke the load() method
   on the media element as soon as all other scripts have finished
   executing

3.15 Scripting

   When a script completes loading: If a script whose element was
   added to one of the lists mentioned above completes loading while
   the document is still being parsed, then the parser handles it.
   Otherwise, when a script completes loading, the UA must run the
   following steps as soon as as any other scripts that may be
   executing have finished executing  ...

3.17.6.2. The template attribute
...
Once the DOM in question has been parsed, assuming that it indeed can be
parsed and does so successfully, the user agent must wait for no scripts to
be executing, and as soon as that opportunity arises, run the following
algorithm  ...

3.17.6.3. The ref attribute
...
   Once the DOM in question has been parsed, assuming that it indeed can
   be parsed and does so successfully, the user agent must wait for no
   scripts to be executing, and as soon as that opportunity arises, run
   the following algorithm ...

4.7.6 Application cache API

  The add(uri) method must run the following steps:
   ...
   9. Wait for there to be no running scripts

6.2.2 Connecting to an event stream

   Each object implementing the EventTarget and RemoteEventTarget
   interfaces has a list of event sources that are registered for
   that object.

   When a new URI is added to this list, the user agent should,
   as soon as all currently executing scripts (if any) have finished
   executing, and if the specified URI isn't removed from the list
   before they do so, fetch the resource identified by that URI.
 
6.4.1 (Cross-document messaging) Processing model
   ...
   3. Wait for the Window object on which the method was invoked to
      have finished executing any pending scripts.


Matt
--
Matt Bonner
Hewlett-Packard Company

Received on Tuesday, 10 June 2008 01:26:01 UTC