From ce1b3e099aaf451f22ef2d0fab1c521f1005badc Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Mon, 18 Jul 2011 21:37:38 +0000 Subject: [PATCH] Only call callback once --- .../zotero/tools/testTranslators/testTranslators.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/chrome/content/zotero/tools/testTranslators/testTranslators.js b/chrome/content/zotero/tools/testTranslators/testTranslators.js index 6d6aa0c985..a57c9303ac 100644 --- a/chrome/content/zotero/tools/testTranslators/testTranslators.js +++ b/chrome/content/zotero/tools/testTranslators/testTranslators.js @@ -425,11 +425,12 @@ function haveTranslators(translators, type) { /** * Runs translator tests recursively, after translatorTestViews has been populated */ -function runTranslatorTests(type, callback) { +function runTranslatorTests(type, callback, runCallbackIfComplete) { if(translatorTestViewsToRun[type].length) { + if(translatorTestViewsToRun[type].length === 1) runCallbackIfComplete = true; var translatorTestView = translatorTestViewsToRun[type].shift(); - translatorTestView.runTests(function() { runTranslatorTests(type, callback) }); - } else if(callback) { + translatorTestView.runTests(function() { runTranslatorTests(type, callback, runCallbackIfComplete) }); + } else if(callback && runCallbackIfComplete) { callback(); } }