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:
Andrey Lushnikov
2019-02-26 16:24:30 -08:00
committed by GitHub
parent 03d06f54d6
commit 9ef23b1754
6 changed files with 269 additions and 72 deletions

View File

@@ -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);