mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
fix: reparenting UAF crash on macOS (#38677)
* fix: reparenting UAF crash on macOS Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> * Update api-browser-window-spec.ts * Update api-browser-window-spec.ts --------- 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:
@@ -4267,6 +4267,21 @@ describe('BrowserWindow module', () => {
|
||||
expect(w.getChildWindows().length).to.equal(0);
|
||||
});
|
||||
|
||||
it('can handle child window close and reparent multiple times', async () => {
|
||||
const w = new BrowserWindow({ show: false });
|
||||
let c: BrowserWindow | null;
|
||||
|
||||
for (let i = 0; i < 5; i++) {
|
||||
c = new BrowserWindow({ show: false, parent: w });
|
||||
const closed = emittedOnce(c, 'closed');
|
||||
c.close();
|
||||
await closed;
|
||||
}
|
||||
|
||||
await delay();
|
||||
expect(w.getChildWindows().length).to.equal(0);
|
||||
});
|
||||
|
||||
ifit(process.platform === 'darwin')('child window matches visibility when visibility changes', async () => {
|
||||
const w = new BrowserWindow({ show: false });
|
||||
const c = new BrowserWindow({ show: false, parent: w });
|
||||
|
||||
Reference in New Issue
Block a user