Bug 1571033 - Don't clear user homepage when setting default via policy. r=mconley a=jcristau
authorMichael Kaply <mozilla@kaply.com>
Wed, 21 Aug 2019 15:36:23 +0000
changeset 545243 fa4ecfc3c66249aa5b8d29432a5a23ae4e950e38
parent 545242 f52321e0fba04f5290cced2b2cdc7d6ddac33e5b
child 545244 f272644e18fa76a7c5d1feab52f1d9322a9e4794
push id2131
push userffxbld-merge
push dateMon, 26 Aug 2019 18:30:20 +0000
treeherdermozilla-release@b19ffb3ca153 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmconley, jcristau
bugs1571033
milestone69.0
Bug 1571033 - Don't clear user homepage when setting default via policy. r=mconley a=jcristau Differential Revision: https://phabricator.services.mozilla.com/D40453
browser/components/enterprisepolicies/Policies.jsm
browser/components/enterprisepolicies/tests/browser/browser_policy_set_homepage.js
--- a/browser/components/enterprisepolicies/Policies.jsm
+++ b/browser/components/enterprisepolicies/Policies.jsm
@@ -867,19 +867,18 @@ var Policies = {
             "pref.browser.homepage.disable_button.bookmark_page",
             true
           );
           setAndLockPref(
             "pref.browser.homepage.disable_button.restore_default",
             true
           );
         } else {
-          runOncePerModification("setHomepage", homepages, () => {
-            Services.prefs.clearUserPref("browser.startup.homepage");
-          });
+          // Clear out old run once modification that is no longer used.
+          clearRunOnceModification("setHomepage");
         }
       }
       if (param.StartPage) {
         let prefValue;
         switch (param.StartPage) {
           case "none":
             prefValue = 0;
             break;
--- a/browser/components/enterprisepolicies/tests/browser/browser_policy_set_homepage.js
+++ b/browser/components/enterprisepolicies/tests/browser/browser_policy_set_homepage.js
@@ -146,29 +146,17 @@ add_task(async function homepage_test_re
       },
     },
   });
   await check_homepage({
     expectedURL: "http://example2.com/",
     expectedPageVal: 3,
   });
   Services.prefs.clearUserPref("browser.startup.page");
-});
-
-add_task(async function homepage_test_different_policy_value() {
-  // This policy is a change from the policy's previous value. This should
-  // override the user's homepage
-  await setupPolicyEngineWithJson({
-    policies: {
-      Homepage: {
-        URL: "http://example3.com/",
-      },
-    },
-  });
-  await check_homepage({ expectedURL: "http://example3.com/" });
+  Services.prefs.clearUserPref("browser.startup.homepage");
 });
 
 add_task(async function homepage_test_empty_additional() {
   await setupPolicyEngineWithJson({
     policies: {
       Homepage: {
         URL: "http://example1.com/",
         Additional: [],