On May 9, 9:30*pm, Nils Maier wrote:
> On 09.05.2009 12:12, Luca Bruno wrote:
>
> > Hello,
> > I'm working on a firefox extension. The extension needs to intercept all
> > the http requests, thus an http-on-modify-request observer has been registered.
> > The observer is being called with an HTTPChannel, but I need to get the
> > frame/tab from which the request was generated, or at least the URI (which is
> > not the referrer).
> > For e.g. if I'm onwww.test.comand the browser loadswww.test.com/test.js
> > (which is the URI of the HTTPChannel) I need to know the request was started
> > fromwww.test.comsomehow.
> > I've looked at other observers and the whole Channel reference but I can't
> > realize how to handle this task yet.
> > Any hints? Thanks.

>
> I just implemented a similar thing... for sniffing flash video URLs.
> See the code here:http://bugs.code.downthemall.net/tra...ponents/conten...
> It should work with modify-request to, not only examine-response.
>
> This will, however, only work when there is actually a DOM window
> associated with the request. Some request might not have one. Such as
> google safebrowsing loads, extension checking, downloads etc.
>
> Hope this helps,
> Cheers
> Nils


Thanks very much for the hint. It works perfectly. I'm including that
code in my extension and mentioning the author.