Skip to content

Commit

Permalink
feat: add isMainFrame argument to 'certificate-error' event (#31038)
Browse files Browse the repository at this point in the history
Co-authored-by: Milan Burda <milan.burda@gmail.com>
  • Loading branch information
trop[bot] and miniak committed Sep 23, 2021
1 parent 6dbf0c5 commit 5219679
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions docs/api/app.md
Expand Up @@ -277,6 +277,7 @@ Returns:
* `certificate` [Certificate](structures/certificate.md)
* `callback` Function
* `isTrusted` Boolean - Whether to consider the certificate as trusted
* `isMainFrame` Boolean

Emitted when failed to verify the `certificate` for `url`, to trust the
certificate you should prevent the default behavior with
Expand Down
1 change: 1 addition & 0 deletions docs/api/web-contents.md
Expand Up @@ -530,6 +530,7 @@ Returns:
* `certificate` [Certificate](structures/certificate.md)
* `callback` Function
* `isTrusted` Boolean - Indicates whether the certificate can be considered trusted.
* `isMainFrame` Boolean

Emitted when failed to verify the `certificate` for `url`.

Expand Down
8 changes: 4 additions & 4 deletions shell/browser/api/electron_api_app.cc
Expand Up @@ -815,10 +815,10 @@ void App::AllowCertificateError(
v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
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, adapted_callback);
bool prevent_default = Emit(
"certificate-error", WebContents::FromOrCreate(isolate, web_contents),
request_url, net::ErrorToString(cert_error), ssl_info.cert,
adapted_callback, is_main_frame_request);

// Deny the certificate by default.
if (!prevent_default)
Expand Down

0 comments on commit 5219679

Please sign in to comment.