RevokeCash / browser-extension

🛡 Protect yourself from crypto scams online
https://revoke.cash/extension
MIT License
63 stars 21 forks source link

Fix non-persistent background script #4

Closed rkalis closed 2 years ago

rkalis commented 2 years ago

In Manifest v2 it was possible to have a persistent background script. With Manifest v3 that's not possible any more, so we'll have to resort to dirty hacks.

https://stackoverflow.com/questions/66618136/persistent-service-worker-in-chrome-extension

rkalis commented 2 years ago

So the service worker goes inactive after 5 minutes of inactivity. We start a new connection to the service worker at every ethereum request that we intercept, for which we store some state in the ephemeral service worker. So as long as the user clicks reject/continue on the popup within 5 minutes, we shouldn't see any adverse effects of the non-persistent background script. I think it's fine to assume that users will do that within 5 minutes, so we can close this issue and re-open if it becomes an issue in the future.