Search code examples
javascripthttpfirefox-addonxpcomfirefox-3

fetch the redirect object body in firefox extension


I am trying to fetch the http object content/body via registering a stream listener to channel when receiving "http-on-modify-request" notification.

var newListener = new TracingListener(this); subject.QueryInterface(Ci.nsITraceableChannel); newListener.originalListener = subject.setNewListener(newListener);

Thing goes well for normal object but redirect object.
I check a problem of firebug https://bugzilla.mozilla.org/show_bug.cgi?id=529536, which show that the listener will be moved to the redirected object. Consequently, OnDataAvailable will not be call for the original redirect object.

So is there a way to get the redirect object content/body through some other way? Any suggestion will be appreciated.


Solution

  • The code for the new Web Console in Firefox 4 is what you want to copy here. Specifically, take a look at this method.