Bug 1619658 - Add picture in picture policy.
☠☠ backed out by 4b31e67c062b ☠ ☠
authorMichael Kaply <mozilla@kaply.com>
Thu, 21 May 2020 20:22:05 +0000
changeset 531526 a5c5a7a3cf833a1b08d97cd7ebbbadf75be9a20c
parent 531525 ff097baf211dee2eba829838180cfdc3082b50ef
child 531527 e9369a667cd1888711d9c4a5691a38b6c4e3432d
push id116703
push usercsabou@mozilla.com
push dateThu, 21 May 2020 20:48:38 +0000
treeherderautoland@e9369a667cd1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1619658
milestone78.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 1619658 - Add picture in picture policy. Differential Revision: https://phabricator.services.mozilla.com/D74490
browser/components/enterprisepolicies/Policies.jsm
browser/components/enterprisepolicies/schemas/policies-schema.json
browser/components/enterprisepolicies/tests/xpcshell/test_simple_pref_policies.js
browser/locales/en-US/browser/policies/policies-descriptions.ftl
--- a/browser/components/enterprisepolicies/Policies.jsm
+++ b/browser/components/enterprisepolicies/Policies.jsm
@@ -1293,16 +1293,32 @@ var Policies = {
       if (param.Locked) {
         Services.prefs.lockPref(
           "media.videocontrols.picture-in-picture.video-toggle.enabled"
         );
       }
     },
   },
 
+  PictureInPicture: {
+    onBeforeAddons(manager, param) {
+      if ("Enabled" in param) {
+        setDefaultPref(
+          "media.videocontrols.picture-in-picture.video-toggle.enabled",
+          param.Enabled
+        );
+      }
+      if (param.Locked) {
+        Services.prefs.lockPref(
+          "media.videocontrols.picture-in-picture.video-toggle.enabled"
+        );
+      }
+    },
+  },
+
   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
@@ -793,16 +793,28 @@
             "Locked": {
               "type": "boolean"
             }
           }
         }
       }
     },
 
+    "PictureInPicture": {
+      "type": "object",
+      "properties": {
+        "Enabled": {
+          "type": "boolean"
+        },
+        "Locked": {
+          "type": "boolean"
+        }
+      }
+    },
+
     "PopupBlocking": {
       "type": "object",
       "properties": {
         "Allow": {
           "type": "array",
           "strict": false,
           "items": {
             "type": "origin"
--- a/browser/components/enterprisepolicies/tests/xpcshell/test_simple_pref_policies.js
+++ b/browser/components/enterprisepolicies/tests/xpcshell/test_simple_pref_policies.js
@@ -709,16 +709,30 @@ const POLICIES_TESTS = [
         Enabled: false,
         Locked: true,
       },
     },
     lockedPrefs: {
       "media.videocontrols.picture-in-picture.video-toggle.enabled": false,
     },
   },
+
+  // POLICY: PictureInPicture
+
+  {
+    policies: {
+      PictureInPicture: {
+        Enabled: false,
+        Locked: true,
+      },
+    },
+    lockedPrefs: {
+      "media.videocontrols.picture-in-picture.video-toggle.enabled": false,
+    },
+  },
 ];
 
 add_task(async function test_policy_simple_prefs() {
   for (let test of POLICIES_TESTS) {
     await setupPolicyEngineWithJson({
       policies: test.policies,
     });
 
--- a/browser/locales/en-US/browser/policies/policies-descriptions.ftl
+++ b/browser/locales/en-US/browser/policies/policies-descriptions.ftl
@@ -146,16 +146,18 @@ policy-PasswordManagerEnabled = Enable s
 
 # PDF.js and PDF should not be translated
 policy-PDFjs = Disable or configure PDF.js, the built-in PDF viewer in { -brand-short-name }.
 
 policy-Permissions2 = Configure permissions for camera, microphone, location, notifications, and autoplay.
 
 policy-PictureInPicture = Enable or disable Picture-in-Picture.
 
+policy-PictureInPicture = Enable or disable Picture-in-Picture.
+
 policy-PopupBlocking = Allow certain websites to display popups by default.
 
 policy-Preferences = Set and lock the value for a subset of preferences.
 
 policy-PromptForDownloadLocation = Ask where to save files when downloading.
 
 policy-Proxy = Configure proxy settings.