Closed Bug 1323290 Opened 7 years ago Closed 7 years ago

[TRACKING] Set relevant automation preferences in Marionette server

Categories

(Remote Protocol :: Marionette, defect)

Version 3
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1344748

People

(Reporter: ato, Unassigned)

Details

We currently maintain lists of relevant automation preferences in a few different places:

https://github.com/mozilla/geckodriver/blob/master/src/marionette.rs#L57
https://github.com/mozilla/geckodriver/blob/master/src/marionette.rs#L110
https://github.com/mozilla/gecko-dev/blob/master/testing/marionette/client/marionette_driver/geckoinstance.py#L19
https://github.com/mozilla/gecko-dev/blob/master/testing/marionette/client/marionette_driver/geckoinstance.py#L167
https://github.com/mozilla/gecko-dev/blob/master/testing/marionette/client/marionette_driver/geckoinstance.py#L266
https://github.com/mozilla/gecko-dev/blob/master/testing/marionette/client/marionette_driver/geckoinstance.py#L378

I’d like to investigate the possibility of setting the large majority of these inside the Marionette server on startup, instead of the client modifying the profile before starting Firefox.

Setting the preferences when Marionette is started enabled (that is, when the firefox-bin binary is started with the --marionette flag) would have a number of advantages:

  (1) Would make it possible to `./firefox --marionette` and interact with it
      using a primitive remote client, such as telnet81) or nc(1), which would
      make debugging easier.

      But it would also reduce the friction and magical subtle behaviour
      that Marionette sometimes exhibits when used against different versions
      of different clients.

  (2) Would reduce amount of maintenance needed to keep geckodriver and
      marionette-client preference lists in sync.  They are already lagging
      severely.

  (3) Relevant preferences would be more closely tied to the Firefox version,
      and clients would not need to keep preferences “forever” due to version
      backwards compatibility.

      I already found a number of preferences that have not been in used since
      Firefox 12 when going through the geckodriver prefs list.

One of the rather neat features of geckodriver is that it allows certain preferences it normally sets to be overridden when it detects it is provided, but prevents overriding of certain important prefs.

This means in practice that for example Telemetry is disabled, but that if the user really wants to enable it and provides a relevant preference to do so, we will not stop her by ignoring the preference she passes to geckodriver.

I imagine we could continue to do this and introduce this behaviour in Marionette proper.  The Preferences.jsm module contains a `Preferences.isSet` API that lets us query if a given preference has a ‘user set’ value:

    http://searchfox.org/mozilla-central/source/toolkit/modules/Preferences.jsm#178

Having done an audit of the preferences we currently use (from all the various sources linked above) I have come up with a coalesced list of preferences that is usable with all different combinations of Firefox, geckodriver, and Fennec:

    https://gist.github.com/andreastt/dde0749a7f0fa4aea226f617d5b5f0bf

I suspect the few desktop- and Fennec specific preferences currently defined in geckoinstance.py can be combined into a single list since they don’t conflict.

The major obstacle to what I describe here is that a number of preferences need to be set in the profile _before_ Firefox starts and it’s not obvious which do.  I suspect we cannot get around this fact easily, so some preferences will still need to be written to profile before launching the browser process.

For these preferences we should consider creating a structured file (like the one in the gist) from which we can generate the Rust struct required by geckodriver and a Python dict for use in marionette-client.  This would achieve a number of the desired features above, but not (3) and parts of (1).
Summary: Set relevant automation preferences in Marionette server → [TRACKING] Set relevant automation preferences in Marionette server
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → DUPLICATE
Product: Testing → Remote Protocol
You need to log in before you can comment on or make changes to this bug.