I've been trying at this for a long time now, and no good results.
var myObserver = {
observe: function(subject, topic, data)
{
if (topic == "http-on-examine-response")
{
// implement later
}
else if(topic == "http-on-modify-request")
{
// implement later
}
},
QueryInterface : function (id)
{
if (id.equals(Components.interfaces["nsIObserver"]) ||
id.equals(Components.interfaces["nsISupports"]))
{
return this;
}
throw Components.results.NS_NOINTERFACE;
}
};
var obs = new Service("observer-service", "ObserverService");
obs.addObserver(myObserver, "http-on-modify-request", false);
Basically, on http-on-modify-request
, I know how to examine the URI, figure out which window (if any) it's associated with, and a bunch of other stuff. What I can't figure out is how to redirect a request, which I know is possible from here, because I can get an nsIHttpChannel before any request is ever sent out.
Anyone know what to do? :/ I've been trying for a couple of weeks on and off, and got nowhere.