Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add isMainFrame argument to 'certificate-error' event #31038

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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