borismus/oauth2-extensions — pull request #39 by johansten (2013-12-08 02:28:12+00:00)
Title: Fixed: Race condition in loadAdapter().

Multiple semi-simultaneous calls to loadAdapter add their own script nodes, and the callbacks sometimes ends up not being called in the order intended. This fix makes sure that there is only ONE script-node per adapter, and adds the callbacks to that node. The event handler appears to call the callbacks in the order they were added to the node, so the initial problem of out-of-order callbacks (calling callback in authorize() before callback in OAuth(), and therefore getting bogus parameters to the OAuth2-tab) is gone.