Commit e3af0948 authored by Hitoshi Yoshida's avatar Hitoshi Yoshida Committed by Commit Bot

bindings: Set null values on nullable members of CookieListItem

CookieListItem is an IDL dictionary which is used as an output
parameter.
It has two nullable members, but their values were not set if
they were null.

This CL explicitly sets null values if it is expected.

Bug: 839389
Change-Id: I29b4bf81a3db72835617c16f7b3120c1d2be9409
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2269381
Auto-Submit: Hitoshi Yoshida <peria@chromium.org>
Commit-Queue: Ayu Ishii <ayui@chromium.org>
Reviewed-by: default avatarAyu Ishii <ayui@chromium.org>
Cr-Commit-Position: refs/heads/master@{#783037}
parent e1e075e8
...@@ -83,12 +83,18 @@ CookieListItem* CookieChangeEvent::ToCookieListItem( ...@@ -83,12 +83,18 @@ CookieListItem* CookieChangeEvent::ToCookieListItem(
// 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();
if (cookie_domain.StartsWith(".")) if (cookie_domain.StartsWith(".")) {
list_item->setDomain(cookie_domain.Substring(1)); list_item->setDomain(cookie_domain.Substring(1));
} else {
list_item->setDomain(String());
}
if (!is_deleted) { if (!is_deleted) {
list_item->setValue(canonical_cookie.Value()); list_item->setValue(canonical_cookie.Value());
if (!canonical_cookie.ExpiryDate().is_null()) { if (canonical_cookie.ExpiryDate().is_null()) {
// TODO(crbug.com/1070871): Use base::nullopt instead.
list_item->setExpiresToNull();
} else {
list_item->setExpires(ConvertSecondsToDOMTimeStamp( list_item->setExpires(ConvertSecondsToDOMTimeStamp(
canonical_cookie.ExpiryDate().ToDoubleT())); canonical_cookie.ExpiryDate().ToDoubleT()));
} }
......
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