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 <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "base/callback_helpers.h"
|
||||||
#include "base/command_line.h"
|
#include "base/command_line.h"
|
||||||
#include "base/environment.h"
|
#include "base/environment.h"
|
||||||
#include "base/files/file_path.h"
|
#include "base/files/file_path.h"
|
||||||
|
@ -698,15 +699,17 @@ void App::AllowCertificateError(
|
||||||
bool is_main_frame_request,
|
bool is_main_frame_request,
|
||||||
bool strict_enforcement,
|
bool strict_enforcement,
|
||||||
base::OnceCallback<void(content::CertificateRequestResultType)> callback) {
|
base::OnceCallback<void(content::CertificateRequestResultType)> callback) {
|
||||||
|
auto adapted_callback = base::AdaptCallbackForRepeating(std::move(callback));
|
||||||
v8::Locker locker(isolate());
|
v8::Locker locker(isolate());
|
||||||
v8::HandleScope handle_scope(isolate());
|
v8::HandleScope handle_scope(isolate());
|
||||||
bool prevent_default = Emit(
|
bool prevent_default =
|
||||||
"certificate-error", WebContents::FromOrCreate(isolate(), web_contents),
|
Emit("certificate-error",
|
||||||
request_url, net::ErrorToString(cert_error), ssl_info.cert, callback);
|
WebContents::FromOrCreate(isolate(), web_contents), request_url,
|
||||||
|
net::ErrorToString(cert_error), ssl_info.cert, adapted_callback);
|
||||||
|
|
||||||
// Deny the certificate by default.
|
// Deny the certificate by default.
|
||||||
if (!prevent_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(
|
base::OnceClosure App::SelectClientCertificate(
|
||||||
|
|
Loading…
Reference in a new issue