fix: crash when loadExtension fails (#27561)

This commit is contained in:
Samuel Maddock 2021-02-02 05:20:05 -05:00 committed by GitHub
parent 20a71be849
commit b6df7cd327
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 15 deletions

View file

@ -107,6 +107,12 @@ describe('chrome extensions', () => {
expect(bg).to.equal('red');
});
it('does not crash when failing to load an extension', async () => {
const customSession = session.fromPartition(`persist:${uuid.v4()}`);
const promise = customSession.loadExtension(path.join(fixtures, 'extensions', 'load-error'));
await expect(promise).to.eventually.be.rejected();
});
it('serializes a loaded extension', async () => {
const extensionPath = path.join(fixtures, 'extensions', 'red-bg');
const manifest = JSON.parse(fs.readFileSync(path.join(extensionPath, 'manifest.json'), 'utf-8'));