I'm using the nsIObserverService to monitor the responses, but it fires events for all tabs (browser in Mozilla terminology). I'd like to know which browser is getting the response in my observe method.
+1
A:
This sample code snippet from DevMo should do the trick. It allows you to find a browser (tab) given an nsICHannel
from an HTTP request/response.
It specifically references the http-on-modify-request
event, but aSubject
should still be an nsIChannel
for http-on-examine-response event
events.
Mike
2010-01-02 23:08:19
I found that it works fine for events fired by the browser, but sometimes fail when the event was fired from a plugin (like Flash). In these cases, nsIChannel will have no notificationCallbacks, making impossible to find the tab that fired the event.
Fábio
2010-03-05 16:49:10