Skip to content

Commit

Permalink
fix: use is_valid for cookie url validation (#18770) (#18843)
Browse files Browse the repository at this point in the history
Use is_valid instead of is_empty to validate url on cookies.set().
  • Loading branch information
codebytere committed Jun 18, 2019
1 parent 7748dec commit eb15be0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion atom/browser/api/atom_api_cookies.cc
Expand Up @@ -291,7 +291,7 @@ void SetCookieOnIO(scoped_refptr<net::URLRequestContextGetter> getter,
EXCLUDE_FAILURE_TO_STORE);
return;
}
if (url.is_empty()) {
if (!url.is_valid()) {
std::move(completion_callback)
.Run(net::CanonicalCookie::CookieInclusionStatus::
EXCLUDE_INVALID_DOMAIN);
Expand Down
2 changes: 1 addition & 1 deletion docs/api/cookies.md
Expand Up @@ -104,7 +104,7 @@ with `callback(error, cookies)` on complete.
#### `cookies.set(details)`

* `details` Object
* `url` String - The url to associate the cookie with.
* `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.
Expand Down

0 comments on commit eb15be0

Please sign in to comment.