diff --git a/chrome/content/zotero/xpcom/date.js b/chrome/content/zotero/xpcom/date.js index c480a0590..08c69a391 100644 --- a/chrome/content/zotero/xpcom/date.js +++ b/chrome/content/zotero/xpcom/date.js @@ -315,7 +315,7 @@ Zotero.Date = new function(){ } if(date.month) date.month--; // subtract one for JS style - Zotero.debug("DATE: retrieved with algorithms: "+date.toSource()); + Zotero.debug("DATE: retrieved with algorithms: "+JSON.stringify(date)); date.part = m[1]+m[7]; } else { diff --git a/chrome/content/zotero/xpcom/translation/translate.js b/chrome/content/zotero/xpcom/translation/translate.js index 9c5594b72..6782b664a 100644 --- a/chrome/content/zotero/xpcom/translation/translate.js +++ b/chrome/content/zotero/xpcom/translation/translate.js @@ -1151,13 +1151,7 @@ Zotero.Translate.Base.prototype = { this._sandboxManager.eval("var translatorInfo = "+translator.code, ["detect"+this._entryFunctionSuffix, "do"+this._entryFunctionSuffix, "Export"]); } catch(e) { - if(translator.logError) { - translator.logError(e.toString()); - } else { - Zotero.logError(e); - } - - this.complete(false, "parse error"); + this.complete(false, e); } if(callback) callback(); @@ -1701,15 +1695,19 @@ Zotero.Translate.Export.prototype._prepareTranslation = function() { } // initialize IO + // this is currently hackish since we pass null callbacks to the init function (they have + // callbacks to be consistent with import, but they are synchronous, so we ignore them) if(!this.location) { - var io = this._io = new Zotero.Translate.IO.String(null, this.path ? this.path : "", this.translator[0].configOptions["dataMode"]); + var io = this._io = new Zotero.Translate.IO.String(null, this.path ? this.path : ""); + io.init(this.translator[0].configOptions["dataMode"], function() {}); this.__defineGetter__("string", function() { return io.string; }); } else if(!Zotero.Translate.IO.Write) { throw new Error("Writing to files is not supported in this build of Zotero."); } else { - this._io = new Zotero.Translate.IO.Write(this.location, - this.translator[0].configOptions["dataMode"], - this._displayOptions["exportCharset"] ? this._displayOptions["exportCharset"] : null); + this._io = new Zotero.Translate.IO.Write(this.location); + this._io.init(this.translator[0].configOptions["dataMode"], + this._displayOptions["exportCharset"] ? this._displayOptions["exportCharset"] : null, + function() {}); } this._sandboxManager.importObject(this._io); diff --git a/chrome/content/zotero/xpcom/translation/translate_firefox.js b/chrome/content/zotero/xpcom/translation/translate_firefox.js index 46524fc3b..70dc4b2f4 100644 --- a/chrome/content/zotero/xpcom/translation/translate_firefox.js +++ b/chrome/content/zotero/xpcom/translation/translate_firefox.js @@ -465,13 +465,12 @@ function() { /******* Write support *******/ -Zotero.Translate.IO.Write = function(file, mode, charset) { +Zotero.Translate.IO.Write = function(file) { Zotero.Translate.IO.maintainedInstances.push(this); this._rawStream = Components.classes["@mozilla.org/network/file-output-stream;1"] .createInstance(Components.interfaces.nsIFileOutputStream); this._rawStream.init(file, 0x02 | 0x08 | 0x20, 0664, 0); // write, create, truncate this._writtenToStream = false; - if(mode || charset) this.reset(mode, charset); } Zotero.Translate.IO.Write.prototype = { @@ -528,7 +527,7 @@ Zotero.Translate.IO.Write.prototype = { this._writtenToStream = true; }, - "reset":function(newMode, charset) { + "init":function(newMode, charset, callback) { this._mode = newMode; if(Zotero.Translate.IO.rdfDataModes.indexOf(this._mode) !== -1) { this._initRDF();