diff --git a/atom/browser/api/atom_api_cookies.cc b/atom/browser/api/atom_api_cookies.cc index 6ee15a6cba90..919a4bff6fe0 100644 --- a/atom/browser/api/atom_api_cookies.cc +++ b/atom/browser/api/atom_api_cookies.cc @@ -30,7 +30,7 @@ struct Converter { if (val == atom::api::Cookies::SUCCESS) return v8::Null(isolate); else - return v8::Exception::Error(StringToV8(isolate, "failed")); + return v8::Exception::Error(StringToV8(isolate, "Setting cookie failed")); } }; diff --git a/spec/api-session-spec.js b/spec/api-session-spec.js index 71a51e6759ea..44f8878dd7b9 100644 --- a/spec/api-session-spec.js +++ b/spec/api-session-spec.js @@ -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) { session.defaultSession.cookies.set({ url: url,