mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-11 12:33:45 +03:00
browser(firefox): roll Firefoxes (#22998)
Fixes https://github.com/microsoft/playwright/issues/15405 Fixes https://github.com/microsoft/playwright/issues/22618
This commit is contained in:
parent
ba0c4951c3
commit
eea7a8e638
@ -21,13 +21,13 @@
|
||||
},
|
||||
{
|
||||
"name": "firefox",
|
||||
"revision": "1406",
|
||||
"revision": "1408",
|
||||
"installByDefault": true,
|
||||
"browserVersion": "113.0"
|
||||
},
|
||||
{
|
||||
"name": "firefox-beta",
|
||||
"revision": "1408",
|
||||
"revision": "1410",
|
||||
"installByDefault": false,
|
||||
"browserVersion": "114.0b3"
|
||||
},
|
||||
|
@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
import { kBrowserClosedError } from '../../common/errors';
|
||||
import { assert } from '../../utils';
|
||||
import { assert, getAsBooleanFromENV } from '../../utils';
|
||||
import type { BrowserOptions } from '../browser';
|
||||
import { Browser } from '../browser';
|
||||
import { assertBrowserContextIsNotOwned, BrowserContext, verifyGeolocation } from '../browserContext';
|
||||
@ -41,8 +41,14 @@ export class FFBrowser extends Browser {
|
||||
const browser = new FFBrowser(connection, options);
|
||||
if ((options as any).__testHookOnConnectToBrowser)
|
||||
await (options as any).__testHookOnConnectToBrowser();
|
||||
let firefoxUserPrefs = options.persistent ? {} : options.originalLaunchOptions.firefoxUserPrefs ?? {};
|
||||
if (Object.keys(kBandaidFirefoxUserPrefs).length)
|
||||
firefoxUserPrefs = { ...kBandaidFirefoxUserPrefs, ...firefoxUserPrefs };
|
||||
const promises: Promise<any>[] = [
|
||||
connection.send('Browser.enable', { attachToDefaultContext: !!options.persistent }),
|
||||
connection.send('Browser.enable', {
|
||||
attachToDefaultContext: !!options.persistent,
|
||||
userPrefs: Object.entries(firefoxUserPrefs).map(([name, value]) => ({ name, value })),
|
||||
}),
|
||||
browser._initVersion(),
|
||||
];
|
||||
if (options.persistent) {
|
||||
@ -408,3 +414,8 @@ function toJugglerProxyOptions(proxy: types.ProxySettings) {
|
||||
password: proxy.password
|
||||
};
|
||||
}
|
||||
|
||||
// Prefs for quick fixes that didn't make it to the build.
|
||||
// Should all be moved to `playwright.cfg`.
|
||||
const kBandaidFirefoxUserPrefs = {};
|
||||
|
||||
|
@ -16,7 +16,6 @@
|
||||
*/
|
||||
|
||||
import * as os from 'os';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { FFBrowser } from './ffBrowser';
|
||||
import { kBrowserCloseMessageId } from './ffConnection';
|
||||
@ -26,7 +25,7 @@ import type { ConnectionTransport } from '../transport';
|
||||
import type { BrowserOptions, PlaywrightOptions } from '../browser';
|
||||
import type * as types from '../types';
|
||||
import { rewriteErrorMessage } from '../../utils/stackTrace';
|
||||
import { getAsBooleanFromENV, wrapInASCIIBox } from '../../utils';
|
||||
import { wrapInASCIIBox } from '../../utils';
|
||||
|
||||
export class Firefox extends BrowserType {
|
||||
constructor(playwrightOptions: PlaywrightOptions) {
|
||||
@ -67,17 +66,6 @@ export class Firefox extends BrowserType {
|
||||
throw new Error('Pass userDataDir parameter to `browserType.launchPersistentContext(userDataDir, ...)` instead of specifying --profile argument');
|
||||
if (args.find(arg => arg.startsWith('-juggler')))
|
||||
throw new Error('Use the port parameter instead of -juggler argument');
|
||||
let firefoxUserPrefs = isPersistent ? undefined : options.firefoxUserPrefs;
|
||||
if (getAsBooleanFromENV('PLAYWRIGHT_DISABLE_FIREFOX_CROSS_PROCESS'))
|
||||
firefoxUserPrefs = { ...kDisableFissionFirefoxUserPrefs, ...firefoxUserPrefs };
|
||||
if (Object.keys(kBandaidFirefoxUserPrefs).length)
|
||||
firefoxUserPrefs = { ...kBandaidFirefoxUserPrefs, ...firefoxUserPrefs };
|
||||
if (firefoxUserPrefs) {
|
||||
const lines: string[] = [];
|
||||
for (const [name, value] of Object.entries(firefoxUserPrefs))
|
||||
lines.push(`user_pref(${JSON.stringify(name)}, ${JSON.stringify(value)});`);
|
||||
fs.writeFileSync(path.join(userDataDir, 'user.js'), lines.join('\n'));
|
||||
}
|
||||
const firefoxArguments = ['-no-remote'];
|
||||
if (headless) {
|
||||
firefoxArguments.push('-headless');
|
||||
@ -96,14 +84,3 @@ export class Firefox extends BrowserType {
|
||||
}
|
||||
}
|
||||
|
||||
// Prefs for quick fixes that didn't make it to the build.
|
||||
// Should all be moved to `playwright.cfg`.
|
||||
const kBandaidFirefoxUserPrefs = {};
|
||||
|
||||
const kDisableFissionFirefoxUserPrefs = {
|
||||
'browser.tabs.remote.useCrossOriginEmbedderPolicy': false,
|
||||
'browser.tabs.remote.useCrossOriginOpenerPolicy': false,
|
||||
'browser.tabs.remote.separatePrivilegedMozillaWebContentProcess': false,
|
||||
'fission.autostart': false,
|
||||
'browser.tabs.remote.systemTriggeredAboutBlankAnywhere': true,
|
||||
};
|
||||
|
@ -8,6 +8,10 @@ export module Protocol {
|
||||
browserContextId?: string;
|
||||
openerId?: string;
|
||||
};
|
||||
export type UserPreference = {
|
||||
name: string;
|
||||
value: any;
|
||||
};
|
||||
export type CookieOptions = {
|
||||
name: string;
|
||||
value: string;
|
||||
@ -71,6 +75,10 @@ export module Protocol {
|
||||
}
|
||||
export type enableParameters = {
|
||||
attachToDefaultContext: boolean;
|
||||
userPrefs?: {
|
||||
name: string;
|
||||
value: any;
|
||||
}[];
|
||||
};
|
||||
export type enableReturnValue = void;
|
||||
export type createBrowserContextParameters = {
|
||||
|
@ -163,7 +163,6 @@ it.describe('screencast', () => {
|
||||
});
|
||||
|
||||
it('should work with old options', async ({ browser, browserName, trace, headless, isWindows }, testInfo) => {
|
||||
it.fixme(browserName === 'firefox' && !headless && isWindows, 'https://github.com/microsoft/playwright/issues/22618');
|
||||
const videosPath = testInfo.outputPath('');
|
||||
// Firefox does not have a mobile variant and has a large minimum size (500 on windows and 450 elsewhere).
|
||||
const size = browserName === 'firefox' ? { width: 500, height: 400 } : { width: 320, height: 240 };
|
||||
@ -188,7 +187,6 @@ it.describe('screencast', () => {
|
||||
});
|
||||
|
||||
it('should capture static page', async ({ browser, browserName, trace, headless, isWindows }, testInfo) => {
|
||||
it.fixme(browserName === 'firefox' && !headless && isWindows, 'https://github.com/microsoft/playwright/issues/22618');
|
||||
// Firefox does not have a mobile variant and has a large minimum size (500 on windows and 450 elsewhere).
|
||||
const size = browserName === 'firefox' ? { width: 500, height: 400 } : { width: 320, height: 240 };
|
||||
const context = await browser.newContext({
|
||||
|
Loading…
Reference in New Issue
Block a user