Bug 1467215 - Reset prefs possibly set by failed init. r?maja_zf
If initialisation fails on being unable to start the TCP listener,
we may have already set some recommended preferences. This patch
ensures any altered preferences get reset when uninit() is called
in the try...catch block in init().
MozReview-Commit-ID: B5vNvTUZcO7
--- a/testing/marionette/components/marionette.js
+++ b/testing/marionette/components/marionette.js
@@ -454,24 +454,24 @@ class MarionetteMainProcess {
env.set(ENV_ENABLED, "1");
Services.obs.notifyObservers(this, NOTIFY_RUNNING, true);
log.debug("Remote service is active");
});
}
uninit() {
+ for (let k of this.alteredPrefs) {
+ log.debug(`Resetting recommended pref ${k}`);
+ Preferences.reset(k);
+ }
+ this.alteredPrefs.clear();
+
if (this.running) {
this.server.stop();
- for (let k of this.alteredPrefs) {
- log.debug(`Resetting recommended pref ${k}`);
- Preferences.reset(k);
- }
- this.alteredPrefs.clear();
-
Services.obs.notifyObservers(this, NOTIFY_RUNNING);
log.debug("Remote service is inactive");
}
}
get QueryInterface() {
return ChromeUtils.generateQI([
Ci.nsICommandLineHandler,