Bug 1432212 - Log error and quit Firefox when Marionette fails to start. r?maja_zf
Log a fatal error when the Marionette remote protocol server fails
to initialise, then quit Firefox. If we fail to start Marionette
when passed the -marionette flag, there is little point in hanging around.
MozReview-Commit-ID: 3s6ORJggNap
--- a/testing/marionette/components/marionette.js
+++ b/testing/marionette/components/marionette.js
@@ -289,27 +289,26 @@ MarionetteComponent.prototype.init = fun
// ... and for startup tests
let startupRecorder = Promise.resolve();
if ("@mozilla.org/test/startuprecorder;1" in Cc) {
startupRecorder = Cc["@mozilla.org/test/startuprecorder;1"]
.getService().wrappedJSObject.done;
}
await startupRecorder;
- let s;
try {
Cu.import("chrome://marionette/content/server.js");
- s = new server.TCPListener(prefs.port);
- s.start();
- log.info(`Listening on port ${s.port}`);
- } finally {
- if (s) {
- this.server = s;
- this.running = true;
- }
+ let listener = new server.TCPListener(prefs.port);
+ listener.start();
+ log.info(`Listening on port ${listener.port}`);
+ this.server = listener;
+ this.running = true;
+ } catch (e) {
+ log.fatal("Remote protocol server failed to start", e);
+ Services.startup.quit(Ci.nsIAppStartup.eForceQuit);
}
});
};
MarionetteComponent.prototype.uninit = function() {
if (!this.running) {
return;
}