Bug 1524089 - Add policy for disabling DNS prefetch. r=Felipe,flod, a=lizzard
authorMichael Kaply <mozilla@kaply.com>
Mon, 04 Feb 2019 19:25:18 +0000
changeset 451142 43f3587bdcc3fdeb2f04c836afe06d6a9db6dea2
parent 451141 c9457b29a36306264a1becb2c52231ac3125f423
child 451143 17f8c622e86cd49a5f9d9bec21e110f533754295
push id399
push userryanvm@gmail.com
push dateThu, 25 Apr 2019 19:25:29 +0000
treeherdermozilla-esr60@4774268f333c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersFelipe, flod, lizzard
bugs1524089
milestone60.6.2
Bug 1524089 - Add policy for disabling DNS prefetch. r=Felipe,flod, a=lizzard Differential Revision: https://phabricator.services.mozilla.com/D18575
browser/components/enterprisepolicies/Policies.jsm
browser/components/enterprisepolicies/schemas/policies-schema.json
browser/components/enterprisepolicies/tests/browser/browser_policies_simple_pref_policies.js
--- a/browser/components/enterprisepolicies/Policies.jsm
+++ b/browser/components/enterprisepolicies/Policies.jsm
@@ -648,16 +648,23 @@ var Policies = {
         if (!param.Default) {
           blockAboutPage(manager, "about:debugging");
           manager.disallowFeature("xpinstall");
         }
       }
     }
   },
 
+  "NetworkPrediction": {
+    onBeforeAddons(manager, param) {
+      setAndLockPref("network.dns.disablePrefetch", !param);
+      setAndLockPref("network.dns.disablePrefetchFromHTTPS", !param);
+    },
+  },
+
   "NoDefaultBookmarks": {
     onProfileAfterChange(manager, param) {
       if (param) {
         manager.disallowFeature("defaultBookmarks");
       }
     }
   },
 
--- a/browser/components/enterprisepolicies/schemas/policies-schema.json
+++ b/browser/components/enterprisepolicies/schemas/policies-schema.json
@@ -452,16 +452,20 @@
           }
         },
         "Default": {
           "type": "boolean"
         }
       }
     },
 
+    "NetworkPrediction": {
+      "type": "boolean"
+    },
+
     "NoDefaultBookmarks": {
       "description": "Don't create the default bookmarks bundled with Firefox, nor the Smart Bookmarks (Most Visited, Recent Tags). Note: this policy is only effective if used before the first run of the profile.",
       "first_available": "60.0",
 
       "type": "boolean"
     },
 
     "OfferToSaveLogins": {
--- a/browser/components/enterprisepolicies/tests/browser/browser_policies_simple_pref_policies.js
+++ b/browser/components/enterprisepolicies/tests/browser/browser_policies_simple_pref_policies.js
@@ -173,16 +173,27 @@ const POLICIES_TESTS = [
       "SSLVersionMin": "tls1.2",
       "SSLVersionMax": "tls1.3",
     },
     lockedPrefs: {
       "security.tls.version.min": 3,
       "security.tls.version.max": 4,
     },
   },
+
+  // POLICY: NetworkPrediction
+  {
+    policies: {
+      "NetworkPrediction": false,
+    },
+    lockedPrefs: {
+      "network.dns.disablePrefetch": true,
+      "network.dns.disablePrefetchFromHTTPS": true,
+    },
+  },
 ];
 
 add_task(async function test_policy_remember_passwords() {
   for (let test of POLICIES_TESTS) {
     await setupPolicyEngineWithJson({
       "policies": test.policies
     });