From ee0b4f5d0d84eddaf658b87fdbf819f6e93a5ea0 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Sun, 30 Jul 2017 07:36:56 -0400 Subject: [PATCH] Use nsIWindowWatcher in Zotero.openInViewer() Instead of getting the last browser window --- chrome/content/zotero/xpcom/zotero.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/chrome/content/zotero/xpcom/zotero.js b/chrome/content/zotero/xpcom/zotero.js index 5a7e3a760e..02c321647b 100644 --- a/chrome/content/zotero/xpcom/zotero.js +++ b/chrome/content/zotero/xpcom/zotero.js @@ -1054,9 +1054,13 @@ Services.scriptloader.loadSubScript("resource://zotero/polyfill.js"); if (win) { win.loadURI(uri); } else { - let window = wm.getMostRecentWindow("navigator:browser"); - win = window.openDialog("chrome://zotero/content/standalone/basicViewer.xul", - "basicViewer", "chrome,resizable,centerscreen,menubar,scrollbars", uri); + let ww = Components.classes['@mozilla.org/embedcomp/window-watcher;1'] + .getService(Components.interfaces.nsIWindowWatcher); + let arg = Components.classes["@mozilla.org/supports-string;1"] + .createInstance(Components.interfaces.nsISupportsString); + arg.data = uri; + win = ww.openWindow(null, "chrome://zotero/content/standalone/basicViewer.xul", + "basicViewer", "chrome,dialog=yes,resizable,centerscreen,menubar,scrollbars", arg); } if (onLoad) { let browser