Skip to content

Commit

Permalink
fix: crash when loading extension with missing manifest (#34192)
Browse files Browse the repository at this point in the history
* fix: crash when loading extension missing manifest

* Update electron_paks.gni

Co-authored-by: Robo <hop2deep@gmail.com>

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: Robo <hop2deep@gmail.com>
  • Loading branch information
3 people committed May 13, 2022
1 parent b1ddee4 commit 8f0526f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions electron_paks.gni
Expand Up @@ -177,6 +177,7 @@ template("electron_paks") {
"${root_gen_dir}/components/strings/components_strings_",
"${root_gen_dir}/third_party/blink/public/strings/blink_strings_",
"${root_gen_dir}/device/bluetooth/strings/bluetooth_strings_",
"${root_gen_dir}/extensions/strings/extensions_strings_",
"${root_gen_dir}/services/strings/services_strings_",
"${root_gen_dir}/ui/strings/app_locale_settings_",
"${root_gen_dir}/ui/strings/ui_strings_",
Expand All @@ -185,6 +186,7 @@ template("electron_paks") {
"//chrome/app/resources:platform_locale_settings",
"//components/strings:components_strings",
"//device/bluetooth/strings",
"//extensions/strings",
"//services/strings",
"//third_party/blink/public/strings",
"//ui/strings:app_locale_settings",
Expand Down
6 changes: 6 additions & 0 deletions spec-main/extensions-spec.ts
Expand Up @@ -109,6 +109,12 @@ describe('chrome extensions', () => {
expect(bg).to.equal('red');
});

it('does not crash when loading an extension with missing manifest', async () => {
const customSession = session.fromPartition(`persist:${uuid.v4()}`);
const promise = customSession.loadExtension(path.join(fixtures, 'extensions', 'missing-manifest'));
await expect(promise).to.eventually.be.rejectedWith(/Manifest file is missing or unreadable/);
});

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'));
Expand Down
1 change: 1 addition & 0 deletions spec-main/fixtures/extensions/missing-manifest/main.js
@@ -0,0 +1 @@
console.log('oh no where is my manifest');

0 comments on commit 8f0526f

Please sign in to comment.