Closed Bug 1870905 Opened 2 years ago Closed 2 years ago

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)

defect

Tracking

()

RESOLVED FIXED
123 Branch
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:

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, _getFullData encountered an error and returned an empty array.
  • AddonDatabase.repopulate(addons) is called with this empty array, which essentially zeroes addons.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.

The severity field is not set for this bug.
:rpl, could you have a look please?

For more information, please visit BugBot documentation.

Flags: needinfo?(lgreco)
Assignee: nobody → rob
Status: NEW → ASSIGNED
Severity: -- → S3
Flags: needinfo?(lgreco)
Priority: -- → P2
Whiteboard: [addons-jira]
See Also: → 1872867
Pushed by rob@robwu.nl: https://hg.mozilla.org/integration/autoland/rev/1d9422a3e1d8 Skip repopulate on error in AddonRepository r=willdurand
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 123 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: