如何在使用“http-on-modify-request”和“http-on-examine-response”时将响应映射到请求?

时间:2010-10-06 13:11:46

标签: firefox firefox-addon xul

如何在使用HTTP观察者时将传入响应映射到传出请求:https://developer.mozilla.org/en/Setting_HTTP_request_headers#Observers

1 个答案:

答案 0 :(得分:1)

比较nsIHttpChannel对象,例如HttpFox

getPendingRequestForRequestEvent: function(request) {
   // check for matching request
   for (var i = 0; i < this.Requests.length; i++) {
      if (request.HttpChannel === this.Requests[i].HttpChannel) {
         return i;
      }
   }

   // no match found
   return -1;
},