48
48
#include " extensions/common/extension.h"
49
49
50
50
#include " net/cert/x509_certificate.h"
51
+ #include " net/cert/test_root_certs.h"
51
52
#include " net/url_request/url_request_context.h"
52
53
#include " sql/connection.h"
53
54
#include " sql/meta_table.h"
@@ -75,6 +76,7 @@ gfx::Image g_app_icon;
75
76
int g_cdt_process_id = -1 ;
76
77
std::string g_extension_id;
77
78
bool g_reloading_app = false ;
79
+ net::CertificateList trust_anchors;
78
80
79
81
#if defined(OS_WIN)
80
82
base::win::ScopedHICON g_window_hicon;
@@ -338,7 +340,6 @@ void MainPartsPreMainMessageLoopRunHook() {
338
340
nw::Package* package = nw::package ();
339
341
const base::ListValue *additional_trust_anchors = NULL ;
340
342
if (package->root ()->GetList (" additional_trust_anchors" , &additional_trust_anchors)) {
341
- net::CertificateList trust_anchors;
342
343
for (size_t i = 0 ; i<additional_trust_anchors->GetSize (); i++) {
343
344
std::string certificate_string;
344
345
if (!additional_trust_anchors->GetString (i, &certificate_string)) {
@@ -360,7 +361,13 @@ void MainPartsPreMainMessageLoopRunHook() {
360
361
trust_anchors.insert (trust_anchors.end (), loaded.begin (), loaded.end ());
361
362
}
362
363
if (!trust_anchors.empty ()) {
364
+ #if !defined(OS_MACOSX)
363
365
SetTrustAnchors (trust_anchors);
366
+ #else
367
+ net::TestRootCerts* certs = net::TestRootCerts::GetInstance ();
368
+ for (size_t i = 0 ; i < trust_anchors.size (); i++)
369
+ certs->Add (trust_anchors[i].get ());
370
+ #endif
364
371
}
365
372
}
366
373
}
0 commit comments