www

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

commit e62433edfb902a8382c02548b02eeb7fbb8f30b8
parent 404e045a9219653019ef14e8811e0652842874a6
Author: Dan Stillman <dstillman@zotero.org>
Date:   Sat, 30 Sep 2017 04:01:28 -0400

Fix citeproc-js in Firefox 56

Our retrieveLocale() implementation was broken by
https://bugzilla.mozilla.org/show_bug.cgi?id=1319111

Diffstat:
Mchrome/content/zotero/xpcom/cite.js | 18+++++-------------
1 file changed, 5 insertions(+), 13 deletions(-)

diff --git a/chrome/content/zotero/xpcom/cite.js b/chrome/content/zotero/xpcom/cite.js @@ -556,21 +556,13 @@ Zotero.Cite.System.prototype = { * @return {String|Boolean} The locale as a string if it exists, or false if it doesn't */ "retrieveLocale":function retrieveLocale(lang) { - var protHandler = Components.classes["@mozilla.org/network/protocol;1?name=chrome"] - .createInstance(Components.interfaces.nsIProtocolHandler); try { - var channel = protHandler.newChannel(protHandler.newURI("chrome://zotero/content/locale/csl/locales-"+lang+".xml", "UTF-8", null)); - var rawStream = channel.open(); - } catch(e) { + return Zotero.File.getContentsFromURL( + `chrome://zotero/content/locale/csl/locales-${lang}.xml` + ); + } + catch (e) { return false; } - var converterStream = Components.classes["@mozilla.org/intl/converter-input-stream;1"] - .createInstance(Components.interfaces.nsIConverterInputStream); - converterStream.init(rawStream, "UTF-8", 65535, - Components.interfaces.nsIConverterInputStream.DEFAULT_REPLACEMENT_CHARACTER); - var str = {}; - converterStream.readString(channel.contentLength, str); - converterStream.close(); - return str.value; } };