0

I am working on a security extension. I am using webrequest.onbeforerequst to intercept navigations and then do an analysis on it.. However, I am noticing that when chrome is not running and I click on a external link from email. My extension does not seem to be presented with that url. I think it might be a race condition that chrome is loading the page before my extension is loaded.

My question is if its possible to make sure chrome loads my extension, prior to the first navigation. Is anyone else seeing similar?

Note: If I enable background permission the issue is resolved, however users can exit at anytime to bypass the security, even if I set the policy to prevent disabling background process. Another mitigation would be if there is a policy to prevent the user from exiting chrome completely. From what I can find that is not possible.

  • Chrome doesn't wait for the background pages of extensions to load, it is reported quite regularly on their bugtracker, but the decision doesn't change since https://crbug.com/99450. IIUC back then they suggested declarativeWebRequest could help or they'll make it so in some distant future i.e. it's possible there's no solution yet. There's also an abandoned https://crbug.com/523634. – wOxxOm Sep 18 '18 at 06:12
  • As for a workaround, since content scripts run at startup you might be able to override XHR in the [page context](https://stackoverflow.com/a/9517879) (also `fetch` and its satellites). And as for the top tab URL just use location, window.stop(), etc. – wOxxOm Sep 18 '18 at 06:12

0 Answers0