commit 732c785af46028f21bb60cabb3d8568e7f3252df
parent 03ed7913a62783b63889f54c50b61ba9a7993d55
Author: Simon Kornblith <simon@simonster.com>
Date: Sat, 19 Jan 2013 11:51:19 -0800
Merge pull request #227 from aurimasv/complete
Complete
Diffstat:
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git 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;
@@ -1720,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"]
@@ -2092,7 +2094,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) {