Bug 1854580 - [wpt] Update test client to support "filter" argument for "storage.getCookies" command. r=webdriver-reviewers,jdescottes

Differential Revision: https://phabricator.services.mozilla.com/D199069
This commit is contained in:
Alexandra Borovova 2024-02-13 17:08:48 +00:00
Родитель a05f76918a
Коммит e7bf0a7791
1 изменённых файлов: 41 добавлений и 3 удалений

Просмотреть файл

@ -46,12 +46,50 @@ class PartialCookie(Dict[str, Any]):
PartitionDescriptor = Union[StorageKeyPartitionDescriptor, BrowsingContextPartitionDescriptor]
class Storage(BidiModule):
class CookieFilter(Dict[str, Any]):
def __init__(
self,
name: Optional[str] = None,
value: Optional[NetworkBytesValue] = None,
domain: Optional[str] = None,
path: Optional[str] = None,
http_only: Optional[bool] = None,
secure: Optional[bool] = None,
same_site: Optional[str] = None,
size: Optional[int] = None,
expiry: Optional[int] = None,
):
if name is not None:
self["name"] = name
if value is not None:
self["value"] = value
if domain is not None:
self["domain"] = domain
if path is not None:
self["path"] = path
if http_only is not None:
self["httpOnly"] = http_only
if secure is not None:
self["secure"] = secure
if same_site is not None:
self["sameSite"] = same_site
if size is not None:
self["size"] = size
if expiry is not None:
self["expiry"] = expiry
# TODO: extend with `filter`.
class Storage(BidiModule):
@command
def get_cookies(self, partition: Optional[PartitionDescriptor] = None) -> Mapping[str, Any]:
def get_cookies(
self,
filter: Optional[CookieFilter] = None,
partition: Optional[PartitionDescriptor] = None,
) -> Mapping[str, Any]:
params: MutableMapping[str, Any] = {}
if filter is not None:
params["filter"] = filter
if partition is not None:
params["partition"] = partition
return params