fix: crash when calling non-reentrant function in loadURL (#40143)

This commit is contained in:
Shelley Vohr 2023-10-10 12:46:04 +02:00 committed by GitHub
parent 563c370d51
commit 86df4db6f1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 2 deletions

View file

@ -431,6 +431,19 @@ describe('webContents module', () => {
}
});
it('fails if loadURL is called inside a non-reentrant critical section', (done) => {
w.webContents.once('did-fail-load', (_event, _errorCode, _errorDescription, validatedURL) => {
expect(validatedURL).to.contain('blank.html');
done();
});
w.webContents.once('did-start-loading', () => {
w.loadURL(`file://${fixturesPath}/pages/blank.html`);
});
w.loadURL('data:text/html,<h1>HELLO</h1>');
});
it('sets appropriate error information on rejection', async () => {
let err: any;
try {