This commit is contained in:
parent
487de33e4b
commit
a37f18c962
|
|
@ -68,7 +68,7 @@ export class Firefox extends BrowserType {
|
||||||
throw new Error('Pass userDataDir parameter to `browserType.launchPersistentContext(userDataDir, ...)` instead of specifying --profile argument');
|
throw new Error('Pass userDataDir parameter to `browserType.launchPersistentContext(userDataDir, ...)` instead of specifying --profile argument');
|
||||||
if (args.find(arg => arg.startsWith('-juggler')))
|
if (args.find(arg => arg.startsWith('-juggler')))
|
||||||
throw new Error('Use the port parameter instead of -juggler argument');
|
throw new Error('Use the port parameter instead of -juggler argument');
|
||||||
const firefoxUserPrefs = isPersistent ? undefined : options.firefoxUserPrefs;
|
const firefoxUserPrefs = isPersistent ? undefined : { ...kBandaidFirefoxUserPrefs, ...options.firefoxUserPrefs };
|
||||||
if (firefoxUserPrefs) {
|
if (firefoxUserPrefs) {
|
||||||
const lines: string[] = [];
|
const lines: string[] = [];
|
||||||
for (const [name, value] of Object.entries(firefoxUserPrefs))
|
for (const [name, value] of Object.entries(firefoxUserPrefs))
|
||||||
|
|
@ -92,3 +92,9 @@ export class Firefox extends BrowserType {
|
||||||
return firefoxArguments;
|
return firefoxArguments;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Prefs for quick fixes that didn't make it to the build.
|
||||||
|
// Should all be moved to `playwright.cfg`.
|
||||||
|
const kBandaidFirefoxUserPrefs = {
|
||||||
|
'network.cookie.cookieBehavior': 4,
|
||||||
|
};
|
||||||
|
|
|
||||||
|
|
@ -320,3 +320,32 @@ it('should add cookies with an expiration', async ({ context }) => {
|
||||||
expires: -42,
|
expires: -42,
|
||||||
}])).rejects.toThrow(/Cookie should have a valid expires/);
|
}])).rejects.toThrow(/Cookie should have a valid expires/);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should be able to send third party cookies via an iframe', async ({ browser, httpsServer, browserName, isMac }) => {
|
||||||
|
it.fixme(browserName === 'webkit' && isMac);
|
||||||
|
it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/16937' });
|
||||||
|
|
||||||
|
const context = await browser.newContext({
|
||||||
|
ignoreHTTPSErrors: true,
|
||||||
|
});
|
||||||
|
try {
|
||||||
|
const page = await context.newPage();
|
||||||
|
await page.goto(httpsServer.EMPTY_PAGE);
|
||||||
|
await context.addCookies([{
|
||||||
|
domain: new URL(httpsServer.CROSS_PROCESS_PREFIX).hostname,
|
||||||
|
path: '/',
|
||||||
|
name: 'cookie1',
|
||||||
|
value: 'yes',
|
||||||
|
httpOnly: true,
|
||||||
|
secure: true,
|
||||||
|
sameSite: 'None'
|
||||||
|
}]);
|
||||||
|
const [response] = await Promise.all([
|
||||||
|
httpsServer.waitForRequest('/grid.html'),
|
||||||
|
page.setContent(`<iframe src="${httpsServer.CROSS_PROCESS_PREFIX}/grid.html"></iframe>`)
|
||||||
|
]);
|
||||||
|
expect(response.headers['cookie']).toBe('cookie1=yes');
|
||||||
|
} finally {
|
||||||
|
await context.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue