<!--  As an open source project with a dedicated but small maintainer team, it can sometimes take a long time for issues to be addressed so please be patient and we will get back to you as soon as we can.
-->

### Preflight Checklist
<!-- Please ensure you've completed the following steps by replacing [ ] with [x]-->

* [x] I have read the [Contributing Guidelines](https://github.com/electron/electron/blob/master/CONTRIBUTING.md) for this project.
* [x] I agree to follow the [Code of Conduct](https://github.com/electron/electron/blob/master/CODE_OF_CONDUCT.md) that this project adheres to.
* [x] I have searched the issue tracker for an issue that matches the one I want to file, without success.

### Issue Details

* **Electron Version:**
  * 10.0.0 and above
* **Operating System:**
  * Pop_OS 20.04, Debian 10
* **Last Known Working Electron version:**
  * 9.2.1

### Expected Behavior

`process.exit(code)` exits the process with exit code `code`.

### Actual Behavior

After updating to Electron 10.0.0, `process.exit(0)` sporadically results in an error that looks like this:

```
undefined:0


illegal access
(Use `node --trace-uncaught ...` to show where the exception was thrown)
```

The process then exits with exit code `7`.

Passing `--trace-uncaught` to `electron` seems to have no effect on the output.

### To Reproduce

You can see this error popping up in the status checks on our Electron 10 upgrade PR: https://github.com/cypress-io/cypress/pull/8406

I attempted to make a reproducible example for this, but couldn't reproduce it outside of Cypress's tests.

To reproduce using Cypress's tests:

1. Clone Cypress, check out the Electron 10 branch, install dependencies:
	```
	git clone https://github.com/cypress-io/cypress.git
	cd cypress
	git checkout renovate/electron-10.x
	yarn
	```
2. Open `packages/server/test/e2e/1_deprecated_spec.ts` and add a `.only` to the `e2e.it` on line 22, so it reads:
	```
	e2e.it.only('push and no return - warns user exactly once', {
	```
3. Run the test until it fails:
	```
	cd packages/server
	# run this until it fails:
	yarn test-e2e 1_dep --browser electron
	# if you're using zsh, this will do the trick:
    while yarn test-e2e 1_dep --browser electron; do echo 'passed'; done
	```

You should see the test fail about 1/3 of the time with exit code `7` and the error mentioned above.

You can enable Cypress's debug logging by setting env var `DEBUG=cypress:*`, from which you can see that the last thing that happens before the crash is a call to `process.exit(0)`.

---

This is blocking us from upgrading to Electron 10, so please let me know if there is a way I can investigate further, or if I can provide any additional information to help debug.

shell/common/gin_converters/content_converter.cc
v8::Isolate* isolate,
    const ContextMenuParamsWithWebContents& val) {
  const auto& params = val.first;
  gin_helper::Dictionary dict = gin::Dictionary::CreateEmpty(isolate);
  dict.Set("x", params.x);
  dict.Set("y", params.y);
  dict.Set("linkURL", params.link_url);
  dict.Set("linkText", params.link_text);
  dict.Set("pageURL", params.page_url);
  dict.Set("frameURL", params.frame_url);
  dict.Set("srcURL", params.src_url);
  dict.Set("mediaType", params.media_type);
  dict.Set("mediaFlags", MediaFlagsToV8(isolate, params.media_flags));
  bool has_image_contents =
      (params.media_type == blink::ContextMenuDataMediaType::kImage) &&
      params.has_image_contents;
  dict.Set("hasImageContents", has_image_contents);