Unable to use subscriptions.getMigrationErrors() during initialization
Environment
- Browser and full version: Chrome 105.0.5195.125
- Extension using this toolkit:
- test-mv2 (based on 0.6.1)
- test-mv3 (based on 0.7.0)
- Commit hash: 0.7.0
Steps to reproduce
- Set value of "version" property in manifest.json file to "0.0.2" to avoid #383 (closed).
- Add
EWE.subscriptions.getMigrationErrors().forEach(console.error)call as part of the extension initialization (e.g. right afterEWE.start()has finished). - Generate migration error (taken from #384 (closed)):
- Copy "test-mv2" directory and rename it to "test".
- Install "test" directory as unpacked extension.
- Run
await EWE.subscriptions.add("https://easylist-downloads.adblockplus.org/easylistchina+easylist.txt"). - Remove "test" directory.
- Copy "test-mv3" directory and rename it to "test".
- Reload unpacked extension.
- Run
EWE.subscriptions.getMigrationErrors().
Actual behavior
- After 3.6) No migration errors are logged during extension initialization.
- After 4) Migration errors are returned.
Expected behavior
- After 3.6) Migration errors are logged during extension initialization.
- After 4) Migration errors are returned.
Further information
When it comes to knowing when it's safe to call EWE.subscriptions.getMigrationErrors(), the API documentation doesn't mention anything and the EWE 0.7.0 release notes only mention "Once the migration happened". In general, there doesn't appear to be a way for consumers to get notified about new migration errors.
Apart from that, since the migration may still be ongoing even after the promise that's returned by EWE.start() resolve, it's unclear whether it's safe to use other APIs (e.g. subscriptions.getDownloadable()) after EWE.start() but before the migration is done. Therefore it may make more sense to run the migration as part of EWE.start() to ensure that the filter storage is in the correct state when its promise resolves.