Bug 1428944 - Policy: Set or disable first-run (welcome) page. r=mkaply a=RyanVM
authorFelipe Gomes <felipc@gmail.com>
Sun, 01 Apr 2018 19:46:24 -0300
changeset 462968 d877278e27a150303e6bcd565e8a2b4e7e81415e
parent 462967 cf6c11e50958118c4630c165b9579e9b812fd0c4
child 462969 cd0d6a8a172abebd4f58d3823d15b9c0a5ca9a69
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)
reviewersmkaply, RyanVM
bugs1428944
milestone60.0
Bug 1428944 - Policy: Set or disable first-run (welcome) page. r=mkaply a=RyanVM
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
@@ -469,16 +469,23 @@ var Policies = {
   "NoDefaultBookmarks": {
     onProfileAfterChange(manager, param) {
       if (param) {
         manager.disallowFeature("defaultBookmarks");
       }
     }
   },
 
+  "OverrideFirstRunPage": {
+    onProfileAfterChange(manager, param) {
+      let url = param ? param.spec : "";
+      setAndLockPref("startup.homepage_welcome_url", url);
+    }
+  },
+
   "PopupBlocking": {
     onBeforeUIStartup(manager, param) {
       addAllowDenyPermissions("popup", param.Allow, null);
 
       if (param.Locked) {
         let blockValue = true;
         if (param.Default !== undefined && !param.Default) {
           blockValue = false;
--- a/browser/components/enterprisepolicies/schemas/policies-schema.json
+++ b/browser/components/enterprisepolicies/schemas/policies-schema.json
@@ -345,16 +345,24 @@
 
     "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"
     },
 
+    "OverrideFirstRunPage": {
+      "description": "Override the first run page. Set this policy to blank if you want to disable the first run page.",
+      "first_available": "60.0",
+      "enterprise_only": true,
+
+      "type": "URLorEmpty"
+    },
+
     "PopupBlocking": {
       "description": "Allow or deny popup usage.",
       "first_available": "60.0",
 
       "type": "object",
       "properties": {
         "Allow": {
           "type": "array",
--- a/browser/components/enterprisepolicies/tests/browser/browser_policies_simple_pref_policies.js
+++ b/browser/components/enterprisepolicies/tests/browser/browser_policies_simple_pref_policies.js
@@ -64,16 +64,22 @@ const POLICIES_TESTS = [
         "Locked": true
       }
     },
     lockedPrefs: {
       "privacy.trackingprotection.enabled": false,
       "privacy.trackingprotection.pbmode.enabled": false,
     }
   },
+
+  // POLICY: OverrideFirstRunPage
+  {
+    policies: { "OverrideFirstRunPage": "https://www.example.com/" },
+    lockedPrefs: { "startup.homepage_welcome_url": "https://www.example.com/" },
+  },
 ];
 
 add_task(async function test_policy_remember_passwords() {
   for (let test of POLICIES_TESTS) {
     await setupPolicyEngineWithJson({
       "policies": test.policies
     });