[Project_owners] Getting Source Tab When Listening to http-on-modify-request

Kyle Wilgus wigginz at gmail.com
Fri Mar 2 08:38:18 PST 2007


Here's what I have so far on the AJAX requests, I'm a bit worried that
there may not be an easy solution, and I'll have to get creative.
Hopefully this explanation makes sense.

Basically in the case when the request it is a XMLHttpRequest (AJAX),
the interface requester (see my previous code in the thread) is an
instance of the XMLHttpRequest interface, and only supports the
following interfaces:

nsIXMLHttpRequest, nsIInterfaceRequestor, nsIClassInfo,
nsIJSXMLHttpRequest, nsIDOMEventTarget, nsISupports

>From here, if I cannot get an nsIDOMWindow instance from the interface
requester, I assume it's an XMLHttpRequest. I don't see any possible
way to get query an interface from this object that will give me
access to the source document or window. This is where I'm stuck now.

I thought of pulling out the host name from the URI returned by the
XMLHttpRequest.name attribute and then cycling through all of the tabs
locations until I get a match. Only drawback with this solution is
that more than one tab may have have the same host so the first tab in
the array would always be picked. At the moment, it's at least better
to do this than not support AJAX at all.

I'm struggling with finding another approach at the moment. I haven't
flushed out any code yet. I'm thinking about trying to find some event
that I can receive specifically for XMLHttpRequests that will give
access the DOM and then attach some meta data (tab Id) to the request
(header value for example) that I can pick up when I observe the
http-on-modify-request topic.

I'll keep you updated on my progress.

Kyle



On 3/2/07, Arturo 'Buanzo' Busleiman <buanzo at buanzo.com.ar> wrote:
> Regarding AJAX, I'm currently testing that, too. Could you post any of
> your findings, Kyle?
> _______________________________________________
> Project_owners mailing list
> Project_owners at mozdev.org
> http://mozdev.org/mailman/listinfo/project_owners
>


More information about the Project_owners mailing list