Recover the generated widgets store if it is not available
Categories
(Firefox :: Widgets, task)
Tracking
()
People
(Reporter: fchasen, Unassigned)
References
(Blocks 1 open bug)
Details
(Whiteboard: [hnt][hnt-wattle])
The generated widgets provider needs a way to recover the list of installed widgets when widgets.json.mozlz4 can't be read at startup.
From https://phabricator.services.mozilla.com/D335844?id=1449812#inline-1819478:
I think that there are a few cases where we would fail to access or parse the file that we may want to handle more gracefully than overwriting the file with an empty map or with the next installed widget, follows some thoughts that we may use as things to consider in the followup:
- NotFoundError may be either a new profile (or an existing one where this provider did never run before) and a profile for which the profile got lost somehow (e.g. disk or filesystem failure, etc), in the XPIProvider is telling apart these kind cases using the
extension.databaseSchemapref (which is set to the const DB_SCHEMA defined in the provider ES module when the DB is fully open and loaded, and eventually migrated to the new DB schema format), we could use something like that (e.g.extensions.widgets.generated.providerDatabaseSchemaor something along the line (and based on that we can decide if it should create a pristine one or if we should do something else (e.g. rebuild it based on the valid entries in the widgets directory)- if the file is there but it is corrupted, that's not transient kind of error and we know it would fail the same during the next startup, then it may also be worth consider if we should rebuild it from the valid entries in the widgets directory
- in case of transient errors, e.g. I think NotAllowedError and NotReadableError may be transient if I'm not mistaken, we may consider it as a "give up and log an error" or doing something else (not sure if it would be reasonable, but if could consider to recompute the kind of content that we would have loaded from the DB by scanning the directory, basically rebuilding the DB)
If we have to resort to rebuild the DB (which would need to iterate over the directory and validate each of the generated widgets zip files to confirm if they should have been added to the DB), then I'd say we should defer that to when the browser is idle for the first time during startup, and wait for the rebuild to be completed to add anything more into the provider db (anyway it would be very likely that by the time the user got to try to generate a new widgets the rebuild promise would have already resolved).
Updated•4 days ago
|
Description
•