mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
fix: properly bubble up cookie creation failure message (#37597)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
This commit is contained in:
@@ -846,6 +846,16 @@ describe('net module', () => {
|
||||
expect(cookies[0].name).to.equal('cookie2');
|
||||
});
|
||||
|
||||
it('throws when an invalid domain is passed', async () => {
|
||||
const sess = session.fromPartition(`cookie-tests-${Math.random()}`);
|
||||
|
||||
await expect(sess.cookies.set({
|
||||
url: 'https://electronjs.org',
|
||||
domain: 'wssss.iamabaddomain.fun',
|
||||
name: 'cookie1'
|
||||
})).to.eventually.be.rejectedWith(/Failed to set cookie with an invalid domain attribute/);
|
||||
});
|
||||
|
||||
it('should be able correctly filter out cookies that are session', async () => {
|
||||
const sess = session.fromPartition(`cookie-tests-${Math.random()}`);
|
||||
|
||||
|
||||
@@ -129,7 +129,7 @@ describe('session module', () => {
|
||||
|
||||
await expect(
|
||||
cookies.set({ url: '', name, value })
|
||||
).to.eventually.be.rejectedWith('Failed to get cookie domain');
|
||||
).to.eventually.be.rejectedWith('Failed to set cookie with an invalid domain attribute');
|
||||
});
|
||||
|
||||
it('yields an error when setting a cookie with an invalid URL', async () => {
|
||||
@@ -139,7 +139,7 @@ describe('session module', () => {
|
||||
|
||||
await expect(
|
||||
cookies.set({ url: 'asdf', name, value })
|
||||
).to.eventually.be.rejectedWith('Failed to get cookie domain');
|
||||
).to.eventually.be.rejectedWith('Failed to set cookie with an invalid domain attribute');
|
||||
});
|
||||
|
||||
it('should overwrite previous cookies', async () => {
|
||||
|
||||
Reference in New Issue
Block a user