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

eric.jung at yahoo.com eric.jung at yahoo.com
Thu Mar 1 04:50:07 PST 2007

I got a little further with this. notificationCallbacks is sometimes null. When it's null, you need to use the loadGroup. However, the loadGroup can also be empty (rare but seems to happen). When this occurs, I cannot get any document at all. Also, sometimes the loadGroup has more than one element in it. In those case, I don't know which one to choose -- perhaps it doesn't matter.

Don't forget that some requests won't be associated with a tab at all; e.g. rss feeds that have been bookmarked.

I'll post some code tonight, but it's not much. I hope someone can give Neil's suggestion a try in the meantime to get the actual tab.

----- Original Message ----
From: Neil <neil at parkwaycc.co.uk>
To: project_owners at mozdev.org
Sent: Thursday, March 1, 2007 4:47:49 AM
Subject: Re: [Project_owners] Getting Source Tab When Listening to http-on-modify-request

Kyle Wilgus wrote:

> var oHttp = 
> aSubject.QueryInterface(Components.interfaces.nsIHttpChannel);
> var interfaceRequestor = 
> oHttp.notificationCallbacks.QueryInterface(Components.interfaces.nsIInterfaceRequestor); 
> var DOMWindow = 
> interfaceRequestor.getInterface(Components.interfaces.nsIDOMWindow);
> var loadedDoc = DOMWindow.document;
> Does anyone know where I can go from here? Is it possible to get the 
> tab object from the window or document?

If you can get hold of the nsIDocShell object (hopefully by getInterface 
on the callbacks but if not then getInterface on the window) then I 
think you can QI it to an nsIDocShellTreeItem, get its rootTreeItem, 
then getInterface on that to an nsIDOMWindow, then call 
Project_owners mailing list
Project_owners at mozdev.org

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mozdev.org/pipermail/project_owners/attachments/20070301/39c95ff5/attachment.html 

More information about the Project_owners mailing list