Open Bug 1260502 Opened 4 years ago Updated 1 year ago
Fix preference handling of enforce
_gecko _prefs() and do a safe shutdown
Right now the enforce_gecko_prefs() method forces a hard-restart of Firefox from the Python side. This has certain disadvantages because lots of data which is usually written during shutdown of Firefox cannot be written. This will cause test failures for certain tests which need a restart. https://dxr.mozilla.org/mozilla-central/source/testing/marionette/client/marionette_driver/marionette.py#1053 There is GeckoInstance.restart() which allows that.
We should wait for bug 1141483 here which keeps the context from before the restart.
Depends on: 1141483
So originally this feature has been implemented in bug 1030442. The requirements were: * set non-default settings for prefs * allow those to be available on startup * should stick for all the tests With the current implementation I see the following issues: 1. We replace any preferences as given via the command line by the ones as specified by enforce_gecko_prefs(). Shouldn't we update the dict? https://dxr.mozilla.org/mozilla-central/rev/3f4c3a3cabaf94958834d3a8935adfb4a887942d/testing/marionette/client/marionette_driver/marionette.py#1078 https://dxr.mozilla.org/mozilla-central/source/testing/marionette/client/marionette_driver/geckoinstance.py#182 2. There is no way to get rid of those extra preferences except specifying an empty dict which due to the above issue would reset everything. I don't say that we should remove this method. We still need a feature like that if a test has to modify preferences which Marionette forces as default. My proposal would be that we add a separate prefs dictionary to the Gecko instance class which only holds preferences as set by enforce_gecko_prefs(). That way we can build a final prefs dict which would allow us to overwrite Marionette defaults, and keep the originally set preferences from the command line. Also we could easily remove all those prefs by calling `enforce_gecko_prefs()` again. Regarding doing a safe restart we will have to do a `quit(in_app=True)`, modify the profile via `_update_profile()`, and start Firefox via `start_session()` again. David, would you have any feedback? Or do you see issues with that? IMO we should get this fixed sooner than later given that our fx-ui-tests are at least affected by not being able to reset those prefs and will cause eg. safebrowsing to stay active.
Summary: enforce_gecko_prefs() should do a safe (in-app) restart → Fix preference handling of enforce_gecko_prefs() and do a safe shutdown
Do what you think needs doing
As seen via bug 1291844 a call to this method also resets formerly set preferences. So it's not at all obvious in how to use this method.
You need to log in before you can comment on or make changes to this bug.