From 4f3d3557cc244741340f12684c06d91ea5a9488b Mon Sep 17 00:00:00 2001 From: joshaber Date: Fri, 31 Mar 2017 21:51:29 -0400 Subject: [PATCH] Notify that the cert changed --- .../browser/api/atom_api_certificate_trust_mac.mm | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/atom/browser/api/atom_api_certificate_trust_mac.mm b/atom/browser/api/atom_api_certificate_trust_mac.mm index dc12ada27f84..5057ef55ab51 100644 --- a/atom/browser/api/atom_api_certificate_trust_mac.mm +++ b/atom/browser/api/atom_api_certificate_trust_mac.mm @@ -15,6 +15,7 @@ #include "base/mac/scoped_cftyperef.h" #include "base/strings/sys_string_conversions.h" #include "net/cert/x509_certificate.h" +#include "net/cert/cert_database.h" namespace atom { @@ -29,14 +30,20 @@ void ShowCertificateTrustUI(atom::NativeWindow* parent_window, SecTrustCreateWithCertificates(cert->CreateOSCertChainForCert(), sec_policy, &trust); // CFRelease(sec_policy); - NSWindow* window = parent_window ? - parent_window->GetNativeWindow() : - NULL; + // NSWindow* window = parent_window ? + // parent_window->GetNativeWindow() : + // NULL; auto msg = base::SysUTF8ToNSString(message); SFCertificateTrustPanel *panel = [[SFCertificateTrustPanel alloc] init]; - [panel beginSheetForWindow:window modalDelegate:nil didEndSelector:NULL contextInfo:NULL trust:trust message:msg]; + [panel runModalForTrust:trust message:msg]; + // [panel beginSheetForWindow:window modalDelegate:nil didEndSelector:NULL contextInfo:NULL trust:trust message:msg]; + + auto cert_db = net::CertDatabase::GetInstance(); + // This forces Chromium to reload the certificate since it might be trusted + // now. + cert_db->NotifyObserversCertDBChanged(cert.get()); callback.Run(true); // CFRelease(trust);