Merge pull request #6282 from electron/cookie-set-failed-message

Mention setting cookie in failure message
This commit is contained in:
Kevin Sawicki 2016-06-29 09:46:02 -07:00 committed by GitHub
commit cde1254e29
2 changed files with 12 additions and 1 deletions

View file

@ -30,7 +30,7 @@ struct Converter<atom::api::Cookies::Error> {
if (val == atom::api::Cookies::SUCCESS) if (val == atom::api::Cookies::SUCCESS)
return v8::Null(isolate); return v8::Null(isolate);
else else
return v8::Exception::Error(StringToV8(isolate, "failed")); return v8::Exception::Error(StringToV8(isolate, "Setting cookie failed"));
} }
}; };

View file

@ -69,6 +69,17 @@ describe('session module', function () {
}) })
}) })
it('calls back with an error when setting a cookie with missing required fields', function (done) {
session.defaultSession.cookies.set({
url: '',
name: '1',
value: '1'
}, function (error) {
assert.equal(error.message, 'Setting cookie failed')
done()
})
})
it('should over-write the existent cookie', function (done) { it('should over-write the existent cookie', function (done) {
session.defaultSession.cookies.set({ session.defaultSession.cookies.set({
url: url, url: url,