========
8b1d353ee8
Author: Nick Alexander <nalexander@mozilla.com>
Bug 1148504 - Part 2: Make updating Firefox Account state happen in a critical section.
It's worth noting that the two consumers of the shared state lock will
only race for a very short window -- essentially only when creating or
re-connecting an account.
That's because Reading List oauth tokens are long-lived and do not
expire (yet) in response to remote Account state changes, such as
updating the Account password. So Sync and RL will race to initialize
the Account state; eventually RL will get an oauth token; and that token
will be cached forever until RL produces a 401 for the token or Android
expires the token.
Since Sync requests a token server token at the start of every sync, the
lock will be constantly exercised, but should never block.
========
d7a8611810
Author: Nick Alexander <nalexander@mozilla.com>
Date: Fri Mar 27 08:27:28 2015 -0700
Bug 1148504 - Part 1: Reduce scope of section that may set Account state.
The only place that might throw a TokenServerException is the token
server client code itself. By handling such an exception earlier, we
reduce the scope of the section that may update the Firefox Account
state. (This comes at the cost of threading AndroidFxAccount into
syncWithAssertion, but c'est la vie.)
This does not interact with the exist handling of 401s that we might see
from the storage endpoint. Those 401s never generated
TokenServerExceptions; in fact, they were (essentially) ignored. Since
we fetch a fresh token every Sync, what was (and is) expected is that
such 401s would be transient and fixed by authenticating with a fresher
token.
Test plan: manually verify that remotely changing the Firefox Account's
password while the device is in the Married state does the following:
1) uses the cached certificate to generate a local assertion;
2) the assertion produces a 401 from the TokenServerException, since the
certificate is no longer fresh;
3) the TokenServerException drives the Account state to Cohabiting;
4) the state machine discovers it cannot /sign, driving the Account
state to Separated.
An explanation of the Mozilla Source Code Directory Structure and links to
project pages with documentation can be found at:
https://developer.mozilla.org/en/Mozilla_Source_Code_Directory_Structure
For information on how to build Mozilla from the source code, see:
http://developer.mozilla.org/en/docs/Build_Documentation
To have your bug fix / feature added to Mozilla, you should create a patch and
submit it to Bugzilla (https://bugzilla.mozilla.org). Instructions are at:
http://developer.mozilla.org/en/docs/Creating_a_patch
http://developer.mozilla.org/en/docs/Getting_your_patch_in_the_tree
If you have a question about developing Mozilla, and can't find the solution
on http://developer.mozilla.org, you can try asking your question in a
mozilla.* Usenet group, or on IRC at irc.mozilla.org. [The Mozilla news groups
are accessible on Google Groups, or news.mozilla.org with a NNTP reader.]
You can download nightly development builds from the Mozilla FTP server.
Keep in mind that nightly builds, which are used by Mozilla developers for
testing, may be buggy. Firefox nightlies, for example, can be found at:
ftp://ftp.mozilla.org/pub/firefox/nightly/latest-trunk/
- or -
http://nightly.mozilla.org/