mozilla-b2g/gaia-email-libs-and-more — pull request #341 by jrburke (2014-09-24 04:24:20+00:00)
Title: Bug 1069412 - Email constantly asks me to reauthenticate

* If an SMTP or IMAP connection fails due to a bad oauth token, allow for a forced renewal try of the access_token then try again.
* To prevent aggressive retries, uses a_transientLastRenew timestamp, generated from date.PERFNOW, which uses performance.now when possible, to track if a renew was recently attempted.
* Since performance.now can be reset or changed, we only know we will get a higher value within the lifetime of the window/worker, so js/composite/account.js resets the value on account instantiation. This is the part where I am not sure if this is the desired way to do this for GELAM, so appreciate there could be more idiomatic GELAM ways to do that.
* I moved the credsUpdatedCallback work to be done inside oauth.js, instead of being being done by the callers in the client.js files, since the retry pathways would also need to do it.