### Preflight Checklist

- [X] I have read the [Contributing Guidelines](https://github.com/electron/electron/blob/master/CONTRIBUTING.md) for this project.
- [X] I agree to follow the [Code of Conduct](https://github.com/electron/electron/blob/master/CODE_OF_CONDUCT.md) that this project adheres to.
- [X] I have searched the [issue tracker](https://www.github.com/electron/electron/issues) for a feature request that matches the one I want to file, without success.

### Problem Description

We need to load a custom error page when the certificate is invalid but without "isMainFrame" property we don't know when to load the custom error page using webContents.loadURL()

### Proposed Solution

webContents.on("certificate-error", ((event, url, error, certificate, callback, isMainFrame)

### Alternatives Considered

Not sure

### Additional Information

Not sure
shell/browser/api/electron_api_app.cc
use_post);
      if (!servers_mojo.has_value()) {
        servers_mojo = absl::make_optional<
            std::vector<network::mojom::DnsOverHttpsServerPtr>>();
      }
      network::mojom::DnsOverHttpsServerPtr server_mojo =
          network::mojom::DnsOverHttpsServer::New();
      server_mojo->server_template = std::string(server_template);
      server_mojo->use_post = use_post;
      servers_mojo->emplace_back(std::move(server_mojo));
    }
  }
  bool enable_built_in_resolver =
      base::FeatureList::IsEnabled(features::kAsyncDns);
  bool additional_dns_query_types_enabled = true;
  if (opts.Has("enableBuiltInResolver") &&
      !opts.Get("enableBuiltInResolver", &enable_built_in_resolver)) {
    thrower.ThrowTypeError("enableBuiltInResolver must be a boolean");
    return;
  }
  if (opts.Has("secureDnsMode") &&
      !opts.Get("secureDnsMode", &secure_dns_mode)) {
    thrower.ThrowTypeError(
        "secureDnsMode must be one of: off, automatic, secure");
    return;
  }
  std::vector<std::string> secure_dns_server_strings;
  if (opts.Has("secureDnsServers")) {
    if (!opts.Get("secureDnsServers", &secure_dns_server_strings)) {
      thrower.ThrowTypeError("secureDnsServers must be an array of strings");