Repository navigation
Description
Environment
- playwright-php/playwright: 1.5.0 (same on current
main) - PHP: 8.4
- Node.js: 22.14.0 (npm
playwright1.64.1) - Browser: chromium
How to reproduce
<?php
require __DIR__.'/vendor/autoload.php';
use Playwright\Network\RouteInterface;
use Playwright\PlaywrightFactory;
$playwright = PlaywrightFactory::create();
$browser = $playwright->chromium()->launch();
$page = $browser->newPage();
$page->route('https://a.test/', fn (RouteInterface $route) => $route->fulfill(['contentType' => 'text/html', 'body' => '<iframe src="https://b.test/"></iframe>']));
$page->route('https://b.test/', fn (RouteInterface $route) => $route->fulfill(['contentType' => 'text/html', 'body' => '<p>b</p>']));
$page->goto('https://b.test/');
$page->evaluate('() => localStorage.setItem("k", "first-party value")');
$page->goto('https://a.test/');
var_dump($page->frame(['url' => 'https://b.test/'])->evaluate('() => localStorage.getItem("k")'));
$browser->close();
$playwright->close();Expected behavior
string(17) "first-party value", the same as the equivalent script in Node.js Playwright, which disables ThirdPartyStoragePartitioning (microsoft/playwright#32230).
Actual behavior
NULL: the iframe gets partitioned storage.
Cause
buildLaunchOptions() in bin/playwright-server.js prepends --disable-features=VizDisplayCompositor to args for every Chromium launch. Node.js Playwright puts its own --disable-features=... before the user args, and Chromium keeps only the last value of a repeated switch, so Playwright's whole list is dropped. Their args docs warn that custom arguments can break Playwright, and microsoft/playwright#43557 covers this specific case.
What gets dropped, as of Playwright 1.64.1 (chromiumSwitches.ts):
| Feature | Why Playwright disables it |
|---|---|
AvoidUnnecessaryBeforeUnloadCheckSync |
microsoft/playwright#14047 |
DestroyProfileOnBrowserClose |
microsoft/playwright#14047 |
DialMediaRouteProvider |
microsoft/playwright#13854 |
GlobalMediaControls |
microsoft/playwright#13854 |
HttpsUpgrades |
microsoft/playwright#27605 |
LensOverlay |
Lens doesn't work in unofficial builds |
MediaRouter |
microsoft/playwright#8162 |
PaintHolding |
microsoft/playwright#28023 |
ThirdPartyStoragePartitioning |
microsoft/playwright#32230 |
BlockOriginHeaderModificationOnRedirect |
Chromium 149 rejects re-applying the origin header on a redirect during request interception, microsoft/playwright#41690 |
AvoidCorsURLLoaderRestartOnRedirect |
Chromium 155 aborts preflighted cross-origin redirects while interception is on, microsoft/playwright#43242 |
Translate |
microsoft/playwright#16126 |
AutoDeElevate |
https://issues.chromium.org/issues/435410220 |
OptimizationHints |
startup requests to Google |
NetworkTimeServiceQuerying |
startup requests to clients2.google.com |
AimEnabled |
startup requests to www.google.com |
msForceBrowserSignIn |
forced sign-in in Edge |
msEdgeUpdateLaunchServicesPreferredVersion |
Edge updating LaunchServices on macOS |
The same happens to any user --disable-features passed through withArgs().
Workaround
Until Playwright can merge these values (see the options in microsoft/playwright#43557), the bridge could pass Playwright's list together with its own:
'--disable-features=<Playwright list above>,VizDisplayCompositor',The list has to be updated whenever Playwright changes it. It may also be worth checking whether VizDisplayCompositor is still needed at all; without it, nothing would be dropped.
Activity
Preserve Playwright’s default Chromium feature flags (playwright-php#199