mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
fix: crash when dialog.showMessageBoxSync with missing buttons (#41043)
* fix: crash when dialog.showMessageBoxSync missing buttons Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> * chore: feedback from review Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> --------- 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:
@@ -146,6 +146,22 @@ describe('dialog module', () => {
|
||||
expect(result.response).to.equal(0);
|
||||
});
|
||||
|
||||
it('does not crash when there is a defaultId but no buttons', async () => {
|
||||
const controller = new AbortController();
|
||||
const signal = controller.signal;
|
||||
const w = new BrowserWindow();
|
||||
const p = dialog.showMessageBox(w, {
|
||||
signal,
|
||||
message: 'i am message',
|
||||
type: 'info',
|
||||
defaultId: 0,
|
||||
title: 'i am title'
|
||||
});
|
||||
controller.abort();
|
||||
const result = await p;
|
||||
expect(result.response).to.equal(0);
|
||||
});
|
||||
|
||||
it('cancels message box', async () => {
|
||||
const controller = new AbortController();
|
||||
const signal = controller.signal;
|
||||
|
||||
Reference in New Issue
Block a user