mirror of
https://github.com/electron/electron.git
synced 2026-05-02 03:00:22 -04:00
test: fix race in reentrant loadURL() ready-to-commit test (#51315)
test: fix race in reentrant loadURL() ready-to-commit test Fix 'fails if loadurl is called after the navigation is ready to commit' by using a done() callback to ensure the test waits for did-fail-load before exiting. Previously, the test would return and call afterEach(closeAllWindows), potentially destroying the window while navigation was in flight.
This commit is contained in:
@@ -558,9 +558,10 @@ describe('webContents module', () => {
|
||||
w.loadURL('data:text/html,<h1>HELLO</h1>');
|
||||
});
|
||||
|
||||
it('fails if loadurl is called after the navigation is ready to commit', () => {
|
||||
it('fails if loadurl is called after the navigation is ready to commit', (done) => {
|
||||
w.webContents.once('did-fail-load', (_event, _errorCode, _errorDescription, validatedURL) => {
|
||||
expect(validatedURL).to.contain('blank.html');
|
||||
done();
|
||||
});
|
||||
|
||||
// @ts-expect-error internal-only event.
|
||||
|
||||
Reference in New Issue
Block a user