Skip to content

Commit d3c97a0

Browse files
committed
refactor: remove deprecated AdaptCallbackForRepeating from App::AllowCertificateError()
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2941842 is the commit that removes AdaptCallbackForRepeating Xref: 5853833 is the interim patch that restores AdaptCallbackForRepeating in Electron until all its uses can be removed.
1 parent a9ab934 commit d3c97a0

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

shell/browser/api/electron_api_app.cc

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -779,18 +779,19 @@ void App::AllowCertificateError(
779779
bool is_main_frame_request,
780780
bool strict_enforcement,
781781
base::OnceCallback<void(content::CertificateRequestResultType)> callback) {
782-
auto adapted_callback = base::AdaptCallbackForRepeating(std::move(callback));
783782
v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
784783
v8::Locker locker(isolate);
785784
v8::HandleScope handle_scope(isolate);
786-
bool prevent_default =
787-
Emit("certificate-error",
788-
WebContents::FromOrCreate(isolate, web_contents), request_url,
789-
net::ErrorToString(cert_error), ssl_info.cert, adapted_callback);
785+
auto callback_pair = base::SplitOnceCallback(std::move(callback));
786+
bool prevent_default = Emit("certificate-error",
787+
WebContents::FromOrCreate(isolate, web_contents),
788+
request_url, net::ErrorToString(cert_error),
789+
ssl_info.cert, std::move(callback_pair.first));
790790

791791
// Deny the certificate by default.
792792
if (!prevent_default)
793-
adapted_callback.Run(content::CERTIFICATE_REQUEST_RESULT_TYPE_DENY);
793+
std::move(callback_pair.second)
794+
.Run(content::CERTIFICATE_REQUEST_RESULT_TYPE_DENY);
794795
}
795796

796797
base::OnceClosure App::SelectClientCertificate(

0 commit comments

Comments
 (0)