mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
chore: improve contents.takeHeapSnapshot error messages (#37460)
* chore: improve contents.takeHeapSnapshot error messages Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> * fix wstring conversion issue 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:
@@ -1812,8 +1812,24 @@ describe('webContents module', () => {
|
||||
|
||||
await w.loadURL('about:blank');
|
||||
|
||||
const promise = w.webContents.takeHeapSnapshot('');
|
||||
return expect(promise).to.be.eventually.rejectedWith(Error, 'takeHeapSnapshot failed');
|
||||
const badPath = path.join('i', 'am', 'a', 'super', 'bad', 'path');
|
||||
const promise = w.webContents.takeHeapSnapshot(badPath);
|
||||
return expect(promise).to.be.eventually.rejectedWith(Error, `Failed to take heap snapshot with invalid file path ${badPath}`);
|
||||
});
|
||||
|
||||
it('fails with invalid render process', async () => {
|
||||
const w = new BrowserWindow({
|
||||
show: false,
|
||||
webPreferences: {
|
||||
sandbox: true
|
||||
}
|
||||
});
|
||||
|
||||
const filePath = path.join(app.getPath('temp'), 'test.heapsnapshot');
|
||||
|
||||
w.webContents.destroy();
|
||||
const promise = w.webContents.takeHeapSnapshot(filePath);
|
||||
return expect(promise).to.be.eventually.rejectedWith(Error, 'Failed to take heap snapshot with nonexistent render frame');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user