Skip to content

Fix #318 - Update allowing filters API to keep working when service workers are suspended

Justin Wernick requested to merge 318-service-worker-allowlisting-api into master

In the production code, this is fairly straightforward. The functions become async, as they need to await the filter engine and frame state being initialized.

However, something else that this MR raises is an issue with one of our tests. We can no longer reliably add an event listener inside the onMessage callback, and respond when we get the next message. If the service worker is suspended while waiting for that next event, then it actually returns undefined to the extension page or content script. This may mean that we generally need a retry mechanism when sending messages to the service worker.

For now, that particular test is implemented using chrome.storage.session.

Merge request reports