зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1429160 - Create enterprise policy to disable PDFjs r=dthayer,Felipe
MozReview-Commit-ID: 4Ir407Qjdoq --HG-- extra : rebase_source : 3108b7b0a9b4121bbc39ee561542584894143b6f
This commit is contained in:
Родитель
7b82a59655
Коммит
c690d6f97d
|
@ -181,6 +181,14 @@ var Policies = {
|
|||
}
|
||||
},
|
||||
|
||||
"DisableBuiltinPDFViewer": {
|
||||
onBeforeUIStartup(manager, param) {
|
||||
if (param) {
|
||||
manager.disallowFeature("PDFjs");
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"DisablePocket": {
|
||||
onBeforeAddons(manager, param) {
|
||||
if (param) {
|
||||
|
|
|
@ -142,6 +142,13 @@
|
|||
"type": "boolean"
|
||||
},
|
||||
|
||||
"DisableBuiltinPDFViewer": {
|
||||
"description": "Disables PDF.js, which displays PDFs within Firefox.",
|
||||
"first_available": "60.0",
|
||||
|
||||
"type": "boolean"
|
||||
},
|
||||
|
||||
"DisablePocket": {
|
||||
"description": "Prevents ability to save webpages to Pocket.",
|
||||
"first_available": "60.0",
|
||||
|
|
|
@ -28,6 +28,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]
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
/* 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 && !Services.policies.isAllowed("PDFjs")) {
|
||||
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
|
||||
|
|
Загрузка…
Ссылка в новой задаче