From 677a040820c5d6dfa25563c062dc3aa33661c3ef Mon Sep 17 00:00:00 2001 From: Micha Hanselmann Date: Thu, 13 Jun 2019 10:21:01 -0700 Subject: [PATCH 1/3] is_empty -> is_valid --- atom/browser/api/atom_api_cookies.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/atom/browser/api/atom_api_cookies.cc b/atom/browser/api/atom_api_cookies.cc index bdcfb4cd261b8..710f697da7d26 100644 --- a/atom/browser/api/atom_api_cookies.cc +++ b/atom/browser/api/atom_api_cookies.cc @@ -258,7 +258,7 @@ v8::Local Cookies::Set(const base::DictionaryValue& details) { : base::Time::UnixEpoch(); GURL url(url_string ? *url_string : ""); - if (url.is_empty()) { + if (url.is_valid()) { promise.RejectWithErrorMessage(InclusionStatusToString( net::CanonicalCookie::CookieInclusionStatus::EXCLUDE_INVALID_DOMAIN)); return handle; From 92fa270e3a37455eb6db68ee545745901e9d1248 Mon Sep 17 00:00:00 2001 From: Micha Hanselmann Date: Thu, 13 Jun 2019 10:22:47 -0700 Subject: [PATCH 2/3] Make docs coherent with 5.x, see #18756 --- docs/api/cookies.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api/cookies.md b/docs/api/cookies.md index d56af39ced351..85ab55bd271b7 100644 --- a/docs/api/cookies.md +++ b/docs/api/cookies.md @@ -84,7 +84,7 @@ the response. #### `cookies.set(details)` * `details` Object - * `url` String - The url to associate the cookie with. An error is thrown if the url is invalid. + * `url` String - The url to associate the cookie with. The promise will be rejected if the url is invalid. * `name` String (optional) - The name of the cookie. Empty by default if omitted. * `value` String (optional) - The value of the cookie. Empty by default if omitted. * `domain` String (optional) - The domain of the cookie; this will be normalized with a preceding dot so that it's also valid for subdomains. Empty by default if omitted. From c3f302f9b146f8efd05d355b6e4c7c665861f888 Mon Sep 17 00:00:00 2001 From: Micha Hanselmann Date: Thu, 13 Jun 2019 16:30:14 -0700 Subject: [PATCH 3/3] Excuse my stupidity --- atom/browser/api/atom_api_cookies.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/atom/browser/api/atom_api_cookies.cc b/atom/browser/api/atom_api_cookies.cc index 710f697da7d26..bcdbceb31ec37 100644 --- a/atom/browser/api/atom_api_cookies.cc +++ b/atom/browser/api/atom_api_cookies.cc @@ -258,7 +258,7 @@ v8::Local Cookies::Set(const base::DictionaryValue& details) { : base::Time::UnixEpoch(); GURL url(url_string ? *url_string : ""); - if (url.is_valid()) { + if (!url.is_valid()) { promise.RejectWithErrorMessage(InclusionStatusToString( net::CanonicalCookie::CookieInclusionStatus::EXCLUDE_INVALID_DOMAIN)); return handle;