feat: add isMainFrame argument to 'certificate-error' event (#30879)

This commit is contained in:
Milan Burda 2021-09-21 08:49:15 +02:00 committed by GitHub
parent e38a0a67c6
commit 92bff00d43
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 4 deletions

View file

@ -277,6 +277,7 @@ Returns:
* `certificate` [Certificate](structures/certificate.md) * `certificate` [Certificate](structures/certificate.md)
* `callback` Function * `callback` Function
* `isTrusted` Boolean - Whether to consider the certificate as trusted * `isTrusted` Boolean - Whether to consider the certificate as trusted
* `isMainFrame` Boolean
Emitted when failed to verify the `certificate` for `url`, to trust the Emitted when failed to verify the `certificate` for `url`, to trust the
certificate you should prevent the default behavior with certificate you should prevent the default behavior with

View file

@ -530,6 +530,7 @@ Returns:
* `certificate` [Certificate](structures/certificate.md) * `certificate` [Certificate](structures/certificate.md)
* `callback` Function * `callback` Function
* `isTrusted` Boolean - Indicates whether the certificate can be considered trusted. * `isTrusted` Boolean - Indicates whether the certificate can be considered trusted.
* `isMainFrame` Boolean
Emitted when failed to verify the `certificate` for `url`. Emitted when failed to verify the `certificate` for `url`.

View file

@ -817,10 +817,10 @@ void App::AllowCertificateError(
v8::Isolate* isolate = JavascriptEnvironment::GetIsolate(); v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
v8::Locker locker(isolate); v8::Locker locker(isolate);
v8::HandleScope handle_scope(isolate); v8::HandleScope handle_scope(isolate);
bool prevent_default = bool prevent_default = Emit(
Emit("certificate-error", "certificate-error", WebContents::FromOrCreate(isolate, web_contents),
WebContents::FromOrCreate(isolate, web_contents), request_url, request_url, net::ErrorToString(cert_error), ssl_info.cert,
net::ErrorToString(cert_error), ssl_info.cert, adapted_callback); adapted_callback, is_main_frame_request);
// Deny the certificate by default. // Deny the certificate by default.
if (!prevent_default) if (!prevent_default)