Re: Media elements may never load, may load the wrong source, etc

On Wed, 8 Jul 2009, Philip Jagenstedt wrote:
>
> I'd prefer wording requiring the resource selection algorithm to 
> continue the "asynchronous" steps once the triggering script has 
> finished, similar to the old wording for the implicit load(): "the user 
> agent must implicitly invoke the load() method on the media element as 
> soon as all other scripts have finished executing". There's no element 
> of chance involved as far as I can see. If this could help remove the 
> different handling of src/source with two different waiting states and 
> ugliness, all the better.

"as soon as all other scripts have finished executing" is vague to the 
point of not being testable, sadly. But I've taken that idea and recast 
the entire algorithm in a way that gets you the same effect.

Basically now it waits until the current task has finished, and then looks 
to see if there's a src="" or <source>, and if there is, it switches to 
the appropriate mode and processes that src="" or <source> 
(asynchronously). For <source>, if that one fails, it waits until the next 
time the event loop has finished, and then tries the next one.


> As I'm sure you're aware most (all?) browser don't update the layout 
> until scripts modifying the DOM have finished,

Yes, that's actually required by HTML5.


> I think this is really a similar case.

I've specced it in a similar way. Basically now there are two ways to hook 
into the event loop mechanism. There's tasks, which can have side-effects 
and are queued (in various task sources that can be independently 
prioritised), and then there's "awaiting a stable state", which hooks into 
the event loop mechanism in between tasks, but can't have side-effects.

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

Received on Sunday, 26 July 2009 03:06:18 UTC