Mastering Firebug NetListener

In more recent versions of Firebug, the developers pulled out the integrated Firebug trace function.  If you want the functionality, you should install the FBTrace Extension; it’s almost required if you want to develop a Firebug Extension. The FBTrace Extension is at https://getfirebug.com/wiki/index.php/FBTrace 

I built an extension following the following tutorials and code:

http://www.softwareishard.com/blog/firebug-tutorial/extending-firebug-hello-world-part-i/
http://www.softwareishard.com/blog/firebug-tutorial/extending-firebug-net-panel-listener-part-viii/
https://code.google.com/p/fbug/source/browse/examples/firebug1.4/netlistener/chrome/content/netlistener/netListener.js
https://github.com/firebug/firebug/blob/4ced8f9cbf05ddd901aeb99895c9270abbf5d29a/extension/content/firebug/net/netUtils.js

The extension logged out the details of API requests to specific applications and filtered on those requests so I could debug an issue when loading multiple of them on the same page.

A couple tips for developers using the NetListeners are:

The url and parameters are in file.href
The method is file.method
The headers are an array which can be retrieved from file.requestHeaders property.  Each object is a name – value pair. header.name / header.value.
The requestBody is really file.postText
The responseBody is best returned using netUtils.js context.sourceCache.loadText(file.href, file.method, file)

Leave a Reply

Your email address will not be published. Required fields are marked *