mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
feat(chromium): roll Chromium to r737027 (#5644)
This corresponds to Chromium 81.0.4044.0. This roll includes: - [DevTools] Add Cookie Priority support to CDP https://chromium-review.googlesource.com/c/chromium/src/+/1959029 - Reject cookies with empty names and values https://chromium-review.googlesource.com/c/chromium/src/+/1982549
This commit is contained in:
parent
c5df4902cb
commit
3387aab37f
@ -8,7 +8,7 @@
|
|||||||
"node": ">=10.18.1"
|
"node": ">=10.18.1"
|
||||||
},
|
},
|
||||||
"puppeteer": {
|
"puppeteer": {
|
||||||
"chromium_revision": "722234",
|
"chromium_revision": "737027",
|
||||||
"firefox_revision": "latest"
|
"firefox_revision": "latest"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
10
src/Page.js
10
src/Page.js
@ -375,9 +375,17 @@ class Page extends EventEmitter {
|
|||||||
* @return {!Promise<!Array<Network.Cookie>>}
|
* @return {!Promise<!Array<Network.Cookie>>}
|
||||||
*/
|
*/
|
||||||
async cookies(...urls) {
|
async cookies(...urls) {
|
||||||
return (await this._client.send('Network.getCookies', {
|
const originalCookies = (await this._client.send('Network.getCookies', {
|
||||||
urls: urls.length ? urls : [this.url()]
|
urls: urls.length ? urls : [this.url()]
|
||||||
})).cookies;
|
})).cookies;
|
||||||
|
|
||||||
|
const unsupportedCookieAttributes = ['priority'];
|
||||||
|
const filterUnsupportedAttributes = cookie => {
|
||||||
|
for (const attr of unsupportedCookieAttributes)
|
||||||
|
delete cookie[attr];
|
||||||
|
return cookie;
|
||||||
|
};
|
||||||
|
return originalCookies.map(filterUnsupportedAttributes);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -41,13 +41,13 @@ describe('Cookie specs', () => {
|
|||||||
size: 16,
|
size: 16,
|
||||||
httpOnly: false,
|
httpOnly: false,
|
||||||
secure: false,
|
secure: false,
|
||||||
session: true
|
session: true,
|
||||||
}]);
|
}]);
|
||||||
});
|
});
|
||||||
it('should properly report httpOnly cookie', async() => {
|
it('should properly report httpOnly cookie', async() => {
|
||||||
const {page, server} = getTestState();
|
const {page, server} = getTestState();
|
||||||
server.setRoute('/empty.html', (req, res) => {
|
server.setRoute('/empty.html', (req, res) => {
|
||||||
res.setHeader('Set-Cookie', ';HttpOnly; Path=/');
|
res.setHeader('Set-Cookie', 'a=b; HttpOnly; Path=/');
|
||||||
res.end();
|
res.end();
|
||||||
});
|
});
|
||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(server.EMPTY_PAGE);
|
||||||
@ -58,7 +58,7 @@ describe('Cookie specs', () => {
|
|||||||
it('should properly report "Strict" sameSite cookie', async() => {
|
it('should properly report "Strict" sameSite cookie', async() => {
|
||||||
const {page, server} = getTestState();
|
const {page, server} = getTestState();
|
||||||
server.setRoute('/empty.html', (req, res) => {
|
server.setRoute('/empty.html', (req, res) => {
|
||||||
res.setHeader('Set-Cookie', ';SameSite=Strict');
|
res.setHeader('Set-Cookie', 'a=b; SameSite=Strict');
|
||||||
res.end();
|
res.end();
|
||||||
});
|
});
|
||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(server.EMPTY_PAGE);
|
||||||
@ -69,7 +69,7 @@ describe('Cookie specs', () => {
|
|||||||
it('should properly report "Lax" sameSite cookie', async() => {
|
it('should properly report "Lax" sameSite cookie', async() => {
|
||||||
const {page, server} = getTestState();
|
const {page, server} = getTestState();
|
||||||
server.setRoute('/empty.html', (req, res) => {
|
server.setRoute('/empty.html', (req, res) => {
|
||||||
res.setHeader('Set-Cookie', ';SameSite=Lax');
|
res.setHeader('Set-Cookie', 'a=b; SameSite=Lax');
|
||||||
res.end();
|
res.end();
|
||||||
});
|
});
|
||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(server.EMPTY_PAGE);
|
||||||
@ -96,7 +96,7 @@ describe('Cookie specs', () => {
|
|||||||
size: 12,
|
size: 12,
|
||||||
httpOnly: false,
|
httpOnly: false,
|
||||||
secure: false,
|
secure: false,
|
||||||
session: true
|
session: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'username',
|
name: 'username',
|
||||||
@ -107,7 +107,7 @@ describe('Cookie specs', () => {
|
|||||||
size: 16,
|
size: 16,
|
||||||
httpOnly: false,
|
httpOnly: false,
|
||||||
secure: false,
|
secure: false,
|
||||||
session: true
|
session: true,
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
@ -137,7 +137,7 @@ describe('Cookie specs', () => {
|
|||||||
size: 11,
|
size: 11,
|
||||||
httpOnly: false,
|
httpOnly: false,
|
||||||
secure: true,
|
secure: true,
|
||||||
session: true
|
session: true,
|
||||||
}, {
|
}, {
|
||||||
name: 'doggo',
|
name: 'doggo',
|
||||||
value: 'woofs',
|
value: 'woofs',
|
||||||
@ -147,7 +147,7 @@ describe('Cookie specs', () => {
|
|||||||
size: 10,
|
size: 10,
|
||||||
httpOnly: false,
|
httpOnly: false,
|
||||||
secure: true,
|
secure: true,
|
||||||
session: true
|
session: true,
|
||||||
}]);
|
}]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -233,7 +233,7 @@ describe('Cookie specs', () => {
|
|||||||
size: 14,
|
size: 14,
|
||||||
httpOnly: false,
|
httpOnly: false,
|
||||||
secure: false,
|
secure: false,
|
||||||
session: true
|
session: true,
|
||||||
}]);
|
}]);
|
||||||
});
|
});
|
||||||
itFailsFirefox('should set a cookie with a path', async() => {
|
itFailsFirefox('should set a cookie with a path', async() => {
|
||||||
@ -254,7 +254,7 @@ describe('Cookie specs', () => {
|
|||||||
size: 14,
|
size: 14,
|
||||||
httpOnly: false,
|
httpOnly: false,
|
||||||
secure: false,
|
secure: false,
|
||||||
session: true
|
session: true,
|
||||||
}]);
|
}]);
|
||||||
expect(await page.evaluate('document.cookie')).toBe('gridcookie=GRID');
|
expect(await page.evaluate('document.cookie')).toBe('gridcookie=GRID');
|
||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(server.EMPTY_PAGE);
|
||||||
@ -350,7 +350,7 @@ describe('Cookie specs', () => {
|
|||||||
size: 18,
|
size: 18,
|
||||||
httpOnly: false,
|
httpOnly: false,
|
||||||
secure: true,
|
secure: true,
|
||||||
session: true
|
session: true,
|
||||||
}]);
|
}]);
|
||||||
});
|
});
|
||||||
itFailsFirefox('should set cookies from a frame', async() => {
|
itFailsFirefox('should set cookies from a frame', async() => {
|
||||||
@ -380,7 +380,7 @@ describe('Cookie specs', () => {
|
|||||||
size: 20,
|
size: 20,
|
||||||
httpOnly: false,
|
httpOnly: false,
|
||||||
secure: false,
|
secure: false,
|
||||||
session: true
|
session: true,
|
||||||
}]);
|
}]);
|
||||||
|
|
||||||
expect(await page.cookies(server.CROSS_PROCESS_PREFIX)).toEqual([{
|
expect(await page.cookies(server.CROSS_PROCESS_PREFIX)).toEqual([{
|
||||||
@ -392,7 +392,7 @@ describe('Cookie specs', () => {
|
|||||||
size: 15,
|
size: 15,
|
||||||
httpOnly: false,
|
httpOnly: false,
|
||||||
secure: false,
|
secure: false,
|
||||||
session: true
|
session: true,
|
||||||
}]);
|
}]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -35,7 +35,7 @@ describe('DefaultBrowserContext', function() {
|
|||||||
size: 16,
|
size: 16,
|
||||||
httpOnly: false,
|
httpOnly: false,
|
||||||
secure: false,
|
secure: false,
|
||||||
session: true
|
session: true,
|
||||||
}]);
|
}]);
|
||||||
});
|
});
|
||||||
itFailsFirefox('page.setCookie() should work', async() => {
|
itFailsFirefox('page.setCookie() should work', async() => {
|
||||||
@ -56,7 +56,7 @@ describe('DefaultBrowserContext', function() {
|
|||||||
size: 16,
|
size: 16,
|
||||||
httpOnly: false,
|
httpOnly: false,
|
||||||
secure: false,
|
secure: false,
|
||||||
session: true
|
session: true,
|
||||||
}]);
|
}]);
|
||||||
});
|
});
|
||||||
itFailsFirefox('page.deleteCookie() should work', async() => {
|
itFailsFirefox('page.deleteCookie() should work', async() => {
|
||||||
@ -82,7 +82,7 @@ describe('DefaultBrowserContext', function() {
|
|||||||
size: 8,
|
size: 8,
|
||||||
httpOnly: false,
|
httpOnly: false,
|
||||||
secure: false,
|
secure: false,
|
||||||
session: true
|
session: true,
|
||||||
}]);
|
}]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user