commit f87bee9f7c4a8164753bca6aecfa8b5a2a4ff02a
parent 87c4dfb893b65e5f1d034e50ee25dbd0d403cc98
Author: Dan Stillman <dstillman@zotero.org>
Date: Wed, 14 Dec 2011 17:46:21 -0500
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.
Diffstat:
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/chrome/content/zotero/zoteroPane.js b/chrome/content/zotero/zoteroPane.js
@@ -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);
}
}
}