Firebug 1.5

Having problems with the latest version of Firebug, it doesn't like the SACK ajax library that I use a great deal (it's the same AJAX library included in WordPress).

The issue only just started, basically Firebug doesn't like the way the SACK script prepares for an AJAX call.

I found something about this in another blog post that appears to explain the issue. Firebug And The Mysterious “Components Is Not Defined”.

A commenter named Svan seems to have found the issue and a simple workaround that I'm going to try.

It seems that every plugin that wants to use the “sack” function of wordpress (for fetching ajax data), will trigger a firebug bug, due to the attempt to create ActiveXObject.

But as Firebug only is made for Firefox, I tried to switch the logic of the createAJAX inner function.
So normally, the javascript function would try to make the xmlhttp object with ActiveXObject (MS Stuff), and when that doesn’t succeed it does it the Mozilla way with XMLHttpRequest.

I changed the order:

if (typeof XMLHttpRequest != “undefined”)
this.xmlhttp = new XMLHttpRequest();

if (! this.xmlhttp) {
try {
this.xmlhttp = new ActiveXObject(“Msxml2.XMLHTTP”);
} catch (e1) {
try {
this.xmlhttp = new ActiveXObject(“Microsoft.XMLHTTP”);
} catch (e2) {
this.xmlhttp = null;
this.failed = true;
}
}
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s