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 <[EMAIL PROTECTED]>
To: project_owners@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 
getBrowser().getBrowserIndexForDocument(DOMWindow.top.document).
_______________________________________________
Project_owners mailing list
Project_owners@mozdev.org
http://mozdev.org/mailman/listinfo/project_owners




_______________________________________________
Project_owners mailing list
Project_owners@mozdev.org
http://mozdev.org/mailman/listinfo/project_owners

Reply via email to