I'm trying to develop a firefox extension to record all resource loading urls for each browser tab/window. I searched for hours but couldn't find a way to associate each intercepted http request to its originating tab. Here is what I have so far.
Components.classes["@mozilla.org/observer-service;1"]
.getService(Components.interfaces.nsIObserverService)
.addObserver({
observe: function(aSubject, aTopic, aData) {
if ("http-on-modify-request" == aTopic) {
var url = aSubject
.QueryInterface(Components.interfaces.nsIHttpChannel)
.originalURI.spec;
alert(url);
}
}
}, "http-on-modify-request", false);
I can get the url of the http request, but I don't know there is way to link it to a browser window/tab.
I read through MDN's documentation but it didn't mention it. (https://developer.mozilla.org/en/XUL_School/Intercepting_Page_Loads)
Any suggestions?