diff --git a/atom/browser/api/atom_api_cookies.cc b/atom/browser/api/atom_api_cookies.cc index bdcfb4cd261b..bcdbceb31ec3 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; diff --git a/docs/api/cookies.md b/docs/api/cookies.md index d56af39ced35..85ab55bd271b 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.