Fix attachment save failure on macOS with window closed
Use hiddenDOMWindow if no other window
This commit is contained in:
parent
fe5af63277
commit
5a08d22dbf
|
@ -2730,14 +2730,17 @@ Zotero.DragDrop = {
|
||||||
Zotero.Browser = new function() {
|
Zotero.Browser = new function() {
|
||||||
var nBrowsers = 0;
|
var nBrowsers = 0;
|
||||||
|
|
||||||
this.createHiddenBrowser = createHiddenBrowser;
|
this.createHiddenBrowser = function (win) {
|
||||||
this.deleteHiddenBrowser = deleteHiddenBrowser;
|
if (!win) {
|
||||||
|
win = Services.wm.getMostRecentWindow("navigator:browser");
|
||||||
function createHiddenBrowser(win) {
|
if (!win) {
|
||||||
if (!win) {
|
win = Services.ww.activeWindow;
|
||||||
var win = Services.wm.getMostRecentWindow("navigator:browser");
|
}
|
||||||
if(!win) {
|
// Use the hidden DOM window on macOS with the main window closed
|
||||||
var win = Services.ww.activeWindow;
|
if (!win) {
|
||||||
|
let appShellService = Components.classes["@mozilla.org/appshell/appShellService;1"]
|
||||||
|
.getService(Components.interfaces.nsIAppShellService);
|
||||||
|
win = appShellService.hiddenDOMWindow;
|
||||||
}
|
}
|
||||||
if (!win) {
|
if (!win) {
|
||||||
throw new Error("Parent window not available for hidden browser");
|
throw new Error("Parent window not available for hidden browser");
|
||||||
|
@ -2760,7 +2763,7 @@ Zotero.Browser = new function() {
|
||||||
return hiddenBrowser;
|
return hiddenBrowser;
|
||||||
}
|
}
|
||||||
|
|
||||||
function deleteHiddenBrowser(myBrowsers) {
|
this.deleteHiddenBrowser = function (myBrowsers) {
|
||||||
if(!(myBrowsers instanceof Array)) myBrowsers = [myBrowsers];
|
if(!(myBrowsers instanceof Array)) myBrowsers = [myBrowsers];
|
||||||
for(var i=0; i<myBrowsers.length; i++) {
|
for(var i=0; i<myBrowsers.length; i++) {
|
||||||
var myBrowser = myBrowsers[i];
|
var myBrowser = myBrowsers[i];
|
||||||
|
|
Loading…
Reference in New Issue
Block a user