Up until now FireBug was my primary JavaScript debug solution and now I am in search for a new one. This post will not be about alternatives to FireBug (that one will fallow soon) but about the reason for the change.
Last 7 days at work we have had strange bug in our new software and were unable to fix it. After week of trying we were completely clueless.
The Bug
Every page executes it self twice. This resulted in double inserts to database and complete mess. We were able to patch it but it wasn’t pritty and this behaviour had to be stopped.
Solution
Shortly after we lost all hope… removing one code snipped at the time for few hours nothing helped. I started using IE (yes internet explorer), and amazing no double inserts! no double execution. For the first time IE was actually helping me with something. Now I knew that problem was with something around FF. First thing I did was disable FireBug and voila the problem was gone.
I am guessing that FireBug does second exec so he can get some info etc. but that is just not the way it should be done. I don’t know if I can ever forgive FireBug for all the pain it has cosed me in last week or so.
Search for new debugging solution begins…
March 22nd, 2007 at 9:07 pm
You should probably just write better code. Firebug does not do anything weird with thousands of people, so don’t just blame firebug without having found the real problem.
March 23rd, 2007 at 8:37 am
I am sorry but it looks like you didn’t read post very well. After disabling Firebug problem was gone and people with no firebug installed did not have the problem.
March 25th, 2007 at 8:42 pm
On one hand, thousands of people do not have a single problem with this extension. On the other hand, your code only works when disabling Firebug.
From that, it’s impossible to determine whether the problem is due to the extension or to a bad code.
March 29th, 2007 at 8:46 pm
You should have asked the guys next door for help ;) I disabled FireBug weeks ago, it definitely has some bugs when used with FF2.0
March 30th, 2007 at 10:05 am
[...] As I wrote few days back Firebug is indeed the guilty for double page execution. Today I tested it a bit more and found out what is cosing problems. Net option (tracks load times for items on page) executes page for it’s tracking, so we get one exec from browser and second one from firebug. [...]
May 30th, 2008 at 12:59 am
I stumbled upon this frustrating bug as well, and am happy to report I found the cause (at least in my case).
If I have firebug set to report JavaScript errors, the double submit (including clicking links and even POST actions!) will occur if a JavaScript error occurs on the page where the submit action takes place. No JS errors, no double submit.
On firebug’s “Console” tab, click the “Options” menu on the right side. When the option “Show JavaScript Errors” is disabled, I don’t get double submit when a JS error occurs. :)
July 21st, 2008 at 12:21 pm
Yeah this costed me my feeling of control for the last week.
(@opl and @schizoduckie, I am SO glad you are not my colleagues.)
August 14th, 2008 at 10:30 am
I had the same problem (double execution of ajax actions) and I’ve lost about two days on searching for errors which were not there.
Solution was simple, as Nate wrote above – turning on the option called “Show JavaScript Errors” made my script working again ;)
I thought that Firebug is the best and ‘final’ solution for my debugging problems, but I can see now, that I was very, very wrong… Damn it… Anyone has an idea what other tools should I use for debugging Ajax?
September 4th, 2008 at 2:15 pm
Michal, I hope you’ve found a solution by now, but if not, I can definitely recommend Charles (www.charlesproxy.com).
It runs a proxy through which all your Firefox/IE requests are automatically passed (when Charles is running), and captures every detail of the communication between the browser and the server.
It’s a lot more powerful than Firebug for debugging AJAX stuff – in fairness to Firebug, however, the double POST thing is a Firefox issue (see https://bugzilla.mozilla.org/show_bug.cgi?id=430155) – Firebug’s only mistake was that it didn’t used to warn the user it was about to POST again. I’m actually quite surprised I never saw any weird behaviour on sites I’ve worked on due to this bug – must have only occurred in certain situations. Anyway, Firebug is still the best tool for Firefox bar none for JS and CSS/HTML debugging, and Charles is pretty much the ultimate for XHR stuff :)
September 15th, 2008 at 4:45 pm
Yes, as Tom points out, firefox apparently does not currently offer a way for add-ons to hook into response bodies (except through workaround hacks that are discouraged). Firefox will be patching this with a new interface through which add-ons will be able to deal with this.
Until firefox comes out with the fix, firebug has taken a decent step by disabling the double-posting of pages until the user confirms the action (present in at least firebug 1.2). So double-posting will only happen if you request it. Unfortunately, this still prevents the proper debugging of such pages (since it’s the response body of the second post you’re seeing, not the original).
In any case, this shouldn’t be an issue for much longer. :)