Bug 1854298 - Implement PrintingEnabled policy r=emilio,mkaply,Gijs,fluent-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D188792
This commit is contained in:
@@ -586,6 +586,16 @@ XPCOMUtils.defineLazyPreferenceGetter(
|
||||
}
|
||||
);
|
||||
|
||||
XPCOMUtils.defineLazyPreferenceGetter(
|
||||
this,
|
||||
"gPrintEnabled",
|
||||
"print.enabled",
|
||||
false,
|
||||
(aPref, aOldVal, aNewVal) => {
|
||||
updatePrintCommands(aNewVal);
|
||||
}
|
||||
);
|
||||
|
||||
XPCOMUtils.defineLazyPreferenceGetter(
|
||||
this,
|
||||
"gScreenshotsComponentEnabled",
|
||||
@@ -847,6 +857,19 @@ function UpdateBackForwardCommands(aWebNavigation) {
|
||||
}
|
||||
}
|
||||
|
||||
function updatePrintCommands(enabled) {
|
||||
var printCommand = document.getElementById("cmd_print");
|
||||
var printPreviewCommand = document.getElementById("cmd_printPreviewToggle");
|
||||
|
||||
if (enabled) {
|
||||
printCommand.removeAttribute("disabled");
|
||||
printPreviewCommand.removeAttribute("disabled");
|
||||
} else {
|
||||
printCommand.setAttribute("disabled", "true");
|
||||
printPreviewCommand.setAttribute("disabled", "true");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Click-and-Hold implementation for the Back and Forward buttons
|
||||
* XXXmano: should this live in toolbarbutton.js?
|
||||
@@ -1643,6 +1666,8 @@ var gBrowserInit = {
|
||||
|
||||
updateFxaToolbarMenu(gFxaToolbarEnabled, true);
|
||||
|
||||
updatePrintCommands(gPrintEnabled);
|
||||
|
||||
gUnifiedExtensions.init();
|
||||
|
||||
// Setting the focus will cause a style flush, it's preferable to call anything
|
||||
|
||||
Reference in New Issue
Block a user