Commit Graph

6 Commits

Author SHA1 Message Date
vivek
6e94caa278 Bug 1178378 - Register for web channel notications and update account profile on callback r=nalexander 2015-09-22 19:06:48 +03:00
Nick Alexander
d35dbe170c Bug 1205334 - Part 1: Don't register FxA WebChannel or listen for Accounts:* messages when restricted. r=sebastian 2015-09-17 13:53:05 -04:00
Nick Alexander
397d513f69 Bug 1191064 - Part 3: Handle removing Android Accounts from fxa-content-server. r=markh
This adds a new JS to Java ping-pong; exposes it via Accounts.jsm; and
uses it in response to the fxa-content-server message.
2015-09-14 17:21:19 -04:00
Nick Alexander
446b571bd1 Bug 1191064 - Part 1: Add Fennec version of FxAccountsWebChannel. r=markh
This ticket does the following things:

* register early.  If the first page that Gecko loads is
  about:accounts, the channel needs to be in place.  If we delay this,
  we can and do miss content server messages.

* listen to the following messages:

  CAN_LINK_ACCOUNT: 'fxaccounts:can_link_account'
  CHANGE_PASSWORD: 'fxaccounts:change_password'
  DELETE_ACCOUNT: 'fxaccounts:delete_account'
  LOADED: 'fxaccounts:loaded'
  LOGIN: 'fxaccounts:login'

The list of messages is from
2a78a14daf/app/scripts/models/auth_brokers/fx-desktop-v2.js (L24)
via
2a78a14daf/app/scripts/models/auth_brokers/fx-fennec-v1.js

This patch implements only LOADED, LOGIN, and CHANGE_PASSWORD.  The
messages have the following behaviour:

A LOADED message is ferried to the individual XUL <browser> element it
originated from.  In general, WebChannel is a global listener: it does
not matter where a message originates.  We want to have fine-grained
control over when an embedding <iframe> is displayed (as opposed to
loaded, in the Gecko sense of loaded).  The fxa-content-server
participates in this exchange via the LOADED message; we complete the
loop by specially handling LOADED.

A LOGIN or CHANGE_PASSWORD message either creates a new Android
Account in the Engaged state, or moves an existing Android Account to
the Engaged state.  An Android sync is not yet requested -- we'll
arrange that from the Java side.
2015-09-15 15:54:29 -04:00
Nick Alexander
7e1a2c9456 Bug 1204937 - Part 3: Add Accounts:UpdateAccountFromJSON message. r=sebastian
This commit does a few things.  First, it fixes a typo
(s/ForResponse/ForResult/).  It's not clear how this /ever/ worked,
but it did.

Second, it adds an UpdateAccountFromJSON sibling to
CreateAccountFromJSON.  It would have been reasonable to have the
create message do double-duty and update an existing account (we have
the latitude to change the meaning since this API is not yet public)
but I generally prefer each consumer to perform the conditional state
check and to act appropriately.

Third, it generalizes the existing Accounts:Exist message to provide
some details (including email and UID) of any existing Firefox
Account.  The Accounts.exist() API /is/ public, so I introduce a new
(not yet public) API for this richer information.
2015-08-21 11:27:54 -07:00
Nick Alexander
f69b667c6d Bug 1204937 - Part 2: Extract Accounts: messages to AccountsHelper. r=sebastian
There are enough Accounts: messages to separate them from BrowserApp,
and the list is only growing.

This has also the small advantage of removing some non-native event
listeners.
2015-08-20 10:03:20 -07:00