Closed Bug 1067720 Opened 5 years ago Closed 4 years ago

[verticalhome] Power off at language selection in FTU for the 1st time may result in incorrect homescreen icon display


(Firefox OS Graveyard :: Gaia::Homescreen, defect)

Not set


(Not tracked)



(Reporter: yifan, Unassigned)




(1 file)

46 bytes, text/x-github-pull-request
Details | Review
The root cause is in apps/verticalhome/js/stores/item.js .

This actually has nothing to do with FTU. The bug happens when the 1st time homescreen is initilaizing IndexedDB. 

There is a flag 'emptyDB' which is used for checking if the IndexedDB of name 'homescreen' exists. The steps for the first time homescreen is launching are as follows:

1. open IndexedDB (emptyDB is false)
2. onupgradeneeded event (if event.oldversion is 0, set emptyDB to true and create an objectStore named 'grid')
3. onsuccess event (if emptyDB is true, loadInitialState)

If power is off between step 2 and 3, when power is on the next time 'loadInitialState' might not be running since in the onupgradeneeded event the event.oldversion > 0 and the emptyDB flag will never be true.
See Also: → 1066492
The flag in verticalhome is 'isEmpty'.
Attached file pull request
Added a homescreen IndexedDB check flag using asyncStorage to prevent grid initialization failure due to unexpected power off.
Attachment #8490563 - Flags: review?(crdlc)
Comment on attachment 8490563 [details] [review]
pull request


   After analyzing the code we could have a race condition if the configuration-ready event is received while we are getting the flag from indexedDB.

   Be careful with the configuration because once this was loaded the first time, it won't be loaded anymore. See:

   I would like you take a look at this patch too.

Attachment #8490563 - Flags: review?(crdlc) → review?(kgrandon)
Thank you Cristian for the check! Updated the fix.
Comment on attachment 8490563 [details] [review]
pull request

Adding another async storage key is not really ideal here.

Yi-fan - instead do you think it would be an option to check on the currently stored data instead? Maybe either checking the count of IDB records, or the verticalPreferences storage?
Attachment #8490563 - Flags: review?(kgrandon)
Flags: needinfo?(yliao)
Feel the same for the asyncStorage work around.

I am not sure how to check the IDB records after a user alters his homescreen icons, the records could be either incremented or decreased, right?

I think creating object stores and saving configuration data in a single IDB transaction might be the proper way, the object stores won't be created if interrupted by power failures. Then we only need to check if the object stores are missing on verticalhome started, probably don't need a flag for it at all.
Flags: needinfo?(yliao)
See Also: → 1143526
Mass update: Resolve wontfix all issues with legacy homescreens.

As of 2.6 we have a new homescreen and having these issues open is confusing. All issues will block bug 1231115 so we can use that to re-visit any of these if needed.
Blocks: 1231115
Closed: 4 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.