Skip to content
Snippets Groups Projects
Commit 1cdb056d authored by Henrik Skupin's avatar Henrik Skupin
Browse files

Bug 1595528 - [remote] Vendor in latest puppeteer changes. r=remote-protocol-reviewers,maja_zf

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

--HG--
extra : moz-landing-system : lando
parent 498c55ae
No related branches found
No related tags found
No related merge requests found
......@@ -161,10 +161,12 @@ class BrowserRunner {
usePipe,
timeout,
slowMo,
preferredRevision
preferredRevision,
use_stdout,
} = options;
if (!usePipe) {
const browserWSEndpoint = await waitForWSEndpoint(this.proc, timeout, preferredRevision);
const browserWSEndpoint = await waitForWSEndpoint(
this.proc, timeout, preferredRevision, use_stdout);
const transport = await WebSocketTransport.create(browserWSEndpoint);
this.connection = new Connection(browserWSEndpoint, transport, slowMo);
} else {
......@@ -239,7 +241,7 @@ class ChromeLauncher {
runner.start({handleSIGHUP, handleSIGTERM, handleSIGINT, dumpio, env, pipe: usePipe});
try {
const connection = await runner.setupConnection({usePipe, timeout, slowMo, preferredRevision: this._preferredRevision});
const connection = await runner.setupConnection({usePipe, timeout, slowMo, preferredRevision: this._preferredRevision, use_stdout: false});
const browser = await Browser.create(connection, [], ignoreHTTPSErrors, defaultViewport, runner.proc, runner.close.bind(runner));
await browser.waitForTarget(t => t.type() === 'page');
return browser;
......@@ -407,7 +409,7 @@ class FirefoxLauncher {
runner.start({handleSIGHUP, handleSIGTERM, handleSIGINT, dumpio, env, pipe});
try {
const connection = await runner.setupConnection({usePipe: pipe, timeout, slowMo, preferredRevision: this._preferredRevision});
const connection = await runner.setupConnection({usePipe: pipe, timeout, slowMo, preferredRevision: this._preferredRevision, use_stdout: true});
const browser = await Browser.create(connection, [], ignoreHTTPSErrors, defaultViewport, runner.proc, runner.close.bind(runner));
await browser.waitForTarget(t => t.type() === 'page');
return browser;
......@@ -518,11 +520,13 @@ class FirefoxLauncher {
* @param {!Puppeteer.ChildProcess} browserProcess
* @param {number} timeout
* @param {string} preferredRevision
* @param {boolean} use_stdout
* @return {!Promise<string>}
*/
function waitForWSEndpoint(browserProcess, timeout, preferredRevision) {
function waitForWSEndpoint(browserProcess, timeout, preferredRevision, use_stdout) {
return new Promise((resolve, reject) => {
const rl = readline.createInterface({ input: browserProcess.stdout });
const input = use_stdout ? browserProcess.stdout : browserProcess.stderr;
const rl = readline.createInterface({ input });
let stderr = '';
const listeners = [
helper.addEventListener(rl, 'line', onLine),
......
......@@ -5,6 +5,6 @@ origin:
description: Headless Chrome Node API
license: Apache-2.0
name: puppeteer
release: d26ff10
url: https://github.com/mjzffr/puppeteer.git
release: firefox
url: https://github.com/andreastt/puppeteer.git
schema: 1
......@@ -16,7 +16,7 @@
const path = require('path');
module.exports.addTests = function({testRunner, expect, defaultBrowserOptions, puppeteer, puppeteerPath, CHROME}) {
module.exports.addTests = function({testRunner, expect, defaultBrowserOptions, puppeteer, puppeteerPath, JUGGLER}) {
const {describe, xdescribe, fdescribe, describe_fails_ffox} = testRunner;
const {it, fit, xit, it_fails_ffox} = testRunner;
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
......@@ -38,16 +38,16 @@ module.exports.addTests = function({testRunner, expect, defaultBrowserOptions, p
const options = Object.assign({}, defaultBrowserOptions, {dumpio: true});
const res = spawn('node',
[path.join(__dirname, 'fixtures', 'dumpio.js'), puppeteerPath, JSON.stringify(options)]);
if (CHROME)
res.stderr.on('data', data => dumpioData += data.toString('utf8'));
else
if (JUGGLER)
res.stdout.on('data', data => dumpioData += data.toString('utf8'));
else
res.stderr.on('data', data => dumpioData += data.toString('utf8'));
await new Promise(resolve => res.on('close', resolve));
if (CHROME)
expect(dumpioData).toContain('DevTools listening on ws://');
else
if (JUGGLER)
expect(dumpioData).toContain('Juggler listening on ws://');
else
expect(dumpioData).toContain('DevTools listening on ws://');
});
it('should close the browser when the node process closes', async({ server }) => {
const {spawn, execSync} = require('child_process');
......
......@@ -73,6 +73,7 @@ module.exports.addTests = ({testRunner, product, puppeteerPath}) => {
product,
FFOX,
CHROME,
JUGGLER,
puppeteer,
expect,
defaultBrowserOptions,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment