[whatwg] <video> ... <script> race condition

Philip Jägenstedt philipj at opera.com
Tue May 17 02:09:21 PDT 2011


On Tue, 17 May 2011 10:47:02 +0200, Remy Sharp <remy at leftlogic.com> wrote:

> On 17 May 2011, at 09:04, Philip Jägenstedt wrote:
>
>> Or do you mean a spec bug?
>
> I meant a spec bug :)

http://www.w3.org/Bugs/Public/show_bug.cgi?id=12664

Still, I don't think just advocacy is any kind of solution. Given that you  
(the co-author of an HTML5 book) make certain assumptions about the  
outcome of this race condition, it's safe to assume that hoards of web  
developers will do the same.

To target this specific pattern, one hypothetical solution would be to  
special-case the first script that attaches event handlers to a <video>  
element. After it has run, all events that were already fired before the  
script are fired again. However, this seems awfully messy if the script  
also observes readyState or networkState. It might also interfere with  
browsers that use scripts behind the scenes to implement the native  
controls.

Although a kludge, another solution might be to block events from being  
fired until x more bytes of the document have been parsed or it has  
finished loading.

Any other bad ideas?

-- 
Philip Jägenstedt
Core Developer
Opera Software



More information about the whatwg mailing list