Bug 1452740 - Added Policy: Disable Hardware Acceleration r?felipe
MozReview-Commit-ID: FVrpCRtwQLh
--- a/browser/components/enterprisepolicies/Policies.jsm
+++ b/browser/components/enterprisepolicies/Policies.jsm
@@ -490,16 +490,24 @@ var Policies = {
if (param.Locked) {
setAndLockPref("plugin.state.flash", flashPrefVal);
} else if (param.Default !== undefined) {
setDefaultPref("plugin.state.flash", flashPrefVal);
}
}
},
+ "HardwareAcceleration": {
+ onBeforeAddons(manager, param) {
+ if (!param) {
+ setAndLockPref("layers.acceleration.disabled", true);
+ }
+ }
+ },
+
"Homepage": {
onBeforeUIStartup(manager, param) {
// |homepages| will be a string containing a pipe-separated ('|') list of
// URLs because that is what the "Home page" section of about:preferences
// (and therefore what the pref |browser.startup.homepage|) accepts.
let homepages = param.URL.spec;
if (param.Additional && param.Additional.length > 0) {
homepages += "|" + param.Additional.map(url => url.spec).join("|");
--- a/browser/components/enterprisepolicies/schemas/policies-schema.json
+++ b/browser/components/enterprisepolicies/schemas/policies-schema.json
@@ -377,16 +377,23 @@
},
"Locked": {
"type": "boolean"
}
}
},
+ "HardwareAcceleration": {
+ "description": "If false, prevents ability to turn on hardware acceleration.",
+ "first_available": "60.0",
+
+ "type": "boolean"
+ },
+
"Homepage": {
"description": "Set and optionally lock the homepage.",
"first_available": "60.0",
"enterprise_only": true,
"type": "object",
"properties": {
"URL": {
new file mode 100644
--- /dev/null
+++ b/browser/components/enterprisepolicies/tests/browser/hardware_acceleration/browser.ini
@@ -0,0 +1,7 @@
+[DEFAULT]
+prefs =
+ browser.policies.alternatePath='<test-root>/browser/components/enterprisepolicies/tests/browser/hardware_acceleration/disable_hardware_acceleration.json'
+support-files =
+ disable_hardware_acceleration.json
+
+[browser_policy_hardware_acceleration.js]
new file mode 100644
--- /dev/null
+++ b/browser/components/enterprisepolicies/tests/browser/hardware_acceleration/browser_policy_hardware_acceleration.js
@@ -0,0 +1,11 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+add_task(async function test_policy_hardware_acceleration() {
+ let winUtils = Services.wm.getMostRecentWindow("").
+ QueryInterface(Ci.nsIInterfaceRequestor).
+ getInterface(Ci.nsIDOMWindowUtils);
+ is(winUtils.layerManagerType, "Basic", "Hardware acceleration disabled");
+});
new file mode 100644
--- /dev/null
+++ b/browser/components/enterprisepolicies/tests/browser/hardware_acceleration/disable_hardware_acceleration.json
@@ -0,0 +1,5 @@
+{
+ "policies": {
+ "HardwareAcceleration": false
+ }
+}
--- a/browser/components/enterprisepolicies/tests/moz.build
+++ b/browser/components/enterprisepolicies/tests/moz.build
@@ -6,13 +6,14 @@
BROWSER_CHROME_MANIFESTS += [
'browser/browser.ini',
'browser/disable_app_update/browser.ini',
'browser/disable_default_bookmarks/browser.ini',
'browser/disable_developer_tools/browser.ini',
'browser/disable_forget_button/browser.ini',
'browser/disable_fxscreenshots/browser.ini',
+ 'browser/hardware_acceleration/browser.ini',
]
TESTING_JS_MODULES += [
'EnterprisePolicyTesting.jsm',
]