www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit f58a5ed298d5e8ba7bd2b1cb818d4a3d943f0e00
parent e85eaf218acf71205067150b0bc33af9f0144541
Author: Simon Kornblith <simon@simonster.com>
Date:   Sat, 17 Aug 2013 00:32:29 -0400

Fix returning translators from Zotero.Translate.getTranslators()

Diffstat:
Mchrome/content/zotero/xpcom/translation/translate.js | 16++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/chrome/content/zotero/xpcom/translation/translate.js b/chrome/content/zotero/xpcom/translation/translate.js @@ -1017,7 +1017,7 @@ Zotero.Translate.Base.prototype = { } // if detection returns immediately, return found translators - var me = this, deferred = Q.defer(); + var me = this; return potentialTranslators.spread(function(allPotentialTranslators, properToProxyFunctions) { me._potentialTranslators = []; me._foundTranslators = []; @@ -1040,10 +1040,12 @@ Zotero.Translate.Base.prototype = { // Attach handler for translators, so that we can return a // promise that provides them. // TODO make me._detect() return a promise - var translatorsHandler = function(obj, translators) { - me.removeHandler("translators", translatorsHandler); - deferred.resolve(translators); - } + var deferred = Q.defer(), + translatorsHandler = function(obj, translators) { + Zotero.debug("TRANSLATORS HANDLER") + me.removeHandler("translators", translatorsHandler); + deferred.resolve(translators); + } me.setHandler("translators", translatorsHandler); me._detect(); @@ -1069,10 +1071,12 @@ Zotero.Translate.Base.prototype = { } }); } + + return deferred.promise; }).fail(function(e) { Zotero.logError(e); me.complete(false, e); - }).then(deferred.promise); + }); }, /**