开发者

FF extension: need some help observing POSTs

开发者 https://www.devze.com 2023-01-23 11:32 出处:网络
I\'m trying to write an extension that observes HTTP requests, and specifically POSTs.I\'m having trouble accessing all开发者_C百科 of them - some things are slipping through, and I don\'t know why.I

I'm trying to write an extension that observes HTTP requests, and specifically POSTs. I'm having trouble accessing all开发者_C百科 of them - some things are slipping through, and I don't know why. I assume it's due to other tabs, iframes or XHR requests. What I'd like to do is create a single listener/handler, and funnel all the requests through it. Can someone assist? For example:

myObj = function(){}
myObj.prototype = {
  observe: function(aSubject, aTopic, aData) {
    if (aTopic == "http-on-modify-request") {
      aSubject.QueryInterface(Components.interfaces.nsIHttpChannel);
      // aSubject is now looking at the request, call method
    }
  }
}

var observerService = Components.classes["@mozilla.org/observer-service;1"]
      .getService(Components.interfaces.nsIObserverService);

observerService.addObserver(myObj, "http-on-modify-request",   false);
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号