use getXULWindowEnumerator to work around a bug I encountered on Linux (even though this code was based on an example on MDC, apparently it doesn't work quite right)
This commit is contained in:
parent
51b5c8322e
commit
8deb7043fc
1 changed files with 6 additions and 3 deletions
|
@ -32,12 +32,15 @@ var ZoteroTab = new function()
|
||||||
// find window this tab is loaded in
|
// find window this tab is loaded in
|
||||||
var windowMediator = Components.classes["@mozilla.org/appshell/window-mediator;1"]
|
var windowMediator = Components.classes["@mozilla.org/appshell/window-mediator;1"]
|
||||||
.getService(Components.interfaces.nsIWindowMediator);
|
.getService(Components.interfaces.nsIWindowMediator);
|
||||||
var enumerator = windowMediator.getZOrderDOMWindowEnumerator("navigator:browser", true);
|
var enumerator = windowMediator.getXULWindowEnumerator("navigator:browser");
|
||||||
while(enumerator.hasMoreElements()) {
|
while(enumerator.hasMoreElements()) {
|
||||||
var window = enumerator.getNext();
|
var xulwin = enumerator.getNext().QueryInterface(Components.interfaces.nsIXULWindow);
|
||||||
|
var window = xulwin.docShell.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
||||||
|
.getInterface(Components.interfaces.nsIDOMWindow);
|
||||||
var browserIndex = window.gBrowser.getBrowserIndexForDocument(document);
|
var browserIndex = window.gBrowser.getBrowserIndexForDocument(document);
|
||||||
if(browserIndex !== -1) break;
|
if(browserIndex !== -1) break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(browserIndex === -1) return;
|
if(browserIndex === -1) return;
|
||||||
|
|
||||||
this.containerWindow = window;
|
this.containerWindow = window;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue