Skip to content

Commit

Permalink
fix: work around a null scoped_ptr dereference
Browse files Browse the repository at this point in the history
This seems to happen occasionally when running the test suite and
indicates that the callback's been already executed or reset. To
workaround, map a different callback which logs the certificate
verification response.
  • Loading branch information
richard-townsend-arm committed Jul 22, 2019
1 parent 5ccdb8c commit fc4f1b2
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions atom/browser/api/atom_api_session.cc
Original file line number Diff line number Diff line change
Expand Up @@ -508,11 +508,21 @@ void Session::DisableNetworkEmulation() {
network_emulation_token_, network::mojom::NetworkConditions::New());
}

void WrapVerifyProc(base::Callback<void(const VerifyRequestParams& request,
base::Callback<void(int)>)> proc,
const VerifyRequestParams& request,
base::OnceCallback<void(int)> cb) {
proc.Run(request, base::AdaptCallbackForRepeating(std::move(cb)));
void WrapVerifyProcNullCallback(int result) {
LOG(INFO) << "WrapVerifyProcNullCallback, result=" << result;
}

void WrapVerifyProc(
base::RepeatingCallback<void(const VerifyRequestParams& request,
base::RepeatingCallback<void(int)>)> proc,
const VerifyRequestParams& request,
base::OnceCallback<void(int)> cb) {
if (cb.is_null()) {
// Callback may have been reset.
proc.Run(request, base::BindRepeating(&WrapVerifyProcNullCallback));
} else {
proc.Run(request, base::AdaptCallbackForRepeating(std::move(cb)));
}
}

void Session::SetCertVerifyProc(v8::Local<v8::Value> val,
Expand Down

0 comments on commit fc4f1b2

Please sign in to comment.