Skip to content

Fix #322 - Ensure that content filters continue to work when service workers are suspended

It appears that the fix added in https://gitlab.com/eyeo/adblockplus/abc/webext-sdk/-/issues/133 (back when we didn't have any proper MV3 testing support) is actually good!

This MR mostly extends the testing to make sure it's reliable in the service worker fuzzing tests (by allowing increased timeouts), and adds a few new test cases for areas that I found weren't adequately covered.

As part of this issue, I also reviewed the content filter code for anything else that might cause problems when the service workers are suspended:

  • Content filters do not need to maintain state between multiple events.
  • Content filters do not emit events (except for onBlockableItem events, which will be handled as part in https://gitlab.com/eyeo/adblockplus/abc/webext-sdk/-/issues/320)
  • Content filters use frame state and the filter engine, so need to ensure that those are initialized before they are used.
  • Sitekeys will still be lost when the service worker is suspended, so those will not work correctly, but sitekey support in MV3 is a later problem.
Edited by Justin Wernick

Merge request reports