Add-on metadata (addons.json) becomes empty when an update check is performed while the network is disconnected
Categories
(Toolkit :: Add-ons Manager, defect, P2)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox123 | --- | fixed |
People
(Reporter: robwu, Assigned: robwu)
References
Details
(Whiteboard: [addons-jira])
Attachments
(1 file)
I noticed on my phone that the metadata of installed add-ons was missing, observed through the number of reviews being zero in the add-ons manager. AddonRepository.sys.js is responsible for providing this metadata, and the data is also written to ProfD in addons.json. I read this file through a debugger, and the addons array within is empty, unexpectedly. I am sure that it was non-empty before.
Upon auditing the code responsible for it, it appears that there is a code path where addons becomes empty:
- (new in Firefox 120, bug 1850674 + bug 1859265): https://searchfox.org/mozilla-central/rev/5920b970c9996c7820c7ebf4e7b072e77017edf2/mobile/android/modules/geckoview/GeckoViewWebExtension.sys.mjs#1072-1080
AddonRepository.backgroundUpdateCheck()looks up the add-ons to cache, and then unconditionally replaces the fulladdons.jsondatabase with the result at https://searchfox.org/mozilla-central/rev/5920b970c9996c7820c7ebf4e7b072e77017edf2/toolkit/mozapps/extensions/internal/AddonRepository.sys.mjs#660,690,692_getFullDatais responsible for fetching the metadata, at https://searchfox.org/mozilla-central/rev/5920b970c9996c7820c7ebf4e7b072e77017edf2/toolkit/mozapps/extensions/internal/AddonRepository.sys.mjs#598-607- It swallows any error and returns an empty array if an error occurs.
What I suspect to have happened on my mobile device is:
- while the network connection is spotty or missing, Fenix wanted to perform an update check, which goes through
AddonRepository.backgroundUpdateCheck. - because the network request failed,
_getFullDataencountered an error and returned an empty array. AddonDatabase.repopulate(addons)is called with this empty array, which essentially zeroesaddons.json
At minimum, a feasible fix could be to return early if addons is empty. Then the metadata isn't updated, but at least not zeroed either.
Comment 1•2 years ago
|
||
The severity field is not set for this bug.
:rpl, could you have a look please?
For more information, please visit BugBot documentation.
| Assignee | ||
Comment 2•2 years ago
|
||
Updated•2 years ago
|
| Assignee | ||
Updated•2 years ago
|
| Assignee | ||
Updated•2 years ago
|
Updated•2 years ago
|
Comment 4•2 years ago
|
||
| bugherder | ||
Description
•