Add --marionette-host for remote/tunneled Firefox#51
Draft
MayCXC wants to merge 2 commits intomozilla:mainfrom
Draft
Add --marionette-host for remote/tunneled Firefox#51MayCXC wants to merge 2 commits intomozilla:mainfrom
MayCXC wants to merge 2 commits intomozilla:mainfrom
Conversation
c5f78ac to
7ecf7d0
Compare
GeckodriverHttpDriver now requests webSocketUrl: true in the session capabilities and exposes a getBidi() method that opens a WebSocket to Firefox's Remote Agent. This allows BiDi-dependent features (console events, network events) to work when using --connect-existing. The WebSocket is opened lazily on the first getBidi() call and closed on quit/kill. The IBiDi interface already defined upstream is satisfied by wrapping the ws WebSocket instance. No behavior change for launch mode (continues to use selenium-webdriver with enableBidi). No behavior change for connect-existing when Firefox was not started with --remote-debugging-port (getBidi throws a clear error, same as before but with a better message).
Adds a --marionette-host CLI parameter (and MARIONETTE_HOST env var) that controls which host geckodriver connects to for Marionette and where the BiDi WebSocket connection is directed. When connecting to a remote or tunneled Firefox (e.g., via SSH port forwarding), the Marionette and BiDi ports are on a different host than localhost. This parameter lets geckodriver reach the tunnel endpoint while preserving the original Host header for Firefox's WebSocket allowHosts check.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Depends on #50.
Summary
Adds a
--marionette-hostCLI parameter (andMARIONETTE_HOSTenv var) for connecting to Firefox through an SSH tunnel or on a remote host.When connecting to a tunneled Firefox (e.g.,
ssh -L 2828:127.0.0.1:2828 remote-host), the Marionette and BiDi ports are reachable on a different hostname than127.0.0.1. This parameter controls:--marionette-hostpassed to geckodriver)127.0.0.1in thewebSocketUrlcapability)Example
Changes
src/cli.ts: Add--marionette-hostoptionsrc/firefox/types.ts: AddmarionetteHosttoFirefoxLaunchOptionssrc/firefox/core.ts: Pass host to geckodriver, rewrite BiDi WebSocket URLsrc/index.ts: PlumbmarionetteHostthrough to optionsNote on Firefox Host header validation
Firefox's
httpd.jsrejects WebSocket connections with aHostheader that doesn't match a configured server identity. When connecting via a tunnel hostname (e.g.,host.internal), Firefox needs to be configured to accept that host. AFAICT for remote devtools, this needs a Firefox bug report to make--remote-allow-hostsalso configure httpd.js identities.