<!--  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 - 8.0.0-beta.2
* **Operating System:**
  * macOS 10.14.6, Windows 10
* **Last Known Working Electron version:**
  * 7.0.0-beta.3

### Expected Behavior
<!-- A clear and concise description of what you expected to happen. -->

According to the docs, one should be able to register a stream protocol handler which serves files from the file system.

The following code snippet is suggested by the [docs](https://electronjs.org/docs/api/protocol#protocolregisterstreamprotocolscheme-handler-completion):

```
const { protocol } = require('electron')
const fs = require('fs')

protocol.registerStreamProtocol('atom', (request, callback) => {
  callback(fs.createReadStream('index.html'))
}, (error) => {
  if (error) console.error('Failed to register protocol')
})
```

The expected behavior is that Electron should read from the stream and (assuming no read errors etc.) serve a valid response for the custom protocol request.

### Actual Behavior
<!-- A clear and concise description of what actually happened. -->

Starting with Electron 7.0.0-beta.4 it looks like the request sometimes randomly never completes on the Renderer side. This can be seen in the Network tab as well as by inspecting AJAX calls at runtime. The read stream seems to be created successfully, and the response starts to be sent back to the renderer, but the final state change never happens.

### To Reproduce

Run the following Fiddle to see the behavior change. In Electron < 7.0.0-beta4, the page can make an AJAX request to the custom scheme in a loop and print the contents. In Electron >= 7.0.0-beta4 the page can occasionally make a few AJAX requests, but it will eventually halt when one request never reaches a `XMLHttpRequest.DONE` state.

https://gist.github.com/33a9b357c606c7cbe7c2cac99bbda973

Good console output (7.0.0-beta3 and bellow) looks like:

```
index.html:22 ajaxStateChange readyState: 1 statusCode: 0
index.html:22 ajaxStateChange readyState: 2 statusCode: 200
index.html:22 ajaxStateChange readyState: 3 statusCode: 200
index.html:22 ajaxStateChange readyState: 4 statusCode: 200
index.html:25 // Just using this file as an example file to be served by the custom scheme handler
index.html:22 ajaxStateChange readyState: 1 statusCode: 0
index.html:22 ajaxStateChange readyState: 2 statusCode: 200
index.html:22 ajaxStateChange readyState: 3 statusCode: 200
index.html:22 ajaxStateChange readyState: 4 statusCode: 200
index.html:25 // Just using this file as an example file to be served by the custom scheme handler
index.html:22 ajaxStateChange readyState: 1 statusCode: 0
index.html:22 ajaxStateChange readyState: 2 statusCode: 200
index.html:22 ajaxStateChange readyState: 3 statusCode: 200
index.html:22 ajaxStateChange readyState: 4 statusCode: 200
index.html:25 // Just using this file as an example file to be served by the custom scheme handler
... and repeat
```

Bad console output (7.0.0-beta4+) looks like:

```
index.html:22 ajaxStateChange readyState: 1 statusCode: 0
index.html:22 ajaxStateChange readyState: 2 statusCode: 200
index.html:22 ajaxStateChange readyState: 3 statusCode: 200
index.html:22 ajaxStateChange readyState: 4 statusCode: 200
index.html:25 // Just using this file as an example file to be served by the custom scheme handler
index.html:22 ajaxStateChange readyState: 1 statusCode: 0
index.html:22 ajaxStateChange readyState: 2 statusCode: 200
index.html:22 ajaxStateChange readyState: 3 statusCode: 200
index.html:22 ajaxStateChange readyState: 4 statusCode: 200
index.html:25 // Just using this file as an example file to be served by the custom scheme handler
index.html:22 ajaxStateChange readyState: 1 statusCode: 0
index.html:22 ajaxStateChange readyState: 2 statusCode: 200
index.html:22 ajaxStateChange readyState: 3 statusCode: 200  <-- stop getting updates here
```

<!--
Your best chance of getting this bug looked at quickly is to provide an example.
-->

<!--
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. -->

Network info for request that completes successfully:

![image](https://user-images.githubusercontent.com/516559/68351335-01a82280-00b8-11ea-9d16-51cc280e15e9.png)

![image](https://user-images.githubusercontent.com/516559/68351572-b93d3480-00b8-11ea-8af2-2ae00808efe8.png)

![image](https://user-images.githubusercontent.com/516559/68351590-c78b5080-00b8-11ea-823b-25fc56969fb7.png)



Network info for request that never completes:

![image](https://user-images.githubusercontent.com/516559/68351323-f0f7ac80-00b7-11ea-9136-34c83afdd6ed.png)

![image](https://user-images.githubusercontent.com/516559/68351601-cd813180-00b8-11ea-9bd6-9a9d5360efeb.png)

![image](https://user-images.githubusercontent.com/516559/68351608-d2de7c00-00b8-11ea-865f-690108fbd187.png)



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

shell/browser/net/node_stream_loader.cc
v8::Locker locker(isolate_);
  v8::Isolate::Scope isolate_scope(isolate_);
  v8::HandleScope handle_scope(isolate_);
  
  for (const auto& it : handlers_) {
    v8::Local<v8::Value> args[] = {gin::StringToV8(isolate_, it.first),
                                   it.second.Get(isolate_)};
    node::MakeCallback(isolate_, emitter_.Get(isolate_), "removeListener",
                       node::arraysize(args), args, {0, 0});
  }
}
void NodeStreamLoader::Start(network::mojom::URLResponseHeadPtr head) {
  mojo::ScopedDataPipeProducerHandle producer;
  mojo::ScopedDataPipeConsumerHandle consumer;
  MojoResult rv = mojo::CreateDataPipe(nullptr, &producer, &consumer);
  if (rv != MOJO_RESULT_OK) {
    NotifyComplete(net::ERR_INSUFFICIENT_RESOURCES);
    return;
  }
  producer_ = std::make_unique<mojo::DataPipeProducer>(std::move(producer));
  client_->OnReceiveResponse(std::move(head));
  client_->OnStartLoadingResponseBody(std::move(consumer));
  auto weak = weak_factory_.GetWeakPtr();
  On("end",
     base::BindRepeating(&NodeStreamLoader::NotifyComplete, weak, net::OK));
  On("error", base::BindRepeating(&NodeStreamLoader::NotifyComplete, weak,
                                  net::ERR_FAILED));
  On("readable", base::BindRepeating(&NodeStreamLoader::NotifyReadable, weak));
}
void NodeStreamLoader::NotifyReadable() {