### 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:**
  * 9.1.1
  * 10.0.0-beta.4
* **Operating System:**
  * Linux x64

### Expected Behavior

Don't crash when `nodeIntegrationInWorker` is `true` and a service worker is being registered. :slightly_smiling_face:

### Actual Behavior

A crash occurs once the service worker is attempted to be registered (blank page, DevTools disconnects).

### To Reproduce

Attempt to register a service worker with `nodeIntegrationInWorker` set to `true`.

```sh
$ git clone https://github.com/lgrahl/electron-node-integration-service-worker-crash
$ npm install
$ npm start
```

Commit https://github.com/lgrahl/electron-node-integration-service-worker-crash/commit/97b14f2c599bfd25ce416b8a7ee91d9122bbfe2c
shell/browser/electron_browser_client.cc
content::RenderFrameHost* rfh) const {
  auto* web_contents = content::WebContents::FromRenderFrameHost(rfh);
  auto* web_preferences = WebContentsPreferences::From(web_contents);
  std::string affinity;
  if (web_preferences &&
      web_preferences->GetPreference("affinity", &affinity) &&
      !affinity.empty()) {
    affinity = base::ToLowerASCII(affinity);
  }
  return affinity;
}
content::SiteInstance* ElectronBrowserClient::GetSiteInstanceFromAffinity(
    content::BrowserContext* browser_context,
    const GURL& url,
    content::RenderFrameHost* rfh) const {
  std::string affinity = GetAffinityPreference(rfh);
  if (!affinity.empty()) {
    auto iter = site_per_affinities_.find(affinity);
    GURL dest_site = content::SiteInstance::GetSiteForURL(browser_context, url);
    if (iter != site_per_affinities_.end() &&
        IsSameWebSite(browser_context, iter->second, dest_site)) {
      return iter->second;
    }
  }
  return nullptr;
}
void ElectronBrowserClient::ConsiderSiteInstanceForAffinity(