fix: crash on netlog connection error (#44406)

* fix: crash on netlog connection error

* refactor: remove default PromiseBase constructor

* Revert "refactor: remove default PromiseBase constructor"

This reverts commit 9292324a0d5f9e63ba8f73f63dfff1d48eb2f38f.

* remove dcheck
This commit is contained in:
Sam Maddock 2024-10-28 05:24:54 -04:00 committed by GitHub
parent 57920e7747
commit 348801b20e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -166,6 +166,7 @@ void NetLog::StartNetLogAfterCreateFile(net::NetLogCaptureMode capture_mode,
std::move(*pending_start_promise_)
.RejectWithErrorMessage(
base::File::ErrorToString(output_file.error_details()));
pending_start_promise_.reset();
net_log_exporter_.reset();
return;
}
@ -178,6 +179,7 @@ void NetLog::StartNetLogAfterCreateFile(net::NetLogCaptureMode capture_mode,
void NetLog::NetLogStarted(int32_t error) {
DCHECK(pending_start_promise_);
ResolvePromiseWithNetError(std::move(*pending_start_promise_), error);
pending_start_promise_.reset();
}
void NetLog::OnConnectionError() {
@ -185,6 +187,7 @@ void NetLog::OnConnectionError() {
if (pending_start_promise_) {
std::move(*pending_start_promise_)
.RejectWithErrorMessage("Failed to start net log exporter");
pending_start_promise_.reset();
}
}