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 { ...@@ -161,10 +161,12 @@ class BrowserRunner {
usePipe, usePipe,
timeout, timeout,
slowMo, slowMo,
preferredRevision preferredRevision,
use_stdout,
} = options; } = options;
if (!usePipe) { 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); const transport = await WebSocketTransport.create(browserWSEndpoint);
this.connection = new Connection(browserWSEndpoint, transport, slowMo); this.connection = new Connection(browserWSEndpoint, transport, slowMo);
} else { } else {
...@@ -239,7 +241,7 @@ class ChromeLauncher { ...@@ -239,7 +241,7 @@ class ChromeLauncher {
runner.start({handleSIGHUP, handleSIGTERM, handleSIGINT, dumpio, env, pipe: usePipe}); runner.start({handleSIGHUP, handleSIGTERM, handleSIGINT, dumpio, env, pipe: usePipe});
try { 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)); const browser = await Browser.create(connection, [], ignoreHTTPSErrors, defaultViewport, runner.proc, runner.close.bind(runner));
await browser.waitForTarget(t => t.type() === 'page'); await browser.waitForTarget(t => t.type() === 'page');
return browser; return browser;
...@@ -407,7 +409,7 @@ class FirefoxLauncher { ...@@ -407,7 +409,7 @@ class FirefoxLauncher {
runner.start({handleSIGHUP, handleSIGTERM, handleSIGINT, dumpio, env, pipe}); runner.start({handleSIGHUP, handleSIGTERM, handleSIGINT, dumpio, env, pipe});
try { 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)); const browser = await Browser.create(connection, [], ignoreHTTPSErrors, defaultViewport, runner.proc, runner.close.bind(runner));
await browser.waitForTarget(t => t.type() === 'page'); await browser.waitForTarget(t => t.type() === 'page');
return browser; return browser;
...@@ -518,11 +520,13 @@ class FirefoxLauncher { ...@@ -518,11 +520,13 @@ class FirefoxLauncher {
* @param {!Puppeteer.ChildProcess} browserProcess * @param {!Puppeteer.ChildProcess} browserProcess
* @param {number} timeout * @param {number} timeout
* @param {string} preferredRevision * @param {string} preferredRevision
* @param {boolean} use_stdout
* @return {!Promise<string>} * @return {!Promise<string>}
*/ */
function waitForWSEndpoint(browserProcess, timeout, preferredRevision) { function waitForWSEndpoint(browserProcess, timeout, preferredRevision, use_stdout) {
return new Promise((resolve, reject) => { 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 = ''; let stderr = '';
const listeners = [ const listeners = [
helper.addEventListener(rl, 'line', onLine), helper.addEventListener(rl, 'line', onLine),
......
...@@ -5,6 +5,6 @@ origin: ...@@ -5,6 +5,6 @@ origin:
description: Headless Chrome Node API description: Headless Chrome Node API
license: Apache-2.0 license: Apache-2.0
name: puppeteer name: puppeteer
release: d26ff10 release: firefox
url: https://github.com/mjzffr/puppeteer.git url: https://github.com/andreastt/puppeteer.git
schema: 1 schema: 1
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
const path = require('path'); 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 {describe, xdescribe, fdescribe, describe_fails_ffox} = testRunner;
const {it, fit, xit, it_fails_ffox} = testRunner; const {it, fit, xit, it_fails_ffox} = testRunner;
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner; const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
...@@ -38,16 +38,16 @@ module.exports.addTests = function({testRunner, expect, defaultBrowserOptions, p ...@@ -38,16 +38,16 @@ module.exports.addTests = function({testRunner, expect, defaultBrowserOptions, p
const options = Object.assign({}, defaultBrowserOptions, {dumpio: true}); const options = Object.assign({}, defaultBrowserOptions, {dumpio: true});
const res = spawn('node', const res = spawn('node',
[path.join(__dirname, 'fixtures', 'dumpio.js'), puppeteerPath, JSON.stringify(options)]); [path.join(__dirname, 'fixtures', 'dumpio.js'), puppeteerPath, JSON.stringify(options)]);
if (CHROME) if (JUGGLER)
res.stderr.on('data', data => dumpioData += data.toString('utf8'));
else
res.stdout.on('data', data => dumpioData += data.toString('utf8')); 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)); await new Promise(resolve => res.on('close', resolve));
if (CHROME) if (JUGGLER)
expect(dumpioData).toContain('DevTools listening on ws://');
else
expect(dumpioData).toContain('Juggler listening on ws://'); 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 }) => { it('should close the browser when the node process closes', async({ server }) => {
const {spawn, execSync} = require('child_process'); const {spawn, execSync} = require('child_process');
......
...@@ -73,6 +73,7 @@ module.exports.addTests = ({testRunner, product, puppeteerPath}) => { ...@@ -73,6 +73,7 @@ module.exports.addTests = ({testRunner, product, puppeteerPath}) => {
product, product,
FFOX, FFOX,
CHROME, CHROME,
JUGGLER,
puppeteer, puppeteer,
expect, expect,
defaultBrowserOptions, 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