Bug 1447345 - Change enterprise policy that sets homepage to set it as the default rather than the user value for the pref r=Felipe
authorKirk Steuber <ksteuber@mozilla.com>
Tue, 20 Mar 2018 10:43:19 -0700
changeset 409032 1fce5707743a53bd3c86236a7607173ecce26fc2
parent 409031 0faa644eb81c0052a4003c6212de2854dad94d74
child 409033 0fd93dddaf2c15e787408b48b33fbf71203181a2
push id33671
push usercsabou@mozilla.com
push dateTue, 20 Mar 2018 22:23:32 +0000
treeherdermozilla-central@e2e874ceae78 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersFelipe
bugs1447345
milestone61.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 1447345 - Change enterprise policy that sets homepage to set it as the default rather than the user value for the pref r=Felipe 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
@@ -293,19 +293,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
@@ -28,17 +28,16 @@ this.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) {