diff options
author | Matt A. Tobin <email@mattatobin.com> | 2020-02-28 16:51:00 -0500 |
---|---|---|
committer | wolfbeast <mcwerewolf@wolfbeast.com> | 2020-04-14 13:01:34 +0200 |
commit | 3ed2b7a7cccea0527dc77c30708db8a3ef8359cb (patch) | |
tree | 473f63ecf48f1a880c344eca3d8c41e09dd2d4e3 /security | |
parent | 9816a810e6197aaaf549e4fe04e77cd2a9d2e865 (diff) | |
download | UXP-3ed2b7a7cccea0527dc77c30708db8a3ef8359cb.tar UXP-3ed2b7a7cccea0527dc77c30708db8a3ef8359cb.tar.gz UXP-3ed2b7a7cccea0527dc77c30708db8a3ef8359cb.tar.lz UXP-3ed2b7a7cccea0527dc77c30708db8a3ef8359cb.tar.xz UXP-3ed2b7a7cccea0527dc77c30708db8a3ef8359cb.zip |
Issue #1053 - Remove android support from nsNSSComponent.cpp
Diffstat (limited to 'security')
-rw-r--r-- | security/manager/ssl/nsNSSComponent.cpp | 78 |
1 files changed, 17 insertions, 61 deletions
diff --git a/security/manager/ssl/nsNSSComponent.cpp b/security/manager/ssl/nsNSSComponent.cpp index 4d6c3963f..dfff59da9 100644 --- a/security/manager/ssl/nsNSSComponent.cpp +++ b/security/manager/ssl/nsNSSComponent.cpp @@ -1267,26 +1267,19 @@ nsNSSComponent::InitializePIPNSSBundle() nsresult rv; nsCOMPtr<nsIStringBundleService> bundleService(do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv)); -#ifdef ANDROID - MOZ_RELEASE_ASSERT(NS_SUCCEEDED(rv)); - MOZ_RELEASE_ASSERT(bundleService); -#endif + if (NS_FAILED(rv) || !bundleService) return NS_ERROR_FAILURE; bundleService->CreateBundle("chrome://pipnss/locale/pipnss.properties", getter_AddRefs(mPIPNSSBundle)); -#ifdef ANDROID - MOZ_RELEASE_ASSERT(mPIPNSSBundle); -#endif + if (!mPIPNSSBundle) rv = NS_ERROR_FAILURE; bundleService->CreateBundle("chrome://pipnss/locale/nsserrors.properties", getter_AddRefs(mNSSErrorsBundle)); -#ifdef ANDROID - MOZ_RELEASE_ASSERT(mNSSErrorsBundle); -#endif + if (!mNSSErrorsBundle) rv = NS_ERROR_FAILURE; @@ -1488,9 +1481,7 @@ CipherSuiteChangeObserver::StartObserve() if (!sObserver) { RefPtr<CipherSuiteChangeObserver> observer = new CipherSuiteChangeObserver(); nsresult rv = Preferences::AddStrongObserver(observer.get(), "security."); -#ifdef ANDROID - MOZ_RELEASE_ASSERT(NS_SUCCEEDED(rv)); -#endif + if (NS_FAILED(rv)) { sObserver = nullptr; return rv; @@ -1724,9 +1715,7 @@ GetNSSProfilePath(nsAutoCString& aProfilePath) #else rv = profileFile->GetNativePath(aProfilePath); #endif -#ifdef ANDROID - MOZ_RELEASE_ASSERT(NS_SUCCEEDED(rv)); -#endif + if (NS_FAILED(rv)) { MOZ_LOG(gPIPNSSLog, LogLevel::Error, ("Could not get native path for profile directory.\n")); @@ -1754,9 +1743,6 @@ nsNSSComponent::InitializeNSS() MutexAutoLock lock(mutex); -#ifdef ANDROID - MOZ_RELEASE_ASSERT(!mNSSInitialized); -#endif if (mNSSInitialized) { // We should never try to initialize NSS more than once in a process. MOZ_ASSERT_UNREACHABLE("Trying to initialize NSS twice"); @@ -1775,9 +1761,7 @@ nsNSSComponent::InitializeNSS() nsAutoCString profileStr; nsresult rv = GetNSSProfilePath(profileStr); -#ifdef ANDROID - MOZ_RELEASE_ASSERT(NS_SUCCEEDED(rv)); -#endif + if (NS_FAILED(rv)) { return NS_ERROR_NOT_AVAILABLE; } @@ -1791,9 +1775,7 @@ nsNSSComponent::InitializeNSS() // modules will be loaded). if (runtime) { rv = runtime->GetInSafeMode(&inSafeMode); -#ifdef ANDROID - MOZ_RELEASE_ASSERT(NS_SUCCEEDED(rv)); -#endif + if (NS_FAILED(rv)) { return rv; } @@ -1818,14 +1800,9 @@ nsNSSComponent::InitializeNSS() // pref has been set to "true", attempt to initialize with no DB. if (nocertdb || init_rv != SECSuccess) { init_rv = NSS_NoDB_Init(nullptr); -#ifdef ANDROID - MOZ_RELEASE_ASSERT(init_rv == SECSuccess); -#endif } + if (init_rv != SECSuccess) { -#ifdef ANDROID - MOZ_RELEASE_ASSERT(false); -#endif MOZ_LOG(gPIPNSSLog, LogLevel::Error, ("could not initialize NSS - panicking\n")); return NS_ERROR_NOT_AVAILABLE; } @@ -1847,9 +1824,7 @@ nsNSSComponent::InitializeNSS() SSL_OptionSetDefault(SSL_V2_COMPATIBLE_HELLO, false); rv = setEnabledTLSVersions(); -#ifdef ANDROID - MOZ_RELEASE_ASSERT(NS_SUCCEEDED(rv)); -#endif + if (NS_FAILED(rv)) { return NS_ERROR_UNEXPECTED; } @@ -1858,9 +1833,7 @@ nsNSSComponent::InitializeNSS() LoadLoadableRoots(); rv = LoadExtendedValidationInfo(); -#ifdef ANDROID - MOZ_RELEASE_ASSERT(NS_SUCCEEDED(rv)); -#endif + if (NS_FAILED(rv)) { MOZ_LOG(gPIPNSSLog, LogLevel::Error, ("failed to load EV info")); return rv; @@ -1900,18 +1873,14 @@ nsNSSComponent::InitializeNSS() ENABLED_0RTT_DATA_DEFAULT)); if (NS_FAILED(InitializeCipherSuite())) { -#ifdef ANDROID - MOZ_RELEASE_ASSERT(false); -#endif + MOZ_LOG(gPIPNSSLog, LogLevel::Error, ("Unable to initialize cipher suite settings\n")); return NS_ERROR_FAILURE; } // ensure the CertBlocklist is initialised nsCOMPtr<nsICertBlocklist> certList = do_GetService(NS_CERTBLOCKLIST_CONTRACTID); -#ifdef ANDROID - MOZ_RELEASE_ASSERT(certList); -#endif + if (!certList) { return NS_ERROR_FAILURE; } @@ -1928,9 +1897,7 @@ nsNSSComponent::InitializeNSS() // Initialize the site security service nsCOMPtr<nsISiteSecurityService> sssService = do_GetService(NS_SSSERVICE_CONTRACTID); -#ifdef ANDROID - MOZ_RELEASE_ASSERT(sssService); -#endif + if (!sssService) { MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("Cannot initialize site security service\n")); return NS_ERROR_FAILURE; @@ -1939,9 +1906,7 @@ nsNSSComponent::InitializeNSS() // Initialize the cert override service nsCOMPtr<nsICertOverrideService> coService = do_GetService(NS_CERTOVERRIDE_CONTRACTID); -#ifdef ANDROID - MOZ_RELEASE_ASSERT(coService); -#endif + if (!coService) { MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("Cannot initialize cert override service\n")); return NS_ERROR_FAILURE; @@ -2010,9 +1975,7 @@ nsNSSComponent::Init() MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("Beginning NSS initialization\n")); rv = InitializePIPNSSBundle(); -#ifdef ANDROID - MOZ_RELEASE_ASSERT(NS_SUCCEEDED(rv)); -#endif + if (NS_FAILED(rv)) { MOZ_LOG(gPIPNSSLog, LogLevel::Error, ("Unable to create pipnss bundle.\n")); return rv; @@ -2033,9 +1996,7 @@ nsNSSComponent::Init() rv = InitializeNSS(); -#ifdef ANDROID - MOZ_RELEASE_ASSERT(NS_SUCCEEDED(rv)); -#endif + if (NS_FAILED(rv)) { MOZ_LOG(gPIPNSSLog, LogLevel::Error, ("nsNSSComponent::InitializeNSS() failed\n")); @@ -2197,9 +2158,7 @@ nsNSSComponent::RegisterObservers() nsCOMPtr<nsIObserverService> observerService( do_GetService("@mozilla.org/observer-service;1")); -#ifdef ANDROID - MOZ_RELEASE_ASSERT(observerService); -#endif + if (!observerService) { MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsNSSComponent: couldn't get observer service\n")); @@ -2421,9 +2380,6 @@ InitializeCipherSuite() NS_ASSERTION(NS_IsMainThread(), "InitializeCipherSuite() can only be accessed in main thread"); if (NSS_SetDomesticPolicy() != SECSuccess) { -#ifdef ANDROID - MOZ_RELEASE_ASSERT(false); -#endif return NS_ERROR_FAILURE; } |