- Hr
Based on my conversations with Chrome's extensions engineering team, this sounds to me like the intended behavior.
Sure, at this point we might as well register the content scripts statically in the manifest. - Robbi
If you are able to, that seems like it may be the better strategy.
One of the motivating use cases for dynamic content scripts support is situations where the host permissions for a content script isn't known ahead of time. I believe another is user script support, in which case it's impossible to statically declare the content scripts because they wouldn't be bundled with the extension.
For example, say you have an extension for GitHub that also supports GitHub Enterprise. The enterprise deployment of GitHub will be hosted on an internal domain and an extension developer can't know the set of domains they'll need to target before the user installs the extensions.
The real problem is that the refresh\reload (linked to the real extension update) is actually unreliable. - Robbi
Can you share more details? Reloading an extension should behave reliably and I would consider inconsistencies in this area to be bugs.
Thanks for reporting
issue 1340341; I've updated a couple properties on this issue to help it get routed to the right engineers.
Using a Chromium-based browser that still allows to install via .crx (i.e. SRWare Iron or Comodo Dragon) - Robbi
FYI, this should also be possible in Chrome/Chromium on Linux.
If what you wrote makes sense then why not revoke the permissions acquired at runtime after a reload? - Robbi
Hr's description matches my mental model; the reload button on chrome://extensions page effectively performs an update to the unpacked extension. The current design is that dynamically registered content scripts (even those declared with
persistAcrossSessions: true) are cleared on update. If you're seeing that this is
not the case when testing extension updates using .crx files, then .crx updates are not behaving as intended.
Permissions are persisted actress extension updates because, like storage, they're stateful information about the extension itself. Whether statically declared in the manifest file or dynamically registered, the same cannot be said about content scripts.
Content script registrations are directly associated with the files bundled with an extension, and those files may change with an extension update. If the browser doesn't clear out the content scripts on update, we can run into situations where the files referenced in the registration no longer exist or require additional files to be present that weren't declared in the previous registration.