Open Bug 1931004 (comment-isFxaSignedIn) Opened 1 year ago Updated 1 year ago

ASRouterTargeting.isFxASignedIn hard to understand/maintain

Categories

(Firefox :: Messaging System, task, P2)

task
Points:
2

Tracking

()

People

(Reporter: dmosedale, Assigned: aminomancer)

References

(Blocks 1 open bug)

Details

(Whiteboard: [omc])

As a maintainer/user of ASRouterTargeting.isFxASignedIn(), I should be able to fairly easily read the code and understand what it's doing, so that I can confidently depend on it and/or change it.

Right now, there are several things that make this hard:

  • we're interacting with a complex state machine maintained by the Sync / FxA code that's not explicitly documented (or has linked-to documentation) here while depending on the existence and semantics of states other than just "signed in" and "signed out".
  • it's not clear why it makes sense to look directly at FXA_USERNAME_PREF here (it's believed to be an optimization to avoid stalling too long).
  • it's not obvious why it's possible for the getSignedInUser() call to be reached by the code

Some comments describing the states we care about and the motivations for the various code clauses would go a long way, I think. We may well want some of these comments to include XXX clauses about things that we could do in the future to clean stuff up.

Points: --- → 2
Priority: -- → P2
You need to log in before you can comment on or make changes to this bug.