Bug 1468022 - Avoid quitting Firefox when enabled via pref at runtime. r=whimboo

If for whatever reason Marionette fails to initialise we quit
Firefox so that the parent process of Firefox (typically geckodriver)
does not have to elapse its connection timeout.

This patch rectifies an oversight that we also have this behaviour
when the user flips the marionette.enabled preference.  If the user
is in control of the process we should not forcefully make Firefox quit.

MozReview-Commit-ID: LVqAeIp56MG

--HG--
extra : rebase_source : aea517efa4e2dfcdd0c82a74d8c3c9c8686fe0e8
This commit is contained in:
Andreas Tolfsen 2018-06-09 18:41:01 +01:00
Родитель 5954a70999
Коммит b66176925a
1 изменённых файлов: 5 добавлений и 3 удалений

Просмотреть файл

@ -319,7 +319,7 @@ class MarionetteParentProcess {
switch (topic) { switch (topic) {
case "nsPref:changed": case "nsPref:changed":
if (this.enabled) { if (this.enabled) {
this.init(); this.init(false);
} else { } else {
this.uninit(); this.uninit();
} }
@ -413,7 +413,7 @@ class MarionetteParentProcess {
}, {once: true}); }, {once: true});
} }
init() { init(quit = true) {
if (this.running || !this.enabled || !this.finalUIStartup) { if (this.running || !this.enabled || !this.finalUIStartup) {
log.debug(`Init aborted (running=${this.running}, ` + log.debug(`Init aborted (running=${this.running}, ` +
`enabled=${this.enabled}, finalUIStartup=${this.finalUIStartup})`); `enabled=${this.enabled}, finalUIStartup=${this.finalUIStartup})`);
@ -448,7 +448,9 @@ class MarionetteParentProcess {
} catch (e) { } catch (e) {
log.fatal("Remote protocol server failed to start", e); log.fatal("Remote protocol server failed to start", e);
this.uninit(); this.uninit();
Services.startup.quit(Ci.nsIAppStartup.eForceQuit); if (quit) {
Services.startup.quit(Ci.nsIAppStartup.eForceQuit);
}
return; return;
} }