Bug 1447345 - Change enterprise policy that sets homepage to set it as the default rather than the user value for the pref. r=Felipe, a=jcristau
authorKirk Steuber <ksteuber@mozilla.com>
Tue, 20 Mar 2018 10:43:19 -0700
changeset 462909 0e8ea2c1220af0aab1aae4806e842516c5404da1
parent 462908 50c2162dfe7fa9c81070734a2fa7596f84ea9465
child 462910 8f10c0a7a87fec424520e133e0038bf338324b02
push id1683
push usersfraser@mozilla.com
push dateThu, 26 Apr 2018 16:43:40 +0000
treeherdermozilla-release@5af6cb21869d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersFelipe, jcristau
bugs1447345
milestone60.0
Bug 1447345 - Change enterprise policy that sets homepage to set it as the default rather than the user value for the pref. r=Felipe, a=jcristau Additionally removes a stray debugging line that I accidentally checked into the tree previously. MozReview-Commit-ID: 7F2S8WBgKCj
browser/components/enterprisepolicies/Policies.jsm
browser/components/enterprisepolicies/tests/EnterprisePolicyTesting.jsm
--- a/browser/components/enterprisepolicies/Policies.jsm
+++ b/browser/components/enterprisepolicies/Policies.jsm
@@ -296,19 +296,21 @@ var Policies = {
       }
       if (param.Locked) {
         setAndLockPref("browser.startup.homepage", homepages);
         setAndLockPref("browser.startup.page", 1);
         setAndLockPref("pref.browser.homepage.disable_button.current_page", true);
         setAndLockPref("pref.browser.homepage.disable_button.bookmark_page", true);
         setAndLockPref("pref.browser.homepage.disable_button.restore_default", true);
       } else {
+        setDefaultPref("browser.startup.homepage", homepages);
+        setDefaultPref("browser.startup.page", 1);
         runOncePerModification("setHomepage", homepages, () => {
-          Services.prefs.setStringPref("browser.startup.homepage", homepages);
-          Services.prefs.setIntPref("browser.startup.page", 1);
+          Services.prefs.clearUserPref("browser.startup.homepage");
+          Services.prefs.clearUserPref("browser.startup.page");
         });
       }
     }
   },
 
   "InstallAddons": {
     onBeforeUIStartup(manager, param) {
       addAllowDenyPermissions("install", param.Allow, null);
--- a/browser/components/enterprisepolicies/tests/EnterprisePolicyTesting.jsm
+++ b/browser/components/enterprisepolicies/tests/EnterprisePolicyTesting.jsm
@@ -30,17 +30,16 @@ var EnterprisePolicyTesting = {
       filePath = json;
     }
 
     Services.prefs.setStringPref("browser.policies.alternatePath", filePath);
 
     let promise = new Promise(resolve => {
       Services.obs.addObserver(function observer() {
         Services.obs.removeObserver(observer, "EnterprisePolicies:AllPoliciesApplied");
-        dump(`bytesized: setupPolicyEngineWithJson resolving`);
         resolve();
       }, "EnterprisePolicies:AllPoliciesApplied");
     });
 
     // Clear any previously used custom schema
     Cu.unload("resource:///modules/policies/schema.jsm");
 
     if (customSchema) {