W3C home > Mailing lists > Public > public-webapps@w3.org > October to December 2009

Re: bug in example

From: Ian Hickson <ian@hixie.ch>
Date: Thu, 5 Nov 2009 22:15:48 +0000 (UTC)
To: (wrong string) ™•–Œ) <bsy@google.com>
Cc: public-webapps@w3.org
Message-ID: <Pine.LNX.4.62.0911052214400.22553@hixie.dreamhostps.com>
On Wed, 4 Nov 2009, Bennet Yee (~Y~U~V~L) wrote:
> 
> my apologies in advance if this has already been noted.  i recently was 
> introduced to http://dev.w3.org/2006/webapi/FileAPI/ and noticed that 
> the first example appears to have the following race condition: in 
> getAsText, reader.readAsText occurs before any event callbacks are set, 
> so if the completion occurs after read.readAsText(...) and 
> reader.onprogress = ..., .onload = ... etc, then no callbacks will ever 
> get called.  or am i misunderstanding the way the callbacks are supposed 
> to work -- i.e., they're level triggered and not edge triggered?  (i'd 
> imagine onprogress shouldn't be level triggered.)

Events are asynchronous, so they never trigger before the script has 
finished (including setting the event handler attributes).

HTH,
-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Thursday, 5 November 2009 22:16:17 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:35 GMT