Firefox Addon Observer Http-on-modify-request Not Working Properly
I have a weird bug in my addon, the addon itself needs to add a request header parameters for a specific domain, it's all working, but the bug is, that the observer http-on-modify-
Solution 1:
currentUri
on browser is the Uri that is currently loaded in the tab. At "http-on-modify-request" notification time, the request is not sent to the server yet, so if it's a new tab, the browser doesn't have any currentUri
. When you refresh the tab in place, it uses the uri of the current page, and it seemingly works.
Try this instead:
if (topic == "http-on-modify-request") {
var httpChannel = subject.QueryInterface(Ci.nsIHttpChannel);
var uri = httpChannel.URI;
var domainloc = uri.host;
//only identify to specific preference domainif (domainloc == "mysite.com") {
httpChannel.setRequestHeader("x-test", "test", false);
}
}
Post a Comment for "Firefox Addon Observer Http-on-modify-request Not Working Properly"