bug 1551188: remote: print listening address similarly to chrome; r=remote-protocol-reviewers,ochameau

Puppeteer parses stderr looking for the regular expression
^DevTools listening on (ws:\/\/.*)$.  For Puppeteer to be able
to connect to Firefox, we need to change the line we print slightly
to conform with this expression.

The remote agent also uses Log.jsm to print it, but we cannot rely
on logging always being enabled, e.g. if remote.log.level is set
to Warn or above.  For this reason we should use dump().

The patch also instantiates the main target before starting the HTTPD.

Differential Revision: https://phabricator.services.mozilla.com/D30913

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Andreas Tolfsen 2019-05-13 14:43:21 +00:00
parent cce639ce14
commit 5485cb24b1

View File

@ -95,12 +95,12 @@ class RemoteAgentClass {
await this.tabs.start();
try {
this.server._start(port, host);
// Immediatly instantiate the main process target in order
// to be accessible via HTTP endpoint on startup
const mainTarget = this.targets.getMainProcessTarget();
log.info(`Remote debugging agent listening on ${mainTarget.wsDebuggerURL}`);
this.server._start(port, host);
dump(`DevTools listening on ${mainTarget.wsDebuggerURL}`);
} catch (e) {
throw new Error(`Unable to start remote agent: ${e.message}`, e);
}