Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use is_valid for cookie url validation #18770

Merged
merged 3 commits into from Jun 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion atom/browser/api/atom_api_cookies.cc
Expand Up @@ -258,7 +258,7 @@ v8::Local<v8::Promise> 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;
Expand Down
2 changes: 1 addition & 1 deletion docs/api/cookies.md
Expand Up @@ -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.
Expand Down