I have recently written a post about Break on Next feature (), introduced in Firebug 1.5 that allows breaking on various events occurring on a page. One of the examples I mentioned was XMLHttpRequest execution.
In this post I would like to describe another way how Firebug can be used to debug XHR. This time I want to focus on how to create XHR conditional breakpoints.
Create XHR Breakpoint
In order to create a XHR breakpoint, the Net panel offers the same breakpoint bar that is already well known from the Script panel.
So, creating a new breakpoint for XHR request is as easy as clicking on the appropriate row with the request the user wants to debug.
You can see two things on this screenshot. First, there is no breakpoint in the source code so, you don't have to know the source code line in advance to start debugging and second, the breakpoint is listed in the Breakpoints side panel in a new section called XHR Breakpoints.
Set Breakpoint Condition
Couple of examples:
Halt JS execution only if URL parameter count is present and equal to 1.
Expression: count == 1
Halt JS execution only if posted data contains string key.
Expression: $postBody.indexOf("key") >= 0
See online demo here.
Update: Break On Next XHR and XHR Breakpoints features are integrated in Firebug 1.5b4 (coming soon) and so, Break On Next XHR now ignores requests with a breakpoint that has a condition evaluated to false.