5

I am attempting to implement a firefox extension which filters incoming HTTP responses and handles them accordingly.

I wish to block HTTP responses containing a specific header. Having read through some of the MDC articles, it appears the most common way of observing HTTP responses is by registering an http-on-examine-response observer.

My question is: Using this observer, is it possible to block the HTTP request from further processing (as a by-product, the page will continue to wait for a response)? Or do I need to use some other facet of XPCOM (if so, care to point me in the right direction)?

Thanks in advance,
Mike

Esko
  • 29,022
  • 11
  • 55
  • 82
Mike Hamer
  • 1,155
  • 11
  • 22

1 Answers1

3

Should be possible: the "subject" of that notification is a HTTP channel, on which you can call nsIRequest::cancel().

the page will not continue to wait for a response, though, since you blocked the response. Perhaps you've been actually looking for a way to alter an HTTP response?

Community
  • 1
  • 1
Nickolay
  • 31,095
  • 13
  • 107
  • 185