bug 1301407 - temporarily add assertions during nsNSSComponent::Init to find out what's failing on Android r=dragana

--HG--
extra : amend_source : 1ce7c0c454d5bb26ffab1ad7ec550faa5d912240
This commit is contained in:
David Keeler 2016-11-07 12:53:13 -08:00
Родитель 1585835379
Коммит 28452cb319
1 изменённых файлов: 64 добавлений и 0 удалений

Просмотреть файл

@ -1282,16 +1282,26 @@ 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;
@ -1463,6 +1473,9 @@ 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;
@ -1711,6 +1724,9 @@ GetNSSProfilePath(nsAutoCString& aProfilePath)
rv = profileFileWin->GetNativeCanonicalPath(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,
@ -1739,6 +1755,9 @@ 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");
@ -1757,6 +1776,9 @@ 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;
}
@ -1770,6 +1792,9 @@ 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;
}
@ -1794,8 +1819,14 @@ 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;
}
@ -1817,6 +1848,9 @@ 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;
}
@ -1825,6 +1859,9 @@ 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;
@ -1864,6 +1901,9 @@ 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;
}
@ -1876,11 +1916,17 @@ nsNSSComponent::InitializeNSS()
// Note that this must occur before any calls to SSL_ClearSessionCache
// (otherwise memory will leak).
if (SSL_ConfigServerSessionIDCache(1000, 0, 0, nullptr) != SECSuccess) {
#ifdef ANDROID
MOZ_RELEASE_ASSERT(false);
#endif
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;
}
@ -1897,6 +1943,9 @@ 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;
@ -1905,6 +1954,9 @@ 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;
@ -1976,6 +2028,9 @@ 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;
@ -1996,6 +2051,9 @@ 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"));
@ -2157,6 +2215,9 @@ 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"));
@ -2378,6 +2439,9 @@ 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;
}