Bug 1561994 - Fix test_enterprise_roots.js so it passes when security.enterprise_roots.enabled is enabled by default. r=keeler
authorJulien Cristau <jcristau@mozilla.com>
Fri, 28 Jun 2019 17:21:15 +0200
changeset 480663 274e4c25f128c96bc200e64fad31d1fbe938f781
parent 480662 e1001dd4f7ebbed6490327d47735a1eb4d6c376c
child 480664 1fb51bb3f412c4d68c9f8c40b19657d37908e75e
push id36217
push userncsoregi@mozilla.com
push dateSat, 29 Jun 2019 10:00:32 +0000
treeherdermozilla-central@84318ef3fa4f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskeeler
bugs1561994
milestone69.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1561994 - Fix test_enterprise_roots.js so it passes when security.enterprise_roots.enabled is enabled by default. r=keeler Avoid race between off-main-thread loading of roots and flipping the pref by making sure initialization is done. Differential Revision: https://phabricator.services.mozilla.com/D36348
security/manager/ssl/tests/unit/test_enterprise_roots.js
--- a/security/manager/ssl/tests/unit/test_enterprise_roots.js
+++ b/security/manager/ssl/tests/unit/test_enterprise_roots.js
@@ -55,16 +55,17 @@ async function check_some_enterprise_roo
   }
   ok(foundNonBuiltIn, "should have found non-built-in root");
   return savedDBKey;
 }
 
 add_task(async function run_test() {
   let nssComponent = Cc["@mozilla.org/psm;1"].getService(Ci.nsINSSComponent);
   let certDB = Cc["@mozilla.org/security/x509certdb;1"].getService(Ci.nsIX509CertDB);
+  nssComponent.getEnterpriseRoots(); // blocks until roots are loaded
   Services.prefs.setBoolPref("security.enterprise_roots.enabled", false);
   await check_no_enterprise_roots_imported(nssComponent, certDB);
   Services.prefs.setBoolPref("security.enterprise_roots.enabled", true);
   await TestUtils.topicObserved("psm:enterprise-certs-imported");
   let savedDBKey = await check_some_enterprise_roots_imported(nssComponent, certDB);
   Services.prefs.setBoolPref("security.enterprise_roots.enabled", false);
   await check_no_enterprise_roots_imported(nssComponent, certDB, savedDBKey);
 });