mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
feat(firefox): implement cookies api (#4076)
This patch implements `page.setCookie()`, `page.deleteCookie()` and `page.cookies()` and doubles the test coverage for cookies so that we can feel safer on cross-browser compatibility.
This commit is contained in:
10
lib/Page.js
10
lib/Page.js
@@ -388,14 +388,8 @@ class Page extends EventEmitter {
|
||||
const item = Object.assign({}, cookie);
|
||||
if (!item.url && startsWithHTTP)
|
||||
item.url = pageURL;
|
||||
assert(
|
||||
item.url !== 'about:blank',
|
||||
`Blank page can not have cookie "${item.name}"`
|
||||
);
|
||||
assert(
|
||||
!String.prototype.startsWith.call(item.url || '', 'data:'),
|
||||
`Data URL page can not have cookie "${item.name}"`
|
||||
);
|
||||
assert(item.url !== 'about:blank', `Blank page can not have cookie "${item.name}"`);
|
||||
assert(!String.prototype.startsWith.call(item.url || '', 'data:'), `Data URL page can not have cookie "${item.name}"`);
|
||||
return item;
|
||||
});
|
||||
await this.deleteCookie(...items);
|
||||
|
||||
Reference in New Issue
Block a user