Last Comment Bug 821610 - Break on XHR
: Break on XHR
Status: NEW
Product: Firefox
Classification: Client Software
Component: Developer Tools: Debugger (show other bugs)
: unspecified
: All All
: P2 normal with 3 votes (vote)
: ---
Assigned To: Nobody; OK to take it and work on it
Depends on: 832983
Blocks: firebug-gaps dbg-control
  Show dependency treegraph
Reported: 2012-12-13 23:34 PST by Victor Porof [:vporof][:vp]
Modified: 2016-04-25 02:09 PDT (History)
14 users (show)
sebastianzartner: needinfo? (vporof)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Description Victor Porof [:vporof][:vp] 2012-12-13 23:34:29 PST

Comment 1 Victor Porof [:vporof][:vp] 2012-12-13 23:35:09 PST
We need a way to break on XHR requests (POST, GET, etc.)
Comment 2 Rob Campbell [:rc] (:robcee) 2013-01-10 09:52:05 PST
take a look at firebug's implementation. Or we could ask Honza!

filter on BLACKEAGLE.
Comment 3 Victor Porof [:vporof][:vp] 2013-01-10 09:52:35 PST
Honza, how do you do this? Can you point us at the relevant code in Firebug?
Comment 4 Jan Honza Odvarko [:Honza] 2013-01-10 10:49:23 PST
1) First you need to handle "http-on-opening-request" (nsIObserver). Note that it was "http-on-opening-request" in the past (Fx 16), but that event is not synchronous anymore (see

Here is where Firebug does it:

2) As soon as the handler is executed (synchronously), the debugger needs to check if there is an enabled breakpoint and associated with the URL.

3) If there is a breakpoint, optional condition needs to be evaluated. The condition should be able to deal at least with URL params and post data.

4) If the breakpoint says: "break", the debugger needs the interrupt JS execution synchronously (to keep the current stack trace).

5) Consequently, the debugger needs to peel off the stack trace and keep only frames coming from the content (web page).

Up to now all happens on the server side. Now, the server should just send 'pause' event to the client and the client should handle it just like it handles other interrupts...

See this posts for UX info:

Comment 5 Victor Porof [:vporof][:vp] 2013-01-10 11:03:41 PST
This is excellent! Thanks!
Comment 6 Jan Honza Odvarko [:Honza] 2013-01-10 11:08:33 PST
(In reply to Jan Honza Odvarko from comment #4)
> 1) First you need to handle "http-on-opening-request" (nsIObserver). Note
> that it was "http-on-opening-request" in the past (Fx 16), but that event is
> not synchronous anymore (see
Just a little correction, it was "http-on-modify-request" in the past...

Comment 7 Victor Porof [:vporof][:vp] 2013-01-21 07:57:18 PST
Filed bug 832983.
Comment 8 Victor Porof [:vporof][:vp] 2014-01-08 12:01:14 PST
It doesn't look like I'll be working on this in the near future. Unassigning, for now.
Comment 9 Sebastian Zartner [:sebo] 2016-04-25 01:37:36 PDT
I've just created bug 1267144 and didn't see that there is already a bug for this.
Now I'm wondering whether this bug is meant for implementing the 'Break On XHR' button, i.e. break on any XHR, or for implementing the single XHR breakpoints, i.e. break on a specific XHR, or both.

Victor, can you please clarify that, so I know what to do with bug 1267144?


Note You need to log in before you can comment on or make changes to this bug.