Skip to content

[Bug]: --disable-features in args replaces Playwright's own --disable-features list #43557

Closed as not planned

Description

@aik099

Version

1.64.1

Steps to reproduce

  1. Clone https://github.com/aik099/playwright-disable-features-repro
  2. npm install
  3. npx playwright install chromium
  4. npx playwright test

The same test runs in two projects. The only difference is launchOptions: { args: ['--disable-features=WebOTP'] } in the second one. It checks that a cross-site iframe still shares localStorage with its first-party site, which holds because Playwright disables ThirdPartyStoragePartitioning (#32230).

Expected behavior

Both projects pass. A user --disable-features adds to the features Playwright disables, the way ChromeDriver handles it: enable-features, disable-features, enable-blink-features and disable-blink-features (joined with ,) and js-flags (joined with a space) are treated as multi-valued, and every occurrence is merged, ChromeDriver's own defaults included (kMultivaluedSwitches / SetMultivaluedSwitch()).

Actual behavior

The with --disable-features=WebOTP project fails, because the iframe gets partitioned storage:

[with --disable-features=WebOTP] › tests/disable-features.spec.ts:5:5 › cross-site iframe shares storage with its first-party site
  Expected: "first-party value"
  Received: null

Chromium keeps only the last value of a repeated switch, and Playwright puts its own --disable-features=... from chromiumSwitches.ts before the user args. chrome://version shows both:

--disable-features=AvoidUnnecessaryBeforeUnloadCheckSync,DestroyProfileOnBrowserClose,...,msEdgeUpdateLaunchServicesPreferredVersion
--disable-features=WebOTP

so all 18 of Playwright's entries are dropped without a warning, including the redirect/interception workarounds (BlockOriginHeaderModificationOnRedirect, AvoidCorsURLLoaderRestartOnRedirect).

Additional context

The last-value-wins part on its own, with two features visible from JS ("OTPCredential" in window, "xr" in navigator):

args WebOTP WebXR
--disable-features=WebOTP off on
--disable-features=WebOTP, --disable-features=WebXR on off
--disable-features=WebOTP,WebXR off off

Same results with chromium-headless-shell and channel: 'chromium', on macOS and Linux arm64.

A merge would fit in chromium.ts, where the user args are appended (chromeArguments.push(...args)). The current workaround is to copy Playwright's list into your own --disable-features value and keep it in sync on every upgrade.

I'd like to work on this if the approach is OK.

Environment

System:
  OS: macOS 26.7
  CPU: arm64
Binaries:
  Node: 26.11.1
  npm: 11.20.0
npmPackages:
  @playwright/test: 1.64.1 => 1.64.1

Activity

  1. dcrousso commented on Oct 21, 2026

    @dcrousso
    Contributor

    Hi, the Playwright bot reviewed the 1.64.1 and current main source on my behalf.

    Automatic feature list merging needs an API design decision. Playwright appends custom args after its defaults, and Chromium uses the last occurrence of a switch. The args documentation warns that custom arguments can break Playwright functionality: https://playwright.dev/docs/api/class-browsertype#browser-type-launch-option-args.

    A custom --disable-features value therefore replaces the default list, including the storage partitioning workaround. ChromeDriver explicitly combines these values; Playwright currently does not. Changing that precedence would also affect configurations that replace defaults intentionally. The related feature options proposal, #36746, was closed without merging.

    This was a source review. No browser tests were run.

  2. aik099 commented on Oct 21, 2026

    @aik099
    Author

    Thanks for looking into it. Fair point that changing how args works could break setups that replace the defaults on purpose. I can't tell how many there are, but I agree it shouldn't change silently.

    It's easy to hit without knowing, though. Playwright PHP adds its own --disable-features=VizDisplayCompositor to args on every Chromium launch, so all of its users run without Playwright's defaults (playwright-php/playwright#190). The repro from this issue returns null there even without any extra args.

    --disable-features is just the most visible case. ChromeDriver merges the same way for all switches that hold a list: --enable-features, --disable-features, --enable-blink-features, --disable-blink-features (joined with ,) and --js-flags (joined with a space). Playwright's defaults already include --enable-features=CDPScreenshotNewSurface, so a user --enable-features drops that one too. And two of these switches in the user args themselves also keep only the last.

    A few options that leave args as it is:

    1. An opt-in flag that merges these five switches across the defaults and args, the way ChromeDriver does.
    2. Separate options that add to the defaults, like chromiumDisableFeatures / chromiumEnableFeatures from feat: chromium{Enable,Disable}Features launch options #36746, extended to the other switches. I asked there why it was closed.
    3. A warning when args replaces one of the default switches.
    4. A way to read the default args (Puppeteer has defaultArgs()), so the values can be merged by hand without copying them.

    I'm happy to work on whichever one you prefer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions