mozilla-shared-nss-db.patch
branchfirefox45
changeset 904 6a889427cd4f
parent 885 ee3c462047d5
child 916 2f9f2e040647
equal deleted inserted replaced
903:83801946c93f 904:6a889427cd4f
     5 References:
     5 References:
     6 
     6 
     7 diff --git a/configure.in b/configure.in
     7 diff --git a/configure.in b/configure.in
     8 --- a/configure.in
     8 --- a/configure.in
     9 +++ b/configure.in
     9 +++ b/configure.in
    10 @@ -8309,16 +8309,31 @@ if test "$MOZ_ENABLE_SKIA"; then
    10 @@ -8310,16 +8310,31 @@ if test "$MOZ_ENABLE_SKIA"; then
    11      AC_DEFINE(USE_SKIA_GPU)
    11      AC_DEFINE(USE_SKIA_GPU)
    12      AC_SUBST(MOZ_ENABLE_SKIA_GPU)
    12      AC_SUBST(MOZ_ENABLE_SKIA_GPU)
    13    fi
    13    fi
    14  fi
    14  fi
    15  AC_SUBST(MOZ_ENABLE_SKIA)
    15  AC_SUBST(MOZ_ENABLE_SKIA)
    40    AC_DEFINE(MOZ_XUL)
    40    AC_DEFINE(MOZ_XUL)
    41  else
    41  else
    42 diff --git a/security/manager/ssl/moz.build b/security/manager/ssl/moz.build
    42 diff --git a/security/manager/ssl/moz.build b/security/manager/ssl/moz.build
    43 --- a/security/manager/ssl/moz.build
    43 --- a/security/manager/ssl/moz.build
    44 +++ b/security/manager/ssl/moz.build
    44 +++ b/security/manager/ssl/moz.build
    45 @@ -156,16 +156,19 @@ FAIL_ON_WARNINGS = True
    45 @@ -160,16 +160,19 @@ UNIFIED_SOURCES += [
    46  FINAL_LIBRARY = 'xul'
    46  FINAL_LIBRARY = 'xul'
    47  
    47  
    48  LOCAL_INCLUDES += [
    48  LOCAL_INCLUDES += [
    49      '/dom/base',
    49      '/dom/base',
    50      '/security/certverifier',
    50      '/security/certverifier',
    52  ]
    52  ]
    53  
    53  
    54 +CXXFLAGS += sorted(CONFIG['NSSHELPER_CFLAGS'])
    54 +CXXFLAGS += sorted(CONFIG['NSSHELPER_CFLAGS'])
    55 +OS_LIBS += sorted(CONFIG['NSSHELPER_LIBS'])
    55 +OS_LIBS += sorted(CONFIG['NSSHELPER_LIBS'])
    56 +
    56 +
    57  GENERATED_INCLUDES += [
    57  LOCAL_INCLUDES += [
    58      '/dist/public/nss',
    58      '!/dist/public/nss',
    59  ]
    59  ]
    60  
    60  
    61  if CONFIG['NSS_DISABLE_DBM']:
    61  if CONFIG['NSS_DISABLE_DBM']:
    62      DEFINES['NSS_DISABLE_DBM'] = '1'
    62      DEFINES['NSS_DISABLE_DBM'] = '1'
    63  
    63  
    81 +
    81 +
    82  #include "nsNSSComponent.h"
    82  #include "nsNSSComponent.h"
    83  
    83  
    84  #include "ExtendedValidation.h"
    84  #include "ExtendedValidation.h"
    85  #include "NSSCertDBTrustDomain.h"
    85  #include "NSSCertDBTrustDomain.h"
    86  #include "mozilla/Telemetry.h"
    86  #include "SharedSSLState.h"
    87  #include "nsAppDirectoryServiceDefs.h"
    87  #include "mozilla/Preferences.h"
    88  #include "nsCertVerificationThread.h"
    88  #include "mozilla/PublicSSL.h"
    89  #include "nsAppDirectoryServiceDefs.h"
    89  #include "mozilla/Services.h"
    90 @@ -1015,17 +1022,31 @@ nsNSSComponent::InitializeNSS()
    90 @@ -1007,17 +1014,31 @@ nsNSSComponent::InitializeNSS()
    91      return NS_ERROR_NOT_AVAILABLE;
    91        return rv;
       
    92      }
    92    }
    93    }
    93  
    94    MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("inSafeMode: %u\n", inSafeMode));
    94    SECStatus init_rv = SECFailure;
       
    95    bool nocertdb = Preferences::GetBool("security.nocertdb", false);
       
    96  
    95  
    97    if (!nocertdb && !profileStr.IsEmpty()) {
    96    if (!nocertdb && !profileStr.IsEmpty()) {
    98      // First try to initialize the NSS DB in read/write mode.
    97      // First try to initialize the NSS DB in read/write mode.
       
    98      // Only load PKCS11 modules if we're not in safe mode.
    99 +#ifdef MOZ_ENABLE_NSSHELPER
    99 +#ifdef MOZ_ENABLE_NSSHELPER
   100 +    if (PR_GetEnv("MOZ_XRE_NO_NSSHELPER")) {
   100 +    if (PR_GetEnv("MOZ_XRE_NO_NSSHELPER")) {
   101 +      init_rv = ::mozilla::psm::InitializeNSS(profileStr.get(), false);
   101 +      init_rv = ::mozilla::psm::InitializeNSS(profileStr.get(), false, !inSafeMode);
   102 +    } else {
   102 +    } else {
   103 +      uint32_t flags = NSS_INIT_NOROOTINIT | NSS_INIT_OPTIMIZESPACE;
   103 +      uint32_t flags = NSS_INIT_NOROOTINIT | NSS_INIT_OPTIMIZESPACE;
   104 +      init_rv = ::nsshelp_open_db ("Firefox", profileStr.get(), flags);
   104 +      init_rv = ::nsshelp_open_db ("Firefox", profileStr.get(), flags);
   105 +
   105 +
   106 +      if (init_rv != SECSuccess) {
   106 +      if (init_rv != SECSuccess) {
   107 +        MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("can not init NSS using nsshelp_open_db in %s\n", profileStr.get()));
   107 +        MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("can not init NSS using nsshelp_open_db in %s\n", profileStr.get()));
   108 +        init_rv = ::mozilla::psm::InitializeNSS(profileStr.get(), false);
   108 +        init_rv = ::mozilla::psm::InitializeNSS(profileStr.get(), false, !inSafeMode);
   109 +      }
   109 +      }
   110 +    }
   110 +    }
   111 +#else
   111 +#else
   112      init_rv = ::mozilla::psm::InitializeNSS(profileStr.get(), false);
   112      init_rv = ::mozilla::psm::InitializeNSS(profileStr.get(), false, !inSafeMode);
   113 +#endif
   113 +#endif
   114      // If that fails, attempt read-only mode.
   114      // If that fails, attempt read-only mode.
   115      if (init_rv != SECSuccess) {
   115      if (init_rv != SECSuccess) {
   116        MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("could not init NSS r/w in %s\n", profileStr.get()));
   116        MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("could not init NSS r/w in %s\n", profileStr.get()));
   117        init_rv = ::mozilla::psm::InitializeNSS(profileStr.get(), true);
   117        init_rv = ::mozilla::psm::InitializeNSS(profileStr.get(), true, !inSafeMode);
   118      }
   118      }
   119      if (init_rv != SECSuccess) {
   119      if (init_rv != SECSuccess) {
   120        MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("could not init in r/o either\n"));
   120        MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("could not init in r/o either\n"));
   121      }
   121      }
   122 diff --git a/toolkit/library/moz.build b/toolkit/library/moz.build
   122 diff --git a/toolkit/library/moz.build b/toolkit/library/moz.build