Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

"abort" listener not executed for XHR

25 views
Skip to first unread message

Jan Honza Odvarko

unread,
Nov 21, 2012, 11:31:22 AM11/21/12
to
I am registering a listener for "abort" event in XHR

xhr.addEventListener("abort", onAbort, false);

but it isn't executed in the following case:

var request = new XMLHttpRequest();
request.open("POST", "issue2462.php", true);
request.send(null);
request.abort();


nsIEventListenerService.addListenerForAllEvents doesn't work either

Am I doing something wrong?

(the listener is added in chrome scope)

Honza

Boris Zbarsky

unread,
Nov 21, 2012, 11:53:10 AM11/21/12
to
On 11/21/12 11:31 AM, Jan Honza Odvarko wrote:
> Am I doing something wrong?

When is the addEventListener call made?

Apart from that, nothing obviously wrong. A testcase that shows the
problem would be helpful.

-Boris

Jan Honza Odvarko

unread,
Nov 22, 2012, 3:48:35 AM11/22/12
to
On Nov 21, 5:53 pm, Boris Zbarsky <bzbar...@mit.edu> wrote:
> On 11/21/12 11:31 AM, Jan Honza Odvarko wrote:
>
> > Am I doing something wrong?
>
> When is the addEventListener call made?
There are two scenarios:

1) The listener is appended when "http-on-modify-request" is sent.
It works in 17, but broken now because "http-on-modify-request" is
asynchronous.

This is currently being solved in bug:
Bug 800799 - http-on-modify-request now called after JS that
started the load is no longer on the stack

2) The listener is appended when "http-on-opening-request"
(or "xhr-load-starting", depending which patch from bug 800799 is
used)
is sent (synchronously).

The situation is a bit better since it seems to fix bug:
Bug 802551 - onHTTPSpyReadyStateChange not sent for aborted XHR

I.e. "readystatechange" event *is* now sent when abort() is called.

But "abort" event is still not sent.

Doesn't matter if addListenerForAllEvents or
addEventListener("abort"...
is used.

> Apart from that, nothing obviously wrong.  A testcase that shows the
> problem would be helpful.
I can create a simple extension, but it'll require having patch from
bug 800799 applied.


Should I create a new bug report for this?


Honza

Boris Zbarsky

unread,
Nov 22, 2012, 11:36:25 PM11/22/12
to
On 11/22/12 3:48 AM, Jan Honza Odvarko wrote:
> I can create a simple extension, but it'll require having patch from
> bug 800799 applied.

That's fine. I'm pretty good at applying patches. ;)

> Should I create a new bug report for this?

Please!

-Boris

Jan Honza Odvarko

unread,
Nov 23, 2012, 2:43:48 AM11/23/12
to
On Nov 23, 5:36 am, Boris Zbarsky <bzbar...@mit.edu> wrote:
> On 11/22/12 3:48 AM, Jan Honza Odvarko wrote:
>
> > I can create a simple extension, but it'll require having patch from
> > bug 800799 applied.
>
> That's fine.  I'm pretty good at applying patches.  ;)
Excellent ;-)

> > Should I create a new bug report for this?
Here you go:
https://bugzilla.mozilla.org/show_bug.cgi?id=814576

Thanks!
Honza
0 new messages