зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1496855 - Switch PDF policy to use pdfjs.disabled. r=Felipe
pdfjs.disabled now works from policy, so use it Differential Revision: https://phabricator.services.mozilla.com/D8237 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
cd129f0546
Коммит
017a78d804
|
@ -227,9 +227,9 @@ var Policies = {
|
|||
},
|
||||
|
||||
"DisableBuiltinPDFViewer": {
|
||||
onBeforeUIStartup(manager, param) {
|
||||
onBeforeAddons(manager, param) {
|
||||
if (param) {
|
||||
manager.disallowFeature("PDF.js");
|
||||
setAndLockPref("pdfjs.disabled", true);
|
||||
}
|
||||
},
|
||||
},
|
||||
|
|
|
@ -37,7 +37,6 @@ support-files =
|
|||
[browser_policy_disable_fxaccounts.js]
|
||||
skip-if = (verify && debug && (os == 'mac'))
|
||||
[browser_policy_disable_masterpassword.js]
|
||||
[browser_policy_disable_pdfjs.js]
|
||||
[browser_policy_disable_pocket.js]
|
||||
[browser_policy_disable_popup_blocker.js]
|
||||
[browser_policy_disable_privatebrowsing.js]
|
||||
|
|
|
@ -53,6 +53,11 @@ const POLICIES_TESTS = [
|
|||
},
|
||||
},
|
||||
|
||||
// POLICY: DisableBuiltinPDFViewer
|
||||
{
|
||||
policies: { "DisableBuiltinPDFViewer": true },
|
||||
lockedPrefs: { "pdfjs.disabled": true },
|
||||
},
|
||||
|
||||
// POLICY: DisableFormHistory
|
||||
{
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
/* 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");
|
||||
});
|
|
@ -3248,7 +3248,6 @@ class PDFHandlerInfoWrapper extends InternalHandlerInfoWrapper {
|
|||
}
|
||||
|
||||
get enabled() {
|
||||
return !Services.prefs.getBoolPref(PREF_PDFJS_DISABLED) &&
|
||||
Services.policies.isAllowed("PDF.js");
|
||||
return !Services.prefs.getBoolPref(PREF_PDFJS_DISABLED);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -268,10 +268,6 @@ 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
|
||||
|
|
Загрузка…
Ссылка в новой задаче