From 1d1b825c629716e15838054caad4e52a35084e1f Mon Sep 17 00:00:00 2001 From: aurimasv Date: Sat, 19 Jan 2013 01:50:47 -0600 Subject: [PATCH 1/2] Properly handle cases where no translator is specified --- chrome/content/zotero/xpcom/translation/translate.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/xpcom/translation/translate.js b/chrome/content/zotero/xpcom/translation/translate.js index 2ae8355f9e..af95601fff 100644 --- a/chrome/content/zotero/xpcom/translation/translate.js +++ b/chrome/content/zotero/xpcom/translation/translate.js @@ -1046,6 +1046,7 @@ Zotero.Translate.Base.prototype = { if(!this.translator || !this.translator.length) { this.complete(false, new Error("No translator specified")); + return; } this._libraryID = libraryID; @@ -2092,7 +2093,8 @@ Zotero.Translate.Search.prototype.setTranslator = function(translator) { * translation fails */ Zotero.Translate.Search.prototype.complete = function(returnValue, error) { - if(this._currentState == "translate" && (!this.newItems || !this.newItems.length)) { + if(this._currentState == "translate" && (!this.newItems || !this.newItems.length) + && this.translator.length) { //length is 0 only when translate was called without translators Zotero.debug("Translate: Could not find a result using "+this.translator[0].label, 3); if(error) Zotero.debug(this._generateErrorString(error), 3); if(this.translator.length > 1) { From 869d0ce90a899a8ea8535cdb74062b13513f71d0 Mon Sep 17 00:00:00 2001 From: aurimasv Date: Sat, 19 Jan 2013 01:49:51 -0600 Subject: [PATCH 2/2] Don't report web translator errors if there is a parent translator --- chrome/content/zotero/xpcom/translation/translate.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/xpcom/translation/translate.js b/chrome/content/zotero/xpcom/translation/translate.js index af95601fff..c450b607ef 100644 --- a/chrome/content/zotero/xpcom/translation/translate.js +++ b/chrome/content/zotero/xpcom/translation/translate.js @@ -1721,7 +1721,8 @@ Zotero.Translate.Web.prototype.complete = function(returnValue, error) { var errorString = Zotero.Translate.Base.prototype.complete.apply(this, [returnValue, error]); // Report translation failure if we failed - if(oldState == "translate" && errorString && this.translator[0].inRepository && Zotero.Prefs.get("reportTranslationFailure")) { + if(oldState == "translate" && errorString && !this._parentTranslator && this.translator.length + && this.translator[0].inRepository && Zotero.Prefs.get("reportTranslationFailure")) { // Don't report failure if in private browsing mode if(Zotero.isFx && !Zotero.isBookmarklet && !Zotero.isStandalone) { var pbs = Components.classes["@mozilla.org/privatebrowsing;1"]