Fix blank window/tab when file.launch() fails
Use nsIExternalProtocolService.loadUrl() as a fallback rather than window.loadURI() If "Remember my choice for file links" is selected, there's currently no way to change that in Standalone short of deleting mimeTypes.rdf.
This commit is contained in:
parent
87c4dfb893
commit
f87bee9f7c
1 changed files with 10 additions and 4 deletions
|
@ -3386,15 +3386,21 @@ var ZoteroPane = new function()
|
|||
this.loadURI(url, event, { attachmentID: itemID});
|
||||
}
|
||||
else {
|
||||
// Some platforms don't have nsILocalFile.launch, so we just load it and
|
||||
// Some platforms don't have nsILocalFile.launch, so we just
|
||||
// let the Firefox external helper app window handle it
|
||||
try {
|
||||
file.launch();
|
||||
}
|
||||
catch (e) {
|
||||
Zotero.debug("launch() not supported -- passing file to loadURI()");
|
||||
var fileURL = attachment.getLocalFileURL();
|
||||
this.loadURI(fileURL);
|
||||
Zotero.debug("launch() not supported -- passing file to loadUrl()");
|
||||
|
||||
var uri = Components.classes["@mozilla.org/network/standard-url;1"].
|
||||
createInstance(Components.interfaces.nsIURI);
|
||||
uri.spec = attachment.getLocalFileURL();
|
||||
|
||||
var nsIEPS = Components.classes["@mozilla.org/uriloader/external-protocol-service;1"].
|
||||
getService(Components.interfaces.nsIExternalProtocolService);
|
||||
nsIEPS.loadUrl(uri);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue