Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

feat(firefox): process.env.PLAYWRIGHT_DISABLE_FIREFOX_CROSS_PROCESS (#18458)

Dmitry Gozman9cc5ca0cd4ad
diff --git a/packages/playwright-core/src/server/firefox/firefox.ts b/packages/playwright-core/src/server/firefox/firefox.ts
index c95605a9d4..8c31746813 100644
--- a/packages/playwright-core/src/server/firefox/firefox.ts
+++ b/packages/playwright-core/src/server/firefox/firefox.ts
@@ -26,7 +26,7 @@ import type { ConnectionTransport } from '../transport';
import type { BrowserOptions, PlaywrightOptions } from '../browser';
import type * as types from '../types';
import { rewriteErrorMessage } from '../../utils/stackTrace';
-import { wrapInASCIIBox } from '../../utils';
+import { getAsBooleanFromENV, wrapInASCIIBox } from '../../utils';
export class Firefox extends BrowserType {
constructor(playwrightOptions: PlaywrightOptions) {
@@ -61,7 +61,11 @@ 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');
- const firefoxUserPrefs = isPersistent ? undefined : { ...kBandaidFirefoxUserPrefs, ...options.firefoxUserPrefs };
+ 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))
@@ -90,3 +94,11 @@ export class Firefox extends BrowserType {
// 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,
+};