Commit 591882a6 authored by Hitoshi Yoshida's avatar Hitoshi Yoshida Committed by Commit Bot

bindings: Do not set an invalid value on CookieListItem.sameSite

"unspecified" is not a member of IDL enum 'CookieSameSite'.
Before this CL, the code set the invalid value on CookieListItem.
sameSite.

This CL fixes it, and leaves the dictionary member unset if
UNSPECIFIED was passed.

Bug: 839389
Change-Id: I61c01c6cd20990f9dd48456c7e50d06f7c93d385
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2210293
Commit-Queue: Hitoshi Yoshida <peria@chromium.org>
Commit-Queue: Victor Costan <pwnall@chromium.org>
Reviewed-by: default avatarVictor Costan <pwnall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#770982}
parent 43a9a951
...@@ -58,7 +58,7 @@ String ToCookieListItemSameSite(network::mojom::CookieSameSite same_site) { ...@@ -58,7 +58,7 @@ String ToCookieListItemSameSite(network::mojom::CookieSameSite same_site) {
case network::mojom::CookieSameSite::NO_RESTRICTION: case network::mojom::CookieSameSite::NO_RESTRICTION:
return "none"; return "none";
case network::mojom::CookieSameSite::UNSPECIFIED: case network::mojom::CookieSameSite::UNSPECIFIED:
return "unspecified"; return String();
} }
NOTREACHED(); NOTREACHED();
...@@ -75,7 +75,9 @@ CookieListItem* CookieChangeEvent::ToCookieListItem( ...@@ -75,7 +75,9 @@ CookieListItem* CookieChangeEvent::ToCookieListItem(
list_item->setName(canonical_cookie.Name()); list_item->setName(canonical_cookie.Name());
list_item->setPath(canonical_cookie.Path()); list_item->setPath(canonical_cookie.Path());
list_item->setSecure(canonical_cookie.IsSecure()); list_item->setSecure(canonical_cookie.IsSecure());
list_item->setSameSite(ToCookieListItemSameSite(canonical_cookie.SameSite())); auto&& same_site = ToCookieListItemSameSite(canonical_cookie.SameSite());
if (!same_site.IsNull())
list_item->setSameSite(same_site);
// The domain of host-only cookies is the host name, without a dot (.) prefix. // The domain of host-only cookies is the host name, without a dot (.) prefix.
String cookie_domain = canonical_cookie.Domain(); String cookie_domain = canonical_cookie.Domain();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment