fix: don't crash on invalid certs (#21976)
This commit is contained in:
parent
c29ec2d4cc
commit
45f30ead61
1 changed files with 7 additions and 4 deletions
|
@ -9,6 +9,7 @@
|
|||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "base/callback_helpers.h"
|
||||
#include "base/command_line.h"
|
||||
#include "base/environment.h"
|
||||
#include "base/files/file_path.h"
|
||||
|
@ -698,15 +699,17 @@ void App::AllowCertificateError(
|
|||
bool is_main_frame_request,
|
||||
bool strict_enforcement,
|
||||
base::OnceCallback<void(content::CertificateRequestResultType)> callback) {
|
||||
auto adapted_callback = base::AdaptCallbackForRepeating(std::move(callback));
|
||||
v8::Locker locker(isolate());
|
||||
v8::HandleScope handle_scope(isolate());
|
||||
bool prevent_default = Emit(
|
||||
"certificate-error", WebContents::FromOrCreate(isolate(), web_contents),
|
||||
request_url, net::ErrorToString(cert_error), ssl_info.cert, callback);
|
||||
bool prevent_default =
|
||||
Emit("certificate-error",
|
||||
WebContents::FromOrCreate(isolate(), web_contents), request_url,
|
||||
net::ErrorToString(cert_error), ssl_info.cert, adapted_callback);
|
||||
|
||||
// Deny the certificate by default.
|
||||
if (!prevent_default)
|
||||
std::move(callback).Run(content::CERTIFICATE_REQUEST_RESULT_TYPE_DENY);
|
||||
adapted_callback.Run(content::CERTIFICATE_REQUEST_RESULT_TYPE_DENY);
|
||||
}
|
||||
|
||||
base::OnceClosure App::SelectClientCertificate(
|
||||
|
|
Loading…
Reference in a new issue