Commit e2fad6bc authored by Kirk Steuber's avatar Kirk Steuber
Browse files

Bug 1429160 - Create enterprise policy to disable PDF.js. r=dthayer,felipe

parent ac057aaa
......@@ -135,6 +135,14 @@ var Policies = {
}
},
"DisableBuiltinPDFViewer": {
onBeforeUIStartup(manager, param) {
if (param) {
manager.disallowFeature("PDF.js");
}
}
},
"DisableDeveloperTools": {
onBeforeAddons(manager, param) {
if (param) {
......
......@@ -107,6 +107,13 @@
"type": "boolean"
},
"DisableBuiltinPDFViewer": {
"description": "Disables PDF.js, which displays PDFs within Firefox.",
"first_available": "60.0",
"type": "boolean"
},
"DisableDeveloperTools": {
"description": "Prevents access to developer tools.",
"first_available": "60.0",
......
......@@ -29,6 +29,7 @@ support-files =
[browser_policy_disable_fxaccounts.js]
[browser_policy_disable_fxscreenshots.js]
[browser_policy_disable_masterpassword.js]
[browser_policy_disable_pdfjs.js]
[browser_policy_disable_pocket.js]
[browser_policy_disable_privatebrowsing.js]
[browser_policy_disable_shield.js]
......
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
const {PdfJs} = ChromeUtils.import("resource://pdf.js/PdfJs.jsm", {});
add_task(async function test_disable_pdfjs() {
is(PdfJs.enabled, true, "PDFjs should be enabled before policy runs");
await setupPolicyEngineWithJson({
"policies": {
"DisableBuiltinPDFViewer": true
}
});
is(PdfJs.enabled, false, "PDFjs should be disabled after policy runs");
});
......@@ -337,6 +337,10 @@ var PdfJs = {
* @return {boolean} Whether or not it's enabled.
*/
get enabled() {
if (!Services.policies.isAllowed("PDF.js")) {
return false;
}
if (!Services.prefs.getBoolPref(PREF_ENABLED_CACHE_INITIALIZED, false)) {
// If we just updated, and the cache hasn't been initialized, then we
// can't assume a default state, and need to synchronously initialize
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment