Extension unresponsive for long time when adding/removing subscriptions in Manifest v3
Environment
- Browser and full version: Chrome 104.0.5112.79
- Extension using this toolkit: custom adblockplusui Manifest v3 build
- Commit hash: 0.6.0
Steps to reproduce
- Run the below command for
idx
values0
to4
:
a = performance.now()
recommendations = await EWE.subscriptions.getRecommendations()
await EWE.subscriptions.add(recommendations[idx].url)
await EWE.subscriptions.getDownloadable()
console.log(performance.now() - a)
- Run the below command for
idx
values4
to0
:
a = performance.now()
recommendations = await EWE.subscriptions.getRecommendations()
await EWE.subscriptions.remove(recommendations[idx].url)
await EWE.subscriptions.getDownloadable()
console.log(performance.now() - a)
Actual behavior
-
EWE.subscriptions.add()
/EWE.subscriptions.remove()
take a long time -
EWE.subscriptions.add()
/EWE.subscriptions.remove()
takes significantly longer the more subscriptions are added. -
EWE.subscriptions.remove()
takes significantly longer thanEWE.subscriptions.add()
. - UI pages (e.g. settings page) become unresponsive and cannot be reloaded.
Performance values (in seconds):
add(0) = 1.85
add(1) = 1.78
add(2) = 1.83
add(3) = 1.96
add(4) = 2.14
remove(4) = 33.30
remove(3) = 24.28
remove(2) = 19.43
remove(1) = 15.25
remove(0) = 8.97
Expected behavior
- Adding/removing subscriptions should not take longer than a second each.
- Adding/removing subscriptions may take longer depending on the amount of added subscriptions, but not by a noticable amount.
- UI pages should not become unresponsive for longer than a second per user interaction.
Further information
While it doesn't seem to be possible to use the developer tools "Performance" tab for the service worker, most of the time when removing subscriptions seems to be spent in undeployFilter()
.