Merge pull request #227 from aurimasv/complete

Complete
This commit is contained in:
Simon Kornblith 2013-01-19 11:51:19 -08:00
commit 732c785af4

View file

@ -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) {