Bug 792816 - Add PDF.js specific policy. r=mconley,fluent-reviewers
authorMichael Kaply <mozilla@kaply.com>
Wed, 22 Apr 2020 19:57:31 +0000
changeset 525477 b6e81401f3be116e8ef3a4109576ab3ffcb3c409
parent 525476 7f4f1d605c69b3a471727810b6fc876187e8211e
child 525478 b000db58d499668a0d27dca2859b759a88533bfa
push id37339
push usernerli@mozilla.com
push dateThu, 23 Apr 2020 09:52:48 +0000
treeherdermozilla-central@47426d145e24 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmconley, fluent-reviewers
bugs792816
milestone77.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 792816 - Add PDF.js specific policy. r=mconley,fluent-reviewers Differential Revision: https://phabricator.services.mozilla.com/D70922
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
@@ -1174,16 +1174,27 @@ var Policies = {
       if (!param) {
         blockAboutPage(manager, "about:logins", true);
         setAndLockPref("pref.privacy.disable_button.view_passwords", true);
       }
       setAndLockPref("signon.rememberSignons", param);
     },
   },
 
+  PDFjs: {
+    onBeforeAddons(manager, param) {
+      if ("Enabled" in param) {
+        setAndLockPref("pdfjs.disabled", !param.Enabled);
+      }
+      if ("EnablePermissions" in param) {
+        setAndLockPref("pdfjs.enablePermissions", !param.Enabled);
+      }
+    },
+  },
+
   Permissions: {
     onBeforeUIStartup(manager, param) {
       if (param.Camera) {
         addAllowDenyPermissions(
           "camera",
           param.Camera.Allow,
           param.Camera.Block
         );
--- a/browser/components/enterprisepolicies/schemas/policies-schema.json
+++ b/browser/components/enterprisepolicies/schemas/policies-schema.json
@@ -609,16 +609,28 @@
     "OverridePostUpdatePage": {
       "type": "URLorEmpty"
     },
 
     "PasswordManagerEnabled": {
       "type": "boolean"
     },
 
+    "PDFjs": {
+      "type": "object",
+      "properties": {
+        "Enabled": {
+          "type": "boolean"
+        },
+        "EnablePermissions": {
+          "type": "boolean"
+        }
+      }
+    },
+
     "Permissions": {
       "type": "object",
       "properties": {
         "Camera": {
           "type": "object",
           "properties": {
             "Allow": {
               "type": "array",
--- a/browser/components/enterprisepolicies/tests/xpcshell/test_simple_pref_policies.js
+++ b/browser/components/enterprisepolicies/tests/xpcshell/test_simple_pref_policies.js
@@ -676,16 +676,31 @@ const POLICIES_TESTS = [
         Enabled: false,
         Locked: true,
       },
     },
     lockedPrefs: {
       "media.eme.enabled": false,
     },
   },
+
+  // POLICY: PDFjs
+
+  {
+    policies: {
+      PDFjs: {
+        Enabled: false,
+        EnablePermissions: true,
+      },
+    },
+    lockedPrefs: {
+      "pdfjs.disabled": true,
+      "pdfjs.enablePermissions": true,
+    },
+  },
 ];
 
 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
@@ -139,16 +139,19 @@ policy-OfferToSaveLogins = Enforce the s
 policy-OfferToSaveLoginsDefault = Set the default value for allowing { -brand-short-name } to offer to remember saved logins and passwords. Both true and false values are accepted.
 
 policy-OverrideFirstRunPage = Override the first run page. Set this policy to blank if you want to disable the first run page.
 
 policy-OverridePostUpdatePage = Override the post-update “What’s New” page. Set this policy to blank if you want to disable the post-update page.
 
 policy-PasswordManagerEnabled = Enable saving passwords to the password manager.
 
+# 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-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.