<!--  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:** 
  * 7.0.0-beta.4
* **Operating System:** 
  * macOS 10.14.6
* **Last Known Working Electron version:** 
  * NA

### Expected Behavior
Serve up a simple html page inside an iframe using a custom protocol (`test-scheme` in this example). The html page should be able to register a service worker to handle requests

Here's the example main process code:

```js
protocol.registerSchemesAsPrivileged([
  { scheme: 'test-scheme', privileges: { allowServiceWorkers: true, standard: true, secure: true } }
]);
```

```js
 protocol.registerStringProtocol('test-scheme, (request, cb) => {
    cb({
      mimeType: 'text/html',
      charset: 'utf-8',
      data: `<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
    <title>Heey World!</title>
  </head>
  <body>
    Hello iframe!
    <script>
      window.navigator.serviceWorker.register('service-worker.js', {scope: './'}).then(function(registration) {
        console.log('All good')
      })
    </script>
  </body>
</html>`
    })
  });
```

### Actual Behavior
The service worker cannot be registered. In the dev tools console, I see the error: 

```
DOMException: Failed to register a ServiceWorker: The document is in an invalid state.
```

### To Reproduce
Use the electron fiddle: https://gist.github.com/98ead2337cf17febffa64f731a8cc3e8

Look at the devtools output to see the errors

<!--
For bugs that can be encapsulated in a small experiment, you can use Electron Fiddle (https://github.com/electron/fiddle) to publish your example to a GitHub Gist and link it your bug report.
-->

<!--
If Fiddle is insufficient to produce an example, please provide an example REPOSITORY that can be cloned and run. You can fork electron-quick-start (https://github.com/electron/electron-quick-start) and include a link to the branch with your changes.
-->

<!--
If you provide a URL, please list the commands required to clone/setup/run your repo e.g.
```sh
$ git clone $YOUR_URL -b $BRANCH
$ npm install
$ npm start || electron .
```
-->

### Screenshots
<!-- If applicable, add screenshots to help explain your problem. -->

### Additional Information
<!-- Add any other context about the problem here. -->


/cc @deepak1556 - This is blocks migrating VS Code to use normal iframes for its webviews
shell/browser/electron_browser_client.cc
base::StringPiece scheme,
    bool is_embedded_origin_secure) {
  if (is_embedded_origin_secure && scheme == content::kChromeUIScheme)
    return true;
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
  return scheme == extensions::kExtensionScheme;
#else
  return false;
#endif
}
bool ElectronBrowserClient::WillInterceptWebSocket(