fix: support Chrome 137+ in web-ext run -t chromium (+functional tests) by Rob--W · Pull Request #3434 · mozilla/web-ext (original) (raw)
Fixes #3388.
This PR gets web-ext run -t chromium working again in Chrome 137+.
It uses the Extensions.loadUnpacked CDP command, with a fallback to --load-extension for versions before Chrome 126 (all based on feature detection; there are no explicit version checks in the implementation, to allow it to work with any Chromium-based browser).
Since the implementation now uses CDP, it also replaces the "web-ext Reload Manager Extension" helper extension with a CDP-based mechanism to reload the extension.
All of this is covered by extensive functional tests, with a fake chrome binary that accurately simulates the relevant behaviors. I have verified the behaviors Chrome 69, 70, 75, 77, 88, 100, 122, 125, 126, 134, 139. Relevant findings of version-specific behavior is documented in #3388 (comment). The tests with real Chrome are disabled by default to not slow down CI, but if interested one can run them by setting the TEST_WEBEXT_USE_REAL_CHROME=1 environment variable. More tips on debugging are documented in tests/functional/test.cli.run-target-chromium.js.