Cancel an HTTP GET request from Firefox Extension -
i have firefox extension listens "http-on-modify-request" , inspects requests coming firefox. i'd able cancel request (say return fail code page) or modify uri of request can't seem it. nsihttpchannel object doesn't allow - instance
delete httpchannel;
or reseting empty request
httpchannel = components.classes["@mozilla.org/xmlextras/xmlhttprequest;1"].createinstance(components.interfaces.nsixmlhttprequest);
don't work (and can't modify uri).
so how both intercept , modify http requests in firefox extension.
delete httpchannel;
deletes variable, sort of saying httpchannel = undefined;
. request unchanged. similarly, second idea sets variable point @ new nsihttpchannel instance, old request still unchanged.
to modify request, use properties , methods. see nsihttpchannel or nsichannel or nsirequest. say, can't modify uri might want cancel (see below) , replace new one. i'm not sure how imagine 1 of 3 pages has answer.
to cancel it, use nsirequest.cancel()
Comments
Post a Comment