FF 扩展:需要一些帮助来观察 POST

发布于 2024-10-01 00:17:53 字数 669 浏览 9 评论 0原文

我正在尝试编写一个扩展来观察 HTTP 请求,特别是 POST。我在访问所有这些内容时遇到了问题 - 有些内容会被忽略,但我不知道为什么。我认为这是由于其他选项卡、iframe 或 XHR 请求造成的。我想做的是创建一个侦听器/处理程序,并通过它传输所有请求。有人可以帮忙吗?例如:

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);

I'm trying to write an extension that observes HTTP requests, and specifically POSTs. I'm having trouble accessing all 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);

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文