cherry-pick(#31958): fix(ui): only populate settings once (#31963)

Cherry-picks https://github.com/microsoft/playwright/pull/31958 into the
release.
This commit is contained in:
Simon Knott 2024-08-01 18:28:40 +02:00 committed by GitHub
parent 876e0e4ba9
commit b20e154902
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -90,6 +90,8 @@ export async function syncLocalStorageWithSettings(page: Page, appName: string)
// iframes w/ snapshots, etc.
if (location && location.protocol === 'data:')
return;
if (window.top !== window)
return;
Object.entries(settings).map(([k, v]) => localStorage[k] = v);
(window as any).saveSettings = () => {
(window as any)._saveSerializedSettings(JSON.stringify({ ...localStorage }));