Bug 1599756 - Fix test_ext_privacy.js permafailure on 72 Beta and DevEdition builds. r=zombie
authorLuca Greco <lgreco@mozilla.com>
Fri, 29 Nov 2019 14:09:08 +0000
changeset 504789 e429ab021364165d93708c17aa599673bff57d65
parent 504788 251480204d10c4bf3731fa625e07624c3cd52b0d
child 504790 4f9740b2be4e8cda8913bb17a02917b1fe506306
push id36867
push userrmaries@mozilla.com
push dateMon, 02 Dec 2019 09:12:09 +0000
treeherdermozilla-central@b8f3a97900e5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerszombie
bugs1599756
milestone72.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 1599756 - Fix test_ext_privacy.js permafailure on 72 Beta and DevEdition builds. r=zombie Differential Revision: https://phabricator.services.mozilla.com/D55267
toolkit/components/extensions/test/xpcshell/test_ext_privacy.js
--- a/toolkit/components/extensions/test/xpcshell/test_ext_privacy.js
+++ b/toolkit/components/extensions/test/xpcshell/test_ext_privacy.js
@@ -15,19 +15,25 @@ ChromeUtils.defineModuleGetter(
 
 const {
   createAppInfo,
   promiseShutdownManager,
   promiseStartupManager,
 } = AddonTestUtils;
 
 AddonTestUtils.init(this);
+AddonTestUtils.overrideCertDB();
 
 createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "42");
 
+// Currently security.tls.version.min has a different default
+// value in Nightly and Beta/Release builds.
+const tlsMinPref = Services.prefs.getIntPref("security.tls.version.min");
+const tlsMinVer = tlsMinPref === 3 ? "TLSv1.2" : "TLSv1";
+
 add_task(async function test_privacy() {
   // Create an object to hold the values to which we will initialize the prefs.
   const SETTINGS = {
     "network.networkPredictionEnabled": {
       "network.predictor.enabled": true,
       "network.prefetch-next": true,
       // This pref starts with a numerical value and we need to use whatever the
       // default is or we encounter issues when the pref is reset during the test.
@@ -372,17 +378,21 @@ add_task(async function test_privacy_oth
     useAddonManager: "temporary",
   });
 
   await extension.startup();
 
   async function testSetting(setting, value, expected, expectedValue = value) {
     extension.sendMessage("set", { value: value }, setting);
     let data = await extension.awaitMessage("settingData");
-    deepEqual(data.value, expectedValue);
+    deepEqual(
+      data.value,
+      expectedValue,
+      `Got expected result on setting ${setting} to ${uneval(value)}`
+    );
     for (let pref in expected) {
       equal(
         Preferences.get(pref),
         expected[pref],
         `${pref} set correctly for ${value}`
       );
     }
   }
@@ -575,37 +585,37 @@ add_task(async function test_privacy_oth
 
   await testSetting(
     "network.tlsVersionRestriction",
     {
       minimum: "invalid",
       maximum: "TLSv1.1",
     },
     {
-      "security.tls.version.min": 3,
+      "security.tls.version.min": tlsMinPref,
       "security.tls.version.max": 2,
     },
     {
-      minimum: "TLSv1.2",
+      minimum: tlsMinVer,
       maximum: "TLSv1.1",
     }
   );
 
   await testSetting(
     "network.tlsVersionRestriction",
     {
       minimum: "invalid",
       maximum: "invalid",
     },
     {
-      "security.tls.version.min": 3,
+      "security.tls.version.min": tlsMinPref,
       "security.tls.version.max": 4,
     },
     {
-      minimum: "TLSv1.2",
+      minimum: tlsMinVer,
       maximum: "TLSv1.3",
     }
   );
 
   await testSetting(
     "network.tlsVersionRestriction",
     {
       minimum: "TLSv1.3",
@@ -637,21 +647,21 @@ add_task(async function test_privacy_oth
   );
 
   await testSetting(
     "network.tlsVersionRestriction",
     {
       maximum: "TLSv1.2",
     },
     {
-      "security.tls.version.min": 3,
+      "security.tls.version.min": tlsMinPref,
       "security.tls.version.max": 3,
     },
     {
-      minimum: "TLSv1.2",
+      minimum: tlsMinVer,
       maximum: "TLSv1.2",
     }
   );
 
   await extension.unload();
 
   await promiseShutdownManager();
 });