summaryrefslogtreecommitdiffstats
path: root/crypto/nss_util.cc
diff options
context:
space:
mode:
authorrsleevi@chromium.org <rsleevi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-29 21:18:16 +0000
committerrsleevi@chromium.org <rsleevi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-29 21:18:16 +0000
commit166fac0d1cb9d3d2c8aae8e9a040c90a57eed5b4 (patch)
treea97c9369175092f8d55fced9fff03f5656769efa /crypto/nss_util.cc
parent28a019d413da8e2902e2e6295de5a8ac7f580cbe (diff)
downloadchromium_src-166fac0d1cb9d3d2c8aae8e9a040c90a57eed5b4.zip
chromium_src-166fac0d1cb9d3d2c8aae8e9a040c90a57eed5b4.tar.gz
chromium_src-166fac0d1cb9d3d2c8aae8e9a040c90a57eed5b4.tar.bz2
Actually close the test NSS DB when ScopedTestNSSDB is destroyed
NSS 3.15.1 fixes all known errors with SECMOD_CloseUserDB, so it can now be safely used again while testing BUG=156433 R=mattm Review URL: https://chromiumcodereview.appspot.com/18238002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@209351 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'crypto/nss_util.cc')
-rw-r--r--crypto/nss_util.cc25
1 files changed, 14 insertions, 11 deletions
diff --git a/crypto/nss_util.cc b/crypto/nss_util.cc
index bbbaa70..850d47d 100644
--- a/crypto/nss_util.cc
+++ b/crypto/nss_util.cc
@@ -318,14 +318,14 @@ class NSSInitSingleton {
}
void CloseTestNSSDB() {
- if (test_slot_) {
- SECStatus status = SECMOD_CloseUserDB(test_slot_);
- if (status != SECSuccess)
- PLOG(ERROR) << "SECMOD_CloseUserDB failed: " << PORT_GetError();
- PK11_FreeSlot(test_slot_);
- test_slot_ = NULL;
- ignore_result(g_test_nss_db_dir.Get().Delete());
- }
+ if (!test_slot_)
+ return;
+ SECStatus status = SECMOD_CloseUserDB(test_slot_);
+ if (status != SECSuccess)
+ PLOG(ERROR) << "SECMOD_CloseUserDB failed: " << PORT_GetError();
+ PK11_FreeSlot(test_slot_);
+ test_slot_ = NULL;
+ ignore_result(g_test_nss_db_dir.Get().Delete());
}
PK11SlotInfo* GetPublicNSSKeySlot() {
@@ -698,9 +698,12 @@ ScopedTestNSSDB::ScopedTestNSSDB()
}
ScopedTestNSSDB::~ScopedTestNSSDB() {
- // TODO(mattm): Close the dababase once NSS 3.14 is required,
- // which fixes https://bugzilla.mozilla.org/show_bug.cgi?id=588269
- // Resource leaks are suppressed. http://crbug.com/156433 .
+ // Don't close when NSS is < 3.15.1, because it would require an additional
+ // sleep for 1 second after closing the database, due to
+ // http://bugzil.la/875601.
+ if (NSS_VersionCheck("3.15.1")) {
+ g_nss_singleton.Get().CloseTestNSSDB();
+ }
}
base::Lock* GetNSSWriteLock() {