Initialization fails if custom filter has no metadata
Environment
- OS version: N/A
- Browser version: Chrome 113
- Extension version: 3.16.2
- Last working version: 3.16.1
Steps to reproduce
- Install Adblock Plus 3.13.
- Add example.com as allowlisted website.
- Update to Adblock Plus 3.16.2.
Observed behavior
Error thrown in background page when extension loads:
Uncaught (in promise) Error: filter_not_found
at FilterStorage.getMetadataForFilter (background.js:14640:11)
at Object.getMetadata (background.js:24815:83)
at async background.js:42062:33
at async Promise.all (index 0)
at async getWebAllowlistingFilterCount (background.js:42061:27)
at async Module.setUninstallURL (background.js:42137:39)
at async background.js:41945:3
Expected behavior
No errors are thrown when extension loads.
Proposed changes
- If @eyeo/webext-sdk updates
filters.getMetadata()
to stop throwing an error: Update @eyeo/webext-sdk dependency. - If the error is thrown intentional: Catch any errors thrown by
ewe.filters.getMetadata()
.- adblockpluschrome/lib/uninstall.js
- src/allowlisting/background/public-api.ts
- src/onpage-dialog/background/timing.ts
- Optional: Rearrange initialization order in adblockpluschrome/lib/subscriptionInit.js.
Further information
This regression was introduced in #1355 (closed), and we're about to run into this error again in #1388 (closed) and #1393 (closed).
The error causes the extension initialization to fail, thereby preventing certain functionality from initializating (e.g. notifications, element hiding debug mode, Premium license activation).
The error is unexpectedly thrown by ewe.filters.getMetadata()
, because we're calling it with an existing custom allowlisting filter that doesn't have any metadata associated with it (i.e. that was created prior to Adblock Plus 3.14).