This commit introduces plumbing for sending "close tab" commands to
other devices that are signed in to the same Mozilla account, and for
receiving "close tab" commands from other devices.
Differential Revision: https://phabricator.services.mozilla.com/D208051
We used to get a session token for Fenix using a special oauth scope,
however that scope leads to there being two session tokens assosiated
with Fenix, one assosiated with the web content and another with the
scope. This patch makes it so that there is only one session token
shared between the content and browser.
Differential Revision: https://phabricator.services.mozilla.com/D205381
On newer AndroidX versions of lifecycle library, interactions with a lifecycle registry,
by default, must happen on the main thread. While in this code we don't control how lifecycle
registries are created, and so we can't be sure if this default behaviour is present, it's likely
safe to assume that our consumers won't create custom lifecycle registries with non-main thread interactions
allowed.
This adds a sliding time-window, within which allow for only a certain number
of authErrors to trigger our recovery flow. If the number of incoming errors
is higher than our limits, state machine is transitioned into an 'unauthorized'
state, which will break potential auth-recovery loops.
This refactor changes how (most) consumers are expected to interact with the logins storage.
Instead of "locking"/"unlocking" the store whenever its needed, a connection to a storage
layer is now cached on first access and re-used for subsequent operations.
Various components relying on logins storage have been simplified.
The tabs engine `sync` method signature needs to be different than
the one currently defined in `SyncableStore.sync`.
`StorageSync` is the only user of the interface method and is deprecated
already.
This patch removes the `StorageSync` class and makes the store `sync`
methods not inherited from any interface.
The sole reason for authErrorRegistry was to expose an instance of FxaAccountManager
to internal components which don't have direct access to it. The registry acted
an internal singleton, but with a bunch of overhead and conceptual complexity around it.
This patch simplifies this: it adds an actual singleton instead of the registry, with a
simple API for components to call into if they encounter authentication errors.
Behaviour of `handleFxaExceptions` also changed slightly, to reduce cognitive overhead:
- instead of calling into an Async function on the observer, and ignoring the result,
this API is now simply `suspend`, which allows us to reason about error handling within
the FxA state machine terms of structured concurrency.
Other cleanup involves marking an expensive OAuthAccount method as async, as well as some
simplification of error handling in FirefoxAccount.
It's possible that `action` parameter may be missing. This patch adds handling for that case,
and tests for the interceptor (which were missing entirely) that cover all combinations.
This patch does a few things:
- adds a webextension for communicating with fxa web content
- provides a backend for said webextension, which understands webchannel communication protocol
and knows how to relay messages to the account manager, and query its state
- expands account manager a bit to support the webchannel authentication protocol
- adds a (rather detailed!) AuthType parameter to AccountObserver:onAuthenticated, instead of the very vague 'newAccount' flag
Co-authored-by: Arturo Mejia <arturomejiamarmol@gmail.com>
Co-authored-by: vladikoff <vlad.filippov@gmail.com>
This removes ability to automatically poll for device events.
That removal allows for a nice simplification of the two awkward classes
that split the same responsibilities.
Ability to automatically poll in the background is removed because we now
have proper push support (see `feature-push` and friends). Automatic polling
isn't something we'd like to see applications engage in, so let's not enable them.
Manual event polling is still possible via a simplified API call.
Refreshing constellation state is now possible without polling for events.
Some nice improvements:
- 0.37.0 fixes behaviour of `FirefoxAccount.disconnect` - device records will now be removed on logout.
- 'wantsKeys' is no longer necessary, so we get a simpler API
- new device type for upcoming integrations
'disconnect' API was introduced recently which destroys the device record.
This means we can remove relevant code from a-c which used to do the same work.