Fx60: Fix CSL locale loading

This commit is contained in:
Dan Stillman 2018-09-26 00:19:33 -04:00
parent ac456ab9bf
commit 77d1c6cf74

View file

@ -673,23 +673,8 @@ Zotero.Cite.Locale = {
if (str) {
return str;
}
var uri = `chrome://zotero/content/locale/csl/locales-${locale}.xml`;
try {
let protHandler = Components.classes["@mozilla.org/network/protocol;1?name=chrome"]
.createInstance(Components.interfaces.nsIProtocolHandler);
let channel = protHandler.newChannel(protHandler.newURI(uri));
let cstream = Components.classes["@mozilla.org/intl/converter-input-stream;1"]
.createInstance(Components.interfaces.nsIConverterInputStream);
cstream.init(channel.open(), "UTF-8", 0, 0);
let obj = {};
let read = 0;
let str = "";
do {
// Read as much as we can and put it in obj.value
read = cstream.readString(0xffffffff, obj);
str += obj.value;
} while (read != 0);
cstream.close();
str = Zotero.File.getResource(`chrome://zotero/content/locale/csl/locales-${locale}.xml`);
this._cache.set(locale, str);
return str;
}