Re-enable cookie specs and add custom cookie name/url validation
This commit is contained in:
parent
c4f80a6d89
commit
8200a132be
2 changed files with 11 additions and 3 deletions
|
@ -231,7 +231,15 @@ void SetCookieOnIO(scoped_refptr<net::URLRequestContextGetter> getter,
|
||||||
last_access_time, secure, http_only,
|
last_access_time, secure, http_only,
|
||||||
net::CookieSameSite::DEFAULT_MODE, net::COOKIE_PRIORITY_DEFAULT));
|
net::CookieSameSite::DEFAULT_MODE, net::COOKIE_PRIORITY_DEFAULT));
|
||||||
auto completion_callback = base::BindOnce(OnSetCookie, callback);
|
auto completion_callback = base::BindOnce(OnSetCookie, callback);
|
||||||
if (!canonical_cookie) {
|
if (!canonical_cookie || !canonical_cookie->IsCanonical()) {
|
||||||
|
std::move(completion_callback).Run(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (url.empty()) {
|
||||||
|
std::move(completion_callback).Run(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (name.empty()) {
|
||||||
std::move(completion_callback).Run(false);
|
std::move(completion_callback).Run(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,13 +90,13 @@ describe('session module', () => {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
// TODO(alexeykuzmin): [Ch66] Fails. Fix it and enable back.
|
it('calls back with an error when setting a cookie with missing required fields', (done) => {
|
||||||
xit('calls back with an error when setting a cookie with missing required fields', (done) => {
|
|
||||||
session.defaultSession.cookies.set({
|
session.defaultSession.cookies.set({
|
||||||
url: '',
|
url: '',
|
||||||
name: '1',
|
name: '1',
|
||||||
value: '1'
|
value: '1'
|
||||||
}, (error) => {
|
}, (error) => {
|
||||||
|
assert(error, 'Should have an error')
|
||||||
assert.equal(error.message, 'Setting cookie failed')
|
assert.equal(error.message, 'Setting cookie failed')
|
||||||
done()
|
done()
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue