Bug 1440030 - CamelCase existing policies to match industry standard. r=mkaply draft
authorFelipe Gomes <felipc@gmail.com>
Wed, 21 Feb 2018 17:17:43 -0300
changeset 758042 73248b719cac7cb44ff9a2decec3a2aea1156e92
parent 758026 2b39872e602332cf0ad8f61f690842eeea792b08
child 758226 db5a53dc7ccf95b954b045e6f83e5608f509fbde
push id99930
push userfelipc@gmail.com
push dateWed, 21 Feb 2018 20:18:09 +0000
reviewersmkaply
bugs1440030
milestone60.0a1
Bug 1440030 - CamelCase existing policies to match industry standard. r=mkaply MozReview-Commit-ID: DJ6ACgYWpqm
browser/components/enterprisepolicies/Policies.jsm
browser/components/enterprisepolicies/helpers/sample.json
browser/components/enterprisepolicies/schemas/policies-schema.json
browser/components/enterprisepolicies/tests/browser/browser_policy_block_set_desktop_background.js
browser/components/enterprisepolicies/tests/browser/browser_policy_default_browser_check.js
browser/components/enterprisepolicies/tests/browser/browser_policy_display_bookmarks.js
browser/components/enterprisepolicies/tests/browser/browser_policy_display_menu.js
browser/components/enterprisepolicies/tests/browser/config_popups_cookies_addons_flash.json
--- a/browser/components/enterprisepolicies/Policies.jsm
+++ b/browser/components/enterprisepolicies/Policies.jsm
@@ -64,51 +64,51 @@ this.Policies = {
   "DisableAppUpdate": {
     onBeforeAddons(manager, param) {
       if (param) {
         manager.disallowFeature("appUpdate");
       }
     }
   },
 
-  "display_menu_bar": {
+  "DisplayMenuBar": {
     onBeforeUIStartup(manager, param) {
       if (param) {
         // This policy is meant to change the default behavior, not to force it.
         // If this policy was alreay applied and the user chose to re-hide the
         // menu bar, do not show it again.
         if (!Services.prefs.getBoolPref(PREF_MENU_ALREADY_DISPLAYED, false)) {
           log.debug("Showing the menu bar");
           gXulStore.setValue(BROWSER_DOCUMENT_URL, "toolbar-menubar", "autohide", "false");
           Services.prefs.setBoolPref(PREF_MENU_ALREADY_DISPLAYED, true);
         } else {
           log.debug("Not showing the menu bar because it has already been shown.");
         }
       }
     }
   },
 
-  "display_bookmarks_toolbar": {
+  "DisplayBookmarksToolbar": {
     onBeforeUIStartup(manager, param) {
       if (param) {
         // This policy is meant to change the default behavior, not to force it.
         // If this policy was alreay applied and the user chose to re-hide the
         // bookmarks toolbar, do not show it again.
         if (!Services.prefs.getBoolPref(PREF_BOOKMARKS_ALREADY_DISPLAYED, false)) {
           log.debug("Showing the bookmarks toolbar");
           gXulStore.setValue(BROWSER_DOCUMENT_URL, "PersonalToolbar", "collapsed", "false");
           Services.prefs.setBoolPref(PREF_BOOKMARKS_ALREADY_DISPLAYED, true);
         } else {
           log.debug("Not showing the bookmarks toolbar because it has already been shown.");
         }
       }
     }
   },
 
-  "block_set_desktop_background": {
+  "BlockSetDesktopBackground": {
     onBeforeUIStartup(manager, param) {
       if (param) {
         manager.disallowFeature("setDesktopBackground", true);
       }
     }
   },
 
   "CreateMasterPassword": {
@@ -138,49 +138,49 @@ this.Policies = {
   "DisableFormHistory": {
     onBeforeUIStartup(manager, param) {
       if (param) {
         setAndLockPref("browser.formfill.enable", false);
       }
     }
   },
 
-  "dont_check_default_browser": {
+  "DontCheckDefaultBrowser": {
     onBeforeUIStartup(manager, param) {
       setAndLockPref("browser.shell.checkDefaultBrowser", false);
     }
   },
 
-  "flash_plugin": {
+  "FlashPlugin": {
     onBeforeUIStartup(manager, param) {
-      addAllowDenyPermissions("plugin:flash", param.allow, param.block);
+      addAllowDenyPermissions("plugin:flash", param.Allow, param.Block);
     }
   },
 
-  "popups": {
+  "Popups": {
     onBeforeUIStartup(manager, param) {
-      addAllowDenyPermissions("popup", param.allow, param.block);
+      addAllowDenyPermissions("popup", param.Allow, param.Block);
     }
   },
 
   "RememberPasswords": {
     onBeforeUIStartup(manager, param) {
       setAndLockPref("signon.rememberSignons", param);
     }
   },
 
-  "install_addons": {
+  "InstallAddons": {
     onBeforeUIStartup(manager, param) {
-      addAllowDenyPermissions("install", param.allow, param.block);
+      addAllowDenyPermissions("install", param.Allow, param.Block);
     }
   },
 
-  "cookies": {
+  "Cookies": {
     onBeforeUIStartup(manager, param) {
-      addAllowDenyPermissions("cookie", param.allow, param.block);
+      addAllowDenyPermissions("cookie", param.Allow, param.Block);
     }
   },
 };
 
 /*
  * ====================
  * = HELPER FUNCTIONS =
  * ====================
--- a/browser/components/enterprisepolicies/helpers/sample.json
+++ b/browser/components/enterprisepolicies/helpers/sample.json
@@ -1,19 +1,18 @@
 {
   "policies": {
-    "block_about_config": true,
-    "dont_check_default_browser": true,
+    "BlockAboutProfiles": true,
+    "DontCheckDefaultBrowser": true,
 
-    "flash_plugin": {
+    "FlashPlugin": {
       "allow": [
         "https://www.example.com"
       ],
 
       "block": [
         "https://www.example.org"
       ]
     },
 
-    "block_about_profiles": true,
     "CreateMasterPassword": false
   }
 }
--- a/browser/components/enterprisepolicies/schemas/policies-schema.json
+++ b/browser/components/enterprisepolicies/schemas/policies-schema.json
@@ -38,33 +38,33 @@
       "description": "Prevent the browser from updating.",
       "first_available": "60.0",
       "enterprise_only": true,
 
       "type": "boolean",
       "enum": [true]
     },
 
-    "display_menu_bar": {
+    "DisplayMenuBar": {
       "description": "Causes the menu bar to be displayed by default.",
       "first_available": "60.0",
 
       "type": "boolean",
       "enum": [true]
     },
 
-    "display_bookmarks_toolbar": {
+    "DisplayBookmarksToolbar": {
       "description": "Causes the bookmarks toolbar to be displayed by default.",
       "first_available": "60.0",
 
       "type": "boolean",
       "enum": [true]
     },
 
-    "block_set_desktop_background": {
+    "BlockSetDesktopBackground": {
       "description": "Prevents usage of the \"Set Image as Desktop Background\" feature.",
       "first_available": "60.0",
 
       "type": "boolean",
       "enum": [true]
     },
 
     "CreateMasterPassword": {
@@ -94,111 +94,111 @@
     "DisableFormHistory": {
       "description": "Don't remember search and form history.",
       "first_available": "60.0",
 
       "type": "boolean",
       "enum": [true]
     },
 
-    "dont_check_default_browser": {
+    "DontCheckDefaultBrowser": {
       "description": "Don't check for the default browser on startup.",
       "first_available": "60.0",
 
       "type": "boolean",
       "enum": [true]
     },
 
-    "flash_plugin": {
+    "FlashPlugin": {
       "description": "Allow or deny flash plugin usage.",
       "first_available": "60.0",
 
       "type": "object",
       "properties": {
-        "allow": {
+        "Allow": {
           "type": "array",
           "items": {
             "type": "origin"
           }
         },
 
-        "block": {
+        "Block": {
           "type": "array",
           "items": {
             "type": "origin"
           }
         }
       }
     },
 
-    "popups": {
+    "Popups": {
       "description": "Allow or deny popup usage.",
       "first_available": "60.0",
 
       "type": "object",
       "properties": {
-        "allow": {
+        "Allow": {
           "type": "array",
           "items": {
             "type": "origin"
           }
         },
 
-        "block": {
+        "Block": {
           "type": "array",
           "items": {
             "type": "origin"
           }
         }
       }
     },
 
     "RememberPasswords": {
       "description": "Enforces the setting to allow Firefox to remember saved logins and passwords. Both true and false values are accepted.",
       "first_available": "60.0",
 
       "type": "boolean"
     },
 
-    "install_addons": {
+    "InstallAddons": {
       "description": "Allow or deny popup websites to install webextensions.",
       "first_available": "60.0",
 
       "type": "object",
       "properties": {
-        "allow": {
+        "Allow": {
           "type": "array",
           "items": {
             "type": "origin"
           }
         },
 
-        "block": {
+        "Block": {
           "type": "array",
           "items": {
             "type": "origin"
           }
         }
       }
     },
 
-    "cookies": {
+    "Cookies": {
       "description": "Allow or deny websites to set cookies.",
       "first_available": "60.0",
 
       "type": "object",
       "properties": {
-        "allow": {
+        "Allow": {
           "type": "array",
           "items": {
             "type": "origin"
           }
         },
 
-        "block": {
+        "Block": {
           "type": "array",
           "items": {
             "type": "origin"
           }
         }
       }
     }
   }
--- a/browser/components/enterprisepolicies/tests/browser/browser_policy_block_set_desktop_background.js
+++ b/browser/components/enterprisepolicies/tests/browser/browser_policy_block_set_desktop_background.js
@@ -1,16 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 "use strict";
 
 add_task(async function setup() {
   await setupPolicyEngineWithJson({
     "policies": {
-      "block_set_desktop_background": true
+      "BlockSetDesktopBackground": true
     }
   });
 });
 
 add_task(async function test_check_set_desktop_background() {
   const imageUrl = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3gwMDAsTBZbkNwAAAB1pVFh0Q29tbWVudAAAAAAAQ3JlYXRlZCB3aXRoIEdJTVBkLmUHAAABNElEQVQ4y8WSsU0DURBE3yyWIaAJaqAAN4DPSL6AlIACKIEOyJEgRsIgOOkiInJqgAKowNg7BHdn7MOksNl+zZ//dvbDf5cAiklp22BdVtXdeTEpDYDB9m1VzU6OJuVp2NdEQCaI96fH2YHG4+mDduKYNMYINTcjcGbXzQVDEAphG0k48zUsajIbnAiMIXThpW8EICE0RAK4dvoKg9NIcTiQ589otyHOZLnwqK5nLwBFUZ4igc3iM0d1ff8CMC6mZ6Ihiaqq3gi1aUAnArD00SW1fq5OLBg0ymYmSZsR2/t4e/rGyCLW0sbp3oq+yTYqVgytQWui2FS7XYF7GFprY921T4CNQt8zr47dNzCkIX7y/jBtH+v+RGMQrc828W8pApnZbmEVQp/Ae7BlOy2ttib81/UFc+WRWEbjckIAAAAASUVORK5CYII=";
   let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, imageUrl, true);
 
--- a/browser/components/enterprisepolicies/tests/browser/browser_policy_default_browser_check.js
+++ b/browser/components/enterprisepolicies/tests/browser/browser_policy_default_browser_check.js
@@ -9,17 +9,17 @@ add_task(async function test_default_bro
   // On a normal profile, the default is true. However, this gets set to false on the
   // testing profile. Let's start with true for a sanity check.
 
   ShellService.shouldCheckDefaultBrowser = true;
   is(ShellService.shouldCheckDefaultBrowser, true, "Sanity check");
 
   await setupPolicyEngineWithJson({
     "policies": {
-      "dont_check_default_browser": true
+      "DontCheckDefaultBrowser": true
     }
   });
 
   is(ShellService.shouldCheckDefaultBrowser, false, "Policy changed it to not check");
 
   // Try to change it to true and check that it doesn't take effect
   ShellService.shouldCheckDefaultBrowser = true;
 
--- a/browser/components/enterprisepolicies/tests/browser/browser_policy_display_bookmarks.js
+++ b/browser/components/enterprisepolicies/tests/browser/browser_policy_display_bookmarks.js
@@ -1,17 +1,17 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 add_task(async function setup() {
   await setupPolicyEngineWithJson({
     "policies": {
-      "display_bookmarks_toolbar": true
+      "DisplayBookmarksToolbar": true
     }
   });
 });
 
 add_task(async function test_menu_shown() {
   // Since testing will apply the policy after the browser has already started,
   // we will need to open a new window to actually see the toolbar
   let newWin = await BrowserTestUtils.openNewBrowserWindow();
--- a/browser/components/enterprisepolicies/tests/browser/browser_policy_display_menu.js
+++ b/browser/components/enterprisepolicies/tests/browser/browser_policy_display_menu.js
@@ -1,17 +1,17 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 add_task(async function setup() {
   await setupPolicyEngineWithJson({
     "policies": {
-      "display_menu_bar": true
+      "DisplayMenuBar": true
     }
   });
 });
 
 add_task(async function test_menu_shown() {
   // Since testing will apply the policy after the browser has already started,
   // we will need to open a new window to actually see the menu bar
   let newWin = await BrowserTestUtils.openNewBrowserWindow();
--- a/browser/components/enterprisepolicies/tests/browser/config_popups_cookies_addons_flash.json
+++ b/browser/components/enterprisepolicies/tests/browser/config_popups_cookies_addons_flash.json
@@ -1,51 +1,51 @@
 {
   "policies": {
-    "popups": {
-      "allow": [
+    "Popups": {
+      "Allow": [
         "https://www.allow.com",
         "https://www.pre-existing-deny.com"
       ],
 
-      "block": [
+      "Block": [
         "https://www.deny.com",
         "https://www.pre-existing-allow.com"
       ]
     },
 
-    "cookies": {
-      "allow": [
+    "Cookies": {
+      "Allow": [
         "https://www.allow.com",
         "https://www.pre-existing-deny.com"
       ],
 
-      "block": [
+      "Block": [
         "https://www.deny.com",
         "https://www.pre-existing-allow.com"
       ]
     },
 
-    "install_addons": {
-      "allow": [
+    "InstallAddons": {
+      "Allow": [
         "https://www.allow.com",
         "https://www.pre-existing-deny.com"
       ],
 
-      "block": [
+      "Block": [
         "https://www.deny.com",
         "https://www.pre-existing-allow.com"
       ]
     },
 
-    "flash_plugin": {
-      "allow": [
+    "FlashPlugin": {
+      "Allow": [
         "https://www.allow.com",
         "https://www.pre-existing-deny.com"
       ],
 
-      "block": [
+      "Block": [
         "https://www.deny.com",
         "https://www.pre-existing-allow.com"
       ]
     }
   }
 }