Merge inbound to mozilla-central. a=merge
authorBrindusan Cristian <cbrindusan@mozilla.com>
Tue, 17 Apr 2018 12:53:33 +0300
changeset 413999 f94b64e0020225c71701930f193bd96c3ad1d150
parent 413986 8b0ba3f7d09995395787369b653c5976dd69fab5 (current diff)
parent 413998 ba5089a967b993f911896e1f787fb9c7c9b406c3 (diff)
child 414000 26d6282bdbe03b9a125f302a3e2daeff28a9eddd
child 414018 01b20ae8a91bf0411c7631ae0a9582eb04e3ae47
child 414088 e2b49506d98cfc7dba7a15ce28e9c4b35a8328ed
push id33854
push usercbrindusan@mozilla.com
push dateTue, 17 Apr 2018 09:54:05 +0000
treeherdermozilla-central@f94b64e00202 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmerge
milestone61.0a1
first release with
nightly linux32
f94b64e00202 / 61.0a1 / 20180417100054 / files
nightly linux64
f94b64e00202 / 61.0a1 / 20180417100054 / files
nightly mac
f94b64e00202 / 61.0a1 / 20180417100054 / files
nightly win32
f94b64e00202 / 61.0a1 / 20180417100054 / files
nightly win64
f94b64e00202 / 61.0a1 / 20180417100054 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Merge inbound to mozilla-central. a=merge
browser/components/nsBrowserGlue.js
devtools/client/framework/toolbox-options.js
dom/media/MediaPrefs.cpp
dom/media/MediaPrefs.h
modules/libpref/init/all.js
toolkit/components/telemetry/Histograms.json
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -1436,30 +1436,16 @@ pref("identity.fxaccounts.migrateToDevEd
 pref("identity.fxaccounts.migrateToDevEdition", false);
 #endif
 
 // On GTK, we now default to showing the menubar only when alt is pressed:
 #ifdef MOZ_WIDGET_GTK
 pref("ui.key.menuAccessKeyFocuses", true);
 #endif
 
-// Encrypted media extensions.
-#ifdef XP_LINUX
-// On Linux EME is visible but disabled by default. This is so that the
-// "Play DRM content" checkbox in the Firefox UI is unchecked by default.
-// DRM requires downloading and installing proprietary binaries, which
-// users on an open source operating systems didn't opt into. The first
-// time a site using EME is encountered, the user will be prompted to
-// enable DRM, whereupon the EME plugin binaries will be downloaded if
-// permission is granted.
-pref("media.eme.enabled", false);
-#else
-pref("media.eme.enabled", true);
-#endif
-
 #ifdef NIGHTLY_BUILD
 pref("media.eme.vp9-in-mp4.enabled", true);
 #else
 pref("media.eme.vp9-in-mp4.enabled", false);
 #endif
 
 pref("media.eme.hdcp-policy-check.enabled", false);
 
--- a/browser/components/nsBrowserGlue.js
+++ b/browser/components/nsBrowserGlue.js
@@ -59,25 +59,26 @@ ChromeUtils.import("resource://gre/modul
     docElt.setAttribute("height", height);
     docElt.setAttribute("width", width);
   } else {
     // Setting the size of the window in the features string instead of here
     // causes the window to grow by the size of the titlebar.
     win.resizeTo(width, height);
   }
 
+  // Set this before showing the window so that graphics code can use it to
+  // decide to skip some expensive code paths (eg. starting the GPU process).
+  docElt.setAttribute("windowtype", "navigator:blank");
+
   // The window becomes visible after OnStopRequest, so make this happen now.
   win.stop();
 
   let { TelemetryTimestamps } =
     ChromeUtils.import("resource://gre/modules/TelemetryTimestamps.jsm", {});
   TelemetryTimestamps.add("blankWindowShown");
-
-  // Used in nsBrowserContentHandler.js to close unwanted blank windows.
-  docElt.setAttribute("windowtype", "navigator:blank");
 })();
 
 Cu.importGlobalProperties(["fetch"]);
 
 XPCOMUtils.defineLazyServiceGetter(this, "WindowsUIUtils", "@mozilla.org/windows-ui-utils;1", "nsIWindowsUIUtils");
 XPCOMUtils.defineLazyGetter(this, "WeaveService", () =>
   Cc["@mozilla.org/weave/service;1"].getService().wrappedJSObject
 );
--- a/browser/themes/shared/customizableui/panelUI.inc.css
+++ b/browser/themes/shared/customizableui/panelUI.inc.css
@@ -760,16 +760,29 @@ toolbarbutton[constrain-size="true"][cui
 .panel-banner-item:not([disabled]):hover {
   background-color: hsla(96,65%,75%,.8);
 }
 
 .panel-banner-item:not([disabled]):hover:active {
   background-color: hsl(96,65%,75%);
 }
 
+:root[lwt-popup-brighttext] .panel-banner-item:not([disabled]) {
+  background-color: rgba(48,230,11,.1);
+  color: #F9F9FA;
+}
+
+:root[lwt-popup-brighttext] .panel-banner-item:not([disabled]):hover {
+  background-color: rgba(48,230,11,.15);
+}
+
+:root[lwt-popup-brighttext] .panel-banner-item:not([disabled]):active {
+  background-color: rgba(48,230,11,.2);
+}
+
 #customization-palette .toolbarbutton-multiline-text,
 #customization-palette .toolbarbutton-text {
   display: none;
 }
 
 .subview-subheader,
 panelview .toolbarbutton-1,
 .subviewbutton,
--- a/build/valgrind/x86_64-pc-linux-gnu.sup
+++ b/build/valgrind/x86_64-pc-linux-gnu.sup
@@ -484,31 +484,19 @@
    fun:*style*parse_into*
    fun:*geckoservo*parse_property_into*
 }
 
 ##########################################
 # Suppressions rooted at *selectors*parser*SelectorList*Impl*parse*
 
 {
-   bug1447137-15
+   bug1454511
    Memcheck:Cond
    fun:*selectors*parser*SelectorList*Impl*parse*
-   fun:*style*parse_nested_rules*
-   fun:*style*parse_block*
-   fun:Servo_StyleSheet_FromUTF8Bytes
-}
-
-{
-   bug1447137-16
-   Memcheck:Cond
-   fun:*selectors*parser*SelectorList*Impl*parse*
-   fun:Servo_StyleSheet_FromUTF8Bytes
-   fun:*mozilla*ServoStyleSheet*ParseSheet*
-   fun:*mozilla*css*Loader*DoParseSheetServo*
 }
 
 ##########################################
 # Suppressions rooted at *style*properties*shorthands*
 
 {
    bug1447137-17
    Memcheck:Cond
--- a/devtools/client/accessibility/accessibility-panel.js
+++ b/devtools/client/accessibility/accessibility-panel.js
@@ -1,17 +1,20 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 "use strict";
 
 const { AccessibilityFront } = require("devtools/shared/fronts/accessibility");
 const EventEmitter = require("devtools/shared/event-emitter");
 
+const Telemetry = require("devtools/client/shared/telemetry");
+
 const { Picker } = require("./picker");
+const { A11Y_SERVICE_DURATION } = require("./constants");
 
 // The panel's window global is an EventEmitter firing the following events:
 const EVENTS = {
   // When the accessibility inspector has a new accessible front selected.
   NEW_ACCESSIBLE_FRONT_SELECTED: "Accessibility:NewAccessibleFrontSelected",
   // When the accessibility inspector has a new accessible front highlighted.
   NEW_ACCESSIBLE_FRONT_HIGHLIGHTED: "Accessibility:NewAccessibleFrontHighlighted",
   // When the accessibility inspector has a new accessible front inspected.
@@ -30,16 +33,17 @@ function AccessibilityPanel(iframeWindow
   this._toolbox = toolbox;
 
   this.onTabNavigated = this.onTabNavigated.bind(this);
   this.onPanelVisibilityChange = this.onPanelVisibilityChange.bind(this);
   this.onNewAccessibleFrontSelected =
     this.onNewAccessibleFrontSelected.bind(this);
   this.onAccessibilityInspectorUpdated =
     this.onAccessibilityInspectorUpdated.bind(this);
+  this.updateA11YServiceDurationTimer = this.updateA11YServiceDurationTimer.bind(this);
   this.updatePickerButton = this.updatePickerButton.bind(this);
 
   EventEmitter.decorate(this);
 }
 
 AccessibilityPanel.prototype = {
   /**
    * Open is effectively an asynchronous constructor.
@@ -55,16 +59,19 @@ AccessibilityPanel.prototype = {
       resolver = resolve;
     });
 
     // Local monitoring needs to make the target remote.
     if (!this.target.isRemote) {
       await this.target.makeRemote();
     }
 
+    this._telemetry = new Telemetry();
+    this.panelWin.gTelemetry = this._telemetry;
+
     this.target.on("navigate", this.onTabNavigated);
     this._toolbox.on("select", this.onPanelVisibilityChange);
 
     this.panelWin.EVENTS = EVENTS;
     EventEmitter.decorate(this.panelWin);
     this.panelWin.on(EVENTS.NEW_ACCESSIBLE_FRONT_SELECTED,
       this.onNewAccessibleFrontSelected);
     this.panelWin.on(EVENTS.ACCESSIBILITY_INSPECTOR_UPDATED,
@@ -79,16 +86,20 @@ AccessibilityPanel.prototype = {
     this._walker = await this._front.getWalker();
 
     this._isOldVersion = !(await this.target.actorHasMethod("accessibility", "enable"));
     if (!this._isOldVersion) {
       await this._front.bootstrap();
       this.picker = new Picker(this);
     }
 
+    this.updateA11YServiceDurationTimer();
+    this._front.on("init", this.updateA11YServiceDurationTimer);
+    this._front.on("shutdown", this.updateA11YServiceDurationTimer);
+
     this.isReady = true;
     this.emit("ready");
     resolver(this);
     return this._opening;
   },
 
   onNewAccessibleFrontSelected(selected) {
     this.emit("new-accessible-front-selected", selected);
@@ -132,21 +143,34 @@ AccessibilityPanel.prototype = {
     if (!this.shouldRefresh) {
       return;
     }
     // Alright reset the flag we are about to refresh the panel.
     this.shouldRefresh = false;
     this.postContentMessage("initialize", this._front, this._walker, this._isOldVersion);
   },
 
+  updateA11YServiceDurationTimer() {
+    if (this._front.enabled) {
+      this._telemetry.startTimer(A11Y_SERVICE_DURATION);
+    } else {
+      this._telemetry.stopTimer(A11Y_SERVICE_DURATION);
+    }
+  },
+
   selectAccessible(accessibleFront) {
     this.postContentMessage("selectAccessible", this._walker, accessibleFront);
   },
 
-  selectAccessibleForNode(nodeFront) {
+  selectAccessibleForNode(nodeFront, reason) {
+    if (reason) {
+      this._telemetry.logKeyedScalar(
+        "devtools.accessibility.select_accessible_for_node", reason, 1);
+    }
+
     this.postContentMessage("selectNodeAccessible", this._walker, nodeFront);
   },
 
   highlightAccessible(accessibleFront) {
     this.postContentMessage("highlightAccessible", this._walker, accessibleFront);
   },
 
   postContentMessage(type, ...args) {
@@ -196,33 +220,39 @@ AccessibilityPanel.prototype = {
       return;
     }
 
     let resolver;
     this._destroying = new Promise(resolve => {
       resolver = resolve;
     });
 
+    this._telemetry.destroy();
+
     this.target.off("navigate", this.onTabNavigated);
     this._toolbox.off("select", this.onPanelVisibilityChange);
 
     this.panelWin.off(EVENTS.NEW_ACCESSIBLE_FRONT_SELECTED,
       this.onNewAccessibleFrontSelected);
     this.panelWin.off(EVENTS.ACCESSIBILITY_INSPECTOR_UPDATED,
       this.onAccessibilityInspectorUpdated);
 
     this.picker.release();
     this.picker = null;
 
     if (this._front) {
+      this._front.off("init", this.updateA11YServiceDurationTimer);
+      this._front.off("shutdown", this.updateA11YServiceDurationTimer);
       await this._front.destroy();
     }
 
     this._front = null;
+    this._telemetry = null;
     this.panelWin.gToolbox = null;
+    this.panelWin.gTelemetry = null;
 
     this.emit("destroyed");
 
     resolver();
   }
 };
 
 // Exports from this module
--- a/devtools/client/accessibility/components/Accessible.js
+++ b/devtools/client/accessibility/components/Accessible.js
@@ -1,14 +1,14 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 "use strict";
 
-/* global EVENTS, gToolbox */
+/* global EVENTS, gTelemetry, gToolbox */
 
 // React & Redux
 const { createFactory, Component } = require("devtools/client/shared/vendor/react");
 const { div, span } = require("devtools/client/shared/vendor/react-dom-factories");
 const PropTypes = require("devtools/client/shared/vendor/react-prop-types");
 const { findDOMNode } = require("devtools/client/shared/vendor/react-dom");
 const { connect } = require("devtools/client/shared/vendor/react-redux");
 
@@ -155,16 +155,20 @@ class Accessible extends Component {
     if (!gToolbox) {
       return;
     }
 
     gToolbox.highlighterUtils.unhighlight();
   }
 
   selectNode(nodeFront, reason = "accessibility") {
+    if (gTelemetry) {
+      gTelemetry.actionOccurred("accessibilityNodeInspected");
+    }
+
     if (!gToolbox) {
       return;
     }
 
     gToolbox.selectTool("inspector").then(() =>
       gToolbox.selection.setNodeFront(nodeFront, reason));
   }
 
--- a/devtools/client/accessibility/components/Description.js
+++ b/devtools/client/accessibility/components/Description.js
@@ -1,25 +1,29 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 "use strict";
 
+/* global gTelemetry */
+
 // React & Redux
 const { createFactory, Component } = require("devtools/client/shared/vendor/react");
 const { div, p, img } = require("devtools/client/shared/vendor/react-dom-factories");
 const PropTypes = require("devtools/client/shared/vendor/react-prop-types");
 const { connect } = require("devtools/client/shared/vendor/react-redux");
 
 const Button = createFactory(require("./Button"));
 const { enable, updateCanBeEnabled } = require("../actions/ui");
 
 // Localization
 const { L10N } = require("../utils/l10n");
 
+const { A11Y_SERVICE_ENABLED_COUNT } = require("../constants");
+
 class OldVersionDescription extends Component {
   render() {
     return (
       div({ className: "description" },
         p({ className: "general" },
           img({
             src: "chrome://devtools/skin/images/accessibility.svg",
             alt: L10N.getStr("accessibility.logo")
@@ -60,16 +64,21 @@ class Description extends Component {
   componentWillUnmount() {
     this.props.accessibility.off("can-be-enabled-change",
       this.onCanBeEnabledChange);
   }
 
   onEnable() {
     let { accessibility, dispatch } = this.props;
     this.setState({ enabling: true });
+
+    if (gTelemetry) {
+      gTelemetry.logCountScalar(A11Y_SERVICE_ENABLED_COUNT, 1);
+    }
+
     dispatch(enable(accessibility))
       .then(() => this.setState({ enabling: false }))
       .catch(() => this.setState({ enabling: false }));
   }
 
   onCanBeEnabledChange(canBeEnabled) {
     this.props.dispatch(updateCanBeEnabled(canBeEnabled));
   }
--- a/devtools/client/accessibility/components/Toolbar.js
+++ b/devtools/client/accessibility/components/Toolbar.js
@@ -45,16 +45,17 @@ class Toolbar extends Component {
 
   onCanBeDisabledChange(canBeDisabled) {
     this.props.dispatch(updateCanBeDisabled(canBeDisabled));
   }
 
   onDisable() {
     let { accessibility, dispatch } = this.props;
     this.setState({ disabling: true });
+
     dispatch(disable(accessibility))
       .then(() => this.setState({ disabling: false }))
       .catch(() => this.setState({ disabling: false }));
   }
 
   render() {
     let { canBeDisabled } = this.props;
     let { disabling } = this.state;
--- a/devtools/client/accessibility/constants.js
+++ b/devtools/client/accessibility/constants.js
@@ -56,8 +56,12 @@ exports.ACCESSIBLE_EVENTS = [
   "name-change",
   "reorder",
   "shortcut-change",
   "states-change",
   "text-change",
   "value-change",
   "index-in-parent-change"
 ];
+
+// Telemetry name constants.
+exports.A11Y_SERVICE_DURATION = "DEVTOOLS_ACCESSIBILITY_SERVICE_TIME_ACTIVE_SECONDS";
+exports.A11Y_SERVICE_ENABLED_COUNT = "devtools.accessibility.service_enabled_count";
--- a/devtools/client/accessibility/picker.js
+++ b/devtools/client/accessibility/picker.js
@@ -25,16 +25,20 @@ class Picker {
   get walker() {
     return this._panel._walker;
   }
 
   get pickerButton() {
     return this.toolbox.pickerButton;
   }
 
+  get _telemetry() {
+    return this._panel._telemetry;
+  }
+
   release() {
     this._panel = null;
   }
 
   emit(event, data) {
     this.toolbox.emit(event, data);
   }
 
@@ -131,16 +135,19 @@ class Picker {
       return;
     }
 
     this.isPicking = false;
 
     this.pickerButton.isChecked = false;
 
     await this.walker.cancelPick();
+
+    this._telemetry.toolClosed("accessibilityPickerUsed");
+
     this.walker.off("picker-accessible-hovered", this.onPickerAccessibleHovered);
     this.walker.off("picker-accessible-picked", this.onPickerAccessiblePicked);
     this.walker.off("picker-accessible-previewed", this.onPickerAccessiblePreviewed);
     this.walker.off("picker-accessible-canceled", this.onPickerAccessibleCanceled);
 
     this.emit("picker-stopped");
   }
 
@@ -159,16 +166,17 @@ class Picker {
     this.pickerButton.isChecked = true;
 
     this.walker.on("picker-accessible-hovered", this.onPickerAccessibleHovered);
     this.walker.on("picker-accessible-picked", this.onPickerAccessiblePicked);
     this.walker.on("picker-accessible-previewed", this.onPickerAccessiblePreviewed);
     this.walker.on("picker-accessible-canceled", this.onPickerAccessibleCanceled);
 
     await this.walker.pick(doFocus);
+    this._telemetry.toolOpened("accessibilityPickerUsed");
     this.emit("picker-started");
   }
 
   /**
    * Toggle between starting and canceling the picker.
    * @param  {Boolean} doFocus
    *         If true, move keyboard focus into content.
    */
--- a/devtools/client/framework/devtools.js
+++ b/devtools/client/framework/devtools.js
@@ -720,17 +720,17 @@ DevTools.prototype = {
 
     let toolbox = await gDevTools.showToolbox(
       target, "accessibility", null, null, startTime);
     let nodeFront = await this.findNodeFront(toolbox.walker, nodeSelectors);
     // Select the accessible object in the panel and wait for the event that
     // tells us it has been done.
     let a11yPanel = toolbox.getCurrentPanel();
     let onSelected = a11yPanel.once("new-accessible-front-selected");
-    a11yPanel.selectAccessibleForNode(nodeFront);
+    a11yPanel.selectAccessibleForNode(nodeFront, "browser-context-menu");
     await onSelected;
   },
 
   /**
    * Either the DevTools Loader has been destroyed or firefox is shutting down.
    * @param {boolean} shuttingDown
    *        True if firefox is currently shutting down. We may prevent doing
    *        some cleanups to speed it up. Otherwise everything need to be
--- a/devtools/client/framework/toolbox-options.js
+++ b/devtools/client/framework/toolbox-options.js
@@ -218,16 +218,20 @@ OptionsPanel.prototype = {
     // globally) and per toolbox (for the tools registered to a single toolbox).
     // This event handler expect this to be binded to the related checkbox element.
     let onCheckboxClick = function(tool) {
       // Set the kill switch pref boolean to true
       Services.prefs.setBoolPref(tool.visibilityswitch, this.checked);
 
       if (!tool.isWebExtension) {
         gDevTools.emit(this.checked ? "tool-registered" : "tool-unregistered", tool.id);
+        // Record which tools were registered and unregistered.
+        Services.telemetry.keyedScalarSet("devtools.tool.registered",
+                                          tool.id,
+                                          this.checked);
       }
     };
 
     let createToolCheckbox = (tool) => {
       let checkboxLabel = this.panelDoc.createElement("label");
       let checkboxInput = this.panelDoc.createElement("input");
       checkboxInput.setAttribute("type", "checkbox");
       checkboxInput.setAttribute("id", tool.id);
--- a/devtools/client/inspector/inspector.js
+++ b/devtools/client/inspector/inspector.js
@@ -1991,17 +1991,18 @@ Inspector.prototype = {
   /**
    * Show Accessibility properties for currently selected node
    */
   async showAccessibilityProperties() {
     let a11yPanel = await this._toolbox.selectTool("accessibility");
     // Select the accessible object in the panel and wait for the event that
     // tells us it has been done.
     let onSelected = a11yPanel.once("new-accessible-front-selected");
-    a11yPanel.selectAccessibleForNode(this.selection.nodeFront);
+    a11yPanel.selectAccessibleForNode(this.selection.nodeFront,
+                                      "inspector-context-menu");
     await onSelected;
   },
 
   /**
    * Use in Console.
    *
    * Takes the currently selected node in the inspector and assigns it to a
    * temp variable on the content window.  Also opens the split console and
--- a/devtools/client/shared/telemetry.js
+++ b/devtools/client/shared/telemetry.js
@@ -19,16 +19,17 @@ const PENDING_EVENT_PROPERTIES = new Map
 
 class Telemetry {
   constructor() {
     // Bind pretty much all functions so that callers do not need to.
     this.toolOpened = this.toolOpened.bind(this);
     this.toolClosed = this.toolClosed.bind(this);
     this.log = this.log.bind(this);
     this.logScalar = this.logScalar.bind(this);
+    this.logCountScalar = this.logCountScalar.bind(this);
     this.logKeyedScalar = this.logKeyedScalar.bind(this);
     this.logOncePerBrowserVersion = this.logOncePerBrowserVersion.bind(this);
     this.recordEvent = this.recordEvent.bind(this);
     this.setEventRecordingEnabled = this.setEventRecordingEnabled.bind(this);
     this.preparePendingEvent = this.preparePendingEvent.bind(this);
     this.addEventProperty = this.addEventProperty.bind(this);
     this.destroy = this.destroy.bind(this);
 
@@ -182,16 +183,27 @@ class Telemetry {
       gridInspectorShowGridAreasOverlayChecked: {
         scalar: "devtools.grid.showGridAreasOverlay.checked",
       },
       gridInspectorShowGridLineNumbersChecked: {
         scalar: "devtools.grid.showGridLineNumbers.checked",
       },
       gridInspectorShowInfiniteLinesChecked: {
         scalar: "devtools.grid.showInfiniteLines.checked",
+      },
+      accessibility: {
+        countScalar: "devtools.accessibility.opened_count",
+        timerHistogram: "DEVTOOLS_ACCESSIBILITY_TIME_ACTIVE_SECONDS"
+      },
+      accessibilityNodeInspected: {
+        countScalar: "devtools.accessibility.node_inspected_count"
+      },
+      accessibilityPickerUsed: {
+        countScalar: "devtools.accessibility.picker_used_count",
+        timerHistogram: "DEVTOOLS_ACCESSIBILITY_PICKER_TIME_ACTIVE_SECONDS"
       }
     };
   }
 
   /**
    * Add an entry to a histogram.
    *
    * @param  {String} id
@@ -205,16 +217,19 @@ class Telemetry {
       this.log(charts.histogram, true);
     }
     if (charts.timerHistogram) {
       this.startTimer(charts.timerHistogram);
     }
     if (charts.scalar) {
       this.logScalar(charts.scalar, 1);
     }
+    if (charts.countScalar) {
+      this.logCountScalar(charts.countScalar, 1);
+    }
   }
 
   /**
    * Record that an action occurred.  Aliases to `toolOpened`, so it's just for
    * readability at the call site for cases where we aren't actually opening
    * tools.
    */
   actionOccurred(id) {
@@ -296,28 +311,56 @@ class Telemetry {
     if (!scalarId) {
       return;
     }
 
     try {
       if (isNaN(value) && typeof value !== "boolean") {
         dump(`Warning: An attempt was made to write a non-numeric and ` +
              `non-boolean value ${value} to the ${scalarId} scalar. Only ` +
-             `numeric and boolean values are allowed.`);
+             `numeric and boolean values are allowed.\n`);
 
         return;
       }
       Services.telemetry.scalarSet(scalarId, value);
     } catch (e) {
       dump(`Warning: An attempt was made to write to the ${scalarId} ` +
            `scalar, which is not defined in Scalars.yaml\n`);
     }
   }
 
   /**
+   * Log a value to a count scalar.
+   *
+   * @param  {String} scalarId
+   *         Scalar in which the data is to be stored.
+   * @param  value
+   *         Value to store.
+   */
+  logCountScalar(scalarId, value) {
+    if (!scalarId) {
+      return;
+    }
+
+    try {
+      if (isNaN(value)) {
+        dump(`Warning: An attempt was made to write a non-numeric value ` +
+             `${value} to the ${scalarId} scalar. Only numeric values are ` +
+             `allowed.\n`);
+
+        return;
+      }
+      Services.telemetry.scalarAdd(scalarId, value);
+    } catch (e) {
+      dump(`Warning: An attempt was made to write to the ${scalarId} ` +
+           `scalar, which is not defined in Scalars.yaml\n`);
+    }
+  }
+
+  /**
    * Log a value to a keyed count scalar.
    *
    * @param  {String} scalarId
    *         Scalar in which the data is to be stored.
    * @param  {String} key
    *         The key within the  scalar.
    * @param  value
    *         Value to store.
@@ -326,17 +369,17 @@ class Telemetry {
     if (!scalarId) {
       return;
     }
 
     try {
       if (isNaN(value)) {
         dump(`Warning: An attempt was made to write a non-numeric value ` +
              `${value} to the ${scalarId} scalar. Only numeric values are ` +
-             `allowed.`);
+             `allowed.\n`);
 
         return;
       }
       Services.telemetry.keyedScalarAdd(scalarId, key, value);
     } catch (e) {
       dump(`Warning: An attempt was made to write to the ${scalarId} ` +
            `scalar, which is not defined in Scalars.yaml\n`);
     }
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -7,23 +7,24 @@
 #include "mozilla/dom/HTMLMediaElement.h"
 #include "mozilla/dom/HTMLMediaElementBinding.h"
 #include "mozilla/dom/HTMLSourceElement.h"
 #include "mozilla/dom/HTMLAudioElement.h"
 #include "mozilla/dom/HTMLVideoElement.h"
 #include "mozilla/dom/ElementInlines.h"
 #include "mozilla/dom/Promise.h"
 #include "mozilla/ArrayUtils.h"
-#include "mozilla/NotNull.h"
-#include "mozilla/MathAlgorithms.h"
 #include "mozilla/AsyncEventDispatcher.h"
 #include "mozilla/dom/MediaEncryptedEvent.h"
 #include "mozilla/EMEUtils.h"
 #include "mozilla/EventDispatcher.h"
+#include "mozilla/NotNull.h"
+#include "mozilla/MathAlgorithms.h"
 #include "mozilla/Sprintf.h"
+#include "mozilla/StaticPrefs.h"
 
 #include "AutoplayPolicy.h"
 #include "base/basictypes.h"
 #include "TimeRanges.h"
 #include "nsGenericHTMLElement.h"
 #include "nsAttrValueInlines.h"
 #include "nsPresContext.h"
 #include "nsIClassOfService.h"
@@ -48,17 +49,16 @@
 
 #include "nsIScriptSecurityManager.h"
 #include "nsIXPConnect.h"
 #include "jsapi.h"
 
 #include "nsITimer.h"
 
 #include "MediaError.h"
-#include "MediaPrefs.h"
 #include "MediaResource.h"
 
 #include "nsICategoryManager.h"
 #include "nsIContentPolicy.h"
 #include "nsContentPolicyUtils.h"
 #include "nsCycleCollectionParticipant.h"
 #include "nsICachingChannel.h"
 #include "nsLayoutUtils.h"
@@ -4460,17 +4460,18 @@ void HTMLMediaElement::HiddenVideoStart(
   MOZ_ASSERT(NS_IsMainThread());
   mHiddenPlayTime.Start();
   if (mVideoDecodeSuspendTimer) {
     // Already started, just keep it running.
     return;
   }
   NS_NewTimerWithFuncCallback(getter_AddRefs(mVideoDecodeSuspendTimer),
                               VideoDecodeSuspendTimerCallback, this,
-                              MediaPrefs::MDSMSuspendBackgroundVideoDelay(), nsITimer::TYPE_ONE_SHOT,
+                              StaticPrefs::MediaSuspendBkgndVideoDelayMs(),
+                              nsITimer::TYPE_ONE_SHOT,
                               "HTMLMediaElement::VideoDecodeSuspendTimerCallback",
                               mMainThreadEventTarget);
 }
 
 void HTMLMediaElement::HiddenVideoStop()
 {
   MOZ_ASSERT(NS_IsMainThread());
   mHiddenPlayTime.Pause();
@@ -4632,17 +4633,18 @@ HTMLMediaElement::ReportTelemetry()
                               NS_LITERAL_CSTRING("All"),
                               max_ms);
         LOG(LogLevel::Debug, ("%p VIDEO_INTER_KEYFRAME_MAX_MS = %u, keys: '%s' and 'All'",
                               this, max_ms, key.get()));
       } else {
         // Here, we have played *some* of the video, but didn't get more than 1
         // keyframe. Report '0' if we have played for longer than the video-
         // decode-suspend delay (showing recovery would be difficult).
-        uint32_t suspendDelay_ms = MediaPrefs::MDSMSuspendBackgroundVideoDelay();
+        uint32_t suspendDelay_ms =
+          StaticPrefs::MediaSuspendBkgndVideoDelayMs();
         if (uint32_t(playTime * 1000.0) > suspendDelay_ms) {
           Telemetry::Accumulate(Telemetry::VIDEO_INTER_KEYFRAME_MAX_MS,
                                 key,
                                 0);
           Telemetry::Accumulate(Telemetry::VIDEO_INTER_KEYFRAME_MAX_MS,
                                 NS_LITERAL_CSTRING("All"),
                                 0);
           LOG(LogLevel::Debug, ("%p VIDEO_INTER_KEYFRAME_MAX_MS = 0 (only 1 keyframe), keys: '%s' and 'All'",
--- a/dom/html/HTMLVideoElement.h
+++ b/dom/html/HTMLVideoElement.h
@@ -4,17 +4,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_dom_HTMLVideoElement_h
 #define mozilla_dom_HTMLVideoElement_h
 
 #include "mozilla/Attributes.h"
 #include "mozilla/dom/HTMLMediaElement.h"
-#include "MediaPrefs.h"
+#include "mozilla/StaticPrefs.h"
 
 namespace mozilla {
 
 class FrameStatistics;
 
 namespace dom {
 
 class WakeLock;
@@ -133,17 +133,17 @@ public:
   // Gives access to the decoder's frame statistics, if present.
   FrameStatistics* GetFrameStatistics();
 
   already_AddRefed<VideoPlaybackQuality> GetVideoPlaybackQuality();
 
 
   bool MozOrientationLockEnabled() const
   {
-    return MediaPrefs::VideoOrientationLockEnabled();
+    return StaticPrefs::MediaVideocontrolsLockVideoOrientation();
   }
 
   bool MozIsOrientationLocked() const
   {
     return mIsOrientationLocked;
   }
 
   void SetMozIsOrientationLocked(bool aLock)
--- a/dom/media/BackgroundVideoDecodingPermissionObserver.cpp
+++ b/dom/media/BackgroundVideoDecodingPermissionObserver.cpp
@@ -1,18 +1,18 @@
 /* vim:set ts=2 sw=2 sts=2 et cindent: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "BackgroundVideoDecodingPermissionObserver.h"
 
 #include "mozilla/AsyncEventDispatcher.h"
+#include "mozilla/StaticPrefs.h"
 #include "MediaDecoder.h"
-#include "MediaPrefs.h"
 #include "nsContentUtils.h"
 #include "nsIDocument.h"
 
 namespace mozilla {
 
 BackgroundVideoDecodingPermissionObserver::
   BackgroundVideoDecodingPermissionObserver(MediaDecoder* aDecoder)
   : mDecoder(aDecoder)
@@ -21,17 +21,17 @@ BackgroundVideoDecodingPermissionObserve
   MOZ_ASSERT(mDecoder);
 }
 
 NS_IMETHODIMP
 BackgroundVideoDecodingPermissionObserver::Observe(nsISupports* aSubject,
                                                    const char* aTopic,
                                                    const char16_t* aData)
 {
-  if (!MediaPrefs::ResumeVideoDecodingOnTabHover()) {
+  if (!StaticPrefs::MediaResumeBkgndVideoOnTabhover()) {
     return NS_OK;
   }
 
   if (!IsValidEventSender(aSubject)) {
     return NS_OK;
   }
 
   if (strcmp(aTopic, "unselected-tab-hover") == 0) {
--- a/dom/media/Benchmark.cpp
+++ b/dom/media/Benchmark.cpp
@@ -3,17 +3,16 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "Benchmark.h"
 
 #include "BufferMediaResource.h"
 #include "MediaData.h"
-#include "MediaPrefs.h"
 #include "PDMFactory.h"
 #include "VideoUtils.h"
 #include "WebMDemuxer.h"
 #include "gfxPrefs.h"
 #include "mozilla/AbstractThread.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/SharedThreadPool.h"
 #include "mozilla/SystemGroup.h"
@@ -147,17 +146,16 @@ Benchmark::Dispose()
 }
 
 void
 Benchmark::Init()
 {
   MOZ_ASSERT(NS_IsMainThread());
   gfxVars::Initialize();
   gfxPrefs::GetSingleton();
-  MediaPrefs::GetSingleton();
 }
 
 BenchmarkPlayback::BenchmarkPlayback(Benchmark* aMainThreadState,
                                      MediaDataDemuxer* aDemuxer)
   : QueueObject(new TaskQueue(
       GetMediaThreadPool(MediaThreadType::PLAYBACK),
       "BenchmarkPlayback::QueueObject"))
   , mMainThreadState(aMainThreadState)
--- a/dom/media/ChannelMediaDecoder.cpp
+++ b/dom/media/ChannelMediaDecoder.cpp
@@ -5,16 +5,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "ChannelMediaDecoder.h"
 #include "DecoderTraits.h"
 #include "MediaDecoderStateMachine.h"
 #include "MediaFormatReader.h"
 #include "BaseMediaResource.h"
 #include "MediaShutdownManager.h"
+#include "mozilla/StaticPrefs.h"
 
 namespace mozilla {
 
 extern LazyLogModule gMediaDecoderLog;
 #define LOG(x, ...)                                                            \
   DDMOZ_LOG(gMediaDecoderLog, LogLevel::Debug, x, ##__VA_ARGS__)
 
 ChannelMediaDecoder::ResourceCallback::ResourceCallback(
@@ -528,17 +529,17 @@ ChannelMediaDecoder::ShouldThrottleDownl
   // We throttle the download if either the throttle override pref is set
   // (so that we can always throttle in Firefox on mobile) or if the download
   // is fast enough that there's no concern about playback being interrupted.
   MOZ_ASSERT(NS_IsMainThread());
   NS_ENSURE_TRUE(GetStateMachine(), false);
 
   int64_t length = aStats.mTotalBytes;
   if (length > 0 &&
-      length <= int64_t(MediaPrefs::MediaMemoryCacheMaxSize()) * 1024) {
+      length <= int64_t(StaticPrefs::MediaMemoryCacheMaxSize()) * 1024) {
     // Don't throttle the download of small resources. This is to speed
     // up seeking, as seeks into unbuffered ranges would require starting
     // up a new HTTP transaction, which adds latency.
     return false;
   }
 
   if (Preferences::GetBool("media.throttle-regardless-of-download-rate",
                            false)) {
--- a/dom/media/DecoderTraits.cpp
+++ b/dom/media/DecoderTraits.cpp
@@ -33,17 +33,16 @@
 
 #include "ADTSDecoder.h"
 #include "ADTSDemuxer.h"
 
 #include "FlacDecoder.h"
 #include "FlacDemuxer.h"
 
 #include "nsPluginHost.h"
-#include "MediaPrefs.h"
 
 namespace mozilla
 {
 
 /* static */ bool
 DecoderTraits::IsHttpLiveStreamingType(const MediaContainerType& aType)
 {
   const auto& mimeType = aType.Type();
--- a/dom/media/FileBlockCache.cpp
+++ b/dom/media/FileBlockCache.cpp
@@ -1,23 +1,23 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim:set ts=2 sw=2 sts=2 et cindent: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "FileBlockCache.h"
 #include "MediaCache.h"
-#include "MediaPrefs.h"
 #include "VideoUtils.h"
 #include "prio.h"
 #include <algorithm>
 #include "nsAnonymousTemporaryFile.h"
 #include "nsIThreadManager.h"
 #include "mozilla/dom/ContentChild.h"
+#include "mozilla/StaticPrefs.h"
 #include "mozilla/SystemGroup.h"
 #include "nsXULAppAPI.h"
 
 namespace mozilla {
 
 #undef LOG
 LazyLogModule gFileBlockCacheLog("FileBlockCache");
 #define LOG(x, ...) MOZ_LOG(gFileBlockCacheLog, LogLevel::Debug, \
@@ -135,17 +135,17 @@ FileBlockCache::Flush()
 }
 
 int32_t
 FileBlockCache::GetMaxBlocks() const
 {
   // We look up the cache size every time. This means dynamic changes
   // to the pref are applied.
   const uint32_t cacheSizeKb =
-    std::min(MediaPrefs::MediaCacheSizeKb(), uint32_t(INT32_MAX) * 2);
+    std::min(StaticPrefs::MediaCacheSize(), uint32_t(INT32_MAX) * 2);
   // Ensure we can divide BLOCK_SIZE by 1024.
   static_assert(MediaCacheStream::BLOCK_SIZE % 1024 == 0,
                 "BLOCK_SIZE should be a multiple of 1024");
   // Ensure BLOCK_SIZE/1024 is at least 2.
   static_assert(MediaCacheStream::BLOCK_SIZE / 1024 >= 2,
                 "BLOCK_SIZE / 1024 should be at least 2");
   // Ensure we can convert BLOCK_SIZE/1024 to a uint32_t without truncation.
   static_assert(MediaCacheStream::BLOCK_SIZE / 1024 <= int64_t(UINT32_MAX),
--- a/dom/media/MediaCache.cpp
+++ b/dom/media/MediaCache.cpp
@@ -4,27 +4,27 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "MediaCache.h"
 
 #include "ChannelMediaResource.h"
 #include "FileBlockCache.h"
 #include "MediaBlockCacheBase.h"
-#include "MediaPrefs.h"
 #include "MediaResource.h"
 #include "MemoryBlockCache.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/ClearOnShutdown.h"
 #include "mozilla/ErrorNames.h"
 #include "mozilla/Logging.h"
 #include "mozilla/Monitor.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/Services.h"
 #include "mozilla/StaticPtr.h"
+#include "mozilla/StaticPrefs.h"
 #include "mozilla/SystemGroup.h"
 #include "mozilla/Telemetry.h"
 #include "nsContentUtils.h"
 #include "nsIObserverService.h"
 #include "nsIPrincipal.h"
 #include "nsPrintfCString.h"
 #include "nsProxyRelease.h"
 #include "nsThreadUtils.h"
@@ -779,17 +779,17 @@ MediaCache::GetMediaCache(int64_t aConte
     ClearOnShutdown(&sClearThread, ShutdownPhase::ShutdownThreads);
   }
 
   if (!sThread) {
     return nullptr;
   }
 
   if (aContentLength > 0 &&
-      aContentLength <= int64_t(MediaPrefs::MediaMemoryCacheMaxSize()) * 1024) {
+      aContentLength <= int64_t(StaticPrefs::MediaMemoryCacheMaxSize()) * 1024) {
     // Small-enough resource, use a new memory-backed MediaCache.
     RefPtr<MediaBlockCacheBase> bc = new MemoryBlockCache(aContentLength);
     nsresult rv = bc->Init();
     if (NS_SUCCEEDED(rv)) {
       RefPtr<MediaCache> mc = new MediaCache(bc);
       LOG("GetMediaCache(%" PRIi64 ") -> Memory MediaCache %p",
           aContentLength,
           mc.get());
@@ -1371,18 +1371,18 @@ MediaCache::Update()
   TimeDuration latestNextUse;
   if (freeBlockCount == 0) {
     int32_t reusableBlock = FindReusableBlock(lock, now, nullptr, 0, maxBlocks);
     if (reusableBlock >= 0) {
       latestNextUse = PredictNextUse(lock, now, reusableBlock);
     }
   }
 
-  int32_t resumeThreshold = MediaPrefs::MediaCacheResumeThreshold();
-  int32_t readaheadLimit = MediaPrefs::MediaCacheReadaheadLimit();
+  int32_t resumeThreshold = StaticPrefs::MediaCacheResumeThreshold();
+  int32_t readaheadLimit = StaticPrefs::MediaCacheReadaheadLimit();
 
   for (uint32_t i = 0; i < mStreams.Length(); ++i) {
     actions.AppendElement(StreamAction{});
 
     MediaCacheStream* stream = mStreams[i];
     if (stream->mClosed) {
       LOG("Stream %p closed", stream);
       continue;
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -13,27 +13,27 @@
 #include "mediasink/DecodedStream.h"
 #include "mediasink/OutputStreamManager.h"
 #include "mediasink/VideoSink.h"
 #include "mozilla/Logging.h"
 #include "mozilla/MathAlgorithms.h"
 #include "mozilla/NotNull.h"
 #include "mozilla/SharedThreadPool.h"
 #include "mozilla/Sprintf.h"
+#include "mozilla/StaticPrefs.h"
 #include "mozilla/Telemetry.h"
 #include "mozilla/TaskQueue.h"
 #include "mozilla/Tuple.h"
 #include "nsIMemoryReporter.h"
 #include "nsPrintfCString.h"
 #include "nsTArray.h"
 #include "ImageContainer.h"
 #include "MediaDecoder.h"
 #include "MediaDecoderStateMachine.h"
 #include "MediaShutdownManager.h"
-#include "MediaPrefs.h"
 #include "MediaTimer.h"
 #include "ReaderProxy.h"
 #include "TimeUnits.h"
 #include "VideoUtils.h"
 
 namespace mozilla {
 
 using namespace mozilla::media;
@@ -154,17 +154,17 @@ static void InitVideoQueuePrefs()
 }
 
 // Delay, in milliseconds, that tabs needs to be in background before video
 // decoding is suspended.
 static TimeDuration
 SuspendBackgroundVideoDelay()
 {
   return TimeDuration::FromMilliseconds(
-    MediaPrefs::MDSMSuspendBackgroundVideoDelay());
+    StaticPrefs::MediaSuspendBkgndVideoDelayMs());
 }
 
 class MediaDecoderStateMachine::StateObject
 {
 public:
   virtual ~StateObject() { }
   virtual void Exit() { }   // Exit action.
   virtual void Step() { }   // Perform a 'cycle' of this state object.
@@ -755,17 +755,17 @@ private:
   void StartDormantTimer()
   {
     if (!mMaster->mMediaSeekable) {
       // Don't enter dormant if the media is not seekable because we need to
       // seek when exiting dormant.
       return;
     }
 
-    auto timeout = MediaPrefs::DormantOnPauseTimeout();
+    auto timeout = StaticPrefs::MediaDormantOnPauseTimeoutMs();
     if (timeout < 0) {
       // Disabled when timeout is negative.
       return;
     } else if (timeout == 0) {
       // Enter dormant immediately without scheduling a timer.
       SetState<DormantState>();
       return;
     }
@@ -2198,17 +2198,17 @@ DecodeMetadataState::OnMetadataRead(Meta
 
   mMaster->mMetadataLoadedEvent.Notify(
     Move(aMetadata.mInfo),
     Move(aMetadata.mTags),
     MediaDecoderEventVisibility::Observable);
 
   // Check whether the media satisfies the requirement of seamless looing.
   // (Before checking the media is audio only, we need to get metadata first.)
-  mMaster->mSeamlessLoopingAllowed = MediaPrefs::SeamlessLooping() &&
+  mMaster->mSeamlessLoopingAllowed = StaticPrefs::MediaSeamlessLooping() &&
                                      mMaster->HasAudio() &&
                                      !mMaster->HasVideo();
   mMaster->LoopingChanged();
 
   SetState<DecodingFirstFrameState>();
 }
 
 void
@@ -3047,17 +3047,17 @@ void MediaDecoderStateMachine::SetVideoD
   MOZ_ASSERT(OnTaskQueue());
 
   LOG("SetVideoDecodeModeInternal(), VideoDecodeMode=(%s->%s), mVideoDecodeSuspended=%c",
       mVideoDecodeMode == VideoDecodeMode::Normal ? "Normal" : "Suspend",
       aMode == VideoDecodeMode::Normal ? "Normal" : "Suspend",
       mVideoDecodeSuspended ? 'T' : 'F');
 
   // Should not suspend decoding if we don't turn on the pref.
-  if (!MediaPrefs::MDSMSuspendBackgroundVideoEnabled() &&
+  if (!StaticPrefs::MediaSuspendBkgndVideoEnabled() &&
       aMode == VideoDecodeMode::Suspend) {
     LOG("SetVideoDecodeModeInternal(), early return because preference off and set to Suspend");
     return;
   }
 
   if (aMode == mVideoDecodeMode) {
     LOG("SetVideoDecodeModeInternal(), early return because the mode does not change");
     return;
--- a/dom/media/MediaFormatReader.cpp
+++ b/dom/media/MediaFormatReader.cpp
@@ -12,20 +12,24 @@
 #include "VideoFrameContainer.h"
 #include "VideoUtils.h"
 #include "mozilla/AbstractThread.h"
 #include "mozilla/CDMProxy.h"
 #include "mozilla/ClearOnShutdown.h"
 #include "mozilla/NotNull.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/SharedThreadPool.h"
+#include "mozilla/StaticPrefs.h"
 #include "mozilla/Telemetry.h"
 #include "mozilla/Unused.h"
 #include "nsContentUtils.h"
 #include "nsPrintfCString.h"
+#ifdef MOZ_WIDGET_ANDROID
+#include "mozilla/jni/Utils.h"
+#endif
 
 #include <algorithm>
 #include <map>
 #include <queue>
 
 using namespace mozilla::media;
 
 static mozilla::LazyLogModule sFormatDecoderLog("MediaFormatReader");
@@ -1300,18 +1304,20 @@ MediaFormatReader::DemuxerProxy::NotifyD
   });
 }
 
 MediaFormatReader::MediaFormatReader(MediaFormatReaderInit& aInit,
                                      MediaDataDemuxer* aDemuxer)
   : mTaskQueue(new TaskQueue(GetMediaThreadPool(MediaThreadType::PLAYBACK),
                              "MediaFormatReader::mTaskQueue",
                              /* aSupportsTailDispatch = */ true))
-  , mAudio(this, MediaData::AUDIO_DATA, MediaPrefs::MaxAudioDecodeError())
-  , mVideo(this, MediaData::VIDEO_DATA, MediaPrefs::MaxVideoDecodeError())
+  , mAudio(this, MediaData::AUDIO_DATA,
+           StaticPrefs::MediaAudioMaxDecodeError())
+  , mVideo(this, MediaData::VIDEO_DATA,
+           StaticPrefs::MediaVideoMaxDecodeError())
   , mDemuxer(new DemuxerProxy(aDemuxer))
   , mDemuxerInitDone(false)
   , mPendingNotifyDataArrived(false)
   , mLastReportedNumDecodedFrames(0)
   , mPreviousDecodedKeyframeTime_us(sNoPreviousDecodedKeyframe)
   , mKnowsCompositor(aInit.mKnowsCompositor)
   , mInitDone(false)
   , mTrackDemuxersMayBlock(false)
@@ -1577,17 +1583,17 @@ MediaFormatReader::AsyncReadMetadata()
 }
 
 void
 MediaFormatReader::OnDemuxerInitDone(const MediaResult& aResult)
 {
   MOZ_ASSERT(OnTaskQueue());
   mDemuxerInitRequest.Complete();
 
-  if (NS_FAILED(aResult) && MediaPrefs::MediaWarningsAsErrors()) {
+  if (NS_FAILED(aResult) && StaticPrefs::MediaPlaybackWarningsAsErrors()) {
     mMetadataPromise.Reject(aResult, __func__);
     return;
   }
 
   mDemuxerInitDone = true;
 
   UniquePtr<MetadataTags> tags(MakeUnique<MetadataTags>());
 
@@ -1777,17 +1783,17 @@ MediaFormatReader::GetDecoderData(TrackT
   return mVideo;
 }
 
 bool
 MediaFormatReader::ShouldSkip(TimeUnit aTimeThreshold)
 {
   MOZ_ASSERT(HasVideo());
 
-  if (!MediaPrefs::MFRSkipToNextKeyFrameEnabled()) {
+  if (!StaticPrefs::MediaDecoderSkipToNextKeyFrameEnabled()) {
     return false;
   }
 
   TimeUnit nextKeyframe;
   nsresult rv = mVideo.mTrackDemuxer->GetNextRandomAccessPoint(&nextKeyframe);
   if (NS_FAILED(rv)) {
     // Only OggTrackDemuxer with video type gets into here.
     // We don't support skip-to-next-frame for this case.
@@ -2398,17 +2404,17 @@ MediaFormatReader::HandleDemuxedSamples(
   }
 
   RefPtr<MediaRawData> sample = decoder.mQueuedSamples[0];
   const RefPtr<TrackInfoSharedPtr> info = sample->mTrackInfo;
 
   if (info && decoder.mLastStreamSourceID != info->GetID()) {
     nsTArray<RefPtr<MediaRawData>> samples;
     if (decoder.mDecoder) {
-      bool recyclable = MediaPrefs::MediaDecoderCheckRecycling() &&
+      bool recyclable = StaticPrefs::MediaDecoderRecycleEnabled() &&
                         decoder.mDecoder->SupportDecoderRecycling();
       if (!recyclable && decoder.mTimeThreshold.isNothing() &&
           (decoder.mNextStreamSourceID.isNothing() ||
             decoder.mNextStreamSourceID.ref() != info->GetID())) {
         LOG("%s stream id has changed from:%d to:%d, draining decoder.",
             TrackTypeToStr(aTrack),
             decoder.mLastStreamSourceID,
             info->GetID());
--- a/dom/media/MediaFormatReader.h
+++ b/dom/media/MediaFormatReader.h
@@ -4,25 +4,25 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #if !defined(MediaFormatReader_h_)
 #define MediaFormatReader_h_
 
 #include "mozilla/Atomics.h"
 #include "mozilla/Maybe.h"
+#include "mozilla/Mutex.h"
 #include "mozilla/StateMirroring.h"
+#include "mozilla/StaticPrefs.h"
 #include "mozilla/TaskQueue.h"
-#include "mozilla/Mutex.h"
 
 #include "FrameStatistics.h"
 #include "MediaEventSource.h"
 #include "MediaDataDemuxer.h"
 #include "MediaMetadataManager.h"
-#include "MediaPrefs.h"
 #include "MediaPromiseDefs.h"
 #include "nsAutoPtr.h"
 #include "PDMFactory.h"
 #include "SeekTarget.h"
 
 namespace mozilla {
 
 class CDMProxy;
@@ -482,17 +482,17 @@ private:
     {
       if (!mError.isSome()) {
         return false;
       }
       if (mError.ref() == NS_ERROR_DOM_MEDIA_DECODE_ERR) {
         // Allow decode errors to be non-fatal, but give up
         // if we have too many, or if warnings should be treated as errors.
         return mNumOfConsecutiveError > mMaxConsecutiveError ||
-               MediaPrefs::MediaWarningsAsErrors();
+               StaticPrefs::MediaPlaybackWarningsAsErrors();
       } else if (mError.ref() == NS_ERROR_DOM_MEDIA_NEED_NEW_DECODER) {
         // If the caller asked for a new decoder we shouldn't treat
         // it as fatal.
         return false;
       } else {
         // All other error types are fatal
         return true;
       }
deleted file mode 100644
--- a/dom/media/MediaPrefs.cpp
+++ /dev/null
@@ -1,93 +0,0 @@
-/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "MediaPrefs.h"
-
-#include "mozilla/ClearOnShutdown.h"
-#include "mozilla/Preferences.h"
-#include "mozilla/StaticPtr.h"
-#include "MainThreadUtils.h"
-
-namespace mozilla {
-
-StaticAutoPtr<MediaPrefs> MediaPrefs::sInstance;
-
-MediaPrefs&
-MediaPrefs::GetSingleton()
-{
-  if (!sInstance) {
-    sInstance = new MediaPrefs;
-    ClearOnShutdown(&sInstance);
-  }
-  MOZ_ASSERT(SingletonExists());
-  return *sInstance;
-}
-
-bool
-MediaPrefs::SingletonExists()
-{
-  return sInstance != nullptr;
-}
-
-MediaPrefs::MediaPrefs()
-{
-  MediaPrefs::AssertMainThread();
-}
-
-void MediaPrefs::AssertMainThread()
-{
-  MOZ_ASSERT(NS_IsMainThread(), "this code must be run on the main thread");
-}
-
-void MediaPrefs::PrefAddVarCache(bool* aVariable,
-                                 const char* aPref,
-                                 bool aDefault)
-{
-  Preferences::AddBoolVarCache(aVariable, aPref, aDefault);
-}
-
-void MediaPrefs::PrefAddVarCache(int32_t* aVariable,
-                                 const char* aPref,
-                                 int32_t aDefault)
-{
-  Preferences::AddIntVarCache(aVariable, aPref, aDefault);
-}
-
-void MediaPrefs::PrefAddVarCache(uint32_t* aVariable,
-                                 const char* aPref,
-                                 uint32_t aDefault)
-{
-  Preferences::AddUintVarCache(aVariable, aPref, aDefault);
-}
-
-void MediaPrefs::PrefAddVarCache(float* aVariable,
-                                 const char* aPref,
-                                 float aDefault)
-{
-  Preferences::AddFloatVarCache(aVariable, aPref, aDefault);
-}
-
-void MediaPrefs::PrefAddVarCache(AtomicBool* aVariable,
-                                 const char* aPref,
-                                 bool aDefault)
-{
-  Preferences::AddAtomicBoolVarCache(aVariable, aPref, aDefault);
-}
-
-void MediaPrefs::PrefAddVarCache(AtomicInt32* aVariable,
-                                 const char* aPref,
-                                 int32_t aDefault)
-{
-  Preferences::AddAtomicIntVarCache(aVariable, aPref, aDefault);
-}
-
-void MediaPrefs::PrefAddVarCache(AtomicUint32* aVariable,
-                                 const char* aPref,
-                                 uint32_t aDefault)
-{
-  Preferences::AddAtomicUintVarCache(aVariable, aPref, aDefault);
-}
-
-} // namespace mozilla
deleted file mode 100644
--- a/dom/media/MediaPrefs.h
+++ /dev/null
@@ -1,233 +0,0 @@
-/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef MEDIA_PREFS_H
-#define MEDIA_PREFS_H
-
-#ifdef MOZ_WIDGET_ANDROID
-#include "GeneratedJNIWrappers.h"
-#endif
-
-#include "mozilla/Atomics.h"
-
-// First time MediaPrefs::GetSingleton() needs to be called on the main thread,
-// before any of the methods accessing the values are used, but after
-// the Preferences system has been initialized.
-
-// The static methods to access the preference value are safe to call
-// from any thread after that first call.
-
-// To register a preference, you need to add a line in this file using
-// the DECL_MEDIA_PREF macro.
-//
-// For example this line in the .h:
-//   DECL_MEDIA_PREF("media.resampling.enabled",AudioSinkResampling,bool,false);
-// means that you can call
-//   const bool& var = MediaPrefs::AudioSinkResampling();
-// from any thread, you will get the most up to date preference value of
-// "media.resampling.enabled".  If the value is not set, the default would be
-// false.
-
-#define DECL_MEDIA_PREF(Pref, Name, Type, Default)                            \
-public:                                                                       \
-static const Type& Name() { MOZ_ASSERT(SingletonExists()); return GetSingleton().mPref##Name.mValue; } \
-private:                                                                      \
-static const char* Get##Name##PrefName() { return Pref; }                     \
-static StripAtomic<Type> Get##Name##PrefDefault() { return Default; }         \
-PrefTemplate<Type, Get##Name##PrefDefault, Get##Name##PrefName> mPref##Name
-
-// Custom Definitions.
-#define GMP_DEFAULT_ASYNC_SHUTDOWN_TIMEOUT 3000
-#define SUSPEND_BACKGROUND_VIDEO_DELAY_MS 10000
-#define TEST_PREFERENCE_FAKE_RECOGNITION_SERVICE "media.webspeech.test.fake_recognition_service"
-
-namespace mozilla {
-
-template<class T> class StaticAutoPtr;
-
-class MediaPrefs final
-{
-  typedef Atomic<bool, Relaxed> AtomicBool;
-  typedef Atomic<int32_t, Relaxed> AtomicInt32;
-  typedef Atomic<uint32_t, Relaxed> AtomicUint32;
-
-  template <typename T>
-  struct StripAtomicImpl {
-    typedef T Type;
-  };
-
-  template <typename T, MemoryOrdering Order>
-  struct StripAtomicImpl<Atomic<T, Order>> {
-    typedef T Type;
-  };
-
-  template <typename T>
-  using StripAtomic = typename StripAtomicImpl<T>::Type;
-
-private:
-  // Since we cannot use const char*, use a function that returns it.
-  template <class T, StripAtomic<T> Default(), const char* Pref()>
-  class PrefTemplate
-  {
-  public:
-    PrefTemplate()
-    : mValue(Default())
-    {
-      Register(Pref());
-    }
-    T mValue;
-  private:
-    void Register(const char* aPreference)
-    {
-      AssertMainThread();
-      PrefAddVarCache(&mValue, aPreference, mValue);
-    }
-  };
-
-  // This is where DECL_MEDIA_PREF for each of the preferences should go.
-
-  // Cache sizes.
-  DECL_MEDIA_PREF("media.cache_size",                         MediaCacheSizeKb, uint32_t, 512000);
-  DECL_MEDIA_PREF("media.memory_cache_max_size",              MediaMemoryCacheMaxSize, uint32_t, 8192);
-  DECL_MEDIA_PREF("media.memory_caches_combined_limit_kb",    MediaMemoryCachesCombinedLimitKb, uint32_t, 524288);
-  DECL_MEDIA_PREF("media.memory_caches_combined_limit_pc_sysmem",
-                                                              MediaMemoryCachesCombinedLimitPcSysmem, uint32_t, 5);
-
-  DECL_MEDIA_PREF("media.cache_resume_threshold",             MediaCacheResumeThreshold, int32_t, 10);
-  DECL_MEDIA_PREF("media.cache_readahead_limit",              MediaCacheReadaheadLimit, int32_t, 30);
-
-  // AudioSink
-  DECL_MEDIA_PREF("accessibility.monoaudio.enable",           MonoAudio, bool, false);
-  DECL_MEDIA_PREF("media.resampling.enabled",                 AudioSinkResampling, bool, false);
-#if defined(XP_WIN) || defined(XP_DARWIN) || defined(MOZ_PULSEAUDIO)
-  DECL_MEDIA_PREF("media.forcestereo.enabled",                AudioSinkForceStereo, bool, false);
-#else
-  DECL_MEDIA_PREF("media.forcestereo.enabled",                AudioSinkForceStereo, bool, true);
-#endif
-  // VideoSink
-  DECL_MEDIA_PREF("media.ruin-av-sync.enabled",               RuinAvSync, bool, false);
-
-  // Encrypted Media Extensions
-  DECL_MEDIA_PREF("media.clearkey.persistent-license.enabled", ClearKeyPersistentLicenseEnabled, bool, false);
-
-  // PlatformDecoderModule
-  DECL_MEDIA_PREF("media.gmp.insecure.allow",                 GMPAllowInsecure, bool, false);
-  DECL_MEDIA_PREF("media.eme.enabled",                        EMEEnabled, bool, false);
-  DECL_MEDIA_PREF("media.use-blank-decoder",                  PDMUseBlankDecoder, bool, false);
-  DECL_MEDIA_PREF("media.gpu-process-decoder",                PDMUseGPUDecoder, bool, false);
-#ifdef MOZ_WIDGET_ANDROID
-  DECL_MEDIA_PREF("media.android-media-codec.enabled",        PDMAndroidMediaCodecEnabled, bool, false);
-  DECL_MEDIA_PREF("media.android-media-codec.preferred",      PDMAndroidMediaCodecPreferred, bool, false);
-  DECL_MEDIA_PREF("media.navigator.hardware.vp8_encode.acceleration_remote_enabled", RemoteMediaCodecVP8EncoderEnabled, bool, false);
-#endif
-  // WebRTC
-  DECL_MEDIA_PREF("media.navigator.mediadatadecoder_enabled", MediaDataDecoderEnabled, bool, false);
-#ifdef MOZ_FFMPEG
-  DECL_MEDIA_PREF("media.ffmpeg.enabled",                     PDMFFmpegEnabled, bool, true);
-  DECL_MEDIA_PREF("media.libavcodec.allow-obsolete",          LibavcodecAllowObsolete, bool, false);
-#endif
-#if defined(MOZ_FFMPEG) || defined(MOZ_FFVPX)
-  DECL_MEDIA_PREF("media.ffmpeg.low-latency.enabled",         PDMFFmpegLowLatencyEnabled, bool, false);
-#endif
-#ifdef MOZ_FFVPX
-  DECL_MEDIA_PREF("media.ffvpx.enabled",                      PDMFFVPXEnabled, bool, true);
-#endif
-#ifdef MOZ_AV1
-  DECL_MEDIA_PREF("media.av1.enabled",                        AV1Enabled, bool, false);
-#endif
-#ifdef XP_WIN
-  DECL_MEDIA_PREF("media.wmf.enabled",                        PDMWMFEnabled, bool, true);
-  DECL_MEDIA_PREF("media.wmf.skip-blacklist",                 PDMWMFSkipBlacklist, bool, false);
-  DECL_MEDIA_PREF("media.decoder-doctor.wmf-disabled-is-failure", DecoderDoctorWMFDisabledIsFailure, bool, false);
-  DECL_MEDIA_PREF("media.wmf.vp9.enabled",                    PDMWMFVP9DecoderEnabled, bool, true);
-#endif
-  DECL_MEDIA_PREF("media.decoder.recycle.enabled",            MediaDecoderCheckRecycling, bool, false);
-  DECL_MEDIA_PREF("media.decoder.skip-to-next-key-frame.enabled", MFRSkipToNextKeyFrameEnabled, bool, true);
-  DECL_MEDIA_PREF("media.gmp.decoder.enabled",                PDMGMPEnabled, bool, true);
-  DECL_MEDIA_PREF("media.eme.audio.blank",                    EMEBlankAudio, bool, false);
-  DECL_MEDIA_PREF("media.eme.video.blank",                    EMEBlankVideo, bool, false);
-  DECL_MEDIA_PREF("media.eme.chromium-api.video-shmems",
-                  EMEChromiumAPIVideoShmemCount,
-                  uint32_t,
-                  3);
-
-  // MediaDecoderStateMachine
-  DECL_MEDIA_PREF("media.suspend-bkgnd-video.enabled",        MDSMSuspendBackgroundVideoEnabled, bool, false);
-  DECL_MEDIA_PREF("media.suspend-bkgnd-video.delay-ms",       MDSMSuspendBackgroundVideoDelay, AtomicUint32, SUSPEND_BACKGROUND_VIDEO_DELAY_MS);
-  DECL_MEDIA_PREF("media.dormant-on-pause-timeout-ms",        DormantOnPauseTimeout, int32_t, 5000);
-
-  // WebSpeech
-  DECL_MEDIA_PREF("media.webspeech.synth.force_global_queue", WebSpeechForceGlobal, bool, false);
-  DECL_MEDIA_PREF("media.webspeech.test.enable",              WebSpeechTestEnabled, bool, false);
-  DECL_MEDIA_PREF("media.webspeech.test.fake_fsm_events",     WebSpeechFakeFSMEvents, bool, false);
-  DECL_MEDIA_PREF(TEST_PREFERENCE_FAKE_RECOGNITION_SERVICE,   WebSpeechFakeRecognitionService, bool, false);
-  DECL_MEDIA_PREF("media.webspeech.recognition.enable",       WebSpeechRecognitionEnabled, bool, false);
-  DECL_MEDIA_PREF("media.webspeech.recognition.force_enable", WebSpeechRecognitionForceEnabled, bool, false);
-
-#if defined(RELEASE_OR_BETA)
-  DECL_MEDIA_PREF("media.audio-max-decode-error",             MaxAudioDecodeError, uint32_t, 3);
-  DECL_MEDIA_PREF("media.video-max-decode-error",             MaxVideoDecodeError, uint32_t, 2);
-#else
-  // Take zero tolerance of decoding error in debug for any decoder regression.
-  DECL_MEDIA_PREF("media.audio-max-decode-error",             MaxAudioDecodeError, uint32_t, 0);
-  DECL_MEDIA_PREF("media.video-max-decode-error",             MaxVideoDecodeError, uint32_t, 0);
-#endif
-
-  // Ogg
-  DECL_MEDIA_PREF("media.ogg.enabled",                        OggEnabled, bool, true);
-  // Flac
-  DECL_MEDIA_PREF("media.ogg.flac.enabled",                   FlacInOgg, bool, false);
-  DECL_MEDIA_PREF("media.flac.enabled",                       FlacEnabled, bool, true);
-
-  // Hls
-  DECL_MEDIA_PREF("media.hls.enabled",                        HLSEnabled, bool, false);
-
-  // True, it enables rust parser and fallback to stagefright if rust parser fails.
-  // False, it uses stagefright only.
-  DECL_MEDIA_PREF("media.rust.mp4parser",                     EnableRustMP4Parser, bool, true);
-
-  DECL_MEDIA_PREF("media.mp4.enabled",                        MP4Enabled, bool, false);
-
-  // Error/warning handling, Decoder Doctor
-  DECL_MEDIA_PREF("media.playback.warnings-as-errors",        MediaWarningsAsErrors, bool, false);
-
-  // resume background video decoding when the cursor is hovering over the tab.
-  DECL_MEDIA_PREF("media.resume-bkgnd-video-on-tabhover",     ResumeVideoDecodingOnTabHover, bool, false);
-
-  DECL_MEDIA_PREF("media.videocontrols.lock-video-orientation",  VideoOrientationLockEnabled, bool, false);
-
-  // Media Seamless Looping
-  DECL_MEDIA_PREF("media.seamless-looping",                   SeamlessLooping, bool, true);
-
-public:
-  // Manage the singleton:
-  static MediaPrefs& GetSingleton();
-  static bool SingletonExists();
-
-private:
-  template<class T> friend class StaticAutoPtr;
-  static StaticAutoPtr<MediaPrefs> sInstance;
-
-  // Creating these to avoid having to include Preferences.h in the .h
-  static void PrefAddVarCache(bool*, const char*, bool);
-  static void PrefAddVarCache(int32_t*, const char*, int32_t);
-  static void PrefAddVarCache(uint32_t*, const char*, uint32_t);
-  static void PrefAddVarCache(float*, const char*, float);
-  static void PrefAddVarCache(AtomicBool*, const char*, bool);
-  static void PrefAddVarCache(AtomicInt32*, const char*, int32_t);
-  static void PrefAddVarCache(AtomicUint32*, const char*, uint32_t);
-
-  static void AssertMainThread();
-
-  MediaPrefs();
-  MediaPrefs(const MediaPrefs&) = delete;
-  MediaPrefs& operator=(const MediaPrefs&) = delete;
-};
-
-#undef DECL_MEDIA_PREF /* Don't need it outside of this file */
-
-} // namespace mozilla
-
-#endif /* MEDIA_PREFS_H */
--- a/dom/media/MediaResource.cpp
+++ b/dom/media/MediaResource.cpp
@@ -1,16 +1,15 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim:set ts=2 sw=2 sts=2 et cindent: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "MediaResource.h"
-#include "MediaPrefs.h"
 #include "mozilla/DebugOnly.h"
 #include "mozilla/Logging.h"
 #include "mozilla/MathAlgorithms.h"
 #include "mozilla/SystemGroup.h"
 #include "mozilla/ErrorNames.h"
 
 using mozilla::media::TimeUnit;
 
--- a/dom/media/MemoryBlockCache.cpp
+++ b/dom/media/MemoryBlockCache.cpp
@@ -1,22 +1,22 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim:set ts=2 sw=2 sts=2 et cindent: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "MemoryBlockCache.h"
 
-#include "MediaPrefs.h"
 #include "mozilla/Atomics.h"
 #include "mozilla/ClearOnShutdown.h"
 #include "mozilla/Logging.h"
 #include "mozilla/Telemetry.h"
 #include "mozilla/Services.h"
+#include "mozilla/StaticPrefs.h"
 #include "nsIObserver.h"
 #include "nsIObserverService.h"
 #include "nsWeakReference.h"
 #include "prsystem.h"
 
 namespace mozilla {
 
 #undef LOG
@@ -134,17 +134,17 @@ enum MemoryBlockCacheTelemetryErrors
   MoveBlockSourceOverrun = 5,
   MoveBlockDestOverflow = 6,
   MoveBlockCannotGrow = 7,
 };
 
 static int32_t
 CalculateMaxBlocks(int64_t aContentLength)
 {
-  int64_t maxSize = int64_t(MediaPrefs::MediaMemoryCacheMaxSize()) * 1024;
+  int64_t maxSize = int64_t(StaticPrefs::MediaMemoryCacheMaxSize()) * 1024;
   MOZ_ASSERT(aContentLength <= maxSize);
   MOZ_ASSERT(maxSize % MediaBlockCacheBase::BLOCK_SIZE == 0);
   // Note: It doesn't matter if calculations overflow, Init() would later fail.
   // We want at least enough blocks to contain the original content length.
   const int32_t requiredBlocks = maxSize / MediaBlockCacheBase::BLOCK_SIZE;
   // Allow at least 1s of ultra HD (25Mbps).
   const int32_t workableBlocks =
     25 * 1024 * 1024 / 8 / MediaBlockCacheBase::BLOCK_SIZE;
@@ -200,18 +200,18 @@ MemoryBlockCache::EnsureBufferCanContain
     // limit.
     // The alternative would have been to reserve the space first with
     // `atomic += extra` and then undo it with `atomic -= extra` in case of
     // failure; but this would have meant potentially preventing other (small
     // but successful) allocations.
     static const size_t sysmem =
       std::max<size_t>(PR_GetPhysicalMemorySize(), 32 * 1024 * 1024);
     const size_t limit = std::min(
-      size_t(MediaPrefs::MediaMemoryCachesCombinedLimitKb()) * 1024,
-      sysmem * MediaPrefs::MediaMemoryCachesCombinedLimitPcSysmem() / 100);
+      size_t(StaticPrefs::MediaMemoryCachesCombinedLimitKb()) * 1024,
+      sysmem * StaticPrefs::MediaMemoryCachesCombinedLimitPcSysmem() / 100);
     const size_t currentSizes = static_cast<size_t>(gCombinedSizes);
     if (currentSizes + extra > limit) {
       LOG("EnsureBufferCanContain(%zu) - buffer size %zu, wanted + %zu = %zu;"
           " combined sizes %zu + %zu > limit %zu",
           aContentLength,
           initialLength,
           extra,
           desiredLength,
--- a/dom/media/VideoUtils.cpp
+++ b/dom/media/VideoUtils.cpp
@@ -5,22 +5,22 @@
 #include "VideoUtils.h"
 
 #include <functional>
 #include <stdint.h>
 
 #include "CubebUtils.h"
 #include "ImageContainer.h"
 #include "MediaContainerType.h"
-#include "MediaPrefs.h"
 #include "MediaResource.h"
 #include "TimeUnits.h"
 #include "VorbisUtils.h"
 #include "mozilla/Base64.h"
 #include "mozilla/SharedThreadPool.h"
+#include "mozilla/StaticPrefs.h"
 #include "mozilla/SystemGroup.h"
 #include "mozilla/TaskCategory.h"
 #include "mozilla/TaskQueue.h"
 #include "mozilla/Telemetry.h"
 #include "nsCharSeparatedTokenizer.h"
 #include "nsContentTypeParser.h"
 #include "nsIConsoleService.h"
 #include "nsIRandomGenerator.h"
@@ -166,21 +166,21 @@ void DownmixStereoToMono(mozilla::AudioD
     sample = (aBuffer[fIdx*channels] + aBuffer[fIdx*channels + 1]) * 0.5;
     aBuffer[fIdx*channels] = aBuffer[fIdx*channels + 1] = sample;
   }
 }
 
 uint32_t
 DecideAudioPlaybackChannels(const AudioInfo& info)
 {
-  if (MediaPrefs::MonoAudio()) {
+  if (StaticPrefs::accessibility_monoaudio_enable()) {
     return 1;
   }
 
-  if (MediaPrefs::AudioSinkForceStereo()) {
+  if (StaticPrefs::MediaForcestereoEnabled()) {
     return 2;
   }
 
   return info.mChannels;
 }
 
 bool
 IsDefaultPlaybackDeviceMono()
--- a/dom/media/eme/MediaKeySystemAccess.cpp
+++ b/dom/media/eme/MediaKeySystemAccess.cpp
@@ -3,18 +3,18 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "mozilla/dom/MediaKeySystemAccess.h"
 #include "mozilla/dom/MediaKeySystemAccessBinding.h"
 #include "mozilla/dom/MediaKeySession.h"
 #include "mozilla/Preferences.h"
+#include "mozilla/StaticPrefs.h"
 #include "MediaContainerType.h"
-#include "MediaPrefs.h"
 #include "nsMimeTypes.h"
 #ifdef XP_WIN
 #include "WMFDecoderModule.h"
 #endif
 #include "nsContentCID.h"
 #include "nsServiceManagerUtils.h"
 #include "mozIGeckoMediaPluginService.h"
 #include "VideoUtils.h"
@@ -30,16 +30,17 @@
 #include "WebMDecoder.h"
 #include "mozilla/StaticPtr.h"
 #include "mozilla/ClearOnShutdown.h"
 #include "nsUnicharUtils.h"
 #include "mozilla/dom/MediaSource.h"
 #include "DecoderTraits.h"
 #ifdef MOZ_WIDGET_ANDROID
 #include "FennecJNIWrappers.h"
+#include "GeneratedJNIWrappers.h"
 #endif
 #include <functional>
 
 namespace mozilla {
 namespace dom {
 
 NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(MediaKeySystemAccess,
                                       mParent)
@@ -128,17 +129,18 @@ EnsureCDMInstalled(const nsAString& aKey
   return MediaKeySystemStatus::Available;
 }
 
 /* static */
 MediaKeySystemStatus
 MediaKeySystemAccess::GetKeySystemStatus(const nsAString& aKeySystem,
                                          nsACString& aOutMessage)
 {
-  MOZ_ASSERT(MediaPrefs::EMEEnabled() || IsClearkeyKeySystem(aKeySystem));
+  MOZ_ASSERT(StaticPrefs::MediaEmeEnabled() ||
+             IsClearkeyKeySystem(aKeySystem));
 
   if (IsClearkeyKeySystem(aKeySystem)) {
     return EnsureCDMInstalled(aKeySystem, aOutMessage);
   }
 
   if (IsWidevineKeySystem(aKeySystem)) {
     if (Preferences::GetBool("media.gmp-widevinecdm.visible", false)) {
       if (!Preferences::GetBool("media.gmp-widevinecdm.enabled", false)) {
@@ -270,17 +272,17 @@ GetSupportedKeySystems()
       KeySystemConfig clearkey;
       clearkey.mKeySystem = NS_ConvertUTF8toUTF16(kEMEKeySystemClearkey);
       clearkey.mInitDataTypes.AppendElement(NS_LITERAL_STRING("cenc"));
       clearkey.mInitDataTypes.AppendElement(NS_LITERAL_STRING("keyids"));
       clearkey.mInitDataTypes.AppendElement(NS_LITERAL_STRING("webm"));
       clearkey.mPersistentState = KeySystemFeatureSupport::Requestable;
       clearkey.mDistinctiveIdentifier = KeySystemFeatureSupport::Prohibited;
       clearkey.mSessionTypes.AppendElement(MediaKeySessionType::Temporary);
-      if (MediaPrefs::ClearKeyPersistentLicenseEnabled()) {
+      if (StaticPrefs::MediaClearkeyPersistentLicenseEnabled()) {
         clearkey.mSessionTypes.AppendElement(MediaKeySessionType::Persistent_license);
       }
 #if defined(XP_WIN)
       // Clearkey CDM uses WMF's H.264 decoder on Windows.
       if (WMFDecoderModule::HasH264()) {
         clearkey.mMP4.SetCanDecryptAndDecode(EME_CODEC_H264);
       } else {
         clearkey.mMP4.SetCanDecrypt(EME_CODEC_H264);
--- a/dom/media/eme/MediaKeySystemAccessManager.cpp
+++ b/dom/media/eme/MediaKeySystemAccessManager.cpp
@@ -1,20 +1,20 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "MediaKeySystemAccessManager.h"
 #include "DecoderDoctorDiagnostics.h"
-#include "MediaPrefs.h"
 #include "mozilla/EMEUtils.h"
 #include "nsServiceManagerUtils.h"
 #include "nsComponentManagerUtils.h"
 #include "nsIObserverService.h"
 #include "mozilla/Services.h"
+#include "mozilla/StaticPrefs.h"
 #include "mozilla/DetailedPromise.h"
 #ifdef XP_WIN
 #include "mozilla/WindowsVersion.h"
 #endif
 #ifdef XP_MACOSX
 #include "nsCocoaFeatures.h"
 #endif
 #include "nsPrintfCString.h"
@@ -103,17 +103,17 @@ MediaKeySystemAccessManager::Request(Det
     // supported.
     aPromise->MaybeReject(NS_ERROR_DOM_NOT_SUPPORTED_ERR,
                           NS_LITERAL_CSTRING("Key system is unsupported"));
     diagnostics.StoreMediaKeySystemAccess(mWindow->GetExtantDoc(),
                                           aKeySystem, false, __func__);
     return;
   }
 
-  if (!MediaPrefs::EMEEnabled() && !IsClearkeyKeySystem(aKeySystem)) {
+  if (!StaticPrefs::MediaEmeEnabled() && !IsClearkeyKeySystem(aKeySystem)) {
     // EME disabled by user, send notification to chrome so UI can inform user.
     // Clearkey is allowed even when EME is disabled because we want the pref
     // "media.eme.enabled" only taking effect on proprietary DRMs.
     MediaKeySystemAccess::NotifyObservers(mWindow,
                                           aKeySystem,
                                           MediaKeySystemStatus::Api_disabled);
     aPromise->MaybeReject(NS_ERROR_DOM_NOT_SUPPORTED_ERR,
                           NS_LITERAL_CSTRING("EME has been preffed off"));
--- a/dom/media/eme/mediadrm/MediaDrmProxySupport.cpp
+++ b/dom/media/eme/mediadrm/MediaDrmProxySupport.cpp
@@ -3,17 +3,16 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "MediaDrmProxySupport.h"
 #include "mozilla/EMEUtils.h"
 #include "FennecJNINatives.h"
 #include "MediaCodec.h" // For MediaDrm::KeyStatus
-#include "MediaPrefs.h"
 
 using namespace mozilla::java;
 
 namespace mozilla {
 
 LogModule* GetMDRMNLog() {
   static LazyLogModule log("MediaDrmProxySupport");
   return log;
--- a/dom/media/flac/FlacDecoder.cpp
+++ b/dom/media/flac/FlacDecoder.cpp
@@ -1,25 +1,25 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "FlacDecoder.h"
 #include "MediaContainerType.h"
-#include "MediaPrefs.h"
+#include "mozilla/StaticPrefs.h"
 
 namespace mozilla {
 
 /* static */ bool
 FlacDecoder::IsEnabled()
 {
 #ifdef MOZ_FFVPX
-  return MediaPrefs::FlacEnabled();
+  return StaticPrefs::MediaFlacEnabled();
 #else
   // Until bug 1295886 is fixed.
   return false;
 #endif
 }
 
 /* static */ bool
 FlacDecoder::IsSupportedType(const MediaContainerType& aContainerType)
--- a/dom/media/gmp/ChromiumCDMParent.cpp
+++ b/dom/media/gmp/ChromiumCDMParent.cpp
@@ -9,35 +9,35 @@
 #include "ChromiumCDMCallbackProxy.h"
 #include "ChromiumCDMProxy.h"
 #include "content_decryption_module.h"
 #include "GMPContentChild.h"
 #include "GMPContentParent.h"
 #include "GMPLog.h"
 #include "GMPService.h"
 #include "GMPUtils.h"
-#include "MediaPrefs.h"
 #include "mozilla/dom/MediaKeyMessageEventBinding.h"
 #include "mozilla/gmp/GMPTypes.h"
+#include "mozilla/StaticPrefs.h"
 #include "mozilla/Unused.h"
 #include "AnnexB.h"
 #include "H264.h"
 
 #define NS_DispatchToMainThread(...) CompileError_UseAbstractMainThreadInstead
 
 namespace mozilla {
 namespace gmp {
 
 using namespace eme;
 
 ChromiumCDMParent::ChromiumCDMParent(GMPContentParent* aContentParent,
                                      uint32_t aPluginId)
   : mPluginId(aPluginId)
   , mContentParent(aContentParent)
-  , mVideoShmemLimit(MediaPrefs::EMEChromiumAPIVideoShmemCount())
+  , mVideoShmemLimit(StaticPrefs::MediaEmeChromiumApiVideoShmems())
 {
   GMP_LOG(
     "ChromiumCDMParent::ChromiumCDMParent(this=%p, contentParent=%p, id=%u)",
     this,
     aContentParent,
     aPluginId);
 }
 
--- a/dom/media/gmp/GMPParent.cpp
+++ b/dom/media/gmp/GMPParent.cpp
@@ -21,17 +21,16 @@
 #include "nsIObserverService.h"
 #include "GMPTimerParent.h"
 #include "runnable_utils.h"
 #if defined(XP_LINUX) && defined(MOZ_GMP_SANDBOX)
 #include "mozilla/SandboxInfo.h"
 #endif
 #include "CDMStorageIdProvider.h"
 #include "GMPContentParent.h"
-#include "MediaPrefs.h"
 #include "VideoUtils.h"
 
 using mozilla::ipc::GeckoChildProcessHost;
 
 using CrashReporter::AnnotationTable;
 using CrashReporter::GetIDFromMinidump;
 
 #include "mozilla/Telemetry.h"
--- a/dom/media/gmp/GMPServiceParent.cpp
+++ b/dom/media/gmp/GMPServiceParent.cpp
@@ -4,16 +4,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "GMPServiceParent.h"
 #include "GMPService.h"
 #include "prio.h"
 #include "base/task.h"
 #include "mozilla/AbstractThread.h"
 #include "mozilla/Logging.h"
+#include "mozilla/StaticPrefs.h"
 #include "mozilla/dom/ContentParent.h"
 #include "GMPParent.h"
 #include "GMPVideoDecoderParent.h"
 #include "nsAutoPtr.h"
 #include "nsIObserverService.h"
 #include "GeckoChildProcessHost.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/ClearOnShutdown.h"
@@ -33,17 +34,16 @@
 #include "nsDirectoryServiceUtils.h"
 #include "nsDirectoryServiceDefs.h"
 #include "nsHashKeys.h"
 #include "nsIFile.h"
 #include "nsISimpleEnumerator.h"
 #include "nsIXULRuntime.h"
 #include "GMPDecoderModule.h"
 #include <limits>
-#include "MediaPrefs.h"
 #include "mozilla/SystemGroup.h"
 
 using mozilla::ipc::Transport;
 
 namespace mozilla {
 
 #ifdef LOG
 #undef LOG
@@ -813,17 +813,17 @@ GeckoMediaPluginServiceParent::SelectPlu
   return nullptr;
 }
 
 RefPtr<GMPParent>
 CreateGMPParent(AbstractThread* aMainThread)
 {
 #if defined(XP_LINUX) && defined(MOZ_GMP_SANDBOX)
   if (!SandboxInfo::Get().CanSandboxMedia()) {
-    if (!MediaPrefs::GMPAllowInsecure()) {
+    if (!StaticPrefs::MediaGmpInsecureAllow()) {
       NS_WARNING("Denying media plugin load due to lack of sandboxing.");
       return nullptr;
     }
     NS_WARNING("Loading media plugin despite lack of sandboxing.");
   }
 #endif
   return new GMPParent(aMainThread);
 }
--- a/dom/media/gtest/TestGMPCrossOrigin.cpp
+++ b/dom/media/gtest/TestGMPCrossOrigin.cpp
@@ -7,32 +7,31 @@
 #include "gtest/gtest.h"
 #include "nsIObserverService.h"
 #include "mozilla/Services.h"
 #include "mozilla/StaticPtr.h"
 #include "GMPTestMonitor.h"
 #include "GMPVideoDecoderProxy.h"
 #include "GMPVideoEncoderProxy.h"
 #include "GMPServiceParent.h"
-#include "MediaPrefs.h"
 #include "nsAppDirectoryServiceDefs.h"
 #include "mozilla/Atomics.h"
 #include "mozilla/DebugOnly.h"
 #include "nsThreadUtils.h"
 
 using namespace std;
 
 using namespace mozilla;
 using namespace mozilla::gmp;
 
 struct GMPTestRunner
 {
   NS_INLINE_DECL_THREADSAFE_REFCOUNTING(GMPTestRunner)
 
-  GMPTestRunner() { MediaPrefs::GetSingleton(); }
+  GMPTestRunner() {}
   void DoTest(void (GMPTestRunner::*aTestMethod)(GMPTestMonitor&));
   void RunTestGMPTestCodec1(GMPTestMonitor& aMonitor);
   void RunTestGMPTestCodec2(GMPTestMonitor& aMonitor);
   void RunTestGMPTestCodec3(GMPTestMonitor& aMonitor);
   void RunTestGMPCrossOrigin1(GMPTestMonitor& aMonitor);
   void RunTestGMPCrossOrigin2(GMPTestMonitor& aMonitor);
   void RunTestGMPCrossOrigin3(GMPTestMonitor& aMonitor);
   void RunTestGMPCrossOrigin4(GMPTestMonitor& aMonitor);
--- a/dom/media/gtest/TestGMPRemoveAndDelete.cpp
+++ b/dom/media/gtest/TestGMPRemoveAndDelete.cpp
@@ -11,17 +11,16 @@
 #include "mozilla/Services.h"
 #include "nsDirectoryServiceDefs.h"
 #include "nsIObserverService.h"
 #include "GMPVideoDecoderProxy.h"
 #include "GMPServiceParent.h"
 #include "GMPService.h"
 #include "GMPUtils.h"
 #include "mozilla/StaticPtr.h"
-#include "MediaPrefs.h"
 
 #define GMP_DIR_NAME NS_LITERAL_STRING("gmp-fakeopenh264")
 #define GMP_OLD_VERSION NS_LITERAL_STRING("1.0")
 #define GMP_NEW_VERSION NS_LITERAL_STRING("1.1")
 
 #define GMP_DELETED_TOPIC "gmp-directory-deleted"
 
 #define EXPECT_OK(X) EXPECT_TRUE(NS_SUCCEEDED(X))
@@ -223,18 +222,16 @@ GMPRemoveTest::~GMPRemoveTest()
   EXPECT_TRUE(NS_SUCCEEDED(mTmpDir->Exists(&exists)) && !exists);
 
   EXPECT_OK(GetServiceParent()->AddPluginDirectory(mOriginalPath));
 }
 
 void
 GMPRemoveTest::Setup()
 {
-  // Initialize media preferences.
-  MediaPrefs::GetSingleton();
   GeneratePlugin();
   GetService()->GetThread(getter_AddRefs(mGMPThread));
 
   // Spin the event loop until the GMP service has had a chance to complete
   // adding GMPs from MOZ_GMP_PATH. Otherwise, the RemovePluginDirectory()
   // below may complete before we're finished adding GMPs from MOZ_GMP_PATH,
   // and we'll end up not removing the GMP, and the test will fail.
   RefPtr<AbstractThread> thread(GetServiceParent()->GetAbstractGMPThread());
--- a/dom/media/gtest/TestGMPUtils.cpp
+++ b/dom/media/gtest/TestGMPUtils.cpp
@@ -2,31 +2,28 @@
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "gtest/gtest.h"
 #include "GMPUtils.h"
 #include "nsString.h"
-#include "MediaPrefs.h"
 
 #include <string>
 #include <vector>
 
 using namespace std;
 using namespace mozilla;
 
 void TestSplitAt(const char* aInput,
                  const char* aDelims,
                  size_t aNumExpectedTokens,
                  const char* aExpectedTokens[])
 {
-  // Initialize media preferences.
-  MediaPrefs::GetSingleton();
   nsCString input(aInput);
   nsTArray<nsCString> tokens;
   SplitAt(aDelims, input, tokens);
   EXPECT_EQ(tokens.Length(), aNumExpectedTokens) << "Should get expected number of tokens";
   for (size_t i = 0; i < tokens.Length(); i++) {
     EXPECT_TRUE(tokens[i].EqualsASCII(aExpectedTokens[i]))
       << "Tokenize fail; expected=" << aExpectedTokens[i] << " got=" <<
       tokens[i].BeginReading();
--- a/dom/media/gtest/mp4_demuxer/TestParser.cpp
+++ b/dom/media/gtest/mp4_demuxer/TestParser.cpp
@@ -1,16 +1,15 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "gtest/gtest.h"
 #include "MediaData.h"
-#include "MediaPrefs.h"
 #include "mozilla/ArrayUtils.h"
 #include "mozilla/Preferences.h"
 #include "BufferStream.h"
 #include "MP4Metadata.h"
 #include "MoofParser.h"
 
 class TestStream;
 namespace mozilla {
--- a/dom/media/hls/HLSDecoder.cpp
+++ b/dom/media/hls/HLSDecoder.cpp
@@ -10,21 +10,21 @@
 #include "DecoderTraits.h"
 #include "GeneratedJNINatives.h"
 #include "GeneratedJNIWrappers.h"
 #include "HLSDemuxer.h"
 #include "HLSUtils.h"
 #include "MediaContainerType.h"
 #include "MediaDecoderStateMachine.h"
 #include "MediaFormatReader.h"
-#include "MediaPrefs.h"
 #include "MediaShutdownManager.h"
 #include "nsContentUtils.h"
 #include "nsNetUtil.h"
 #include "nsThreadUtils.h"
+#include "mozilla/StaticPrefs.h"
 
 using namespace mozilla::java;
 
 namespace mozilla {
 
 class HLSResourceCallbacksSupport
   : public GeckoHLSResourceWrapper::Callbacks::Natives<HLSResourceCallbacksSupport>
 {
@@ -122,17 +122,17 @@ HLSDecoder::CreateStateMachine()
     new MediaFormatReader(init, new HLSDemuxer(mHLSResourceWrapper->GetPlayerId()));
 
   return new MediaDecoderStateMachine(this, mReader);
 }
 
 bool
 HLSDecoder::IsEnabled()
 {
-  return MediaPrefs::HLSEnabled() && (jni::GetAPIVersion() >= 16);
+  return StaticPrefs::MediaHlsEnabled() && (jni::GetAPIVersion() >= 16);
 }
 
 bool
 HLSDecoder::IsSupportedType(const MediaContainerType& aContainerType)
 {
   return IsEnabled() &&
          DecoderTraits::IsHttpLiveStreamingType(aContainerType);
 }
--- a/dom/media/ipc/RemoteVideoDecoder.cpp
+++ b/dom/media/ipc/RemoteVideoDecoder.cpp
@@ -1,20 +1,21 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=99: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
 #include "RemoteVideoDecoder.h"
 #include "VideoDecoderChild.h"
 #include "VideoDecoderManagerChild.h"
 #include "mozilla/layers/TextureClient.h"
+#include "mozilla/StaticPrefs.h"
 #include "base/thread.h"
 #include "MediaInfo.h"
-#include "MediaPrefs.h"
 #include "ImageContainer.h"
 #include "mozilla/layers/SynchronousTask.h"
 
 namespace mozilla {
 namespace dom {
 
 using base::Thread;
 using namespace ipc;
@@ -165,17 +166,17 @@ IsRemoteAcceleratedCompositor(KnowsCompo
   TextureFactoryIdentifier ident = aKnows->GetTextureFactoryIdentifier();
   return ident.mParentBackend != LayersBackend::LAYERS_BASIC &&
          ident.mParentProcessType == GeckoProcessType_GPU;
 }
 
 already_AddRefed<MediaDataDecoder>
 RemoteDecoderModule::CreateVideoDecoder(const CreateDecoderParams& aParams)
 {
-  if (!MediaPrefs::PDMUseGPUDecoder() ||
+  if (!StaticPrefs::MediaGpuProcessDecoder() ||
       !aParams.mKnowsCompositor ||
       !IsRemoteAcceleratedCompositor(aParams.mKnowsCompositor))
   {
     return mWrapped->CreateVideoDecoder(aParams);
   }
 
   RefPtr<RemoteVideoDecoder> object = new RemoteVideoDecoder();
 
--- a/dom/media/ipc/VideoDecoderManagerChild.cpp
+++ b/dom/media/ipc/VideoDecoderManagerChild.cpp
@@ -1,17 +1,17 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=99: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
 #include "VideoDecoderManagerChild.h"
 #include "VideoDecoderChild.h"
 #include "mozilla/dom/ContentChild.h"
-#include "MediaPrefs.h"
 #include "nsThreadUtils.h"
 #include "mozilla/gfx/2D.h"
 #include "mozilla/ipc/ProtocolUtils.h"
 #include "mozilla/layers/SynchronousTask.h"
 #include "mozilla/gfx/DataSurfaceHelpers.h"
 #include "mozilla/layers/ISurfaceAllocator.h"
 #include "base/task.h"
 
--- a/dom/media/mediasink/AudioSink.cpp
+++ b/dom/media/mediasink/AudioSink.cpp
@@ -8,17 +8,17 @@
 #include "MediaQueue.h"
 #include "AudioSink.h"
 #include "VideoUtils.h"
 #include "AudioConverter.h"
 
 #include "mozilla/CheckedInt.h"
 #include "mozilla/DebugOnly.h"
 #include "mozilla/IntegerPrintfMacros.h"
-#include "MediaPrefs.h"
+#include "mozilla/StaticPrefs.h"
 
 namespace mozilla {
 
 extern LazyLogModule gMediaDecoderLog;
 #define SINK_LOG(msg, ...) \
   MOZ_LOG(gMediaDecoderLog, LogLevel::Debug, ("AudioSink=%p " msg, this, ##__VA_ARGS__))
 #define SINK_LOG_V(msg, ...) \
   MOZ_LOG(gMediaDecoderLog, LogLevel::Verbose, ("AudioSink=%p " msg, this, ##__VA_ARGS__))
@@ -43,17 +43,17 @@ AudioSink::AudioSink(AbstractThread* aTh
   , mErrored(false)
   , mPlaybackComplete(false)
   , mOwnerThread(aThread)
   , mProcessedQueueLength(0)
   , mFramesParsed(0)
   , mIsAudioDataAudible(false)
   , mAudioQueue(aAudioQueue)
 {
-  bool resampling = MediaPrefs::AudioSinkResampling();
+  bool resampling = StaticPrefs::MediaResamplingEnabled();
 
   if (resampling) {
     mOutputRate = 48000;
   } else if (mInfo.mRate == 44100 || mInfo.mRate == 48000) {
     // The original rate is of good quality and we want to minimize unecessary
     // resampling. The common scenario being that the sampling rate is one or
     // the other, this allows to minimize audio quality regression and hoping
     // content provider want change from those rates mid-stream.
@@ -190,17 +190,18 @@ AudioSink::InitializeAudioStream(const P
   mAudioStream = new AudioStream(*this);
   // When AudioQueue is empty, there is no way to know the channel layout of
   // the coming audio data, so we use the predefined channel map instead.
   AudioConfig::ChannelLayout::ChannelMap channelMap =
     mConverter ? mConverter->OutputConfig().Layout().Map()
                : AudioConfig::ChannelLayout(mOutputChannels).Map();
   // The layout map used here is already processed by mConverter with
   // mOutputChannels into SMPTE format, so there is no need to worry if
-  // MediaPrefs::MonoAudio() or MediaPrefs::AudioSinkForceStereo() is applied.
+  // StaticPrefs::accessibility_monoaudio_enable() or
+  // StaticPrefs::MediaForcestereoEnabled() is applied.
   nsresult rv = mAudioStream->Init(mOutputChannels, channelMap, mOutputRate);
   if (NS_FAILED(rv)) {
     mAudioStream->Shutdown();
     mAudioStream = nullptr;
     return rv;
   }
 
   // Set playback params before calling Start() so they can take effect
--- a/dom/media/mediasink/VideoSink.cpp
+++ b/dom/media/mediasink/VideoSink.cpp
@@ -7,20 +7,20 @@
 #ifdef XP_WIN
 // Include Windows headers required for enabling high precision timers.
 #include "windows.h"
 #include "mmsystem.h"
 #endif
 
 #include "MediaQueue.h"
 #include "VideoSink.h"
-#include "MediaPrefs.h"
 #include "VideoUtils.h"
 
 #include "mozilla/IntegerPrintfMacros.h"
+#include "mozilla/StaticPrefs.h"
 
 namespace mozilla {
 
 extern LazyLogModule gMediaDecoderLog;
 
 #undef FMT
 
 #define FMT(x, ...) "VideoSink=%p " x, this, ##__VA_ARGS__
@@ -45,17 +45,17 @@ VideoSink::VideoSink(AbstractThread* aTh
   , mAudioSink(aAudioSink)
   , mVideoQueue(aVideoQueue)
   , mContainer(aContainer)
   , mProducerID(ImageContainer::AllocateProducerID())
   , mFrameStats(aFrameStats)
   , mHasVideo(false)
   , mUpdateScheduler(aThread)
   , mVideoQueueSendToCompositorSize(aVQueueSentToCompositerSize)
-  , mMinVideoQueueSize(MediaPrefs::RuinAvSync() ? 1 : 0)
+  , mMinVideoQueueSize(StaticPrefs::MediaRuinAvSyncEnabled() ? 1 : 0)
 #ifdef XP_WIN
   , mHiResTimersRequested(false)
 #endif
 
 {
   MOZ_ASSERT(mAudioSink, "AudioSink should exist.");
 }
 
--- a/dom/media/mediasource/TrackBuffersManager.cpp
+++ b/dom/media/mediasource/TrackBuffersManager.cpp
@@ -1,21 +1,21 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "TrackBuffersManager.h"
 #include "ContainerParser.h"
-#include "MediaPrefs.h"
 #include "MediaSourceDemuxer.h"
 #include "MediaSourceUtils.h"
 #include "mozilla/ErrorResult.h"
 #include "mozilla/Preferences.h"
+#include "mozilla/StaticPrefs.h"
 #include "nsMimeTypes.h"
 #include "SourceBuffer.h"
 #include "SourceBufferResource.h"
 #include "SourceBufferTask.h"
 #include "WebMDemuxer.h"
 
 #ifdef MOZ_FMP4
 #include "MP4Demuxer.h"
@@ -942,17 +942,17 @@ TrackBuffersManager::ResetDemuxingState(
 }
 
 void
 TrackBuffersManager::OnDemuxerResetDone(const MediaResult& aResult)
 {
   MOZ_ASSERT(OnTaskQueue());
   mDemuxerInitRequest.Complete();
 
-  if (NS_FAILED(aResult) && MediaPrefs::MediaWarningsAsErrors()) {
+  if (NS_FAILED(aResult) && StaticPrefs::MediaPlaybackWarningsAsErrors()) {
     RejectAppend(aResult, __func__);
     return;
   }
 
   // mInputDemuxer shouldn't have been destroyed while a demuxer init/reset
   // request was being processed. See bug 1239983.
   MOZ_DIAGNOSTIC_ASSERT(mInputDemuxer);
 
@@ -1050,17 +1050,17 @@ TrackBuffersManager::InitializationSegme
 void
 TrackBuffersManager::OnDemuxerInitDone(const MediaResult& aResult)
 {
   MOZ_ASSERT(OnTaskQueue());
   MOZ_DIAGNOSTIC_ASSERT(mInputDemuxer, "mInputDemuxer has been destroyed");
 
   mDemuxerInitRequest.Complete();
 
-  if (NS_FAILED(aResult) && MediaPrefs::MediaWarningsAsErrors()) {
+  if (NS_FAILED(aResult) && StaticPrefs::MediaPlaybackWarningsAsErrors()) {
     RejectAppend(aResult, __func__);
     return;
   }
 
   MediaInfo info;
 
   uint32_t numVideos = mInputDemuxer->GetNumberTracks(TrackInfo::kVideoTrack);
   if (numVideos) {
--- a/dom/media/moz.build
+++ b/dom/media/moz.build
@@ -121,17 +121,16 @@ EXPORTS += [
     'MediaDecoder.h',
     'MediaDecoderOwner.h',
     'MediaDecoderStateMachine.h',
     'MediaEventSource.h',
     'MediaFormatReader.h',
     'MediaInfo.h',
     'MediaMetadataManager.h',
     'MediaMIMETypes.h',
-    'MediaPrefs.h',
     'MediaPromiseDefs.h',
     'MediaQueue.h',
     'MediaRecorder.h',
     'MediaResource.h',
     'MediaResourceCallback.h',
     'MediaResult.h',
     'MediaSegment.h',
     'MediaShutdownManager.h',
@@ -238,17 +237,16 @@ UNIFIED_SOURCES += [
     'MediaDecoder.cpp',
     'MediaDecoderStateMachine.cpp',
     'MediaDeviceInfo.cpp',
     'MediaDevices.cpp',
     'MediaFormatReader.cpp',
     'MediaInfo.cpp',
     'MediaManager.cpp',
     'MediaMIMETypes.cpp',
-    'MediaPrefs.cpp',
     'MediaRecorder.cpp',
     'MediaResource.cpp',
     'MediaShutdownManager.cpp',
     'MediaStreamError.cpp',
     'MediaStreamGraph.cpp',
     'MediaStreamListener.cpp',
     'MediaStreamTrack.cpp',
     'MediaStreamVideoSink.cpp',
--- a/dom/media/mp4/MP4Decoder.cpp
+++ b/dom/media/mp4/MP4Decoder.cpp
@@ -1,21 +1,21 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim:set ts=2 sw=2 sts=2 et cindent: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "MP4Decoder.h"
 #include "MediaContainerType.h"
-#include "MediaPrefs.h"
 #include "MP4Demuxer.h"
 #include "nsMimeTypes.h"
 #include "VideoUtils.h"
 #include "PDMFactory.h"
+#include "mozilla/StaticPrefs.h"
 
 namespace mozilla {
 
 static bool
 IsWhitelistedH264Codec(const nsAString& aCodec)
 {
   int16_t profile = 0, level = 0;
 
@@ -163,12 +163,12 @@ MP4Decoder::IsAAC(const nsACString& aMim
 {
   return aMimeType.EqualsLiteral("audio/mp4a-latm");
 }
 
 /* static */
 bool
 MP4Decoder::IsEnabled()
 {
-  return MediaPrefs::MP4Enabled();
+  return StaticPrefs::mediaMp4Enabled();
 }
 
 } // namespace mozilla
--- a/dom/media/mp4/MP4Demuxer.cpp
+++ b/dom/media/mp4/MP4Demuxer.cpp
@@ -5,17 +5,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include <algorithm>
 #include <limits>
 #include <stdint.h>
 
 #include "MP4Demuxer.h"
 
-#include "MediaPrefs.h"
+#include "mozilla/StaticPrefs.h"
 // Used for telemetry
 #include "mozilla/Telemetry.h"
 #include "AnnexB.h"
 #include "H264.h"
 #include "MoofParser.h"
 #include "MP4Metadata.h"
 #include "ResourceStream.h"
 #include "BufferStream.h"
@@ -162,29 +162,29 @@ MP4Demuxer::Init()
   nsresult rv = metadata.Parse();
   if (NS_FAILED(rv)) {
     return InitPromise::CreateAndReject(
       MediaResult(rv, RESULT_DETAIL("Parse MP4 metadata failed")), __func__);
   }
 
   auto audioTrackCount = metadata.GetNumberTracks(TrackInfo::kAudioTrack);
   if (audioTrackCount.Ref() == MP4Metadata::NumberTracksError()) {
-    if (MediaPrefs::MediaWarningsAsErrors()) {
+    if (StaticPrefs::MediaPlaybackWarningsAsErrors()) {
       return InitPromise::CreateAndReject(
         MediaResult(NS_ERROR_DOM_MEDIA_DEMUXER_ERR,
                     RESULT_DETAIL("Invalid audio track (%s)",
                                   audioTrackCount.Result().Description().get())),
         __func__);
     }
     audioTrackCount.Ref() = 0;
   }
 
   auto videoTrackCount = metadata.GetNumberTracks(TrackInfo::kVideoTrack);
   if (videoTrackCount.Ref() == MP4Metadata::NumberTracksError()) {
-    if (MediaPrefs::MediaWarningsAsErrors()) {
+    if (StaticPrefs::MediaPlaybackWarningsAsErrors()) {
       return InitPromise::CreateAndReject(
         MediaResult(NS_ERROR_DOM_MEDIA_DEMUXER_ERR,
                     RESULT_DETAIL("Invalid video track (%s)",
                                   videoTrackCount.Result().Description().get())),
         __func__);
     }
     videoTrackCount.Ref() = 0;
   }
@@ -205,17 +205,17 @@ MP4Demuxer::Init()
     result = Move(videoTrackCount.Result());
   }
 
   if (audioTrackCount.Ref() != 0) {
     for (size_t i = 0; i < audioTrackCount.Ref(); i++) {
       MP4Metadata::ResultAndTrackInfo info =
         metadata.GetTrackInfo(TrackInfo::kAudioTrack, i);
       if (!info.Ref()) {
-        if (MediaPrefs::MediaWarningsAsErrors()) {
+        if (StaticPrefs::MediaPlaybackWarningsAsErrors()) {
           return InitPromise::CreateAndReject(
             MediaResult(NS_ERROR_DOM_MEDIA_DEMUXER_ERR,
                         RESULT_DETAIL("Invalid MP4 audio track (%s)",
                                       info.Result().Description().get())),
             __func__);
         }
         if (result == NS_OK) {
           result = MediaResult(NS_ERROR_DOM_MEDIA_DEMUXER_ERR,
@@ -241,17 +241,17 @@ MP4Demuxer::Init()
     }
   }
 
   if (videoTrackCount.Ref() != 0) {
     for (size_t i = 0; i < videoTrackCount.Ref(); i++) {
       MP4Metadata::ResultAndTrackInfo info =
         metadata.GetTrackInfo(TrackInfo::kVideoTrack, i);
       if (!info.Ref()) {
-        if (MediaPrefs::MediaWarningsAsErrors()) {
+        if (StaticPrefs::MediaPlaybackWarningsAsErrors()) {
           return InitPromise::CreateAndReject(
             MediaResult(NS_ERROR_DOM_MEDIA_DEMUXER_ERR,
                         RESULT_DETAIL("Invalid MP4 video track (%s)",
                                       info.Result().Description().get())),
             __func__);
         }
         if (result == NS_OK) {
           result = MediaResult(NS_ERROR_DOM_MEDIA_DEMUXER_ERR,
--- a/dom/media/mp4/MP4Metadata.cpp
+++ b/dom/media/mp4/MP4Metadata.cpp
@@ -8,17 +8,16 @@
 #include "mozilla/Logging.h"
 #include "mozilla/RefPtr.h"
 #include "mozilla/Telemetry.h"
 #include "mozilla/UniquePtr.h"
 #include "VideoUtils.h"
 #include "MoofParser.h"
 #include "MP4Metadata.h"
 #include "ByteStream.h"
-#include "MediaPrefs.h"
 #include "mp4parse.h"
 
 #include <limits>
 #include <stdint.h>
 #include <vector>
 
 using mozilla::media::TimeUnit;
 
--- a/dom/media/ogg/OggDecoder.cpp
+++ b/dom/media/ogg/OggDecoder.cpp
@@ -1,27 +1,27 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim:set ts=2 sw=2 sts=2 et cindent: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "OggDecoder.h"
-#include "MediaPrefs.h"
 #include "MediaContainerType.h"
 #include "MediaDecoder.h"
 #include "nsMimeTypes.h"
+#include "mozilla/StaticPrefs.h"
 
 namespace mozilla {
 
 /* static */
 bool
 OggDecoder::IsSupportedType(const MediaContainerType& aContainerType)
 {
-  if (!MediaPrefs::OggEnabled()) {
+  if (!StaticPrefs::MediaOggEnabled()) {
     return false;
   }
 
   if (aContainerType.Type() != MEDIAMIMETYPE(AUDIO_OGG) &&
       aContainerType.Type() != MEDIAMIMETYPE(VIDEO_OGG) &&
       aContainerType.Type() != MEDIAMIMETYPE("application/ogg")) {
     return false;
   }
@@ -33,17 +33,18 @@ OggDecoder::IsSupportedType(const MediaC
     // WebM guarantees that the only codecs it contained are vp8, vp9, opus or vorbis.
     return true;
   }
   // Verify that all the codecs specified are ones that we expect that
   // we can play.
   for (const auto& codec : codecs.Range()) {
     if ((MediaDecoder::IsOpusEnabled() && codec.EqualsLiteral("opus")) ||
         codec.EqualsLiteral("vorbis") ||
-        (MediaPrefs::FlacInOgg() && codec.EqualsLiteral("flac"))) {
+        (StaticPrefs::MediaOggFlacEnabled() &&
+         codec.EqualsLiteral("flac"))) {
       continue;
     }
     // Note: Only accept Theora in a video container type, not in an audio
     // container type.
     if (isOggVideo && codec.EqualsLiteral("theora")) {
       continue;
     }
     // Some unsupported codec.
--- a/dom/media/ogg/OggDemuxer.cpp
+++ b/dom/media/ogg/OggDemuxer.cpp
@@ -7,22 +7,22 @@
 #include "nsError.h"
 #include "MediaDecoderStateMachine.h"
 #include "OggDemuxer.h"
 #include "OggCodecState.h"
 #include "mozilla/AbstractThread.h"
 #include "mozilla/Atomics.h"
 #include "mozilla/PodOperations.h"
 #include "mozilla/SharedThreadPool.h"
+#include "mozilla/StaticPrefs.h"
 #include "mozilla/Telemetry.h"
 #include "mozilla/TimeStamp.h"
 #include "MediaDataDemuxer.h"
 #include "nsAutoRef.h"
 #include "XiphExtradata.h"
-#include "MediaPrefs.h"
 
 #include <algorithm>
 
 extern mozilla::LazyLogModule gMediaDemuxerLog;
 #define OGG_DEBUG(arg, ...)                                                    \
   DDMOZ_LOG(gMediaDemuxerLog,                                                  \
             mozilla::LogLevel::Debug,                                          \
             "::%s: " arg,                                                      \
@@ -533,17 +533,17 @@ OggDemuxer::ReadMetadata()
             SetupTarget(&mOpusState, s);
           } else {
             s->Deactivate();
           }
         } else {
           NS_WARNING("Opus decoding disabled."
                      " See media.opus.enabled in about:config");
         }
-      } else if (MediaPrefs::FlacInOgg() &&
+      } else if (StaticPrefs::MediaOggFlacEnabled() &&
                  s->GetType() == OggCodecState::TYPE_FLAC &&
                  ReadHeaders(TrackInfo::kAudioTrack, s)) {
         if (!mFlacState) {
           SetupTarget(&mFlacState, s);
         } else {
           s->Deactivate();
         }
       } else if (s->GetType() == OggCodecState::TYPE_SKELETON && !mSkeletonState) {
--- a/dom/media/platforms/PDMFactory.cpp
+++ b/dom/media/platforms/PDMFactory.cpp
@@ -23,21 +23,21 @@
 #include "AndroidDecoderModule.h"
 #endif
 #include "GMPDecoderModule.h"
 
 #include "mozilla/CDMProxy.h"
 #include "mozilla/ClearOnShutdown.h"
 #include "mozilla/SharedThreadPool.h"
 #include "mozilla/StaticPtr.h"
+#include "mozilla/StaticPrefs.h"
 #include "mozilla/SyncRunnable.h"
 #include "mozilla/TaskQueue.h"
 
 #include "MediaInfo.h"
-#include "MediaPrefs.h"
 #include "H264Converter.h"
 
 #include "AgnosticDecoderModule.h"
 #include "EMEDecoderModule.h"
 
 #include "DecoderDoctorDiagnostics.h"
 
 #include "MP4Decoder.h"
@@ -328,64 +328,65 @@ PDMFactory::Supports(const TrackInfo& aT
   return !!current;
 }
 
 void
 PDMFactory::CreatePDMs()
 {
   RefPtr<PlatformDecoderModule> m;
 
-  if (MediaPrefs::PDMUseBlankDecoder()) {
+  if (StaticPrefs::MediaUseBlankDecoder()) {
     m = CreateBlankDecoderModule();
     StartupPDM(m);
     // The Blank PDM SupportsMimeType reports true for all codecs; the creation
     // of its decoder is infallible. As such it will be used for all media, we
     // can stop creating more PDM from this point.
     return;
   }
 
 #ifdef XP_WIN
-  if (MediaPrefs::PDMWMFEnabled() && !IsWin7AndPre2000Compatible()) {
+  if (StaticPrefs::MediaWmfEnabled() && !IsWin7AndPre2000Compatible()) {
     m = new WMFDecoderModule();
     RefPtr<PlatformDecoderModule> remote = new dom::RemoteDecoderModule(m);
     StartupPDM(remote);
     mWMFFailedToLoad = !StartupPDM(m);
   } else {
-    mWMFFailedToLoad = MediaPrefs::DecoderDoctorWMFDisabledIsFailure();
+    mWMFFailedToLoad =
+      StaticPrefs::MediaDecoderDoctorWmfDisabledIsFailure();
   }
 #endif
 #ifdef MOZ_FFVPX
-  if (MediaPrefs::PDMFFVPXEnabled()) {
+  if (StaticPrefs::MediaFfvpxEnabled()) {
     m = FFVPXRuntimeLinker::CreateDecoderModule();
     StartupPDM(m);
   }
 #endif
 #ifdef MOZ_FFMPEG
-  if (MediaPrefs::PDMFFmpegEnabled()) {
+  if (StaticPrefs::MediaFfmpegEnabled()) {
     m = FFmpegRuntimeLinker::CreateDecoderModule();
     mFFmpegFailedToLoad = !StartupPDM(m);
   } else {
     mFFmpegFailedToLoad = false;
   }
 #endif
 #ifdef MOZ_APPLEMEDIA
   m = new AppleDecoderModule();
   StartupPDM(m);
 #endif
 #ifdef MOZ_WIDGET_ANDROID
-  if(MediaPrefs::PDMAndroidMediaCodecEnabled()){
+  if (StaticPrefs::MediaAndroidMediaCodecEnabled()) {
     m = new AndroidDecoderModule();
-    StartupPDM(m, MediaPrefs::PDMAndroidMediaCodecPreferred());
+    StartupPDM(m, StaticPrefs::MediaAndroidMediaCodecPreferred());
   }
 #endif
 
   m = new AgnosticDecoderModule();
   StartupPDM(m);
 
-  if (MediaPrefs::PDMGMPEnabled()) {
+  if (StaticPrefs::MediaGmpDecoderEnabled()) {
     m = new GMPDecoderModule();
     mGMPPDMFailedToStartup = !StartupPDM(m);
   } else {
     mGMPPDMFailedToStartup = false;
   }
 }
 
 void
--- a/dom/media/platforms/agnostic/AgnosticDecoderModule.cpp
+++ b/dom/media/platforms/agnostic/AgnosticDecoderModule.cpp
@@ -1,22 +1,22 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim:set ts=2 sw=2 sts=2 et cindent: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "AgnosticDecoderModule.h"
-#include "MediaPrefs.h"
 #include "OpusDecoder.h"
 #include "TheoraDecoder.h"
 #include "VPXDecoder.h"
 #include "VorbisDecoder.h"
 #include "WAVDecoder.h"
 #include "mozilla/Logging.h"
+#include "mozilla/StaticPrefs.h"
 
 #ifdef MOZ_AV1
 #include "AOMDecoder.h"
 #endif
 
 namespace mozilla {
 
 bool
@@ -26,17 +26,17 @@ AgnosticDecoderModule::SupportsMimeType(
 {
   bool supports =
     VPXDecoder::IsVPX(aMimeType) ||
     OpusDataDecoder::IsOpus(aMimeType) ||
     VorbisDataDecoder::IsVorbis(aMimeType) ||
     WaveDataDecoder::IsWave(aMimeType) ||
     TheoraDecoder::IsTheora(aMimeType);
 #ifdef MOZ_AV1
-  if (MediaPrefs::AV1Enabled()) {
+  if (StaticPrefs::MediaAv1Enabled()) {
     supports |= AOMDecoder::IsAV1(aMimeType);
   }
 #endif
   MOZ_LOG(sPDMLog, LogLevel::Debug, ("Agnostic decoder %s requested type",
         supports ? "supports" : "rejects"));
   return supports;
 }
 
@@ -45,17 +45,17 @@ AgnosticDecoderModule::CreateVideoDecode
 {
   RefPtr<MediaDataDecoder> m;
 
   if (VPXDecoder::IsVPX(aParams.mConfig.mMimeType)) {
     m = new VPXDecoder(aParams);
   }
 #ifdef MOZ_AV1
   else if (AOMDecoder::IsAV1(aParams.mConfig.mMimeType) &&
-           MediaPrefs::AV1Enabled()) {
+           StaticPrefs::MediaAv1Enabled()) {
     m = new AOMDecoder(aParams);
   }
 #endif
   else if (TheoraDecoder::IsTheora(aParams.mConfig.mMimeType)) {
     m = new TheoraDecoder(aParams);
   }
 
   return m.forget();
--- a/dom/media/platforms/agnostic/eme/EMEDecoderModule.cpp
+++ b/dom/media/platforms/agnostic/eme/EMEDecoderModule.cpp
@@ -7,21 +7,21 @@
 #include "EMEDecoderModule.h"
 
 #include <inttypes.h>
 
 #include "Adts.h"
 #include "GMPDecoderModule.h"
 #include "GMPService.h"
 #include "MediaInfo.h"
-#include "MediaPrefs.h"
 #include "PDMFactory.h"
 #include "mozIGeckoMediaPluginService.h"
 #include "mozilla/CDMProxy.h"
 #include "mozilla/EMEUtils.h"
+#include "mozilla/StaticPrefs.h"
 #include "mozilla/UniquePtr.h"
 #include "mozilla/Unused.h"
 #include "nsAutoPtr.h"
 #include "nsClassHashtable.h"
 #include "nsServiceManagerUtils.h"
 #include "DecryptThroughputLimit.h"
 #include "ChromiumCDMVideoDecoder.h"
 
@@ -404,17 +404,17 @@ CreateDecoderWrapper(CDMProxy* aProxy, c
   return decoder.forget();
 }
 
 already_AddRefed<MediaDataDecoder>
 EMEDecoderModule::CreateVideoDecoder(const CreateDecoderParams& aParams)
 {
   MOZ_ASSERT(aParams.mConfig.mCrypto.mValid);
 
-  if (MediaPrefs::EMEBlankVideo()) {
+  if (StaticPrefs::MediaEmeVideoBlank()) {
     EME_LOG("EMEDecoderModule::CreateVideoDecoder() creating a blank decoder.");
     RefPtr<PlatformDecoderModule> m(CreateBlankDecoderModule());
     return m->CreateVideoDecoder(aParams);
   }
 
   if (SupportsMimeType(aParams.mConfig.mMimeType, nullptr)) {
     // GMP decodes. Assume that means it can decrypt too.
     RefPtr<MediaDataDecoderProxy> wrapper =
@@ -440,17 +440,17 @@ already_AddRefed<MediaDataDecoder>
 EMEDecoderModule::CreateAudioDecoder(const CreateDecoderParams& aParams)
 {
   MOZ_ASSERT(aParams.mConfig.mCrypto.mValid);
 
   // We don't support using the GMP to decode audio.
   MOZ_ASSERT(!SupportsMimeType(aParams.mConfig.mMimeType, nullptr));
   MOZ_ASSERT(mPDM);
 
-  if (MediaPrefs::EMEBlankAudio()) {
+  if (StaticPrefs::MediaEmeAudioBlank()) {
     EME_LOG("EMEDecoderModule::CreateAudioDecoder() creating a blank decoder.");
     RefPtr<PlatformDecoderModule> m(CreateBlankDecoderModule());
     return m->CreateAudioDecoder(aParams);
   }
 
   UniquePtr<ADTSSampleConverter> converter = nullptr;
   if (MP4Decoder::IsAAC(aParams.mConfig.mMimeType)) {
     // The CDM expects encrypted AAC to be in ADTS format.
--- a/dom/media/platforms/agnostic/gmp/GMPDecoderModule.cpp
+++ b/dom/media/platforms/agnostic/gmp/GMPDecoderModule.cpp
@@ -6,17 +6,16 @@
 
 #include "DecoderDoctorDiagnostics.h"
 #include "GMPDecoderModule.h"
 #include "GMPService.h"
 #include "GMPUtils.h"
 #include "GMPVideoDecoder.h"
 #include "MP4Decoder.h"
 #include "MediaDataDecoderProxy.h"
-#include "MediaPrefs.h"
 #include "VPXDecoder.h"
 #include "VideoUtils.h"
 #include "gmp-video-decode.h"
 #include "mozIGeckoMediaPluginService.h"
 #include "mozilla/StaticMutex.h"
 #include "nsServiceManagerUtils.h"
 #ifdef XP_WIN
 #include "WMFDecoderModule.h"
--- a/dom/media/platforms/android/AndroidDecoderModule.cpp
+++ b/dom/media/platforms/android/AndroidDecoderModule.cpp
@@ -1,15 +1,14 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "GeneratedJNIWrappers.h"
 #include "MediaInfo.h"
-#include "MediaPrefs.h"
 #include "OpusDecoder.h"
 #include "RemoteDataDecoder.h"
 #include "VPXDecoder.h"
 #include "VorbisDecoder.h"
 
 #include "nsIGfxInfo.h"
 #include "nsPromiseFlatString.h"
 
--- a/dom/media/platforms/apple/AppleDecoderModule.cpp
+++ b/dom/media/platforms/apple/AppleDecoderModule.cpp
@@ -5,17 +5,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "AppleATDecoder.h"
 #include "AppleCMLinker.h"
 #include "AppleDecoderModule.h"
 #include "AppleVTDecoder.h"
 #include "AppleVTLinker.h"
 #include "MacIOSurfaceImage.h"
-#include "MediaPrefs.h"
 #include "mozilla/DebugOnly.h"
 #include "mozilla/Logging.h"
 #include "mozilla/gfx/gfxVars.h"
 
 namespace mozilla {
 
 bool AppleDecoderModule::sInitialized = false;
 bool AppleDecoderModule::sIsCoreMediaAvailable = false;
--- a/dom/media/platforms/ffmpeg/FFmpegDecoderModule.h
+++ b/dom/media/platforms/ffmpeg/FFmpegDecoderModule.h
@@ -6,17 +6,17 @@
 
 #ifndef __FFmpegDecoderModule_h__
 #define __FFmpegDecoderModule_h__
 
 #include "PlatformDecoderModule.h"
 #include "FFmpegLibWrapper.h"
 #include "FFmpegAudioDecoder.h"
 #include "FFmpegVideoDecoder.h"
-#include "MediaPrefs.h"
+#include "mozilla/StaticPrefs.h"
 
 namespace mozilla {
 
 template <int V>
 class FFmpegDecoderModule : public PlatformDecoderModule
 {
 public:
   static already_AddRefed<PlatformDecoderModule>
@@ -37,17 +37,17 @@ public:
     // Bug 1263836 will handle alpha scenario once implemented. It will shift
     // the check for alpha to PDMFactory but not itself remove the need for a
     // check.
     if (aParams.VideoConfig().HasAlpha()) {
       return nullptr;
     }
     if (aParams.mOptions.contains(
           CreateDecoderParams::Option::LowLatency) &&
-        !MediaPrefs::PDMFFmpegLowLatencyEnabled()) {
+        !StaticPrefs::MediaFfmpegLowLatencyEnabled()) {
       return nullptr;
     }
     RefPtr<MediaDataDecoder> decoder = new FFmpegVideoDecoder<V>(
       mLib,
       aParams.mTaskQueue,
       aParams.VideoConfig(),
       aParams.mKnowsCompositor,
       aParams.mImageContainer,
--- a/dom/media/platforms/ffmpeg/FFmpegLibWrapper.cpp
+++ b/dom/media/platforms/ffmpeg/FFmpegLibWrapper.cpp
@@ -1,16 +1,18 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "FFmpegLibWrapper.h"
 #include "FFmpegLog.h"
-#include "MediaPrefs.h"
 #include "mozilla/PodOperations.h"
+#ifdef MOZ_FFMPEG
+#include "mozilla/StaticPrefs.h"
+#endif
 #include "mozilla/Types.h"
 #include "PlatformDecoderModule.h"
 #include "prlink.h"
 
 #define AV_LOG_DEBUG    48
 #define AV_LOG_INFO     32
 
 namespace mozilla
@@ -40,17 +42,17 @@ FFmpegLibWrapper::Link()
     if (macro == 57) {
       // Due to current AVCodecContext binary incompatibility we can only
       // support FFmpeg 57 at this stage.
       Unlink();
       return LinkResult::CannotUseLibAV57;
     }
 #ifdef MOZ_FFMPEG
     if (version < (54u << 16 | 35u << 8 | 1u) &&
-        !MediaPrefs::LibavcodecAllowObsolete()) {
+        !StaticPrefs::MediaLibavcodecAllowObsolete()) {
       // Refuse any libavcodec version prior to 54.35.1.
       // (Unless media.libavcodec.allow-obsolete==true)
       Unlink();
       return LinkResult::BlockedOldLibAVVersion;
     }
 #endif
   }
 
--- a/dom/media/platforms/wmf/WMFDecoderModule.cpp
+++ b/dom/media/platforms/wmf/WMFDecoderModule.cpp
@@ -4,27 +4,27 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "WMFDecoderModule.h"
 #include "GfxDriverInfo.h"
 #include "MFTDecoder.h"
 #include "MP4Decoder.h"
 #include "MediaInfo.h"
-#include "MediaPrefs.h"
 #include "VPXDecoder.h"
 #include "WMF.h"
 #include "WMFAudioMFTManager.h"
 #include "WMFMediaDataDecoder.h"
 #include "WMFVideoMFTManager.h"
 #include "gfxPrefs.h"
 #include "mozilla/DebugOnly.h"
 #include "mozilla/Maybe.h"
 #include "mozilla/Services.h"
 #include "mozilla/StaticMutex.h"
+#include "mozilla/StaticPrefs.h"
 #include "mozilla/WindowsVersion.h"
 #include "mozilla/gfx/gfxVars.h"
 #include "nsAutoPtr.h"
 #include "nsComponentManagerUtils.h"
 #include "nsIGfxInfo.h"
 #include "nsIWindowsRegKey.h"
 #include "nsServiceManagerUtils.h"
 #include "nsWindowsHelpers.h"
@@ -50,17 +50,17 @@ WMFDecoderModule::~WMFDecoderModule()
 /* static */
 void
 WMFDecoderModule::Init()
 {
   if (XRE_IsContentProcess()) {
     // If we're in the content process and the UseGPUDecoder pref is set, it
     // means that we've given up on the GPU process (it's been crashing) so we
     // should disable DXVA
-    sDXVAEnabled = !MediaPrefs::PDMUseGPUDecoder();
+    sDXVAEnabled = !StaticPrefs::MediaGpuProcessDecoder();
   } else if (XRE_IsGPUProcess()) {
     // Always allow DXVA in the GPU process.
     sDXVAEnabled = true;
   } else {
     // Only allow DXVA in the UI process if we aren't in e10s Firefox
     sDXVAEnabled = !mozilla::BrowserTabsRemoteAutostart();
   }
 
@@ -208,17 +208,17 @@ WMFDecoderModule::Supports(const TrackIn
   }
   if (MP4Decoder::IsH264(aTrackInfo.mMimeType) && WMFDecoderModule::HasH264()) {
     return true;
   }
   if (aTrackInfo.mMimeType.EqualsLiteral("audio/mpeg") &&
       CanCreateWMFDecoder<CLSID_CMP3DecMediaObject>()) {
     return true;
   }
-  if (MediaPrefs::PDMWMFVP9DecoderEnabled()) {
+  if (StaticPrefs::MediaWmfVp9Enabled()) {
     static const uint32_t VP8_USABLE_BUILD = 16287;
     if (VPXDecoder::IsVP8(aTrackInfo.mMimeType) &&
         IsWindowsBuildOrLater(VP8_USABLE_BUILD) &&
         CanCreateWMFDecoder<CLSID_WebmMfVpxDec>()) {
       return true;
     }
     if (VPXDecoder::IsVP9(aTrackInfo.mMimeType) &&
         ((gfxPrefs::PDMWMFAMDVP9DecoderEnabled() &&
--- a/dom/media/platforms/wrappers/H264Converter.cpp
+++ b/dom/media/platforms/wrappers/H264Converter.cpp
@@ -4,18 +4,18 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "H264Converter.h"
 
 #include "DecoderDoctorDiagnostics.h"
 #include "ImageContainer.h"
 #include "MediaInfo.h"
-#include "MediaPrefs.h"
 #include "PDMFactory.h"
+#include "mozilla/StaticPrefs.h"
 #include "mozilla/TaskQueue.h"
 #include "AnnexB.h"
 #include "H264.h"
 
 namespace mozilla
 {
 
 H264Converter::H264Converter(PlatformDecoderModule* aPDM,
@@ -359,17 +359,17 @@ H264Converter::CreateDecoderAndInit(Medi
   }
   return rv;
 }
 
 bool
 H264Converter::CanRecycleDecoder() const
 {
   MOZ_ASSERT(mDecoder);
-  return MediaPrefs::MediaDecoderCheckRecycling() &&
+  return StaticPrefs::MediaDecoderRecycleEnabled() &&
          mDecoder->SupportDecoderRecycling();
 }
 
 void
 H264Converter::DecodeFirstSample(MediaRawData* aSample)
 {
   if (mNeedKeyframe && !aSample->mKeyframe) {
     mDecodePromise.Resolve(mPendingFrames, __func__);
--- a/dom/media/webm/WebMDecoder.cpp
+++ b/dom/media/webm/WebMDecoder.cpp
@@ -1,21 +1,21 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim:set ts=2 sw=2 sts=2 et cindent: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "WebMDecoder.h"
 #include "mozilla/Preferences.h"
+#include "mozilla/StaticPrefs.h"
 #ifdef MOZ_AV1
 #include "AOMDecoder.h"
 #endif
 #include "MediaContainerType.h"
-#include "MediaPrefs.h"
 #include "PDMFactory.h"
 #include "VideoUtils.h"
 
 namespace mozilla {
 
 /* static */
 bool
 WebMDecoder::IsSupportedType(const MediaContainerType& aContainerType)
@@ -65,17 +65,17 @@ WebMDecoder::IsSupportedType(const Media
           if (!platform->Supports(*trackInfo, nullptr)) {
             return false;
           }
         }
         continue;
       }
     }
 #ifdef MOZ_AV1
-    if (isVideo && MediaPrefs::AV1Enabled() &&
+    if (isVideo && StaticPrefs::MediaAv1Enabled() &&
         AOMDecoder::IsSupportedCodec(codec)) {
       continue;
     }
 #endif
     // Some unsupported codec.
     return false;
   }
   return true;
--- a/dom/media/webspeech/recognition/SpeechRecognition.cpp
+++ b/dom/media/webspeech/recognition/SpeechRecognition.cpp
@@ -11,18 +11,18 @@
 
 #include "mozilla/dom/BindingUtils.h"
 #include "mozilla/dom/Element.h"
 #include "mozilla/dom/SpeechRecognitionBinding.h"
 #include "mozilla/dom/MediaStreamTrackBinding.h"
 #include "mozilla/dom/MediaStreamError.h"
 #include "mozilla/MediaManager.h"
 #include "mozilla/Preferences.h"
-#include "MediaPrefs.h"
 #include "mozilla/Services.h"
+#include "mozilla/StaticPrefs.h"
 
 #include "AudioSegment.h"
 #include "DOMMediaStream.h"
 #include "MediaEnginePrefs.h"
 #include "endpointer.h"
 
 #include "mozilla/dom/SpeechRecognitionEvent.h"
 #include "nsContentUtils.h"
@@ -82,17 +82,17 @@ GetSpeechRecognitionService(const nsAStr
       NS_LITERAL_CSTRING(DEFAULT_RECOGNITION_SERVICE_PREFIX) +
       NS_ConvertUTF16toUTF8(aLang);
   } else if (!prefValue.IsEmpty()) {
     speechRecognitionService = prefValue;
   } else {
     speechRecognitionService = DEFAULT_RECOGNITION_SERVICE;
   }
 
-  if (MediaPrefs::WebSpeechFakeRecognitionService()) {
+  if (StaticPrefs::MediaWebspeechTextFakeRecognitionService()) {
     speechRecognitionServiceCID =
       NS_SPEECH_RECOGNITION_SERVICE_CONTRACTID_PREFIX "fake";
   } else {
     speechRecognitionServiceCID =
       NS_LITERAL_CSTRING(NS_SPEECH_RECOGNITION_SERVICE_CONTRACTID_PREFIX) +
       speechRecognitionService;
   }
 
@@ -120,17 +120,17 @@ SpeechRecognition::SpeechRecognition(nsP
   , mAudioSamplesPerChunk(mEndpointer.FrameSize())
   , mSpeechDetectionTimer(NS_NewTimer())
   , mSpeechGrammarList(new SpeechGrammarList(GetParentObject()))
   , mInterimResults(false)
   , mMaxAlternatives(1)
 {
   SR_LOG("created SpeechRecognition");
 
-  if (MediaPrefs::WebSpeechTestEnabled()) {
+  if (StaticPrefs::MediaWebspeechTestEnable()) {
     nsCOMPtr<nsIObserverService> obs = services::GetObserverService();
     obs->AddObserver(this, SPEECH_RECOGNITION_TEST_EVENT_REQUEST_TOPIC, false);
     obs->AddObserver(this, SPEECH_RECOGNITION_TEST_END_TOPIC, false);
   }
 
   mEndpointer.set_speech_input_complete_silence_length(
       Preferences::GetInt(PREFERENCE_ENDPOINTER_SILENCE_LENGTH, 1250000));
   mEndpointer.set_long_speech_input_complete_silence_length(
@@ -176,19 +176,20 @@ SpeechRecognition::IsAuthorized(JSContex
     principal, "speech-recognition", &speechRecognition);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return false;
   }
 
   bool hasPermission =
     (speechRecognition == nsIPermissionManager::ALLOW_ACTION);
 
-  return (hasPermission || MediaPrefs::WebSpeechRecognitionForceEnabled() ||
-          MediaPrefs::WebSpeechTestEnabled()) &&
-         MediaPrefs::WebSpeechRecognitionEnabled();
+  return (hasPermission ||
+          StaticPrefs::MediaWebspeechRecognitionForceEnable() ||
+          StaticPrefs::MediaWebspeechTestEnable()) &&
+         StaticPrefs::MediaWebspeechRecognitionEnable();
 }
 
 already_AddRefed<SpeechRecognition>
 SpeechRecognition::Constructor(const GlobalObject& aGlobal,
                                ErrorResult& aRv)
 {
   nsCOMPtr<nsPIDOMWindowInner> win = do_QueryInterface(aGlobal.GetAsSupports());
   if (!win) {
@@ -615,17 +616,17 @@ SpeechRecognition::Observe(nsISupports* 
 
     DispatchError(SpeechRecognition::EVENT_AUDIO_ERROR,
                   SpeechRecognitionErrorCode::No_speech,
                   NS_LITERAL_STRING("No speech detected (timeout)"));
   } else if (!strcmp(aTopic, SPEECH_RECOGNITION_TEST_END_TOPIC)) {
     nsCOMPtr<nsIObserverService> obs = services::GetObserverService();
     obs->RemoveObserver(this, SPEECH_RECOGNITION_TEST_EVENT_REQUEST_TOPIC);
     obs->RemoveObserver(this, SPEECH_RECOGNITION_TEST_END_TOPIC);
-  } else if (MediaPrefs::WebSpeechFakeFSMEvents() &&
+  } else if (StaticPrefs::MediaWebspeechTextFakeFsmEvents() &&
              !strcmp(aTopic, SPEECH_RECOGNITION_TEST_EVENT_REQUEST_TOPIC)) {
     ProcessTestEventRequest(aSubject, nsDependentString(aData));
   }
 
   return NS_OK;
 }
 
 void
@@ -635,19 +636,19 @@ SpeechRecognition::ProcessTestEventReque
   if (aEventName.EqualsLiteral("EVENT_ABORT")) {
     Abort();
   } else if (aEventName.EqualsLiteral("EVENT_AUDIO_ERROR")) {
     DispatchError(
       SpeechRecognition::EVENT_AUDIO_ERROR,
       SpeechRecognitionErrorCode::Audio_capture, // TODO different codes?
       NS_LITERAL_STRING("AUDIO_ERROR test event"));
   } else {
-    NS_ASSERTION(MediaPrefs::WebSpeechFakeRecognitionService(),
+    NS_ASSERTION(StaticPrefs::MediaWebspeechTextFakeRecognitionService(),
                  "Got request for fake recognition service event, but "
-                 TEST_PREFERENCE_FAKE_RECOGNITION_SERVICE " is unset");
+                 "media.webspeech.test.fake_recognition_service is unset");
 
     // let the fake recognition service handle the request
   }
 }
 
 already_AddRefed<SpeechGrammarList>
 SpeechRecognition::Grammars() const
 {
--- a/dom/media/webspeech/recognition/test/FakeSpeechRecognitionService.cpp
+++ b/dom/media/webspeech/recognition/test/FakeSpeechRecognitionService.cpp
@@ -2,24 +2,24 @@
 /* vim:set ts=2 sw=2 sts=2 et cindent: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsThreadUtils.h"
 
 #include "FakeSpeechRecognitionService.h"
-#include "MediaPrefs.h"
 
 #include "SpeechRecognition.h"
 #include "SpeechRecognitionAlternative.h"
 #include "SpeechRecognitionResult.h"
 #include "SpeechRecognitionResultList.h"
 #include "nsIObserverService.h"
 #include "mozilla/Services.h"
+#include "mozilla/StaticPrefs.h"
 
 namespace mozilla {
 
 using namespace dom;
 
 NS_IMPL_ISUPPORTS(FakeSpeechRecognitionService, nsISpeechRecognitionService, nsIObserver)
 
 FakeSpeechRecognitionService::FakeSpeechRecognitionService()
@@ -62,19 +62,19 @@ NS_IMETHODIMP
 FakeSpeechRecognitionService::Abort()
 {
   return NS_OK;
 }
 
 NS_IMETHODIMP
 FakeSpeechRecognitionService::Observe(nsISupports* aSubject, const char* aTopic, const char16_t* aData)
 {
-  MOZ_ASSERT(MediaPrefs::WebSpeechFakeRecognitionService(),
+  MOZ_ASSERT(StaticPrefs::MediaWebspeechTextFakeRecognitionService(),
              "Got request to fake recognition service event, but "
-             TEST_PREFERENCE_FAKE_RECOGNITION_SERVICE " is not set");
+             "media.webspeech.test.fake_recognition_service is not set");
 
   if (!strcmp(aTopic, SPEECH_RECOGNITION_TEST_END_TOPIC)) {
     nsCOMPtr<nsIObserverService> obs = services::GetObserverService();
     obs->RemoveObserver(this, SPEECH_RECOGNITION_TEST_EVENT_REQUEST_TOPIC);
     obs->RemoveObserver(this, SPEECH_RECOGNITION_TEST_END_TOPIC);
 
     return NS_OK;
   }
--- a/dom/media/webspeech/synth/nsSynthVoiceRegistry.cpp
+++ b/dom/media/webspeech/synth/nsSynthVoiceRegistry.cpp
@@ -3,29 +3,29 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsISpeechService.h"
 #include "nsServiceManagerUtils.h"
 #include "nsCategoryManagerUtils.h"
 
-#include "MediaPrefs.h"
 #include "SpeechSynthesisUtterance.h"
 #include "SpeechSynthesisVoice.h"
 #include "nsSynthVoiceRegistry.h"
 #include "nsSpeechTask.h"
 #include "AudioChannelService.h"
 
 #include "nsString.h"
 #include "mozilla/ClearOnShutdown.h"
-#include "mozilla/StaticPtr.h"
 #include "mozilla/dom/ContentChild.h"
 #include "mozilla/dom/ContentParent.h"
 #include "mozilla/intl/LocaleService.h"
+#include "mozilla/StaticPrefs.h"
+#include "mozilla/StaticPtr.h"
 #include "mozilla/Unused.h"
 
 #include "SpeechSynthesisChild.h"
 #include "SpeechSynthesisParent.h"
 
 using mozilla::intl::LocaleService;
 
 #undef LOG
@@ -341,17 +341,18 @@ nsSynthVoiceRegistry::RemoveVoice(nsISpe
   if(NS_WARN_IF(!(aService == retval->mService))) {
     return NS_ERROR_INVALID_ARG;
   }
 
   mVoices.RemoveElement(retval);
   mDefaultVoices.RemoveElement(retval);
   mUriVoiceMap.Remove(aUri);
 
-  if (retval->mIsQueued && !MediaPrefs::WebSpeechForceGlobal()) {
+  if (retval->mIsQueued &&
+      !StaticPrefs::MediaWebspeechSynthForceGlobalQueue()) {
     // Check if this is the last queued voice, and disable the global queue if
     // it is.
     bool queued = false;
     for (uint32_t i = 0; i < mVoices.Length(); i++) {
       VoiceData* voice = mVoices[i];
       if (voice->mIsQueued) {
         queued = true;
         break;
@@ -712,17 +713,18 @@ nsSynthVoiceRegistry::Speak(const nsAStr
   if (!voice) {
     NS_WARNING("No voices found.");
     aTask->ForceError(0, 0);
     return;
   }
 
   aTask->SetChosenVoiceURI(voice->mUri);
 
-  if (mUseGlobalQueue || MediaPrefs::WebSpeechForceGlobal()) {
+  if (mUseGlobalQueue ||
+      StaticPrefs::MediaWebspeechSynthForceGlobalQueue()) {
     LOG(LogLevel::Debug,
         ("nsSynthVoiceRegistry::Speak queueing text='%s' lang='%s' uri='%s' rate=%f pitch=%f",
          NS_ConvertUTF16toUTF8(aText).get(), NS_ConvertUTF16toUTF8(aLang).get(),
          NS_ConvertUTF16toUTF8(aUri).get(), aRate, aPitch));
     RefPtr<GlobalQueueItem> item = new GlobalQueueItem(voice, aTask, aText,
                                                          aVolume, aRate, aPitch);
     mGlobalQueue.AppendElement(item);
 
@@ -791,17 +793,18 @@ nsSynthVoiceRegistry::IsSpeaking()
 
 void
 nsSynthVoiceRegistry::SetIsSpeaking(bool aIsSpeaking)
 {
   MOZ_ASSERT(XRE_IsParentProcess());
 
   // Only set to 'true' if global queue is enabled.
   mIsSpeaking =
-    aIsSpeaking && (mUseGlobalQueue || MediaPrefs::WebSpeechForceGlobal());
+    aIsSpeaking && (mUseGlobalQueue ||
+                    StaticPrefs::MediaWebspeechSynthForceGlobalQueue());
 
   nsTArray<SpeechSynthesisParent*> ssplist;
   GetAllSpeechSynthActors(ssplist);
   for (uint32_t i = 0; i < ssplist.Length(); ++i) {
     Unused << ssplist[i]->SendIsSpeakingChanged(aIsSpeaking);
   }
 }
 
--- a/gfx/ipc/GPUProcessManager.cpp
+++ b/gfx/ipc/GPUProcessManager.cpp
@@ -7,16 +7,17 @@
 #include "GPUProcessManager.h"
 
 #include "gfxPrefs.h"
 #include "GPUProcessHost.h"
 #include "GPUProcessListener.h"
 #include "mozilla/MemoryReportingProcess.h"
 #include "mozilla/Sprintf.h"
 #include "mozilla/StaticPtr.h"
+#include "mozilla/StaticPrefs.h"
 #include "mozilla/dom/ContentParent.h"
 #include "mozilla/gfx/gfxVars.h"
 #include "mozilla/layers/APZCTreeManagerChild.h"
 #include "mozilla/layers/CompositorBridgeParent.h"
 #include "mozilla/layers/CompositorManagerChild.h"
 #include "mozilla/layers/CompositorManagerParent.h"
 #include "mozilla/layers/CompositorOptions.h"
 #include "mozilla/layers/ImageBridgeChild.h"
@@ -32,17 +33,16 @@
 #include "nsContentUtils.h"
 #include "VRManagerChild.h"
 #include "VRManagerParent.h"
 #include "VsyncBridgeChild.h"
 #include "VsyncIOThreadHolder.h"
 #include "VsyncSource.h"
 #include "mozilla/dom/VideoDecoderManagerChild.h"
 #include "mozilla/dom/VideoDecoderManagerParent.h"
-#include "MediaPrefs.h"
 #include "nsExceptionHandler.h"
 #include "nsPrintfCString.h"
 
 #if defined(MOZ_WIDGET_ANDROID)
 #include "mozilla/widget/AndroidUiThread.h"
 #include "mozilla/layers/UiCompositorControllerChild.h"
 #endif // defined(MOZ_WIDGET_ANDROID)
 
@@ -976,17 +976,17 @@ GPUProcessManager::CreateContentVRManage
   return true;
 }
 
 void
 GPUProcessManager::CreateContentVideoDecoderManager(base::ProcessId aOtherProcess,
                                                     ipc::Endpoint<dom::PVideoDecoderManagerChild>* aOutEndpoint)
 {
   if (!EnsureGPUReady() ||
-      !MediaPrefs::PDMUseGPUDecoder() ||
+      !StaticPrefs::MediaGpuProcessDecoder() ||
       !mDecodeVideoOnGpuProcess) {
     return;
   }
 
   ipc::Endpoint<dom::PVideoDecoderManagerParent> parentPipe;
   ipc::Endpoint<dom::PVideoDecoderManagerChild> childPipe;
 
   nsresult rv = dom::PVideoDecoderManager::CreateEndpoints(
--- a/gfx/thebes/gfxPlatform.cpp
+++ b/gfx/thebes/gfxPlatform.cpp
@@ -26,17 +26,16 @@
 
 #include "gfxCrashReporterUtils.h"
 #include "gfxPlatform.h"
 #include "gfxPrefs.h"
 #include "gfxEnv.h"
 #include "gfxTextRun.h"
 #include "gfxUserFontSet.h"
 #include "gfxConfig.h"
-#include "MediaPrefs.h"
 #include "VRThread.h"
 
 #ifdef XP_WIN
 #include <process.h>
 #define getpid _getpid
 #else
 #include <unistd.h>
 #endif
@@ -652,17 +651,16 @@ gfxPlatform::Init()
 
     if (gEverInitialized) {
         MOZ_CRASH("Already started???");
     }
     gEverInitialized = true;
 
     // Initialize the preferences by creating the singleton.
     gfxPrefs::GetSingleton();
-    MediaPrefs::GetSingleton();
     gfxVars::Initialize();
 
     gfxConfig::Init();
 
     if (XRE_IsParentProcess()) {
       GPUProcessManager::Initialize();
 
       if (Preferences::GetBool("media.wmf.skip-blacklist")) {
--- a/js/src/vm/TypeInference-inl.h
+++ b/js/src/vm/TypeInference-inl.h
@@ -117,19 +117,19 @@ TypeSet::ObjectKey::singleton()
     JSObject::readBarrier(res);
     return res;
 }
 
 inline JSCompartment*
 TypeSet::ObjectKey::maybeCompartment()
 {
     if (isSingleton())
-        return singleton()->compartment();
+        return singletonNoBarrier()->compartment();
 
-    return group()->compartment();
+    return groupNoBarrier()->compartment();
 }
 
 /* static */ inline TypeSet::Type
 TypeSet::ObjectType(JSObject* obj)
 {
     if (obj->isSingleton())
         return Type(uintptr_t(obj) | 1);
     return Type(uintptr_t(obj->group()));
--- a/js/src/vm/TypeInference.cpp
+++ b/js/src/vm/TypeInference.cpp
@@ -665,23 +665,31 @@ TypeSet::addType(Type type, LifoAlloc* a
 // used during Ion compilation, and if some ConstraintTypeSet contains nursery
 // pointers then any number of TemporaryTypeSets might as well. Thus, if there
 // are any such ConstraintTypeSets in existence, all off thread Ion
 // compilations are canceled by the next minor GC.
 class TypeSetRef : public BufferableRef
 {
     Zone* zone;
     ConstraintTypeSet* types;
+#ifdef DEBUG
+    uint64_t minorGCNumberAtCreation;
+#endif
 
   public:
     TypeSetRef(Zone* zone, ConstraintTypeSet* types)
-      : zone(zone), types(types)
+      : zone(zone)
+      , types(types)
+#ifdef DEBUG
+      , minorGCNumberAtCreation(zone->runtimeFromMainThread()->gc.minorGCCount())
+#endif
     {}
 
     void trace(JSTracer* trc) override {
+        MOZ_ASSERT(trc->runtime()->gc.minorGCCount() == minorGCNumberAtCreation);
         types->trace(zone, trc);
     }
 };
 
 void
 ConstraintTypeSet::postWriteBarrier(JSContext* cx, Type type)
 {
     if (type.isSingletonUnchecked() && IsInsideNursery(type.singletonNoBarrier())) {
@@ -4139,16 +4147,43 @@ ConstraintTypeSet::trace(Zone* zone, JST
                   MemCheckKind::MakeUndefined);
     } else if (objectCount == 1) {
         ObjectKey* key = (ObjectKey*) objectSet;
         TraceObjectKey(trc, &key);
         objectSet = reinterpret_cast<ObjectKey**>(key);
     } else {
         MOZ_RELEASE_ASSERT(!objectSet);
     }
+
+#ifdef DEBUG
+    MOZ_ASSERT(objectCount == baseObjectCount());
+    if (objectCount >= 2) {
+        unsigned capacity = TypeHashSet::Capacity(objectCount);
+        MOZ_ASSERT(uintptr_t(objectSet[-1]) == capacity);
+        for (unsigned i = 0; i < capacity; i++) {
+            ObjectKey* key = objectSet[i];
+            if (!key)
+                continue;
+            if (key->isGroup())
+                CheckGCThingAfterMovingGC(key->groupNoBarrier());
+            else
+                CheckGCThingAfterMovingGC(key->singletonNoBarrier());
+            JSCompartment* compartment = key->maybeCompartment();
+            MOZ_ASSERT_IF(compartment, compartment->zone() == zone);
+        }
+    } else if (objectCount == 1) {
+        ObjectKey* key = (ObjectKey*) objectSet;
+        if (key->isGroup())
+            CheckGCThingAfterMovingGC(key->groupNoBarrier());
+        else
+            CheckGCThingAfterMovingGC(key->singletonNoBarrier());
+        JSCompartment* compartment = key->maybeCompartment();
+        MOZ_ASSERT_IF(compartment, compartment->zone() == zone);
+    }
+#endif
 }
 
 static inline void
 AssertGCStateForSweep(Zone* zone)
 {
     MOZ_ASSERT(zone->isGCSweepingOrCompacting());
 
     // IsAboutToBeFinalized doesn't work right on tenured objects when called
--- a/layout/build/nsLayoutStatics.cpp
+++ b/layout/build/nsLayoutStatics.cpp
@@ -100,17 +100,16 @@
 #include "nsApplicationCacheService.h"
 #include "mozilla/dom/CustomElementRegistry.h"
 #include "mozilla/EventDispatcher.h"
 #include "mozilla/IMEStateManager.h"
 #include "mozilla/dom/HTMLVideoElement.h"
 #include "TouchManager.h"
 #include "DecoderDoctorLogger.h"
 #include "MediaDecoder.h"
-#include "MediaPrefs.h"
 #include "mozilla/ServoBindings.h"
 #include "mozilla/StaticPresData.h"
 #include "mozilla/dom/WebIDLGlobalNameHash.h"
 #include "mozilla/dom/ipc/IPCBlobInputStreamStorage.h"
 #include "mozilla/dom/U2FTokenManager.h"
 #include "mozilla/dom/PointerEventHandler.h"
 #include "nsHostObjectProtocolHandler.h"
 #include "nsThreadManager.h"
@@ -278,21 +277,16 @@ nsLayoutStatics::Initialize()
   PromiseDebugging::Init();
 
   mozilla::dom::WebCryptoThreadPool::Initialize();
 
   if (XRE_IsParentProcess() || XRE_IsContentProcess()) {
     InitializeServo();
   }
 
-#ifndef MOZ_WIDGET_ANDROID
-  // On Android, we instantiate it when constructing AndroidBridge.
-  MediaPrefs::GetSingleton();
-#endif
-
   // This must be initialized on the main-thread.
   mozilla::dom::IPCBlobInputStreamStorage::Initialize();
 
   mozilla::dom::U2FTokenManager::Initialize();
 
   if (XRE_IsParentProcess()) {
     // On content process we initialize DOMPrefs when PContentChild is fully
     // initialized.
--- a/layout/style/ServoBindings.cpp
+++ b/layout/style/ServoBindings.cpp
@@ -2567,18 +2567,16 @@ Gecko_LoadStyleSheet(css::Loader* aLoade
   RefPtr<ServoStyleSheet> sheet =
     static_cast<ServoStyleSheet*>(aParent->GetFirstChild());
   return sheet.forget().take();
 }
 
 nsCSSKeyword
 Gecko_LookupCSSKeyword(const uint8_t* aString, uint32_t aLength)
 {
-  MOZ_ASSERT(NS_IsMainThread());
-
   nsDependentCSubstring keyword(reinterpret_cast<const char*>(aString), aLength);
   return nsCSSKeywords::LookupKeyword(keyword);
 }
 
 const char*
 Gecko_CSSKeywordString(nsCSSKeyword aKeyword, uint32_t* aLength)
 {
   MOZ_ASSERT(NS_IsMainThread());
--- a/layout/tools/reftest/reftestcommandline.py
+++ b/layout/tools/reftest/reftestcommandline.py
@@ -405,17 +405,17 @@ class RemoteArgumentsParser(ReftestArgum
                           xrePath="",
                           utilityPath="",
                           localLogName=None)
 
         self.add_argument("--adbpath",
                           action="store",
                           type=str,
                           dest="adb_path",
-                          default="adb",
+                          default=None,
                           help="path to adb")
 
         self.add_argument("--deviceSerial",
                           action="store",
                           type=str,
                           dest="deviceSerial",
                           help="adb serial number of remote device to test")
 
--- a/layout/tools/reftest/remotereftest.py
+++ b/layout/tools/reftest/remotereftest.py
@@ -144,17 +144,17 @@ class RemoteReftest(RefTest):
         self.run_by_manifest = False
         self.scriptDir = scriptDir
         self.localLogName = options.localLogName
 
         verbose = False
         if options.log_tbpl_level == 'debug' or options.log_mach_level == 'debug':
             verbose = True
             print "set verbose!"
-        self.device = ADBAndroid(adb=options.adb_path,
+        self.device = ADBAndroid(adb=options.adb_path or 'adb',
                                  device=options.deviceSerial,
                                  test_root=options.remoteTestRoot,
                                  verbose=verbose)
 
         if options.remoteTestRoot is None:
             options.remoteTestRoot = posixpath.join(self.device.test_root, "reftest")
         options.remoteProfile = posixpath.join(options.remoteTestRoot, "profile")
         options.remoteLogFile = posixpath.join(options.remoteTestRoot, "reftest.log")
--- a/media/webrtc/signaling/src/media-conduit/MediaCodecVideoCodec.cpp
+++ b/media/webrtc/signaling/src/media-conduit/MediaCodecVideoCodec.cpp
@@ -1,31 +1,31 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "CSFLog.h"
 #include "nspr.h"
+#include "mozilla/StaticPrefs.h"
 
 #include "WebrtcMediaCodecVP8VideoCodec.h"
 #include "MediaCodecVideoCodec.h"
-#include "MediaPrefs.h"
 
 namespace mozilla {
 
 static const char* mcvcLogTag ="MediaCodecVideoCodec";
 #ifdef LOGTAG
 #undef LOGTAG
 #endif
 #define LOGTAG mcvcLogTag
 
 WebrtcVideoEncoder* MediaCodecVideoCodec::CreateEncoder(CodecType aCodecType) {
   CSFLogDebug(LOGTAG,  "%s ", __FUNCTION__);
   if (aCodecType == CODEC_VP8) {
-    if (MediaPrefs::RemoteMediaCodecVP8EncoderEnabled()) {
+    if (StaticPrefs::MediaNavigatorHardwareVp8encodeAccelerationRemoteEnabled()) {
       return new WebrtcMediaCodecVP8VideoRemoteEncoder();
     } else {
       return new WebrtcMediaCodecVP8VideoEncoder();
     }
   }
   return nullptr;
 }
 
--- a/media/webrtc/signaling/src/media-conduit/MediaDataDecoderCodec.cpp
+++ b/media/webrtc/signaling/src/media-conduit/MediaDataDecoderCodec.cpp
@@ -1,37 +1,37 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "MediaDataDecoderCodec.h"
-#include "MediaPrefs.h"
 #include "WebrtcMediaDataDecoderCodec.h"
+#include "mozilla/StaticPrefs.h"
 
 namespace mozilla {
 
 /* static */ WebrtcVideoEncoder*
 MediaDataDecoderCodec::CreateEncoder(
   webrtc::VideoCodecType aCodecType)
 {
   return nullptr;
 }
 
 /* static */ WebrtcVideoDecoder*
 MediaDataDecoderCodec::CreateDecoder(
   webrtc::VideoCodecType aCodecType)
 {
-  if (!MediaPrefs::MediaDataDecoderEnabled()) {
+  if (!StaticPrefs::MediaNavigatorMediadatadecoderEnabled()) {
     return nullptr;
   }
 
   switch (aCodecType) {
     case webrtc::VideoCodecType::kVideoCodecVP8:
     case webrtc::VideoCodecType::kVideoCodecVP9:
     case webrtc::VideoCodecType::kVideoCodecH264:
       break;
     default:
       return nullptr;
   }
   return new WebrtcMediaDataDecoder();
 }
 
-} // namespace mozilla
\ No newline at end of file
+} // namespace mozilla
--- a/mobile/android/app/mobile.js
+++ b/mobile/android/app/mobile.js
@@ -558,59 +558,37 @@ pref("dom.webnotifications.enabled", tru
 pref("browser.chrome.toolbar_tips", false);
 
 // don't allow meta-refresh when backgrounded
 pref("browser.meta_refresh_when_inactive.disabled", true);
 
 // prevent video elements from preloading too much data
 pref("media.preload.default", 1); // default to preload none
 pref("media.preload.auto", 2);    // preload metadata if preload=auto
-pref("media.cache_size", 32768);    // 32MB media cache
-// Try to save battery by not resuming reading from a connection until we fall
-// below 10s of buffered data.
-pref("media.cache_resume_threshold", 10);
-pref("media.cache_readahead_limit", 30);
 // On mobile we'll throttle the download once the readahead_limit is hit,
 // even if the download is slow. This is to preserve battery and data.
 pref("media.throttle-regardless-of-download-rate", true);
 
 // Number of video frames we buffer while decoding video.
 // On Android this is decided by a similar value which varies for
 // each OMX decoder |OMX_PARAM_PORTDEFINITIONTYPE::nBufferCountMin|. This
 // number must be less than the OMX equivalent or gecko will think it is
 // chronically starved of video frames. All decoders seen so far have a value
 // of at least 4.
 pref("media.video-queue.default-size", 3);
 // The maximum number of queued frames to send to the compositor.
 // On Android, it needs to be throttled because SurfaceTexture contains only one
 // (the most recent) image data.
 pref("media.video-queue.send-to-compositor-size", 1);
 
-// Allow to check if the decoder supports recycling only on Fennec nightly build.
-pref("media.decoder.recycle.enabled", true);
-
-// Enable the MediaCodec PlatformDecoderModule by default.
-pref("media.android-media-codec.enabled", true);
-pref("media.android-media-codec.preferred", true);
-
 // Enable MSE
 pref("media.mediasource.enabled", true);
 
 pref("media.mediadrm-widevinecdm.visible", true);
 
-#ifdef NIGHTLY_BUILD
-// Enable EME (Encrypted Media Extensions)
-pref("media.eme.enabled", true);
-#endif
-
-pref("media.hls.enabled", true);
-
-// Whether to suspend decoding of videos in background tabs.
-pref("media.suspend-bkgnd-video.enabled", true);
-
 // optimize images memory usage
 pref("image.downscale-during-decode.enabled", true);
 
 // The download protection UI is not implemented yet (bug 1239094).
 pref("browser.safebrowsing.downloads.enabled", false);
 
 // The application reputation lists are not available on Android.
 pref("urlclassifier.downloadAllowTable", "");
@@ -895,12 +873,10 @@ pref("dom.keyboardevent.dispatch_during_
 
 #if CPU_ARCH == aarch64
 pref("javascript.options.native_regexp", false);
 #endif
 
 // Ask for permission when enumerating WebRTC devices.
 pref("media.navigator.permission.device", true);
 
-pref("media.videocontrols.lock-video-orientation", true);
-
 // Allow system add-on updates
 pref("extensions.systemAddon.update.url", "https://aus5.mozilla.org/update/3/SystemAddons/%VERSION%/%BUILD_ID%/%BUILD_TARGET%/%LOCALE%/%CHANNEL%/%OS_VERSION%/%DISTRIBUTION%/%DISTRIBUTION_VERSION%/update.xml");
--- a/modules/libpref/init/StaticPrefList.h
+++ b/modules/libpref/init/StaticPrefList.h
@@ -73,16 +73,26 @@
 // - <default-value> is the same as for normal prefs.
 //
 // Note that Rust code must access the global variable directly, rather than via
 // the getter.
 
 // clang-format off
 
 //---------------------------------------------------------------------------
+// Accessibility prefs
+//---------------------------------------------------------------------------
+
+VARCACHE_PREF(
+  "accessibility.monoaudio.enable",
+   accessibility_monoaudio_enable,
+  bool, false
+)
+
+//---------------------------------------------------------------------------
 // Full-screen prefs
 //---------------------------------------------------------------------------
 
 #ifdef RELEASE_OR_BETA
 # define PREF_VALUE false
 #else
 # define PREF_VALUE true
 #endif
@@ -291,16 +301,507 @@ VARCACHE_PREF(
 
 VARCACHE_PREF(
   "javascript.options.mem.notify",
    javascript_options_mem_notify,
   bool, false
 )
 
 //---------------------------------------------------------------------------
+// Media prefs
+//---------------------------------------------------------------------------
+
+// These prefs use camel case instead of snake case for the getter because one
+// reviewer had an unshakeable preference for that.
+
+// File-backed MediaCache size.
+#ifdef ANDROID
+# define PREF_VALUE  32768  // Measured in KiB
+#else
+# define PREF_VALUE 512000  // Measured in KiB
+#endif
+VARCACHE_PREF(
+  "media.cache_size",
+   MediaCacheSize,
+  uint32_t, PREF_VALUE
+)
+#undef PREF_VALUE
+
+// If a resource is known to be smaller than this size (in kilobytes), a
+// memory-backed MediaCache may be used; otherwise the (single shared global)
+// file-backed MediaCache is used.
+VARCACHE_PREF(
+  "media.memory_cache_max_size",
+   MediaMemoryCacheMaxSize,
+  uint32_t, 8192      // Measured in KiB
+)
+
+// Don't create more memory-backed MediaCaches if their combined size would go
+// above this absolute size limit.
+#ifdef ANDROID
+# define PREF_VALUE  32768    // Measured in KiB
+#else
+# define PREF_VALUE 524288    // Measured in KiB
+#endif
+VARCACHE_PREF(
+  "media.memory_caches_combined_limit_kb",
+   MediaMemoryCachesCombinedLimitKb,
+  uint32_t, PREF_VALUE
+)
+#undef PREF_VALUE
+
+// Don't create more memory-backed MediaCaches if their combined size would go
+// above this relative size limit (a percentage of physical memory).
+VARCACHE_PREF(
+  "media.memory_caches_combined_limit_pc_sysmem",
+   MediaMemoryCachesCombinedLimitPcSysmem,
+  uint32_t, 5         // A percentage
+)
+
+// When a network connection is suspended, don't resume it until the amount of
+// buffered data falls below this threshold (in seconds).
+#ifdef ANDROID
+# define PREF_VALUE 10  // Use a smaller limit to save battery.
+#else
+# define PREF_VALUE 30
+#endif
+VARCACHE_PREF(
+  "media.cache_resume_threshold",
+   MediaCacheResumeThreshold,
+  int32_t, PREF_VALUE
+)
+#undef PREF_VALUE
+
+// Stop reading ahead when our buffered data is this many seconds ahead of the
+// current playback position. This limit can stop us from using arbitrary
+// amounts of network bandwidth prefetching huge videos.
+#ifdef ANDROID
+# define PREF_VALUE 30  // Use a smaller limit to save battery.
+#else
+# define PREF_VALUE 60
+#endif
+VARCACHE_PREF(
+  "media.cache_readahead_limit",
+   MediaCacheReadaheadLimit,
+  int32_t, PREF_VALUE
+)
+#undef PREF_VALUE
+
+// AudioSink
+VARCACHE_PREF(
+  "media.resampling.enabled",
+   MediaResamplingEnabled,
+  bool, false
+)
+
+#if defined(XP_WIN) || defined(XP_DARWIN) || defined(MOZ_PULSEAUDIO)
+// libcubeb backend implement .get_preferred_channel_layout
+# define PREF_VALUE false
+#else
+# define PREF_VALUE true
+#endif
+VARCACHE_PREF(
+  "media.forcestereo.enabled",
+   MediaForcestereoEnabled,
+  bool, PREF_VALUE
+)
+#undef PREF_VALUE
+
+// VideoSink
+VARCACHE_PREF(
+  "media.ruin-av-sync.enabled",
+   MediaRuinAvSyncEnabled,
+  bool, false
+)
+
+// Encrypted Media Extensions
+#if defined(ANDROID)
+# if defined(NIGHTLY_BUILD)
+#  define PREF_VALUE true
+# else
+#  define PREF_VALUE false
+# endif
+#elif defined(XP_LINUX)
+  // On Linux EME is visible but disabled by default. This is so that the "Play
+  // DRM content" checkbox in the Firefox UI is unchecked by default. DRM
+  // requires downloading and installing proprietary binaries, which users on
+  // an open source operating systems didn't opt into. The first time a site
+  // using EME is encountered, the user will be prompted to enable DRM,
+  // whereupon the EME plugin binaries will be downloaded if permission is
+  // granted.
+# define PREF_VALUE false
+#else
+# define PREF_VALUE true
+#endif
+VARCACHE_PREF(
+  "media.eme.enabled",
+   MediaEmeEnabled,
+  bool, PREF_VALUE
+)
+#undef PREF_VALUE
+
+VARCACHE_PREF(
+  "media.clearkey.persistent-license.enabled",
+   MediaClearkeyPersistentLicenseEnabled,
+  bool, false
+)
+
+#if defined(XP_LINUX) && defined(MOZ_GMP_SANDBOX)
+// Whether to allow, on a Linux system that doesn't support the necessary
+// sandboxing features, loading Gecko Media Plugins unsandboxed.  However, EME
+// CDMs will not be loaded without sandboxing even if this pref is changed.
+VARCACHE_PREF(
+  "media.gmp.insecure.allow",
+   MediaGmpInsecureAllow,
+  bool, false
+)
+#endif
+
+// Specifies whether the PDMFactory can create a test decoder that just outputs
+// blank frames/audio instead of actually decoding. The blank decoder works on
+// all platforms.
+VARCACHE_PREF(
+  "media.use-blank-decoder",
+   MediaUseBlankDecoder,
+  bool, false
+)
+
+#if defined(XP_WIN)
+# define PREF_VALUE true
+#else
+# define PREF_VALUE false
+#endif
+VARCACHE_PREF(
+  "media.gpu-process-decoder",
+   MediaGpuProcessDecoder,
+  bool, PREF_VALUE
+)
+#undef PREF_VALUE
+
+#ifdef ANDROID
+
+// Enable the MediaCodec PlatformDecoderModule by default.
+VARCACHE_PREF(
+  "media.android-media-codec.enabled",
+   MediaAndroidMediaCodecEnabled,
+  bool, true
+)
+
+VARCACHE_PREF(
+  "media.android-media-codec.preferred",
+   MediaAndroidMediaCodecPreferred,
+  bool, true
+)
+
+#endif // ANDROID
+
+// WebRTC
+#ifdef MOZ_WEBRTC
+#ifdef ANDROID
+
+VARCACHE_PREF(
+  "media.navigator.hardware.vp8_encode.acceleration_remote_enabled",
+   MediaNavigatorHardwareVp8encodeAccelerationRemoteEnabled,
+  bool, true
+)
+
+PREF("media.navigator.hardware.vp8_encode.acceleration_enabled", bool, true)
+
+PREF("media.navigator.hardware.vp8_decode.acceleration_enabled", bool, false)
+
+#endif // ANDROID
+
+// Use MediaDataDecoder API for WebRTC. This includes hardware acceleration for
+// decoding.
+VARCACHE_PREF(
+  "media.navigator.mediadatadecoder_enabled",
+   MediaNavigatorMediadatadecoderEnabled,
+  bool, false
+)
+#endif // MOZ_WEBRTC
+
+#ifdef MOZ_FFMPEG
+
+# if defined(XP_MACOSX)
+#  define PREF_VALUE false
+# else
+#  define PREF_VALUE true
+# endif
+VARCACHE_PREF(
+  "media.ffmpeg.enabled",
+   MediaFfmpegEnabled,
+  bool, PREF_VALUE
+)
+#undef PREF_VALUE
+
+VARCACHE_PREF(
+  "media.libavcodec.allow-obsolete",
+   MediaLibavcodecAllowObsolete,
+  bool, false
+)
+
+#endif // MOZ_FFMPEG
+
+#ifdef MOZ_FFVPX
+VARCACHE_PREF(
+  "media.ffvpx.enabled",
+   MediaFfvpxEnabled,
+  bool, true
+)
+#endif
+
+#if defined(MOZ_FFMPEG) || defined(MOZ_FFVPX)
+VARCACHE_PREF(
+  "media.ffmpeg.low-latency.enabled",
+   MediaFfmpegLowLatencyEnabled,
+  bool, false
+)
+#endif
+
+#ifdef MOZ_WMF
+
+VARCACHE_PREF(
+  "media.wmf.enabled",
+   MediaWmfEnabled,
+  bool, true
+)
+
+// Whether DD should consider WMF-disabled a WMF failure, useful for testing.
+VARCACHE_PREF(
+  "media.decoder-doctor.wmf-disabled-is-failure",
+   MediaDecoderDoctorWmfDisabledIsFailure,
+  bool, false
+)
+
+VARCACHE_PREF(
+  "media.wmf.vp9.enabled",
+   MediaWmfVp9Enabled,
+  bool, true
+)
+
+#endif // MOZ_WMF
+
+// Whether to check the decoder supports recycling.
+#ifdef ANDROID
+# define PREF_VALUE true
+#else
+# define PREF_VALUE false
+#endif
+VARCACHE_PREF(
+  "media.decoder.recycle.enabled",
+   MediaDecoderRecycleEnabled,
+  bool, PREF_VALUE
+)
+#undef PREF_VALUE
+
+// Should MFR try to skip to the next key frame?
+VARCACHE_PREF(
+  "media.decoder.skip-to-next-key-frame.enabled",
+   MediaDecoderSkipToNextKeyFrameEnabled,
+  bool, true
+)
+
+VARCACHE_PREF(
+  "media.gmp.decoder.enabled",
+   MediaGmpDecoderEnabled,
+  bool, false
+)
+
+VARCACHE_PREF(
+  "media.eme.audio.blank",
+   MediaEmeAudioBlank,
+  bool, false
+)
+VARCACHE_PREF(
+  "media.eme.video.blank",
+   MediaEmeVideoBlank,
+  bool, false
+)
+
+VARCACHE_PREF(
+  "media.eme.chromium-api.video-shmems",
+   MediaEmeChromiumApiVideoShmems,
+  uint32_t, 6
+)
+
+// Whether to suspend decoding of videos in background tabs.
+VARCACHE_PREF(
+  "media.suspend-bkgnd-video.enabled",
+   MediaSuspendBkgndVideoEnabled,
+  bool, true
+)
+
+// Delay, in ms, from time window goes to background to suspending
+// video decoders. Defaults to 10 seconds.
+VARCACHE_PREF(
+  "media.suspend-bkgnd-video.delay-ms",
+   MediaSuspendBkgndVideoDelayMs,
+  RelaxedAtomicUint32, 10000
+)
+
+VARCACHE_PREF(
+  "media.dormant-on-pause-timeout-ms",
+   MediaDormantOnPauseTimeoutMs,
+  int32_t, 5000
+)
+
+VARCACHE_PREF(
+  "media.webspeech.synth.force_global_queue",
+   MediaWebspeechSynthForceGlobalQueue,
+  bool, false
+)
+
+VARCACHE_PREF(
+  "media.webspeech.test.enable",
+   MediaWebspeechTestEnable,
+  bool, false
+)
+
+VARCACHE_PREF(
+  "media.webspeech.test.fake_fsm_events",
+   MediaWebspeechTextFakeFsmEvents,
+  bool, false
+)
+
+VARCACHE_PREF(
+  "media.webspeech.test.fake_recognition_service",
+   MediaWebspeechTextFakeRecognitionService,
+  bool, false
+)
+
+#ifdef MOZ_WEBSPEECH
+VARCACHE_PREF(
+  "media.webspeech.recognition.enable",
+   MediaWebspeechRecognitionEnable,
+  bool, false
+)
+#endif
+
+VARCACHE_PREF(
+  "media.webspeech.recognition.force_enable",
+   MediaWebspeechRecognitionForceEnable,
+  bool, false
+)
+
+#if defined(RELEASE_OR_BETA)
+# define PREF_VALUE 3
+#else
+  // Zero tolerance in pre-release builds to detect any decoder regression.
+# define PREF_VALUE 0
+#endif
+VARCACHE_PREF(
+  "media.audio-max-decode-error",
+   MediaAudioMaxDecodeError,
+  uint32_t, PREF_VALUE
+)
+#undef PREF_VALUE
+
+#if defined(RELEASE_OR_BETA)
+# define PREF_VALUE 2
+#else
+  // Zero tolerance in pre-release builds to detect any decoder regression.
+# define PREF_VALUE 0
+#endif
+VARCACHE_PREF(
+  "media.video-max-decode-error",
+   MediaVideoMaxDecodeError,
+  uint32_t, PREF_VALUE
+)
+#undef PREF_VALUE
+
+// Ogg
+VARCACHE_PREF(
+  "media.ogg.enabled",
+   MediaOggEnabled,
+  bool, true
+)
+
+// AV1
+VARCACHE_PREF(
+  "media.av1.enabled",
+   MediaAv1Enabled,
+  bool, true
+)
+
+// Flac
+// Use new MediaFormatReader architecture for plain ogg.
+VARCACHE_PREF(
+  "media.ogg.flac.enabled",
+   MediaOggFlacEnabled,
+  bool, true
+)
+
+VARCACHE_PREF(
+  "media.flac.enabled",
+   MediaFlacEnabled,
+  bool, true
+)
+
+// Hls
+#ifdef ANDROID
+# define PREF_VALUE true
+#else
+# define PREF_VALUE false
+#endif
+VARCACHE_PREF(
+  "media.hls.enabled",
+   MediaHlsEnabled,
+  bool, PREF_VALUE
+)
+#undef PREF_VALUE
+
+#ifdef MOZ_FMP4
+# define PREF_VALUE true
+#else
+# define PREF_VALUE false
+#endif
+VARCACHE_PREF(
+  "media.mp4.enabled",
+   mediaMp4Enabled,
+  bool, PREF_VALUE
+)
+#undef PREF_VALUE
+
+// Error/warning handling, Decoder Doctor.
+//
+// Set to true to force demux/decode warnings to be treated as errors.
+VARCACHE_PREF(
+  "media.playback.warnings-as-errors",
+   MediaPlaybackWarningsAsErrors,
+  bool, false
+)
+
+// Resume video decoding when the cursor is hovering on a background tab to
+// reduce the resume latency and improve the user experience.
+VARCACHE_PREF(
+  "media.resume-bkgnd-video-on-tabhover",
+   MediaResumeBkgndVideoOnTabhover,
+  bool, true
+)
+
+#ifdef ANDROID
+# define PREF_VALUE true
+#else
+# define PREF_VALUE false
+#endif
+VARCACHE_PREF(
+  "media.videocontrols.lock-video-orientation",
+   MediaVideocontrolsLockVideoOrientation,
+  bool, PREF_VALUE
+)
+#undef PREF_VALUE
+
+// Media Seamless Looping
+VARCACHE_PREF(
+  "media.seamless-looping",
+   MediaSeamlessLooping,
+  bool, true
+)
+
+//---------------------------------------------------------------------------
 // Network prefs
 //---------------------------------------------------------------------------
 
 // Sub-resources HTTP-authentication:
 //   0 - don't allow sub-resources to open HTTP authentication credentials
 //       dialogs
 //   1 - allow sub-resources to open HTTP authentication credentials dialogs,
 //       but don't allow it for cross-origin sub-resources
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -344,40 +344,20 @@ pref("print.shrink-to-fit.scale-limit-pe
 pref("print.use_simplify_page", false);
 
 // Disable support for MathML
 pref("mathml.disabled",    false);
 
 // Enable scale transform for stretchy MathML operators. See bug 414277.
 pref("mathml.scale_stretchy_operators.enabled", true);
 
-pref("media.dormant-on-pause-timeout-ms", 5000);
-
 // Used by ChannelMediaResource to run data callbacks from HTTP channel
 // off the main thread.
 pref("media.omt_data_delivery.enabled", true);
 
-// File-backed MediaCache size in kilobytes
-pref("media.cache_size", 512000);
-// When a network connection is suspended, don't resume it until the
-// amount of buffered data falls below this threshold (in seconds).
-pref("media.cache_resume_threshold", 30);
-// Stop reading ahead when our buffered data is this many seconds ahead
-// of the current playback position. This limit can stop us from using arbitrary
-// amounts of network bandwidth prefetching huge videos.
-pref("media.cache_readahead_limit", 60);
-// If a resource is known to be smaller than this size (in kilobytes), a
-// memory-backed MediaCache may be used; otherwise the (single shared
-// global) file-backed MediaCache is used.
-pref("media.memory_cache_max_size", 8192);
-// Don't create more memory-backed MediaCaches if their combined size would go
-// above the lowest limit (in kilobytes or in percent of physical memory size).
-pref("media.memory_caches_combined_limit_kb", 524288);
-pref("media.memory_caches_combined_limit_pc_sysmem", 5);
-
 // We'll throttle the download if the download rate is throttle-factor times
 // the estimated playback rate, AND we satisfy the cache readahead_limit
 // above. The estimated playback rate is time_duration/length_in_bytes.
 // This means we'll only throttle the download if there's no concern that
 // throttling would cause us to stop and buffer.
 pref("media.throttle-factor", 2);
 // By default, we'll throttle media download once we've reached the the
 // readahead_limit if the download is fast. This pref toggles the "and the
@@ -390,65 +370,37 @@ pref("media.volume_scale", "1.0");
 
 // Whether we should play videos opened in a "video document", i.e. videos
 // opened as top-level documents, as opposed to inside a media element.
 pref("media.play-stand-alone", true);
 
 pref("media.hardware-video-decoding.enabled", true);
 pref("media.hardware-video-decoding.force-enabled", false);
 
-#ifdef MOZ_FMP4
-pref("media.mp4.enabled", true);
-// Specifies whether the PDMFactory can create a test decoder that
-#endif
-// just outputs blank frames/audio instead of actually decoding. The blank
-// decoder works on all platforms.
-pref("media.use-blank-decoder", false);
 #ifdef MOZ_WMF
-pref("media.wmf.enabled", true);
 pref("media.wmf.dxva.enabled", true);
 pref("media.wmf.dxva.d3d11.enabled", true);
 pref("media.wmf.dxva.max-videos", 8);
 pref("media.wmf.low-latency.enabled", false);
-pref("media.wmf.skip-blacklist", false);
-pref("media.wmf.vp9.enabled", true);
 pref("media.wmf.amd.vp9.enabled", true);
 pref("media.wmf.amd.highres.enabled", true);
 pref("media.wmf.allow-unsupported-resolutions", false);
 pref("media.wmf.use-nv12-format", true);
 pref("media.wmf.disable-d3d11-for-dlls", "igd11dxva64.dll: 20.19.15.4463, 20.19.15.4454, 20.19.15.4444, 20.19.15.4416, 20.19.15.4404, 20.19.15.4390, 20.19.15.4380, 20.19.15.4377, 20.19.15.4364, 20.19.15.4360, 20.19.15.4352, 20.19.15.4331, 20.19.15.4326, 20.19.15.4300; igd10iumd32.dll: 20.19.15.4444, 20.19.15.4424, 20.19.15.4409, 20.19.15.4390, 20.19.15.4380, 20.19.15.4360, 10.18.10.4358, 20.19.15.4331, 20.19.15.4312, 20.19.15.4300, 10.18.15.4281, 10.18.15.4279, 10.18.10.4276, 10.18.15.4268, 10.18.15.4256, 10.18.10.4252, 10.18.15.4248, 10.18.14.4112, 10.18.10.3958, 10.18.10.3496, 10.18.10.3431, 10.18.10.3412, 10.18.10.3355, 9.18.10.3234, 9.18.10.3071, 9.18.10.3055, 9.18.10.3006; igd10umd32.dll: 9.17.10.4229, 9.17.10.3040, 9.17.10.2884, 9.17.10.2857, 8.15.10.2274, 8.15.10.2272, 8.15.10.2246, 8.15.10.1840, 8.15.10.1808; igd10umd64.dll: 9.17.10.4229, 9.17.10.2884, 9.17.10.2857, 10.18.10.3496; isonyvideoprocessor.dll: 4.1.2247.8090, 4.1.2153.6200; tosqep.dll: 1.2.15.526, 1.1.12.201, 1.0.11.318, 1.0.11.215, 1.0.10.1224; tosqep64.dll: 1.1.12.201, 1.0.11.215; nvwgf2um.dll: 22.21.13.8253, 22.21.13.8233, 22.21.13.8205, 22.21.13.8189, 22.21.13.8178, 22.21.13.8165, 21.21.13.7892, 21.21.13.7878, 21.21.13.7866, 21.21.13.7849, 21.21.13.7654, 21.21.13.7653, 21.21.13.7633, 21.21.13.7619, 21.21.13.7563, 21.21.13.7306, 21.21.13.7290, 21.21.13.7270, 21.21.13.7254, 21.21.13.6939, 21.21.13.6926, 21.21.13.6909, 21.21.13.4201, 21.21.13.4200, 10.18.13.6881, 10.18.13.6839, 10.18.13.6510, 10.18.13.6472, 10.18.13.6143, 10.18.13.5946, 10.18.13.5923, 10.18.13.5921, 10.18.13.5891, 10.18.13.5887, 10.18.13.5582, 10.18.13.5445, 10.18.13.5382, 10.18.13.5362, 9.18.13.4788, 9.18.13.4752, 9.18.13.4725, 9.18.13.4709, 9.18.13.4195, 9.18.13.4192, 9.18.13.4144, 9.18.13.4052, 9.18.13.3788, 9.18.13.3523, 9.18.13.3235, 9.18.13.3165, 9.18.13.2723, 9.18.13.2702, 9.18.13.1422, 9.18.13.1407, 9.18.13.1106, 9.18.13.546; atidxx32.dll: 21.19.151.3, 21.19.142.257, 21.19.137.514, 21.19.137.1, 21.19.134.1, 21.19.128.7, 21.19.128.4, 20.19.0.32837, 20.19.0.32832, 8.17.10.682, 8.17.10.671, 8.17.10.661, 8.17.10.648, 8.17.10.644, 8.17.10.625, 8.17.10.605, 8.17.10.581, 8.17.10.569, 8.17.10.560, 8.17.10.545, 8.17.10.539, 8.17.10.531, 8.17.10.525, 8.17.10.520, 8.17.10.519, 8.17.10.514, 8.17.10.511, 8.17.10.494, 8.17.10.489, 8.17.10.483, 8.17.10.453, 8.17.10.451, 8.17.10.441, 8.17.10.436, 8.17.10.432, 8.17.10.425, 8.17.10.418, 8.17.10.414, 8.17.10.401, 8.17.10.395, 8.17.10.385, 8.17.10.378, 8.17.10.362, 8.17.10.355, 8.17.10.342, 8.17.10.331, 8.17.10.318, 8.17.10.310, 8.17.10.286, 8.17.10.269, 8.17.10.261, 8.17.10.247, 8.17.10.240, 8.15.10.212; atidxx64.dll: 21.19.151.3, 21.19.142.257, 21.19.137.514, 21.19.137.1, 21.19.134.1, 21.19.128.7, 21.19.128.4, 20.19.0.32832, 8.17.10.682, 8.17.10.661, 8.17.10.644, 8.17.10.625; nvumdshim.dll: 10.18.13.6822");
 pref("media.wmf.disable-d3d9-for-dlls", "igdumd64.dll: 8.15.10.2189, 8.15.10.2119, 8.15.10.2104, 8.15.10.2102, 8.771.1.0; atiumd64.dll: 7.14.10.833, 7.14.10.867, 7.14.10.885, 7.14.10.903, 7.14.10.911, 8.14.10.768, 9.14.10.1001, 9.14.10.1017, 9.14.10.1080, 9.14.10.1128, 9.14.10.1162, 9.14.10.1171, 9.14.10.1183, 9.14.10.1197, 9.14.10.945, 9.14.10.972, 9.14.10.984, 9.14.10.996");
 pref("media.wmf.deblacklisting-for-telemetry-in-gpu-process", true);
 pref("media.wmf.play-stand-alone", true);
 pref("media.wmf.use-sync-texture", true);
 #endif
-#if defined(MOZ_FFMPEG)
-#if defined(XP_MACOSX)
-pref("media.ffmpeg.enabled", false);
-#else
-pref("media.ffmpeg.enabled", true);
-#endif
-pref("media.libavcodec.allow-obsolete", false);
-#endif
-#if defined(MOZ_FFVPX)
-pref("media.ffvpx.enabled", true);
-#endif
-#if defined(MOZ_FFMPEG) || defined(MOZ_FFVPX)
-pref("media.ffmpeg.low-latency.enabled", false);
-#endif
-pref("media.gmp.decoder.enabled", false);
 pref("media.gmp.decoder.aac", 0);
 pref("media.gmp.decoder.h264", 0);
-pref("media.ogg.enabled", true);
 pref("media.opus.enabled", true);
 pref("media.wave.enabled", true);
 pref("media.webm.enabled", true);
 
-pref("media.eme.chromium-api.video-shmems", 6);
-
 // GMP storage version number. At startup we check the version against
 // media.gmp.storage.version.observed, and if the versions don't match,
 // we clear storage and set media.gmp.storage.version.observed=expected.
 // This provides a mechanism to clear GMP storage when non-compatible
 // changes are made.
 pref("media.gmp.storage.version.expected", 1);
 
 // Filter what triggers user notifications.
@@ -457,33 +409,19 @@ pref("media.gmp.storage.version.expected
 pref("media.decoder-doctor.notifications-allowed", "MediaWMFNeeded,MediaWidevineNoWMF,MediaCannotInitializePulseAudio,MediaCannotPlayNoDecoders,MediaUnsupportedLibavcodec,MediaDecodeError");
 #else
 pref("media.decoder-doctor.notifications-allowed", "MediaWMFNeeded,MediaWidevineNoWMF,MediaCannotInitializePulseAudio,MediaCannotPlayNoDecoders,MediaUnsupportedLibavcodec");
 #endif
 pref("media.decoder-doctor.decode-errors-allowed", "");
 pref("media.decoder-doctor.decode-warnings-allowed", "");
 // Whether we report partial failures.
 pref("media.decoder-doctor.verbose", false);
-// Whether DD should consider WMF-disabled a WMF failure, useful for testing.
-pref("media.decoder-doctor.wmf-disabled-is-failure", false);
 // URL to report decode issues
 pref("media.decoder-doctor.new-issue-endpoint", "https://webcompat.com/issues/new");
 
-// Whether to suspend decoding of videos in background tabs.
-pref("media.suspend-bkgnd-video.enabled", true);
-// Delay, in ms, from time window goes to background to suspending
-// video decoders. Defaults to 10 seconds.
-pref("media.suspend-bkgnd-video.delay-ms", 10000);
-// Resume video decoding when the cursor is hovering on a background tab to
-// reduce the resume latency and improve the user experience.
-pref("media.resume-bkgnd-video-on-tabhover", true);
-
-// Whether to enable media seamless looping.
-pref("media.seamless-looping", true);
-
 #ifdef MOZ_WEBRTC
 pref("media.navigator.enabled", true);
 pref("media.navigator.video.enabled", true);
 pref("media.navigator.video.default_fps",30);
 pref("media.navigator.video.use_remb", true);
 pref("media.navigator.video.use_tmmbr", false);
 pref("media.navigator.audio.use_fec", true);
 pref("media.navigator.video.red_ulpfec_enabled", false);
@@ -566,25 +504,19 @@ pref("media.getusermedia.agc", 3); // kA
 // full_duplex: enable cubeb full-duplex capture/playback
 pref("media.navigator.audio.full_duplex", true);
 #if defined(XP_MACOSX)
 pref("media.peerconnection.capture_delay", 50);
 #elif defined(XP_WIN)
 pref("media.peerconnection.capture_delay", 50);
 #elif defined(ANDROID)
 pref("media.peerconnection.capture_delay", 100);
-pref("media.navigator.hardware.vp8_encode.acceleration_enabled", true);
-pref("media.navigator.hardware.vp8_encode.acceleration_remote_enabled", true);
-pref("media.navigator.hardware.vp8_decode.acceleration_enabled", false);
 #else
 pref("media.peerconnection.capture_delay", 70);
 #endif
-// Use MediaDataDecoder API for WebRTC, this includes hardware acceleration for
-// decoding.
-pref("media.navigator.mediadatadecoder_enabled", false);
 #endif
 
 pref("dom.webaudio.enabled", true);
 
 // Exposes the navigator.webdriver attribute.
 pref("dom.webdriver.enabled", true);
 
 #if !defined(ANDROID)
@@ -609,28 +541,21 @@ pref("media.mediasource.mp4.enabled", tr
 
 #if defined(XP_WIN) || defined(XP_MACOSX) || defined(MOZ_WIDGET_ANDROID)
 pref("media.mediasource.webm.enabled", false);
 #else
 pref("media.mediasource.webm.enabled", true);
 #endif
 pref("media.mediasource.webm.audio.enabled", true);
 
-pref("media.av1.enabled", false);
-
-// Use new MediaFormatReader architecture for plain ogg.
-pref("media.flac.enabled", true);
-pref("media.ogg.flac.enabled", true);
-
 pref("media.benchmark.vp9.threshold", 150);
 pref("media.benchmark.frames", 300);
 pref("media.benchmark.timeout", 1000);
 
 #ifdef MOZ_WEBSPEECH
-pref("media.webspeech.recognition.enable", false);
 pref("media.webspeech.synth.enabled", false);
 #endif
 #ifdef MOZ_WEBM_ENCODER
 pref("media.encoder.webm.enabled", true);
 #endif
 
 // Whether to allow recording of AudioNodes with MediaRecorder
 pref("media.recorder.audio_node.enabled", false);
@@ -655,41 +580,32 @@ pref("media.video-queue.default-size", 1
 
 // The maximum number of queued frames to send to the compositor.
 // By default, send all of them.
 pref("media.video-queue.send-to-compositor-size", 9999);
 
 // Whether to disable the video stats to prevent fingerprinting
 pref("media.video_stats.enabled", true);
 
-// Whether to check the decoder supports recycling.
-pref("media.decoder.recycle.enabled", false);
-
-//Weather MFR should try to skip to next key frame or not.
-pref("media.decoder.skip-to-next-key-frame.enabled", true);
-
 // Log level for cubeb, the audio input/output system. Valid values are
 // "verbose", "normal" and "" (log disabled).
 pref("media.cubeb.logging_level", "");
 
 // Cubeb sandbox (remoting) control
 #ifdef XP_LINUX
 pref("media.cubeb.sandbox", true);
 pref("media.audioipc.pool_size", 2);
 // 64 kB stack per pool thread.
 pref("media.audioipc.stack_size", 65536);
 #else
 pref("media.cubeb.sandbox", false);
 #endif
 
 pref("media.webaudio.audiocontextoptions-samplerate.enabled", true);
 
-// Set to true to force demux/decode warnings to be treated as errors.
-pref("media.playback.warnings-as-errors", false);
-
 // Weather we allow AMD switchable graphics
 pref("layers.amd-switchable-gfx.enabled", true);
 
 // Whether to use async panning and zooming
 pref("layers.async-pan-zoom.enabled", true);
 
 // Whether to enable event region building during painting
 pref("layout.event-regions.enabled", false);
@@ -4810,17 +4726,16 @@ pref("network.tcp.tcp_fastopen_http_stal
 // Whether to disable acceleration for all widgets.
 pref("layers.acceleration.disabled", false);
 // Preference that when switched at runtime will run a series of benchmarks
 // and output the result to stderr.
 pref("layers.bench.enabled", false);
 
 #if defined(XP_WIN)
 pref("layers.gpu-process.enabled", true);
-pref("media.gpu-process-decoder", true);
 pref("layers.gpu-process.allow-software", true);
 #ifdef NIGHTLY_BUILD
 pref("layers.gpu-process.max_restarts", 3);
 #endif
 #endif
 
 // Whether to force acceleration on, ignoring blacklists.
 #ifdef ANDROID
@@ -5698,23 +5613,16 @@ pref("narrate.enabled", false);
 #endif
 
 pref("narrate.test", false);
 pref("narrate.rate", 0);
 pref("narrate.voice", " { \"default\": \"automatic\" }");
 // Only make voices that match content language available.
 pref("narrate.filter-voices", true);
 
-#if defined(XP_LINUX) && defined(MOZ_GMP_SANDBOX)
-// Whether to allow, on a Linux system that doesn't support the necessary sandboxing
-// features, loading Gecko Media Plugins unsandboxed.  However, EME CDMs will not be
-// loaded without sandboxing even if this pref is changed.
-pref("media.gmp.insecure.allow", false);
-#endif
-
 // HTML <dialog> element
 pref("dom.dialog_element.enabled", false);
 
 // Allow control characters appear in composition string.
 // When this is false, control characters except
 // CHARACTER TABULATION (horizontal tab) are removed from
 // both composition string and data attribute of compositionupdate
 // and compositionend events.
--- a/servo/components/style/gecko/data.rs
+++ b/servo/components/style/gecko/data.rs
@@ -1,28 +1,29 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 //! Data needed to style a Gecko document.
 
 use atomic_refcell::{AtomicRef, AtomicRefCell, AtomicRefMut};
+use context::QuirksMode;
 use dom::TElement;
 use gecko_bindings::bindings::{self, RawServoStyleSet};
 use gecko_bindings::structs::{self, RawGeckoPresContextOwned, ServoStyleSetSizes, ServoStyleSheet};
 use gecko_bindings::structs::{ServoStyleSheetInner, StyleSheetInfo, nsIDocument};
 use gecko_bindings::sugar::ownership::{HasArcFFI, HasBoxFFI, HasFFI, HasSimpleFFI};
 use invalidation::media_queries::{MediaListKey, ToMediaListKey};
 use malloc_size_of::MallocSizeOfOps;
 use media_queries::{Device, MediaList};
 use properties::ComputedValues;
 use selector_parser::SnapshotMap;
 use servo_arc::Arc;
 use shared_lock::{Locked, SharedRwLockReadGuard, StylesheetGuards};
-use stylesheets::{StylesheetContents, StylesheetInDocument};
+use stylesheets::{CssRule, Origin, StylesheetContents, StylesheetInDocument};
 use stylist::Stylist;
 
 /// Little wrapper to a Gecko style sheet.
 #[derive(Debug, Eq, PartialEq)]
 pub struct GeckoStyleSheet(*const ServoStyleSheet);
 
 impl ToMediaListKey for ::gecko::data::GeckoStyleSheet {
     fn to_media_list_key(&self) -> MediaListKey {
@@ -53,39 +54,48 @@ impl GeckoStyleSheet {
         unsafe { &*self.0 }
     }
 
     fn inner(&self) -> &ServoStyleSheetInner {
         unsafe {
             &*(self.raw()._base.mInner as *const StyleSheetInfo as *const ServoStyleSheetInner)
         }
     }
+
+    /// Gets the StylesheetContents for this stylesheet.
+    pub fn contents(&self) -> &StylesheetContents {
+        debug_assert!(!self.inner().mContents.mRawPtr.is_null());
+        unsafe {
+            let contents =
+                (&**StylesheetContents::as_arc(&&*self.inner().mContents.mRawPtr)) as *const _;
+            &*contents
+        }
+    }
 }
 
 impl Drop for GeckoStyleSheet {
     fn drop(&mut self) {
         unsafe { bindings::Gecko_StyleSheet_Release(self.0) };
     }
 }
 
 impl Clone for GeckoStyleSheet {
     fn clone(&self) -> Self {
         unsafe { bindings::Gecko_StyleSheet_AddRef(self.0) };
         GeckoStyleSheet(self.0)
     }
 }
 
 impl StylesheetInDocument for GeckoStyleSheet {
-    fn contents(&self, _: &SharedRwLockReadGuard) -> &StylesheetContents {
-        debug_assert!(!self.inner().mContents.mRawPtr.is_null());
-        unsafe {
-            let contents =
-                (&**StylesheetContents::as_arc(&&*self.inner().mContents.mRawPtr)) as *const _;
-            &*contents
-        }
+    fn origin(&self, _guard: &SharedRwLockReadGuard) -> Origin {
+        self.contents().origin
+    }
+
+    fn quirks_mode(&self, _guard: &SharedRwLockReadGuard) -> QuirksMode {
+        self.contents().quirks_mode
     }
 
     fn media<'a>(&'a self, guard: &'a SharedRwLockReadGuard) -> Option<&'a MediaList> {
         use gecko_bindings::structs::ServoMediaList;
         use std::mem;
 
         unsafe {
             let servo_media_list = self.raw()._base.mMedia.mRawPtr as *const ServoMediaList;
@@ -98,16 +108,21 @@ impl StylesheetInDocument for GeckoStyle
         }
     }
 
     // All the stylesheets Servo knows about are enabled, because that state is
     // handled externally by Gecko.
     fn enabled(&self) -> bool {
         true
     }
+
+    #[inline]
+    fn rules<'a, 'b: 'a>(&'a self, guard: &'b SharedRwLockReadGuard) -> &'a [CssRule] {
+        self.contents().rules(guard)
+    }
 }
 
 /// The container for data that a Servo-backed Gecko document needs to style
 /// itself.
 pub struct PerDocumentStyleDataImpl {
     /// Rule processor.
     pub stylist: Stylist,
 }
--- a/servo/components/style/stylesheet_set.rs
+++ b/servo/components/style/stylesheet_set.rs
@@ -473,17 +473,17 @@ where
         }
     }
 
     fn collection_for(
         &mut self,
         sheet: &S,
         guard: &SharedRwLockReadGuard,
     ) -> &mut SheetCollection<S> {
-        let origin = sheet.contents(guard).origin;
+        let origin = sheet.origin(guard);
         self.collections.borrow_mut_for_origin(&origin)
     }
 
     sheet_set_methods!("DocumentStylesheetSet");
 
     /// Returns the number of stylesheets in the set.
     pub fn len(&self) -> usize {
         self.collections
--- a/servo/components/style/stylesheets/import_rule.rs
+++ b/servo/components/style/stylesheets/import_rule.rs
@@ -1,65 +1,132 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 //! The [`@import`][import] at-rule.
 //!
 //! [import]: https://drafts.csswg.org/css-cascade-3/#at-import
 
+use context::QuirksMode;
 use cssparser::SourceLocation;
 use media_queries::MediaList;
 use shared_lock::{DeepCloneParams, DeepCloneWithLock};
 use shared_lock::{SharedRwLock, SharedRwLockReadGuard, ToCssWithGuard};
 use std::fmt::{self, Write};
 use str::CssStringWriter;
 use style_traits::{CssWriter, ToCss};
-use stylesheets::{StylesheetContents, StylesheetInDocument};
+use stylesheets::{CssRule, Origin, StylesheetInDocument};
 use values::CssUrl;
 
+/// With asynchronous stylesheet parsing, we can't synchronously create a
+/// GeckoStyleSheet. So we use this placeholder instead.
+#[derive(Clone, Debug)]
+pub struct PendingSheet {
+    origin: Origin,
+    quirks_mode: QuirksMode,
+}
+
 /// A sheet that is held from an import rule.
 #[cfg(feature = "gecko")]
 #[derive(Debug)]
-pub struct ImportSheet(pub ::gecko::data::GeckoStyleSheet);
+pub enum ImportSheet {
+    /// A bonafide stylesheet.
+    Sheet(::gecko::data::GeckoStyleSheet),
+    /// An @import created while parsing off-main-thread, whose Gecko sheet has
+    /// yet to be created and attached.
+    Pending(PendingSheet),
+}
+
+#[cfg(feature = "gecko")]
+impl ImportSheet {
+    /// Creates a new ImportSheet from a GeckoStyleSheet.
+    pub fn new(sheet: ::gecko::data::GeckoStyleSheet) -> Self {
+        ImportSheet::Sheet(sheet)
+    }
+
+    /// Creates a pending ImportSheet for a load that has not started yet.
+    pub fn new_pending(origin: Origin, quirks_mode: QuirksMode) -> Self {
+        ImportSheet::Pending(PendingSheet {
+            origin,
+            quirks_mode,
+        })
+    }
+
+    /// Returns a reference to the GeckoStyleSheet in this ImportSheet, if it
+    /// exists.
+    pub fn as_sheet(&self) -> Option<&::gecko::data::GeckoStyleSheet> {
+        match *self {
+            ImportSheet::Sheet(ref s) => Some(s),
+            ImportSheet::Pending(_) => None,
+        }
+    }
+}
 
 #[cfg(feature = "gecko")]
 impl DeepCloneWithLock for ImportSheet {
     fn deep_clone_with_lock(
         &self,
         _lock: &SharedRwLock,
         _guard: &SharedRwLockReadGuard,
         params: &DeepCloneParams,
     ) -> Self {
         use gecko::data::GeckoStyleSheet;
         use gecko_bindings::bindings;
-        let clone = unsafe {
-            bindings::Gecko_StyleSheet_Clone(self.0.raw() as *const _, params.reference_sheet)
-        };
-        ImportSheet(unsafe { GeckoStyleSheet::from_addrefed(clone) })
+        match *self {
+            ImportSheet::Sheet(ref s) => {
+                let clone = unsafe {
+                    bindings::Gecko_StyleSheet_Clone(s.raw() as *const _, params.reference_sheet)
+                };
+                ImportSheet::Sheet(unsafe { GeckoStyleSheet::from_addrefed(clone) })
+            },
+            ImportSheet::Pending(ref p) => ImportSheet::Pending(p.clone()),
+        }
     }
 }
 
 /// A sheet that is held from an import rule.
 #[cfg(feature = "servo")]
 #[derive(Debug)]
 pub struct ImportSheet(pub ::servo_arc::Arc<::stylesheets::Stylesheet>);
 
 impl StylesheetInDocument for ImportSheet {
-    /// Get the media associated with this stylesheet.
-    fn media<'a>(&'a self, guard: &'a SharedRwLockReadGuard) -> Option<&'a MediaList> {
-        self.0.media(guard)
+    fn origin(&self, _guard: &SharedRwLockReadGuard) -> Origin {
+        match *self {
+            ImportSheet::Sheet(ref s) => s.contents().origin,
+            ImportSheet::Pending(ref p) => p.origin,
+        }
     }
 
-    fn contents(&self, guard: &SharedRwLockReadGuard) -> &StylesheetContents {
-        self.0.contents(guard)
+    fn quirks_mode(&self, _guard: &SharedRwLockReadGuard) -> QuirksMode {
+        match *self {
+            ImportSheet::Sheet(ref s) => s.contents().quirks_mode,
+            ImportSheet::Pending(ref p) => p.quirks_mode,
+        }
     }
 
     fn enabled(&self) -> bool {
-        self.0.enabled()
+        match *self {
+            ImportSheet::Sheet(ref s) => s.enabled(),
+            ImportSheet::Pending(_) => true,
+        }
+    }
+
+    fn media<'a>(&'a self, guard: &'a SharedRwLockReadGuard) -> Option<&'a MediaList> {
+        match *self {
+            ImportSheet::Sheet(ref s) => s.media(guard),
+            ImportSheet::Pending(_) => None,
+        }
+    }
+
+    fn rules<'a, 'b: 'a>(&'a self, guard: &'b SharedRwLockReadGuard) -> &'a [CssRule] {
+        match *self {
+            ImportSheet::Sheet(ref s) => s.contents().rules(guard),
+            ImportSheet::Pending(_) => &[],
+        }
     }
 }
 
 #[cfg(feature = "servo")]
 impl DeepCloneWithLock for ImportSheet {
     fn deep_clone_with_lock(
         &self,
         _lock: &SharedRwLock,
--- a/servo/components/style/stylesheets/rules_iterator.rs
+++ b/servo/components/style/stylesheets/rules_iterator.rs
@@ -4,18 +4,19 @@
 
 //! An iterator over a list of rules.
 
 use context::QuirksMode;
 use media_queries::Device;
 use shared_lock::SharedRwLockReadGuard;
 use smallvec::SmallVec;
 use std::slice;
-use stylesheets::{CssRule, CssRules, DocumentRule, ImportRule, MediaRule, SupportsRule};
+use stylesheets::{CssRule, DocumentRule, ImportRule, MediaRule, SupportsRule};
 use stylesheets::StylesheetInDocument;
+use stylesheets::import_rule::ImportSheet;
 
 /// An iterator over a list of rules.
 pub struct RulesIterator<'a, 'b, C>
 where
     'b: 'a,
     C: NestedRuleIterationCondition + 'static,
 {
     device: &'a Device,
@@ -30,20 +31,20 @@ where
     'b: 'a,
     C: NestedRuleIterationCondition + 'static,
 {
     /// Creates a new `RulesIterator` to iterate over `rules`.
     pub fn new(
         device: &'a Device,
         quirks_mode: QuirksMode,
         guard: &'a SharedRwLockReadGuard<'b>,
-        rules: &'a CssRules,
+        rules: &'a [CssRule],
     ) -> Self {
         let mut stack = SmallVec::new();
-        stack.push(rules.0.iter());
+        stack.push(rules.iter());
         Self {
             device: device,
             quirks_mode: quirks_mode,
             guard: guard,
             stack: stack,
             _phantom: ::std::marker::PhantomData,
         }
     }
@@ -97,20 +98,17 @@ where
                             self.device,
                             self.quirks_mode,
                             import_rule,
                         ) {
                             continue;
                         }
                         import_rule
                             .stylesheet
-                            .contents(self.guard)
-                            .rules
-                            .read_with(self.guard)
-                            .0
+                            .rules(self.guard)
                             .iter()
                     },
                     CssRule::Document(ref doc_rule) => {
                         let doc_rule = doc_rule.read_with(self.guard);
                         if !C::process_document(self.guard, self.device, self.quirks_mode, doc_rule)
                         {
                             continue;
                         }
--- a/servo/components/style/stylesheets/stylesheet.rs
+++ b/servo/components/style/stylesheets/stylesheet.rs
@@ -98,32 +98,20 @@ impl StylesheetContents {
             url_data: RwLock::new(url_data),
             namespaces: namespaces,
             quirks_mode: quirks_mode,
             source_map_url: RwLock::new(source_map_url),
             source_url: RwLock::new(source_url),
         }
     }
 
-    /// Return an iterator using the condition `C`.
+    /// Returns a reference to the list of rules.
     #[inline]
-    pub fn iter_rules<'a, 'b, C>(
-        &'a self,
-        device: &'a Device,
-        guard: &'a SharedRwLockReadGuard<'b>,
-    ) -> RulesIterator<'a, 'b, C>
-    where
-        C: NestedRuleIterationCondition,
-    {
-        RulesIterator::new(
-            device,
-            self.quirks_mode,
-            guard,
-            &self.rules.read_with(guard),
-        )
+    pub fn rules<'a, 'b: 'a>(&'a self, guard: &'b SharedRwLockReadGuard) -> &'a [CssRule] {
+        &self.rules.read_with(guard).0
     }
 
     /// Measure heap usage.
     #[cfg(feature = "gecko")]
     pub fn size_of(&self, guard: &SharedRwLockReadGuard, ops: &mut MallocSizeOfOps) -> usize {
         // Measurement of other fields may be added later.
         self.rules.unconditional_shallow_size_of(ops) +
             self.rules.read_with(guard).size_of(guard, ops)
@@ -184,54 +172,50 @@ macro_rules! rule_filter {
                 }
             }
         )+
     }
 }
 
 /// A trait to represent a given stylesheet in a document.
 pub trait StylesheetInDocument {
-    /// Get the contents of this stylesheet.
-    fn contents(&self, guard: &SharedRwLockReadGuard) -> &StylesheetContents;
-
     /// Get the stylesheet origin.
-    fn origin(&self, guard: &SharedRwLockReadGuard) -> Origin {
-        self.contents(guard).origin
-    }
+    fn origin(&self, guard: &SharedRwLockReadGuard) -> Origin;
 
     /// Get the stylesheet quirks mode.
-    fn quirks_mode(&self, guard: &SharedRwLockReadGuard) -> QuirksMode {
-        self.contents(guard).quirks_mode
-    }
+    fn quirks_mode(&self, guard: &SharedRwLockReadGuard) -> QuirksMode;
+
+    /// Get whether this stylesheet is enabled.
+    fn enabled(&self) -> bool;
 
     /// Get the media associated with this stylesheet.
     fn media<'a>(&'a self, guard: &'a SharedRwLockReadGuard) -> Option<&'a MediaList>;
 
-    /// Returns whether the style-sheet applies for the current device.
-    fn is_effective_for_device(&self, device: &Device, guard: &SharedRwLockReadGuard) -> bool {
-        match self.media(guard) {
-            Some(medialist) => medialist.evaluate(device, self.quirks_mode(guard)),
-            None => true,
-        }
-    }
-
-    /// Get whether this stylesheet is enabled.
-    fn enabled(&self) -> bool;
+    /// Returns a reference to the list of rules in this stylesheet.
+    fn rules<'a, 'b: 'a>(&'a self, guard: &'b SharedRwLockReadGuard) -> &'a [CssRule];
 
     /// Return an iterator using the condition `C`.
     #[inline]
     fn iter_rules<'a, 'b, C>(
         &'a self,
         device: &'a Device,
         guard: &'a SharedRwLockReadGuard<'b>,
     ) -> RulesIterator<'a, 'b, C>
     where
         C: NestedRuleIterationCondition,
     {
-        self.contents(guard).iter_rules(device, guard)
+        RulesIterator::new(device, self.quirks_mode(guard), guard, self.rules(guard))
+    }
+
+    /// Returns whether the style-sheet applies for the current device.
+    fn is_effective_for_device(&self, device: &Device, guard: &SharedRwLockReadGuard) -> bool {
+        match self.media(guard) {
+            Some(medialist) => medialist.evaluate(device, self.quirks_mode(guard)),
+            None => true,
+        }
     }
 
     /// Return an iterator over the effective rules within the style-sheet, as
     /// according to the supplied `Device`.
     #[inline]
     fn effective_rules<'a, 'b>(
         &'a self,
         device: &'a Device,
@@ -250,27 +234,36 @@ pub trait StylesheetInDocument {
         effective_keyframes_rules(Keyframes => KeyframesRule),
         effective_supports_rules(Supports => SupportsRule),
         effective_page_rules(Page => PageRule),
         effective_document_rules(Document => DocumentRule),
     }
 }
 
 impl StylesheetInDocument for Stylesheet {
-    fn contents(&self, _: &SharedRwLockReadGuard) -> &StylesheetContents {
-        &self.contents
+    fn origin(&self, _guard: &SharedRwLockReadGuard) -> Origin {
+        self.contents.origin
+    }
+
+    fn quirks_mode(&self, _guard: &SharedRwLockReadGuard) -> QuirksMode {
+        self.contents.quirks_mode
     }
 
     fn media<'a>(&'a self, guard: &'a SharedRwLockReadGuard) -> Option<&'a MediaList> {
         Some(self.media.read_with(guard))
     }
 
     fn enabled(&self) -> bool {
         !self.disabled()
     }
+
+    #[inline]
+    fn rules<'a, 'b: 'a>(&'a self, guard: &'b SharedRwLockReadGuard) -> &'a [CssRule] {
+        self.contents.rules(guard)
+    }
 }
 
 /// A simple wrapper over an `Arc<Stylesheet>`, with pointer comparison, and
 /// suitable for its use in a `StylesheetSet`.
 #[derive(Clone)]
 #[cfg_attr(feature = "servo", derive(MallocSizeOf))]
 pub struct DocumentStyleSheet(
     #[cfg_attr(feature = "servo", ignore_malloc_size_of = "Arc")] pub Arc<Stylesheet>,
@@ -284,27 +277,36 @@ impl PartialEq for DocumentStyleSheet {
 
 impl ToMediaListKey for DocumentStyleSheet {
     fn to_media_list_key(&self) -> MediaListKey {
         self.0.to_media_list_key()
     }
 }
 
 impl StylesheetInDocument for DocumentStyleSheet {
-    fn contents(&self, guard: &SharedRwLockReadGuard) -> &StylesheetContents {
-        self.0.contents(guard)
+    fn origin(&self, guard: &SharedRwLockReadGuard) -> Origin {
+        self.0.origin(guard)
+    }
+
+    fn quirks_mode(&self, guard: &SharedRwLockReadGuard) -> QuirksMode {
+        self.0.quirks_mode(guard)
     }
 
     fn media<'a>(&'a self, guard: &'a SharedRwLockReadGuard) -> Option<&'a MediaList> {
         self.0.media(guard)
     }
 
     fn enabled(&self) -> bool {
         self.0.enabled()
     }
+
+    #[inline]
+    fn rules<'a, 'b: 'a>(&'a self, guard: &'b SharedRwLockReadGuard) -> &'a [CssRule] {
+        self.0.rules(guard)
+    }
 }
 
 impl Stylesheet {
     /// Updates an empty stylesheet from a given string of text.
     pub fn update_from_str<R>(
         existing: &Stylesheet,
         css: &str,
         url_data: UrlExtraData,
--- a/servo/ports/geckolib/glue.rs
+++ b/servo/ports/geckolib/glue.rs
@@ -2043,17 +2043,17 @@ pub extern "C" fn Servo_ImportRule_GetHr
     })
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_ImportRule_GetSheet(
     rule: RawServoImportRuleBorrowed,
 ) -> *const ServoStyleSheet {
     read_locked_arc(rule, |rule: &ImportRule| {
-        rule.stylesheet.0.raw() as *const ServoStyleSheet
+        rule.stylesheet.as_sheet().unwrap().raw() as *const ServoStyleSheet
     })
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_Keyframe_GetKeyText(
     keyframe: RawServoKeyframeBorrowed,
     result: *mut nsAString
 ) {
--- a/servo/ports/geckolib/stylesheet_loader.rs
+++ b/servo/ports/geckolib/stylesheet_loader.rs
@@ -50,14 +50,13 @@ impl StyleStylesheetLoader for Styleshee
                                  base_url_data,
                                  spec_bytes,
                                  spec_len as u32,
                                  media.into_strong())
         };
 
         debug_assert!(!child_sheet.is_null(),
                       "Import rules should always have a strong sheet");
-        let stylesheet = unsafe {
-            ImportSheet(GeckoStyleSheet::from_addrefed(child_sheet))
-        };
+        let sheet = unsafe { GeckoStyleSheet::from_addrefed(child_sheet) };
+        let stylesheet = ImportSheet::new(sheet);
         Arc::new(lock.wrap(ImportRule { url, source_location, stylesheet }))
     }
 }
--- a/testing/mochitest/mochitest_options.py
+++ b/testing/mochitest/mochitest_options.py
@@ -850,17 +850,17 @@ class AndroidArguments(ArgumentContainer
     args = [
         [["--deviceSerial"],
          {"dest": "deviceSerial",
           "help": "ip address of remote device to test",
           "default": None,
           }],
         [["--adbpath"],
          {"dest": "adbPath",
-          "default": "adb",
+          "default": None,
           "help": "Path to adb binary.",
           "suppress": True,
           }],
         [["--remote-webserver"],
          {"dest": "remoteWebServer",
           "default": None,
           "help": "ip address where the remote web server is hosted at",
           }],
--- a/testing/mochitest/rungeckoview.py
+++ b/testing/mochitest/rungeckoview.py
@@ -34,34 +34,34 @@ class GeckoviewOptions(OptionParser):
                         default="org.mozilla.geckoview_example",
                         help="geckoview_example package name")
         self.add_option("--deviceSerial",
                         action="store", type="string", dest="deviceSerial",
                         default=None,
                         help="serial ID of remote device to test")
         self.add_option("--adbpath",
                         action="store", type="string", dest="adbPath",
-                        default="adb",
+                        default=None,
                         help="Path to adb binary.")
         self.add_option("--remoteTestRoot",
                         action="store", type="string", dest="remoteTestRoot",
                         default=None,
                         help="remote directory to use as test root \
                               (eg. /mnt/sdcard/tests or /data/local/tests)")
 
 
 class GeckoviewTestRunner:
     """
        A quick-and-dirty test harness to verify the geckoview_example
        app starts without crashing.
     """
 
     def __init__(self, log, options):
         self.log = log
-        self.device = ADBAndroid(adb=options.adbPath,
+        self.device = ADBAndroid(adb=options.adbPath or 'adb',
                                  device=options.deviceSerial,
                                  test_root=options.remoteTestRoot)
         self.options = options
         self.appname = self.options.app.split('/')[-1]
         self.logcat = None
         self.build_profile()
         self.log.debug("options=%s" % vars(options))
 
--- a/testing/mochitest/runrobocop.py
+++ b/testing/mochitest/runrobocop.py
@@ -42,17 +42,17 @@ class RobocopTestRunner(MochitestDesktop
         """
            Simple one-time initialization.
         """
         MochitestDesktop.__init__(self, options.flavor, vars(options))
 
         verbose = False
         if options.log_tbpl_level == 'debug' or options.log_mach_level == 'debug':
             verbose = True
-        self.device = ADBAndroid(adb=options.adbPath,
+        self.device = ADBAndroid(adb=options.adbPath or 'adb',
                                  device=options.deviceSerial,
                                  test_root=options.remoteTestRoot,
                                  verbose=verbose)
 
         # Check that Firefox is installed
         expected = options.app.split('/')[-1]
         if not self.device.is_app_installed(expected):
             raise Exception("%s is not installed on this device" % expected)
--- a/testing/mochitest/runtestsremote.py
+++ b/testing/mochitest/runtestsremote.py
@@ -35,17 +35,17 @@ class MochiRemote(MochitestDesktop):
             verbose = True
         if hasattr(options, 'log'):
             delattr(options, 'log')
 
         self.certdbNew = True
         self.chromePushed = False
         self.mozLogName = "moz.log"
 
-        self.device = ADBAndroid(adb=options.adbPath,
+        self.device = ADBAndroid(adb=options.adbPath or 'adb',
                                  device=options.deviceSerial,
                                  test_root=options.remoteTestRoot,
                                  verbose=verbose)
 
         if options.remoteTestRoot is None:
             options.remoteTestRoot = self.device.test_root
         options.dumpOutputDirectory = options.remoteTestRoot
         self.remoteLogFile = posixpath.join(options.remoteTestRoot, "logs", "mochitest.log")
--- a/testing/mozbase/mozdevice/mozdevice/adb.py
+++ b/testing/mozbase/mozdevice/mozdevice/adb.py
@@ -3,33 +3,34 @@
 # You can obtain one at http://mozilla.org/MPL/2.0/.
 
 from __future__ import absolute_import
 
 import os
 import posixpath
 import re
 import shutil
+import signal
 import subprocess
 import tempfile
 import time
 import traceback
 
 from abc import ABCMeta, abstractmethod
 from distutils import dir_util
 
 
 class ADBProcess(object):
     """ADBProcess encapsulates the data related to executing the adb process."""
 
     def __init__(self, args):
         #: command argument argument list.
         self.args = args
         #: Temporary file handle to be used for stdout.
-        self.stdout_file = tempfile.TemporaryFile()
+        self.stdout_file = tempfile.TemporaryFile(mode='w+b')
         #: boolean indicating if the command timed out.
         self.timedout = None
         #: exitcode of the process.
         self.exitcode = None
         #: subprocess Process object used to execute the command.
         self.proc = subprocess.Popen(args,
                                      stdout=self.stdout_file,
                                      stderr=subprocess.STDOUT)
@@ -972,33 +973,35 @@ class ADBDevice(ADBCommand):
         else:
             self._validate_port(local, is_local=True)
             cmd.extend(["--remove", local])
 
         self.command_output(cmd, timeout=timeout)
 
     # Device Shell methods
 
-    def shell(self, cmd, env=None, cwd=None, timeout=None, root=False):
+    def shell(self, cmd, env=None, cwd=None, timeout=None, root=False,
+              stdout_callback=None):
         """Executes a shell command on the device.
 
         :param str cmd: The command to be executed.
         :param env: Contains the environment variables and
             their values.
         :type env: dict or None
         :param cwd: The directory from which to execute.
         :type cwd: str or None
         :param timeout: The maximum time in
             seconds for any spawned adb process to complete before
             throwing an ADBTimeoutError.  This timeout is per adb call. The
             total time spent may exceed this value. If it is not
             specified, the value set in the ADBDevice constructor is used.
         :type timeout: integer or None
         :param bool root: Flag specifying if the command should
             be executed as root.
+        :param stdout_callback: Function called for each line of output.
         :returns: :class:`mozdevice.ADBProcess`
         :raises: ADBRootError
 
         shell() provides a low level interface for executing commands
         on the device via adb shell.
 
         shell() executes on the host in such as fashion that stdout
         contains the stdout and stderr of the host abd process
@@ -1027,16 +1030,41 @@ class ADBDevice(ADBCommand):
         process takes longer than the specified timeout, the process
         is terminated. The return code is extracted from the stdout
         and is then removed from the file.
 
         It is the caller's responsibilty to clean up by closing
         the stdout temporary files.
 
         """
+        def _timed_read_line_handler(signum, frame):
+            raise IOError('ReadLineTimeout')
+
+        def _timed_read_line(filehandle, timeout=None):
+            """
+            Attempt to readline from filehandle. If readline does not return
+            within timeout seconds, raise IOError('ReadLineTimeout').
+            On Windows, required signal facilities are usually not available;
+            as a result, the timeout is not respected and some reads may
+            block on Windows.
+            """
+            if not hasattr(signal, 'SIGALRM'):
+                return filehandle.readline().rstrip()
+            if timeout is None:
+                timeout = 5
+            default_alarm_handler = signal.getsignal(signal.SIGALRM)
+            signal.signal(signal.SIGALRM, _timed_read_line_handler)
+            signal.alarm(timeout)
+            try:
+                line = filehandle.readline().rstrip()
+            finally:
+                signal.alarm(0)
+                signal.signal(signal.SIGALRM, default_alarm_handler)
+            return line
+
         if root and not self._have_root_shell:
             # If root was requested and we do not already have a root
             # shell, then use the appropriate version of su to invoke
             # the shell cmd. Prefer Android's su version since it may
             # falsely report support for su -c.
             if self._have_android_su:
                 cmd = "su 0 %s" % cmd
             elif self._have_su:
@@ -1063,17 +1091,33 @@ class ADBDevice(ADBCommand):
         args.extend(["wait-for-device", "shell", cmd])
         adb_process = ADBProcess(args)
 
         if timeout is None:
             timeout = self._timeout
 
         start_time = time.time()
         exitcode = adb_process.proc.poll()
+        if stdout_callback:
+            stdout_dup = os.fdopen(os.dup(adb_process.stdout_file.fileno()))
+            offset = 0
         while ((time.time() - start_time) <= timeout) and exitcode is None:
+            if stdout_callback:
+                while True:
+                    try:
+                        stdout_dup.seek(offset, os.SEEK_SET)
+                        line = _timed_read_line(stdout_dup)
+                        offset = stdout_dup.tell()
+                        if line and len(line) > 0:
+                            stdout_callback(line)
+                        else:
+                            # no new output, so sleep and poll
+                            break
+                    except IOError:
+                        pass
             time.sleep(self._polling_interval)
             exitcode = adb_process.proc.poll()
         if exitcode is None:
             adb_process.proc.kill()
             adb_process.timedout = True
             adb_process.exitcode = adb_process.proc.poll()
         elif exitcode == 0:
             adb_process.exitcode = self._get_exitcode(adb_process.stdout_file)
--- a/testing/remotecppunittests.py
+++ b/testing/remotecppunittests.py
@@ -23,17 +23,17 @@ except ImportError:
     build_obj = None
 
 
 class RemoteCPPUnitTests(cppunittests.CPPUnitTests):
 
     def __init__(self, options, progs):
         cppunittests.CPPUnitTests.__init__(self)
         self.options = options
-        self.device = ADBAndroid(adb=options.adb_path,
+        self.device = ADBAndroid(adb=options.adb_path or 'adb',
                                  device=options.device_serial,
                                  test_root=options.remote_test_root)
         self.remote_test_root = posixpath.join(self.device.test_root, "cppunittests")
         self.remote_bin_dir = posixpath.join(self.remote_test_root, "b")
         self.remote_tmp_dir = posixpath.join(self.remote_test_root, "tmp")
         self.remote_home_dir = posixpath.join(self.remote_test_root, "h")
         if options.setup:
             self.setup_bin(progs)
@@ -170,17 +170,17 @@ class RemoteCPPUnittestOptions(cppunitte
         self.add_option("--deviceSerial", action="store",
                         type="string", dest="device_serial",
                         help="serial ID of device")
         defaults["device_serial"] = None
 
         self.add_option("--adbPath", action="store",
                         type="string", dest="adb_path",
                         help="Path to adb")
-        defaults["adb_path"] = "adb"
+        defaults["adb_path"] = None
 
         self.add_option("--noSetup", action="store_false",
                         dest="setup",
                         help="do not copy any files to device (to be used only if "
                         "device is already setup)")
         defaults["setup"] = True
 
         self.add_option("--localLib", action="store",
--- a/testing/xpcshell/remotexpcshelltests.py
+++ b/testing/xpcshell/remotexpcshelltests.py
@@ -236,17 +236,17 @@ class XPCShellRemote(xpcshell.XPCShellTe
 
     def __init__(self, options, log):
         xpcshell.XPCShellTests.__init__(self, log)
 
         self.options = options
         verbose = False
         if options['log_tbpl_level'] == 'debug' or options['log_mach_level'] == 'debug':
             verbose = True
-        self.device = ADBAndroid(adb=options['adbPath'],
+        self.device = ADBAndroid(adb=options['adbPath'] or 'adb',
                                  device=options['deviceSerial'],
                                  test_root=options['remoteTestRoot'],
                                  verbose=verbose)
         self.remoteTestRoot = posixpath.join(self.device.test_root, "xpc")
         # Add Android version (SDK level) to mozinfo so that manifest entries
         # can be conditional on android_version.
         mozinfo.info['android_version'] = self.device.version
 
--- a/testing/xpcshell/xpcshellcommandline.py
+++ b/testing/xpcshell/xpcshellcommandline.py
@@ -142,17 +142,17 @@ def add_remote_arguments(parser):
 
     parser.add_argument("--apk", action="store", type=str, dest="localAPK",
                         help="local path to Fennec APK")
 
     parser.add_argument("--deviceSerial", action="store", type=str, dest="deviceSerial",
                         help="serial ID of device")
 
     parser.add_argument("--adbPath", action="store", type=str, dest="adbPath",
-                        default="adb",
+                        default=None,
                         help="Path to adb")
 
     parser.add_argument("--noSetup", action="store_false", dest="setup", default=True,
                         help="do not copy any files to device (to be used only if "
                              "device is already setup)")
 
     parser.add_argument("--local-lib-dir", action="store", type=str, dest="localLib",
                         help="local path to library directory")
--- a/toolkit/components/extensions/Schemas.jsm
+++ b/toolkit/components/extensions/Schemas.jsm
@@ -3052,17 +3052,17 @@ this.Schemas = {
         if (typeof data.get === "function") {
           // Create a new Map so we're sure it's in the same compartment.
           [this.schemaJSON, data] = [new Map(data), this.schemaJSON];
         }
 
         for (let [url, schema] of data) {
           this.schemaJSON.set(url, schema);
         }
-        if (this._rootScheam) {
+        if (this._rootSchema) {
           throw new Error("Schema loaded after root schema populated");
         }
         break;
     }
   },
 
   _loadCachedSchemasPromise: null,
   loadCachedSchemas() {
@@ -3084,17 +3084,17 @@ this.Schemas = {
       let data = Services.ppmm.initialProcessData;
       data["Extension:Schemas"] = this.contentSchemaJSON;
 
       Services.ppmm.broadcastAsyncMessage("Schema:Add", [[url, schema]]);
     } else if (this.schemaHook) {
       this.schemaHook([[url, schema]]);
     }
 
-    if (this._rootScheam) {
+    if (this._rootSchema) {
       throw new Error("Schema loaded after root schema populated");
     }
   },
 
   fetch(url) {
     return readJSONAndBlobbify(url);
   },
 
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -9462,16 +9462,49 @@
     "record_in_processes": ["main", "content"],
     "alert_emails": ["dev-developer-tools@lists.mozilla.org"],
     "expires_in_version": "never",
     "kind": "count",
     "bug_numbers": [1247985],
     "description": "Number of times a custom developer tool has been opened.",
     "releaseChannelCollection": "opt-out"
   },
+  "DEVTOOLS_ACCESSIBILITY_TIME_ACTIVE_SECONDS": {
+    "record_in_processes": ["main", "content"],
+    "expires_in_version": "65",
+    "kind": "exponential",
+    "high": 86400,
+    "n_buckets": 100,
+    "bug_numbers": [1447302],
+    "alert_emails": ["dev-developer-tools@lists.mozilla.org", "yzenevich@mozilla.com"],
+    "releaseChannelCollection": "opt-out",
+    "description": "How long has the accessibility panel been active (seconds)."
+  },
+  "DEVTOOLS_ACCESSIBILITY_PICKER_TIME_ACTIVE_SECONDS": {
+    "record_in_processes": ["main", "content"],
+    "expires_in_version": "65",
+    "kind": "exponential",
+    "high": 86400,
+    "n_buckets": 100,
+    "bug_numbers": [1447302],
+    "alert_emails": ["dev-developer-tools@lists.mozilla.org", "yzenevich@mozilla.com"],
+    "releaseChannelCollection": "opt-out",
+    "description": "How long has the picker tool in accessibility panel been active (seconds)."
+  },
+  "DEVTOOLS_ACCESSIBILITY_SERVICE_TIME_ACTIVE_SECONDS": {
+    "record_in_processes": ["main", "content"],
+    "expires_in_version": "65",
+    "kind": "exponential",
+    "high": 86400,
+    "n_buckets": 100,
+    "bug_numbers": [1447302],
+    "alert_emails": ["dev-developer-tools@lists.mozilla.org", "yzenevich@mozilla.com"],
+    "releaseChannelCollection": "opt-out",
+    "description": "How long has the platform accessibility been active (seconds) in accessibility panel."
+  },
   "DEVTOOLS_TOOLBOX_TIME_ACTIVE_SECONDS": {
     "record_in_processes": ["main", "content"],
     "expires_in_version": "never",
     "kind": "exponential",
     "high": 10000000,
     "n_buckets": 100,
     "bug_numbers": [1446496],
     "alert_emails": ["dev-developer-tools@lists.mozilla.org", "jryans@mozilla.com"],
--- a/toolkit/components/telemetry/Scalars.yaml
+++ b/toolkit/components/telemetry/Scalars.yaml
@@ -964,16 +964,112 @@ devtools.responsive:
     kind: uint
     keyed: true
     notification_emails:
       - dev-developer-tools@lists.mozilla.org, jryans@mozilla.com
     record_in_processes:
       - main
     release_channel_collection: opt-out
 
+devtools.tool:
+  registered:
+    bug_numbers:
+      - 1447302
+    description: >
+      Recorded on enable tool checkbox check/uncheck in Developer Tools options
+      panel. Boolean stating if the tool was enabled or disabled by the user.
+      Keyed by tool id. Current default tools with their id's are defined in
+      https://dxr.mozilla.org/mozilla-central/source/devtools/client/definitions.js
+    expires: "65"
+    kind: boolean
+    keyed: true
+    notification_emails:
+      - dev-developer-tools@lists.mozilla.org
+      - yzenevich@mozilla.com
+    release_channel_collection: opt-out
+    record_in_processes:
+      - 'main'
+
+devtools.accessibility:
+  node_inspected_count:
+    bug_numbers:
+      - 1447302
+    description: >
+      Number of times a DOM node was inspected from within the Accessibility
+      tool.
+    expires: "65"
+    kind: uint
+    notification_emails:
+      - dev-developer-tools@lists.mozilla.org
+      - yzenevich@mozilla.com
+    release_channel_collection: opt-out
+    record_in_processes:
+      - 'main'
+
+  opened_count:
+    bug_numbers:
+      - 1447302
+    description: >
+      Number of times the DevTools Accessibility tool has been opened.
+    expires: "65"
+    kind: uint
+    notification_emails:
+      - dev-developer-tools@lists.mozilla.org
+      - yzenevich@mozilla.com
+    release_channel_collection: opt-out
+    record_in_processes:
+      - 'main'
+
+  picker_used_count:
+    bug_numbers:
+      - 1447302
+    description: >
+      Number of times the picker tool has been used in DevTools Accessibility
+      panel.
+    expires: "65"
+    kind: uint
+    notification_emails:
+      - dev-developer-tools@lists.mozilla.org
+      - yzenevich@mozilla.com
+    release_channel_collection: opt-out
+    record_in_processes:
+      - 'main'
+
+  select_accessible_for_node:
+    bug_numbers:
+      - 1447302
+    description: >
+      Number of times an accessible object was inspected from outside the
+      Accessibility tool (navigation to Accessibility panel). Keyed by the
+      source of user action (inspector context menu, browser context menu, etc).
+    expires: "65"
+    kind: uint
+    keyed: true
+    notification_emails:
+      - dev-developer-tools@lists.mozilla.org
+      - yzenevich@mozilla.com
+    release_channel_collection: opt-out
+    record_in_processes:
+      - 'main'
+
+  service_enabled_count:
+    bug_numbers:
+      - 1447302
+    description: >
+      Number of times platform accessibility has been enabled in DevTools
+      Accessibility panel.
+    expires: "65"
+    kind: uint
+    notification_emails:
+      - dev-developer-tools@lists.mozilla.org
+      - yzenevich@mozilla.com
+    release_channel_collection: opt-out
+    record_in_processes:
+      - 'main'
+
 navigator.storage:
   estimate_count:
     bug_numbers:
       - 1359708
     description: >
       Number of times navigator.storage.estimate has been used.
     expires: "60"
     kind: uint
--- a/toolkit/content/aboutSupport.js
+++ b/toolkit/content/aboutSupport.js
@@ -196,32 +196,16 @@ var snapshotFormatters = {
       return $.new("tr", [
         $.new("td", feature.name),
         $.new("td", feature.version),
         $.new("td", feature.id),
       ]);
     }));
   },
 
-  experiments: function experiments(data) {
-    $.append($("experiments-tbody"), data.map(function(experiment) {
-      return $.new("tr", [
-        $.new("td", experiment.name),
-        $.new("td", experiment.id),
-        $.new("td", experiment.description),
-        $.new("td", experiment.active),
-        $.new("td", experiment.endDate),
-        $.new("td", [
-          $.new("a", experiment.detailURL, null, {href: experiment.detailURL, })
-        ]),
-        $.new("td", experiment.branch),
-      ]);
-    }));
-  },
-
   modifiedPreferences: function modifiedPreferences(data) {
     $.append($("prefs-tbody"), sortedArrayFromObject(data).map(
       function([name, value]) {
         return $.new("tr", [
           $.new("td", name, "pref-name"),
           // Very long preference values can cause users problems when they
           // copy and paste them into some text editors.  Long values generally
           // aren't useful anyway, so truncate them to a reasonable length.
--- a/toolkit/content/aboutSupport.xhtml
+++ b/toolkit/content/aboutSupport.xhtml
@@ -709,50 +709,16 @@
         &aboutSupport.libraryVersionsTitle;
       </h2>
 
       <table>
         <tbody id="libversions-tbody">
         </tbody>
       </table>
 
-
-      <h2 class="major-section">
-        &aboutSupport.experimentsTitle;
-      </h2>
-
-      <table>
-        <thead>
-          <tr>
-            <th>
-              &aboutSupport.experimentName;
-            </th>
-            <th>
-              &aboutSupport.experimentId;
-            </th>
-            <th>
-              &aboutSupport.experimentDescription;
-            </th>
-            <th>
-              &aboutSupport.experimentActive;
-            </th>
-            <th>
-              &aboutSupport.experimentEndDate;
-            </th>
-            <th>
-              &aboutSupport.experimentHomepage;
-            </th>
-            <th>
-              &aboutSupport.experimentBranch;
-            </th>
-          </tr>
-        </thead>
-        <tbody id="experiments-tbody">
-        </tbody>
-      </table>
       <!-- - - - - - - - - - - - - - - - - - - - - -->
 
 #if defined(MOZ_SANDBOX)
       <h2 class="major-section" id="sandbox">
 	&aboutSupport.sandboxTitle;
       </h2>
 
       <table>
--- a/toolkit/locales/en-US/chrome/global/aboutSupport.dtd
+++ b/toolkit/locales/en-US/chrome/global/aboutSupport.dtd
@@ -32,25 +32,16 @@ This is likely the same like id.heading 
 <!ENTITY aboutSupport.securitySoftwareAntiSpyware "Antispyware">
 <!ENTITY aboutSupport.securitySoftwareFirewall "Firewall">
 
 <!ENTITY aboutSupport.featuresTitle "&brandShortName; Features">
 <!ENTITY aboutSupport.featureName "Name">
 <!ENTITY aboutSupport.featureVersion "Version">
 <!ENTITY aboutSupport.featureId "ID">
 
-<!ENTITY aboutSupport.experimentsTitle "Experimental Features">
-<!ENTITY aboutSupport.experimentName "Name">
-<!ENTITY aboutSupport.experimentId "ID">
-<!ENTITY aboutSupport.experimentDescription "Description">
-<!ENTITY aboutSupport.experimentActive "Active">
-<!ENTITY aboutSupport.experimentEndDate "End Date">
-<!ENTITY aboutSupport.experimentHomepage "Homepage">
-<!ENTITY aboutSupport.experimentBranch "Branch">
-
 <!ENTITY aboutSupport.appBasicsTitle "Application Basics">
 <!ENTITY aboutSupport.appBasicsName "Name">
 <!ENTITY aboutSupport.appBasicsVersion "Version">
 <!ENTITY aboutSupport.appBasicsBuildID "Build ID">
 
 <!-- LOCALIZATION NOTE (aboutSupport.appBasicsUpdateChannel, aboutSupport.appBasicsUpdateHistory, aboutSupport.appBasicsShowUpdateHistory):
 "Update" is a noun here, not a verb. -->
 <!ENTITY aboutSupport.appBasicsUpdateChannel "Update Channel">
--- a/widget/GfxInfoBase.cpp
+++ b/widget/GfxInfoBase.cpp
@@ -27,17 +27,16 @@
 #include "nsIXULAppInfo.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/dom/ContentChild.h"
 #include "mozilla/gfx/2D.h"
 #include "mozilla/gfx/GPUProcessManager.h"
 #include "mozilla/gfx/Logging.h"
 #include "mozilla/gfx/gfxVars.h"
 #include "mozilla/layers/PaintThread.h"
-#include "MediaPrefs.h"
 #include "gfxPrefs.h"
 #include "gfxPlatform.h"
 #include "gfxConfig.h"
 #include "DriverCrashGuard.h"
 
 using namespace mozilla::widget;
 using namespace mozilla;
 using mozilla::MutexAutoLock;
@@ -593,20 +592,16 @@ GfxInfoBase::~GfxInfoBase()
 {
 }
 
 nsresult
 GfxInfoBase::Init()
 {
   InitGfxDriverInfoShutdownObserver();
   gfxPrefs::GetSingleton();
-  if (!XRE_IsGPUProcess()) {
-    // MediaPrefs can't run in the GPU process.
-    MediaPrefs::GetSingleton();
-  }
 
   nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
   if (os) {
     os->AddObserver(this, "blocklist-data-gfxItems", true);
   }
 
   return NS_OK;
 }
--- a/widget/android/AndroidBridge.cpp
+++ b/widget/android/AndroidBridge.cpp
@@ -43,17 +43,16 @@
 #include "SurfaceTexture.h"
 #include "GLContextProvider.h"
 
 #include "mozilla/TimeStamp.h"
 #include "mozilla/UniquePtr.h"
 #include "mozilla/dom/ContentChild.h"
 #include "nsIObserverService.h"
 #include "nsISupportsPrimitives.h"
-#include "MediaPrefs.h"
 #include "WidgetUtils.h"
 
 #include "FennecJNIWrappers.h"
 
 using namespace mozilla;
 using namespace mozilla::gfx;
 using namespace mozilla::java;
 
@@ -125,18 +124,16 @@ AndroidBridge::ConstructBridge()
      * linker lock still held.  This results in a deadlock when trying
      * to call dlclose() while we're already inside dlclose().
      * Conveniently, NSS has an env var that can prevent it from unloading.
      */
     putenv(const_cast<char*>("NSS_DISABLE_UNLOAD=1"));
 
     MOZ_ASSERT(!sBridge);
     sBridge = new AndroidBridge();
-
-    MediaPrefs::GetSingleton();
 }
 
 void
 AndroidBridge::DeconstructBridge()
 {
     if (sBridge) {
         delete sBridge;
         // AndroidBridge destruction requires sBridge to still be valid,
--- a/widget/windows/nsWindow.cpp
+++ b/widget/windows/nsWindow.cpp
@@ -606,16 +606,17 @@ nsWindow::nsWindow(bool aIsChildWindow)
   mDisplayPanFeedback   = false;
   mTouchWindow          = false;
   mFutureMarginsToUse   = false;
   mCustomNonClient      = false;
   mHideChrome           = false;
   mFullscreenMode       = false;
   mMousePresent         = false;
   mDestroyCalled        = false;
+  mIsEarlyBlankWindow   = false;
   mHasTaskbarIconBeenCreated = false;
   mMouseTransparent     = false;
   mPickerDisplayCount   = 0;
   mWindowType           = eWindowType_child;
   mBorderStyle          = eBorderStyle_default;
   mOldSizeMode          = nsSizeMode_Normal;
   mLastSizeMode         = nsSizeMode_Normal;
   mLastSize.width       = 0;
@@ -4097,16 +4098,22 @@ nsWindow::AddWindowOverlayWebRenderComma
 }
 
 uint32_t
 nsWindow::GetMaxTouchPoints() const
 {
   return WinUtils::GetMaxTouchPoints();
 }
 
+void
+nsWindow::SetWindowClass(const nsAString& xulWinType)
+{
+  mIsEarlyBlankWindow = xulWinType.EqualsLiteral("navigator:blank");
+}
+
 /**************************************************************
  **************************************************************
  **
  ** BLOCK: Moz Events
  **
  ** Moz GUI event management. 
  **
  **************************************************************
--- a/widget/windows/nsWindow.h
+++ b/widget/windows/nsWindow.h
@@ -218,16 +218,17 @@ public:
   virtual void            UpdateOpaqueRegion(const LayoutDeviceIntRegion& aOpaqueRegion) override;
 #endif // MOZ_XUL
   virtual nsresult        SetNonClientMargins(LayoutDeviceIntMargin& aMargins) override;
   void                    SetDrawsInTitlebar(bool aState) override;
   virtual void            UpdateWindowDraggingRegion(const LayoutDeviceIntRegion& aRegion) override;
 
   virtual void            UpdateThemeGeometries(const nsTArray<ThemeGeometry>& aThemeGeometries) override;
   virtual uint32_t        GetMaxTouchPoints() const override;
+  virtual void            SetWindowClass(const nsAString& xulWinType) override;
 
   /**
    * Event helpers
    */
   virtual bool            DispatchMouseEvent(
                             mozilla::EventMessage aEventMessage,
                             WPARAM wParam,
                             LPARAM lParam,
@@ -543,16 +544,17 @@ protected:
   bool                  mTouchWindow;
   bool                  mDisplayPanFeedback;
   bool                  mHideChrome;
   bool                  mIsRTL;
   bool                  mFullscreenMode;
   bool                  mMousePresent;
   bool                  mDestroyCalled;
   bool                  mOpeningAnimationSuppressed;
+  bool                  mIsEarlyBlankWindow;
   uint32_t              mBlurSuppressLevel;
   DWORD_PTR             mOldStyle;
   DWORD_PTR             mOldExStyle;
   nsNativeDragTarget*   mNativeDragTarget;
   HKL                   mLastKeyboardLayout;
   nsSizeMode            mOldSizeMode;
   nsSizeMode            mLastSizeMode;
   WindowHook            mWindowHook;
--- a/widget/windows/nsWindowGfx.cpp
+++ b/widget/windows/nsWindowGfx.cpp
@@ -216,16 +216,21 @@ bool nsWindow::OnPaint(HDC aDC, uint32_t
       // could fail. Return without asserting since it's not our fault.
       NS_WARNING("Plugin failed to subclass our window");
     }
 
     ValidateRect(mWnd, nullptr);
     return true;
   }
 
+  // Avoid starting the GPU process for the initial navigator:blank window.
+  if (mIsEarlyBlankWindow) {
+    return true;
+  }
+
   if (GetLayerManager()->AsKnowsCompositor() && !mBounds.IsEqualEdges(mLastPaintBounds)) {
     // Do an early async composite so that we at least have something on the
     // screen in the right place, even if the content is out of date.
     GetLayerManager()->ScheduleComposite();
   }
   mLastPaintBounds = mBounds;
 
   PAINTSTRUCT ps;