Closed Bug 1216319 Opened 9 years ago Closed 9 years ago

Clear mTime from asyncStorage in Sync app after DataStore clear

Categories

(Firefox OS Graveyard :: Sync, defect, P1)

ARM
Gonk (Firefox OS)
defect

Tracking

(Not tracked)

RESOLVED FIXED
FxOS-S10 (30Oct)

People

(Reporter: mbdejong, Assigned: mbdejong)

References

Details

Attachments

(1 file)

The TV will send a command to clear all local data from the Sync app when the user logs out of FxA (and therefore disables Sync). When this command is received, all data should be wiped from Kinto.js, localStorage, and all DataStores to which the sync app has access (the TV browser will keep its local bookmarks/history outside the applicable DataStores).
Assignee: nobody → mbdejong
Blocks: 1195647
Priority: -- → P2
Target Milestone: --- → FxOS-S10 (30Oct)
Blocks: 1216022
New plan: listen for DataStore#clear operations, and react to that instead of getting the command through IAC.
Priority: P2 → P1
Changed this so that it only clears `mTime` from `asyncStorage`. That's enough to make sure the DataStore is repopulated on next sync for that userId.

Should this operation fail, then on next logout/login it will be repeated.

It's not easy to see the last operation for a DataStore (you have to cursor through all the history), so instead I'm checking if the DataStore has zero records.

I created follow-up bug 1218420 in case we want to clear more than just the mTime, so that maybe we can get out of some data corruption situations, but that requires more thought to see how we can make that work both on the TV and on the phone (where the DataStore is never cleared).
Summary: Support clearing data in Sync app → Clear mTime from asyncStorage in Sync app after DataStore clear
Attachment #8676635 - Flags: review?(ferjmoreno)
Comment on attachment 8676635 [details] [review]
[gaia] michielbdejong:1216319-clear-command > mozilla-b2g:master

Unfortunately, checking the size of the DataStore is probably not enough :( I left a comment on the PR
Attachment #8676635 - Flags: review?(ferjmoreno) → review-
Comment on attachment 8676635 [details] [review]
[gaia] michielbdejong:1216319-clear-command > mozilla-b2g:master

Can you give me feedback on the approach? I changed it so that the clear is done the next time the user comes back, it's safer when a retry is needed.

For read-write we will need to store the lastRevisionId per userid anyway, so that makes this code more reusable.

Will write the unit tests now.

Thanks!
Attachment #8676635 - Flags: feedback?(ferjmoreno)
QA Whiteboard: [COM= Data Sync]
Comment on attachment 8676635 [details] [review]
[gaia] michielbdejong:1216319-clear-command > mozilla-b2g:master

Looks good! Thanks for addressing the previous feedback.
Attachment #8676635 - Flags: feedback?(ferjmoreno) → feedback+
Attachment #8676635 - Flags: review- → review?(ferjmoreno)
Comment on attachment 8676635 [details] [review]
[gaia] michielbdejong:1216319-clear-command > mozilla-b2g:master

Thanks! I left a couple of comments more on the PR
Attachment #8676635 - Flags: review?(ferjmoreno) → review+
Comments addressed and rebased, TreeHerder almost finished (98% atm).
https://github.com/mozilla-b2g/gaia/commit/927bcd0612d89925ead14a320c65ebd21b5d61e3
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: