Stepping over a call to an XmlHttpRequest object continues execution

11 views
Skip to first unread message

Nicolas Hatier

unread,
Oct 14, 2010, 3:53:31 PM10/14/10
to @Group: Firebug

I see this behavior since a while - if I step through some code, and one
of the function call includes, somewhere down the way, access to an
XmlHttpRequest object to retrieve data (synchronously), the debugger
does not step to the next line. Instead, it continues execution as if I
pressed F8.

I've been unable to create a consistent, working example for this, and
even in my complex code this can't be reproduced each and every time,
but often enough to be annoying.

Simplified example:

01 function FetchSomeData(in_url)
02 {
03 var l_Object = new XMLHttpRequest();
04 l_Object.open("get", in_url, false);
05 l_Object.send(null);
06 return in_Object.responseText;
07 }
08
09 function CodeIAmDebugging()
10 {
11 somecall();
12 someothercall();
13 var dummy = 1;
14 var data = FetchSomeData("someresource.php?param=" + dummy);
15 if (verifydata(data))
16 {
17 JsonEval(data);
18 }
19 }

This example is only to explain the issue further. As is, it is unlikely
to show the behavior.

- I put a breakpoint on line 11 and the debugger breaks there when it
reaches the line.
- I step (F10) until I reach line 14
- If I step (F10) another time, execution continues, instead of stepping
to line 15

So, to debug this kind of code properly, I have to put an additional
breakpoint at line 15.

Without knowing all the internals of the jsd and Firebug, it looks
probably more like a jsd issue. Maybe (and I said maybe) for some
reason, when calling XMLHttpRequest.open or XMLHttpRequest.send, the jsd
disables the step-by-step mode to allow some code internal to
XMLHttpRequest to run without being interrupted, or something like that,
and when the call returns, in some cases, the jsd fails to go back in
step mode?

Anybody is seeing this? Maybe it's a known Firebug or Mozilla bug?

Nicolas

Reply all
Reply to author
Forward
0 new messages