feat(chromium): roll to r754895 (#1610)

This commit is contained in:
Pavel Feldman 2020-03-31 13:23:08 -07:00 committed by GitHub
parent 92c5ab3b7e
commit 307b33ab7d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 30 deletions

View File

@ -8,7 +8,7 @@
},
"main": "index.js",
"playwright": {
"chromium_revision": "751710",
"chromium_revision": "754895",
"firefox_revision": "1062",
"webkit_revision": "1184"
},

View File

@ -317,6 +317,13 @@ export class CRBrowserContext extends BrowserContextBase {
}
async addCookies(cookies: network.SetNetworkCookieParam[]) {
cookies = cookies.map(c => {
const copy = { ...c };
// Working around setter issue in Chrome. Cookies are now None by default.
if (copy.sameSite === 'None')
delete copy.sameSite;
return copy;
});
await this._browser._session.send('Storage.setCookies', { cookies: network.rewriteCookies(cookies), browserContextId: this._browserContextId || undefined });
}

View File

@ -421,11 +421,10 @@ module.exports.describe = function({testRunner, expect, browserType, defaultBrow
sameSite: 'None',
}]);
});
it('should set cookies from a frame', async({context, page, server}) => {
await page.goto(server.PREFIX + '/grid.html');
it('should set cookies for a frame', async({context, page, server}) => {
await page.goto(server.EMPTY_PAGE);
await context.addCookies([
{url: server.PREFIX, name: 'localhost-cookie', value: 'best'},
{url: server.CROSS_PROCESS_PREFIX, name: '127-cookie', value: 'worst'}
{url: server.PREFIX, name: 'frame-cookie', value: 'value'}
]);
await page.evaluate(src => {
let fulfill;
@ -435,32 +434,9 @@ module.exports.describe = function({testRunner, expect, browserType, defaultBrow
iframe.onload = fulfill;
iframe.src = src;
return promise;
}, server.CROSS_PROCESS_PREFIX);
}, server.PREFIX + '/grid.html');
expect(await page.evaluate('document.cookie')).toBe('localhost-cookie=best');
expect(await page.frames()[1].evaluate('document.cookie')).toBe('127-cookie=worst');
expect(await context.cookies(server.PREFIX)).toEqual([{
name: 'localhost-cookie',
value: 'best',
domain: 'localhost',
path: '/',
expires: -1,
httpOnly: false,
secure: false,
sameSite: 'None',
}]);
expect(await context.cookies(server.CROSS_PROCESS_PREFIX)).toEqual([{
name: '127-cookie',
value: 'worst',
domain: '127.0.0.1',
path: '/',
expires: -1,
httpOnly: false,
secure: false,
sameSite: 'None',
}]);
expect(await page.frames()[1].evaluate('document.cookie')).toBe('frame-cookie=value');
});
});