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

This commit is contained in:
Simon Kornblith 2011-07-01 06:07:30 +00:00
parent 36b36b6857
commit e37f4e3215

View file

@ -378,10 +378,15 @@ Zotero.Translate.Sandbox = {
};
}
translate._runHandler("select", items, newCallback);
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