RE: [XHR] Event processing during synchronous request

2012-09-12 Thread Mike Wilson
Anne van Kesteren wrote:
 On Mon, Sep 10, 2012 at 10:05 AM, Mike Wilson 
 mike...@hotmail.com wrote:
  Thanks. So I understand it is the HTML specification reference
  that provides details on this behaviour for the XHR spec.
  I'll look further there as its fetching section by itself
  doesn't directly express the relationship between synchronous
  and a stopped event loop (although as a programmer I can infer
  this relationship).
 
 Well yeah, shit's complicated. HTML fetch can be invoked either
 synchronously or asynchronously. When invoked synchronously it's as
 part of some task already and since the event loop is not manually
 spun no other tasks will run at that time. When invoked asynchronously
 HTML fetch itself queues tasks on the event loop that then cause
 various things to happen per XMLHttpRequest, such as dispatching
 progress events.

Thanks, and yes, for me this section:
http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#
event-loops
has the sufficient text to define this.

On the other hand, in:
https://bugzilla.mozilla.org/show_bug.cgi?id=785243
Firefox implementors say that:
  sync XHR spins the event loop, so events (including async 
  script execution and whatnot) can fire under a sync XHR call.
which seems to suggest that the XHR spec should allow 
implementations to pump events during a synchronous fetch.

What is the XHR spec teams's opinion on this?
Best regards
Mike




Re: [XHR] Event processing during synchronous request

2012-09-12 Thread Anne van Kesteren
On Wed, Sep 12, 2012 at 8:35 PM, Mike Wilson mike...@hotmail.com wrote:
 On the other hand, in:
 https://bugzilla.mozilla.org/show_bug.cgi?id=785243
 Firefox implementors say that:
   sync XHR spins the event loop, so events (including async
   script execution and whatnot) can fire under a sync XHR call.
 which seems to suggest that the XHR spec should allow
 implementations to pump events during a synchronous fetch.

No, bz is just explaining the Gecko implementation.


 What is the XHR spec teams's opinion on this?

That Gecko has a bug.


-- 
http://annevankesteren.nl/



Re: [XHR] Event processing during synchronous request

2012-09-12 Thread Boris Zbarsky

On 9/12/12 7:35 PM, Mike Wilson wrote:

On the other hand, in:
https://bugzilla.mozilla.org/show_bug.cgi?id=785243
Firefox implementors say that:
   sync XHR spins the event loop, so events (including async
   script execution and whatnot) can fire under a sync XHR call.


That's a comment about implementation of sync XHR in Gecko, not about 
the spec.


-Boris



Re: [XHR] Event processing during synchronous request

2012-09-10 Thread Anne van Kesteren
On Sun, Sep 9, 2012 at 6:33 PM, Mike Wilson mike...@hotmail.com wrote:
 I didn't find statements directly addressing this in
 http://www.w3.org/TR/XMLHttpRequest/
 or
 http://www.whatwg.org/specs/web-apps/current-work/multipage/fetching-resourc
 es.html
 but maybe there are indirect relationships between
 specification sections that I am missing?

What you are missing is that for synchronous fetching the event loop
stops working so incoming events will not be processed.


-- 
http://annevankesteren.nl/



RE: [XHR] Event processing during synchronous request

2012-09-10 Thread Mike Wilson
Anne van Kesteren wrote:
 On Sun, Sep 9, 2012 at 6:33 PM, Mike Wilson 
 mike...@hotmail.com wrote:
  I didn't find statements directly addressing this in
  http://www.w3.org/TR/XMLHttpRequest/
  or
  
 http://www.whatwg.org/specs/web-apps/current-work/multipage/fe
 tching-resourc
  es.html
  but maybe there are indirect relationships between
  specification sections that I am missing?
 
 What you are missing is that for synchronous fetching the event loop
 stops working so incoming events will not be processed.

Thanks. So I understand it is the HTML specification reference
that provides details on this behaviour for the XHR spec. 
I'll look further there as its fetching section by itself 
doesn't directly express the relationship between synchronous 
and a stopped event loop (although as a programmer I can infer
this relationship).

Best regards
Mike




Re: [XHR] Event processing during synchronous request

2012-09-10 Thread Anne van Kesteren
On Mon, Sep 10, 2012 at 10:05 AM, Mike Wilson mike...@hotmail.com wrote:
 Thanks. So I understand it is the HTML specification reference
 that provides details on this behaviour for the XHR spec.
 I'll look further there as its fetching section by itself
 doesn't directly express the relationship between synchronous
 and a stopped event loop (although as a programmer I can infer
 this relationship).

Well yeah, shit's complicated. HTML fetch can be invoked either
synchronously or asynchronously. When invoked synchronously it's as
part of some task already and since the event loop is not manually
spun no other tasks will run at that time. When invoked asynchronously
HTML fetch itself queues tasks on the event loop that then cause
various things to happen per XMLHttpRequest, such as dispatching
progress events.


-- 
http://annevankesteren.nl/



Re: [XHR] Event processing during synchronous request

2012-09-09 Thread Olli Pettay

On 09/09/2012 06:33 PM, Mike Wilson wrote:

Is it defined how the browser should behave wrt calling
unrelated event handlers in user code during synchronous
XHR requests? (with unrelated I refer to events that are
not related to the ongoing synchronous request itself)

I didn't find statements directly addressing this in
http://www.w3.org/TR/XMLHttpRequest/
or
http://www.whatwg.org/specs/web-apps/current-work/multipage/fetching-resourc
es.html
but maybe there are indirect relationships between
specification sections that I am missing?
Or maybe it's deliberately undefined?

I ask because Firefox behaves differently to the other
popular browsers, in that it triggers event handlers for
other asynchronous XHR requests while blocking for a
synchronous XHR request.

That is a well-known bug in Gecko (other engines have or have had different 
kinds of bug
related to sync XHR, like locks etc).
But since synchronous XHR in UI-thread is by all means
effectively deprecated and very bad for the ux, I wouldn't
expect the bug in Gecko to be fixed any time soon (at least not by me :) ).


-Olli




Thanks
Mike Wilson