W3C home > Mailing lists > Public > whatwg@whatwg.org > August 2010

[whatwg] Race condition in media load algorithm

From: Philip Jägenstedt <philipj@opera.com>
Date: Tue, 03 Aug 2010 10:27:10 +0200
Message-ID: <op.vgusfkqhsr6mfa@philip-pc.gothenburg.osa>
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.

Philip J?genstedt
Core Developer
Opera Software
Received on Tuesday, 3 August 2010 01:27:10 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:25 UTC