Request host permissions if necessary
With Manifest v3 host permissions (used to modify requests and inject scripts) have to be requested via host_permissions (see migration guide). Host permission are optional as a matter of principle, and as I found in tests not granted on install by default (or at least not the way Selenium does the installation).
Extensions can check if they have certain permissions and request them using the permissions API.
If it stays that way for the Manifest v3 release, the following seems like a reasonable approach:
- Install the extension with modifications disabled.
- If the user enables the extension, request host permissions.
declarativeNetRequest works without host permission, but is very limited: For modifying headers, the header can only be removed, or set/appended to with a fixed string. This would break "prune" and "target" rules.