www

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

commit e37f4e321552126545640b7d722e154c1eea602b
parent 36b36b68576c534dcf62aba381804c37abb1dc46
Author: Simon Kornblith <simon@simonster.com>
Date:   Fri,  1 Jul 2011 06:07:30 +0000

Don't break code (e.g. Scaffold) that returns a value from the select handler instead of using the callback


Diffstat:
Mchrome/content/zotero/xpcom/translation/translate.js | 13+++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/chrome/content/zotero/xpcom/translation/translate.js b/chrome/content/zotero/xpcom/translation/translate.js @@ -378,10 +378,15 @@ Zotero.Translate.Sandbox = { }; } - translate._runHandler("select", items, newCallback); - - // if we don't have returnedItems set already, the handler is asynchronous - haveAsyncHandler = !callbackExecuted; + var returnValue = translate._runHandler("select", items, newCallback); + if(returnValue !== undefined) { + // handler may have returned a value, which makes callback unnecessary + returnedItems = returnValue; + haveAsyncHandler = false; + } else { + // if we don't have returnedItems set already, the handler is asynchronous + haveAsyncHandler = !callbackExecuted; + } if(haveAsyncCallback) { // we are running asynchronously, so increment async processes