diff --git a/chrome/content/zotero/xpcom/schema.js b/chrome/content/zotero/xpcom/schema.js index b43372a03..b4e580efb 100644 --- a/chrome/content/zotero/xpcom/schema.js +++ b/chrome/content/zotero/xpcom/schema.js @@ -1433,9 +1433,19 @@ Zotero.Schema = new function(){ xmlnode.getElementsByTagName('priority')[0].firstChild.nodeValue ), inRepository: true, - lastUpdated: xmlnode.getAttribute('lastUpdated') }; + for each(var attr in ["configOptions", "displayOptions"]) { + try { + metadata[attr] = JSON.parse(xmlnode.getAttribute(attr)); + } catch(e) { + Zotero.logError("Invalid JSON for "+attr+" in new version of "+metadata.label+" ("+translatorID+") from repository"); + return; + } + } + + metadata.lastUpdated = xmlnode.getAttribute('lastUpdated'); + // detectCode can not exist or be empty var detectCode = (xmlnode.getElementsByTagName('detectCode').item(0) && xmlnode.getElementsByTagName('detectCode')[0].firstChild) diff --git a/chrome/content/zotero/xpcom/translation/translator.js b/chrome/content/zotero/xpcom/translation/translator.js index 17b6fb853..b3f45b14e 100644 --- a/chrome/content/zotero/xpcom/translation/translator.js +++ b/chrome/content/zotero/xpcom/translation/translator.js @@ -181,6 +181,8 @@ Zotero.Translators = new function() { * @param {String|Null} metadata.target Target regexp * @param {String|Null} metadata.minVersion * @param {String} metadata.maxVersion + * @param {String|undefined} metadata.configOptions + * @param {String|undefined} metadata.displayOptions * @param {Integer} metadata.priority * @param {Boolean} metadata.inRepository * @param {String} metadata.lastUpdated SQL date @@ -225,15 +227,8 @@ Zotero.Translators = new function() { var destFile = Zotero.getTranslatorsDirectory(); destFile.append(fileName); - var metadataJSON; - // JSON.stringify (FF 3.5.4 and up) has the benefit of indenting JSON - if (typeof JSON != "undefined" && 'function' == typeof JSON.stringify) { - metadataJSON = JSON.stringify(metadata,null,8); - } else { - var nsIJSON = Cc["@mozilla.org/dom/json;1"].createInstance(Ci.nsIJSON); - metadataJSON = nsIJSON.encode(metadata); - } + var metadataJSON = JSON.stringify(metadata,null,8); var str = metadataJSON + "\n\n" + code;