[whatwg] Race condition in media load algorithm
philipj at opera.com
Tue Aug 3 01:27:10 PDT 2010
On Tue, 03 Aug 2010 00:40:26 +0200, Chris Pearce <chris at pearce.org.nz>
> On 2/08/2010 9:17 p.m., Ian Hickson wrote:
>> On Mon, 2 Aug 2010, Chris Pearce wrote:
>>> There's a race condition in the media load algorithm. When the resource
>>> selection algorithm begins, it sets a task to complete the rest of the
>>> resource selection algorithm asynchronously.
>> Not quite. It awaits a stable state and then runs a synchronous section,
>> which means that it will run the subsequent steps as soon as the current
>> task has finished, before anything else that is queued.
> Ah, I see. My understanding of the processing model was incomplete,
> thanks for clarifying!
For the record, here's how I interpreted "await a stable state":
The only state that is not stable is a running script. The only step in
any video-related algorithm one can reach from a script is step 2 of the
resource selection algorithm. Therefore, when reaching that step, if the
resource selection algorithm was triggered by a script, wait until that
script has finished and then continue. The only somewhat tricky part is
that if we are in an event handler triggered by script, we should wait
until the script that triggered the event handler has finished. The only
way I know of triggering this corner case is by invoking a synchronous
event handler from script, e.g. by calling click().
All other occurrences of "await a stable state" I've ignored as we can't
not be in a stable state when reaching them.
More information about the whatwg