Bug 1460651 - [marionette] Add additional debug logging for browser startup.
MozReview-Commit-ID: 9ABM2XcJoKc
--- a/testing/marionette/components/marionette.js
+++ b/testing/marionette/components/marionette.js
@@ -379,16 +379,17 @@ class MarionetteMainProcess {
let win = winEn.getNext();
if (win.document.documentURI == "chrome://gfxsanity/content/sanityparent.html") {
this.gfxWindow = win;
break;
}
}
if (this.gfxWindow) {
+ log.debug("GFX sanity window detected, waiting until it has been closed...");
Services.obs.addObserver(this, "domwindowclosed");
} else {
Services.obs.addObserver(this, "xpcom-will-shutdown");
this.finalUIStartup = true;
this.init();
}
break;
@@ -409,24 +410,26 @@ class MarionetteMainProcess {
win.document.documentElement.getButton("accept").click();
});
}
}, {once: true});
}
init() {
if (this.running || !this.enabled || !this.finalUIStartup) {
+ log.debug(`Init aborted (running=${this.running}, ` +
+ `enabled=${this.enabled}, finalUIStartup=${this.finalUIStartup})`);
return;
}
- // wait for delayed startup...
+ log.debug(`Waiting for delayed startup...`);
Services.tm.idleDispatchToMainThread(async () => {
- // ... and for startup tests
let startupRecorder = Promise.resolve();
if ("@mozilla.org/test/startuprecorder;1" in Cc) {
+ log.debug(`Waiting for startup tests...`);
startupRecorder = Cc["@mozilla.org/test/startuprecorder;1"]
.getService().wrappedJSObject.done;
}
await startupRecorder;
if (MarionettePrefs.recommendedPrefs) {
for (let [k, v] of RECOMMENDED_PREFS) {
if (!Preferences.isSet(k)) {
@@ -445,29 +448,31 @@ class MarionetteMainProcess {
} catch (e) {
log.fatal("Remote protocol server failed to start", e);
this.uninit();
Services.startup.quit(Ci.nsIAppStartup.eForceQuit);
}
env.set(ENV_ENABLED, "1");
Services.obs.notifyObservers(this, NOTIFY_RUNNING, true);
- log.info(`Listening on port ${this.server.port}`);
+ log.debug("Remote service is active");
});
}
uninit() {
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,
Ci.nsIMarionette,
Ci.nsIObserver,
--- a/testing/marionette/server.js
+++ b/testing/marionette/server.js
@@ -85,23 +85,25 @@ class TCPListener {
this.socket = new ServerSocket(this.port, flags, backlog);
} catch (e) {
throw new Error(`Could not bind to port ${this.port} (${e.name})`);
}
this.port = this.socket.port;
this.socket.asyncListen(this);
- logger.debug("New connections are accepted");
+ logger.info(`Listening on port ${this.port}`);
}
} else if (this.socket) {
+ // Note that closing the server socket will not close currently active
+ // connections.
this.socket.close();
this.socket = null;
- logger.debug("New connections will no longer be accepted");
+ logger.info(`Stopped listening on port ${this.port}`);
}
}
/**
* Bind this listener to {@link #port} and start accepting incoming
* socket connections on {@link #onSocketAccepted}.
*
* The marionette.port preference will be populated with the value