fix(firefox): isolate ignoreHTTPSErrors setting between contexts (#1617)

This commit is contained in:
Yury Semikhatsky 2020-04-01 12:59:48 -07:00 committed by GitHub
parent c2617c090a
commit c218d8c25f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 6 deletions

View File

@ -9,7 +9,7 @@
"main": "index.js", "main": "index.js",
"playwright": { "playwright": {
"chromium_revision": "754895", "chromium_revision": "754895",
"firefox_revision": "1062", "firefox_revision": "1067",
"webkit_revision": "1185" "webkit_revision": "1185"
}, },
"scripts": { "scripts": {

View File

@ -92,14 +92,12 @@ export class FFBrowser extends platform.EventEmitter implements Browser {
const { browserContextId } = await this._connection.send('Browser.createBrowserContext', { const { browserContextId } = await this._connection.send('Browser.createBrowserContext', {
userAgent: options.userAgent, userAgent: options.userAgent,
bypassCSP: options.bypassCSP, bypassCSP: options.bypassCSP,
ignoreHTTPSErrors: options.ignoreHTTPSErrors,
javaScriptDisabled: options.javaScriptEnabled === false ? true : undefined, javaScriptDisabled: options.javaScriptEnabled === false ? true : undefined,
viewport, viewport,
locale: options.locale, locale: options.locale,
removeOnDetach: true removeOnDetach: true
}); });
// TODO: move ignoreHTTPSErrors to browser context level.
if (options.ignoreHTTPSErrors)
await this._connection.send('Browser.setIgnoreHTTPSErrors', { enabled: true });
const context = new FFBrowserContext(this, browserContextId, options); const context = new FFBrowserContext(this, browserContextId, options);
await context._initialize(); await context._initialize();
this._contexts.set(browserContextId, context); this._contexts.set(browserContextId, context);

View File

@ -32,7 +32,7 @@ module.exports.describe = function({testRunner, expect, defaultBrowserOptions, p
expect(response.ok()).toBe(true); expect(response.ok()).toBe(true);
await context.close(); await context.close();
}); });
it.fail(FFOX)('should isolate contexts', async({browser, httpsServer}) => { it('should isolate contexts', async({browser, httpsServer}) => {
{ {
let error = null; let error = null;
const context = await browser.newContext({ ignoreHTTPSErrors: true }); const context = await browser.newContext({ ignoreHTTPSErrors: true });
@ -57,7 +57,7 @@ module.exports.describe = function({testRunner, expect, defaultBrowserOptions, p
}); });
const context = await browser.newContext({ ignoreHTTPSErrors: true }); const context = await browser.newContext({ ignoreHTTPSErrors: true });
const page = await context.newPage(); const page = await context.newPage();
await page.goto(httpsServer.PREFIX + '/mixedcontent.html', {waitUntil: 'load'}); await page.goto(httpsServer.PREFIX + '/mixedcontent.html', {waitUntil: 'domcontentloaded'});
expect(page.frames().length).toBe(2); expect(page.frames().length).toBe(2);
// Make sure blocked iframe has functional execution context // Make sure blocked iframe has functional execution context
// @see https://github.com/GoogleChrome/puppeteer/issues/2709 // @see https://github.com/GoogleChrome/puppeteer/issues/2709