I think the only place you can get it is nsIEmbeddingSiteWindow.siteWindow (its type is GtkWidget*on Linux, it should be possible to get the window id from this). Getting an instance nsIEmbeddingSiteWindowfor a top-level window is relatively simple:
Components.utils.import("resource://gre/modules/Services.jsm");
var embedding = Services.ww.getChromeForWindow(window)
.QueryInterface(Components.interfaces.nsIEmbeddingSiteWindow);
The problem is that the property is siteWindowmarked with an annotator [noscript]- it is not accessible from JavaScript. So I had to use the XPCOM binary component (written in C ++) in order to actually get this property. I don't know if this is right for you. The only alternative is to search the window tree.
source
share