开发者

FF extension: need some help observing POSTs

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜