www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 0ce45103bb5a2e5d49eae1918717c26880e66ea7
parent ba1285fdef5f8f790425896e26f1281b6f46f97d
Author: Dan Stillman <dstillman@zotero.org>
Date:   Thu, 20 Oct 2016 15:41:08 -0400

Fix style installation from file

Diffstat:
Mchrome/content/zotero/xpcom/style.js | 22+++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/chrome/content/zotero/xpcom/style.js b/chrome/content/zotero/xpcom/style.js @@ -246,17 +246,17 @@ Zotero.Styles = new function() { this.install = Zotero.Promise.coroutine(function* (style, origin) { var styleInstalled; - if(style instanceof Components.interfaces.nsIFile) { - // handle nsIFiles - var url = Services.io.newFileURI(style); - styleInstalled = Zotero.HTTP.promise("GET", url.spec).when(function(xmlhttp) { - return _install(xmlhttp.responseText, style.leafName); - }); - } else { - styleInstalled = _install(style, origin); + try { + if (style instanceof Components.interfaces.nsIFile) { + // handle nsIFiles + var url = Services.io.newFileURI(style); + var xmlhttp = yield Zotero.HTTP.request("GET", url.spec); + styleInstalled = yield _install(xmlhttp.responseText, style.leafName); + } else { + styleInstalled = yield _install(style, origin); + } } - - styleInstalled.catch(function(error) { + catch (e) { // Unless user cancelled, show an alert with the error if(typeof error === "object" && error instanceof Zotero.Exception.UserCancelled) return; if(typeof error === "object" && error instanceof Zotero.Exception.Alert) { @@ -267,7 +267,7 @@ Zotero.Styles = new function() { (new Zotero.Exception.Alert("styles.install.unexpectedError", origin, "styles.install.title", error)).present(); } - }).done(); + } }); /**