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:
parent
36b36b6857
commit
e37f4e3215
1 changed files with 9 additions and 4 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue