Closed Bug 1574051 Opened 6 years ago Closed 5 years ago

Refactor session/account status handling

Categories

(Firefox :: Firefox Accounts, enhancement, P2)

enhancement

Tracking

()

RESOLVED FIXED
Firefox 72
Tracking Status
firefox72 --- fixed

People

(Reporter: markh, Assigned: markh)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

We have strangeness around the "public" function hasLocalSession() and sessionStatus(). In particular, we want to end up in a place where:

  • sessionStatus() is no longer a public function - the fact external callers might want this means our API is wrong. For example, if we see a 401 fetching an oauth token or (say) signing an assertion/certificate/whatever, then we should probably check the session status at that time.

  • FxAccountsPush.jsm calls sessionStatus(), then drops some credentials and notifies observers of the account state change. This should be done whenever we notice the session is invalid, not just when push gets a password change notice.

  • hasLocalSession() probably can remain as a public function, but with a new name - it's the canonical "are we in a 'needs reauth' state?" function.

heh - we also have accountStatus(), which is "does the account still exist". This too should be removed from the public API - we are doing something wrong if we are exposing an API which says a user is logged in to an account which doesn't exist!

Summary: Refactor session status handling → Refactor session/account status handling
Priority: P1 → P2

I'm about to put a patch up for this change. I'll be asking :mtigley for review because this touches the FxA code in AboutProtectionsHandler.jsm.

Note that I intend landing this in 72, so there's no urgency for the review.

Pushed by mhammond@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/33ff8c691a2b make FxA's session/account status checking sane and understandable. r=rfkelly,mtigley
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 72
Regressions: 1590716
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: