Backed out 22 changesets (bug 1419771) for build bustage build/src/dom/base/FuzzingFunctions.cpp on a CLOSED TREE
authorGurzau Raul <rgurzau@mozilla.com>
Wed, 13 Dec 2017 23:41:49 +0200
changeset 396289 ccd7b237c4337a00e45bf18ac2d0218c61e1134d
parent 396288 f5ea86116d56e8e90689ec325061c948869159ba
child 396290 6b52d9870d2d16a29e3075627953304c574f11ed
push id33087
push userdluca@mozilla.com
push dateThu, 14 Dec 2017 09:54:55 +0000
treeherdermozilla-central@8062887ff0d9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1419771
milestone59.0a1
backs outb2b7b46c8ad0ed72ebfc2a192e841f90e8620c91
0206657d2ea2d9a83ab4859c7dcae5c9c875dcc1
f0f4b98a07b66a30689803d92f0e9c7ad7f63040
4b52904694f40be316835a479e70c9a78982eafd
9f40cc12d6c67d9264f28add6bd6b25562fbeaa0
f500a61f564cc349cc75a2ec8b12f2d54c1465a2
0bd9d964df8a23c193ec4b20b9694f6f8fe57502
1397a6bbb4460fa7b1d4da88cabdcd128dbd1ec9
7e77a00fa8b51c1a053ef6a0f3158883ed0324cb
5f6df771459a9c08bd8dba480ef1d8e1d57e8342
7624e70b2965910553c2749e8548128438eb2921
b9d674bdc72366f0adf272c6a1c619503fd0b657
5e44aeda4196494f6ac6114faa38d8091a136329
601b49f51b41ca478019cb28d9ac0c7f1c780f56
d12dc55579820a2120cedfc390ba15f71d171ab0
6c863ab2e986f76bc8ab8fc5b41a49747f080265
0866d79873ab8f4e207834e90927061837ca6be3
8ecc91474621403df8725a4ad757427c85dacfdc
19b14deed8fefc08d567cb01feb9151fb47812c7
000c8d5fbc03d656b87b088dfabb57e5d8cd8d0b
2e263a2519c50359bd6b9663b94d462e5e30249e
b628d9298be89033495ad48372743a0902afab39
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out 22 changesets (bug 1419771) for build bustage build/src/dom/base/FuzzingFunctions.cpp on a CLOSED TREE Backed out changeset b2b7b46c8ad0 (bug 1419771) Backed out changeset 0206657d2ea2 (bug 1419771) Backed out changeset f0f4b98a07b6 (bug 1419771) Backed out changeset 4b52904694f4 (bug 1419771) Backed out changeset 9f40cc12d6c6 (bug 1419771) Backed out changeset f500a61f564c (bug 1419771) Backed out changeset 0bd9d964df8a (bug 1419771) Backed out changeset 1397a6bbb446 (bug 1419771) Backed out changeset 7e77a00fa8b5 (bug 1419771) Backed out changeset 5f6df771459a (bug 1419771) Backed out changeset 7624e70b2965 (bug 1419771) Backed out changeset b9d674bdc723 (bug 1419771) Backed out changeset 5e44aeda4196 (bug 1419771) Backed out changeset 601b49f51b41 (bug 1419771) Backed out changeset d12dc5557982 (bug 1419771) Backed out changeset 6c863ab2e986 (bug 1419771) Backed out changeset 0866d79873ab (bug 1419771) Backed out changeset 8ecc91474621 (bug 1419771) Backed out changeset 19b14deed8fe (bug 1419771) Backed out changeset 000c8d5fbc03 (bug 1419771) Backed out changeset 2e263a2519c5 (bug 1419771) Backed out changeset b628d9298be8 (bug 1419771)
dom/base/DOMPreferences.cpp
dom/base/DOMPreferences.h
dom/base/DOMPreferencesInternal.h
dom/base/FuzzingFunctions.h
dom/base/IntlUtils.cpp
dom/base/IntlUtils.h
dom/base/moz.build
dom/base/nsContentUtils.cpp
dom/base/nsContentUtils.h
dom/base/nsFrameMessageManager.cpp
dom/base/nsGlobalWindowInner.cpp
dom/base/nsGlobalWindowInner.h
dom/cache/Cache.cpp
dom/cache/Cache.h
dom/cache/CacheStorage.cpp
dom/cache/CacheStorage.h
dom/canvas/ImageBitmap.cpp
dom/canvas/ImageBitmap.h
dom/canvas/OffscreenCanvas.cpp
dom/canvas/OffscreenCanvas.h
dom/console/Console.cpp
dom/fetch/FetchObserver.cpp
dom/fetch/FetchObserver.h
dom/fetch/Request.cpp
dom/fetch/Request.h
dom/filesystem/Directory.cpp
dom/filesystem/Directory.h
dom/html/HTMLFormSubmission.cpp
dom/html/HTMLInputElement.cpp
dom/html/HTMLInputElement.h
dom/html/ImageDocument.cpp
dom/ipc/TabContext.cpp
dom/network/Connection.cpp
dom/network/Connection.h
dom/notification/Notification.cpp
dom/notification/Notification.h
dom/performance/PerformanceMainThread.cpp
dom/performance/PerformanceWorker.cpp
dom/push/PushManager.h
dom/push/PushSubscription.h
dom/push/PushSubscriptionOptions.h
dom/quota/StorageManager.cpp
dom/quota/StorageManager.h
dom/webidl/Cache.webidl
dom/webidl/CacheStorage.webidl
dom/webidl/FetchObserver.webidl
dom/webidl/File.webidl
dom/webidl/ImageBitmap.webidl
dom/webidl/Navigator.webidl
dom/webidl/NetworkInformation.webidl
dom/webidl/Notification.webidl
dom/webidl/OffscreenCanvas.webidl
dom/webidl/PromiseRejectionEvent.webidl
dom/webidl/PushEvent.webidl
dom/webidl/PushManager.webidl
dom/webidl/PushMessageData.webidl
dom/webidl/PushSubscription.webidl
dom/webidl/PushSubscriptionOptions.webidl
dom/webidl/Request.webidl
dom/webidl/Response.webidl
dom/webidl/ServiceWorkerRegistration.webidl
dom/webidl/StorageManager.webidl
dom/webidl/WebGLRenderingContext.webidl
dom/webidl/WindowOrWorkerGlobalScope.webidl
dom/webidl/WorkerNavigator.webidl
dom/workers/RuntimeService.cpp
dom/workers/RuntimeService.h
dom/workers/ServiceWorker.cpp
dom/workers/ServiceWorkerContainer.cpp
dom/workers/ServiceWorkerManager.cpp
dom/workers/ServiceWorkerPrivate.cpp
dom/workers/ServiceWorkerRegistration.cpp
dom/workers/ServiceWorkerRegistration.h
dom/workers/WorkerNavigator.cpp
dom/workers/WorkerPrefs.h
dom/workers/WorkerPrivate.cpp
dom/workers/WorkerPrivate.h
dom/workers/WorkerScope.cpp
dom/workers/Workers.h
dom/workers/moz.build
dom/worklet/WorkletGlobalScope.cpp
js/xpconnect/loader/mozJSComponentLoader.cpp
js/xpconnect/src/Sandbox.cpp
js/xpconnect/src/XPCWrappedJSClass.cpp
js/xpconnect/src/nsXPConnect.cpp
layout/build/nsLayoutStatics.cpp
layout/forms/nsFileControlFrame.cpp
modules/libpref/Preferences.cpp
deleted file mode 100644
--- a/dom/base/DOMPreferences.cpp
+++ /dev/null
@@ -1,81 +0,0 @@
-/* -*- 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 "DOMPreferences.h"
-#include "mozilla/Atomics.h"
-#include "mozilla/Preferences.h"
-
-namespace mozilla {
-namespace dom {
-
-void
-DOMPreferences::Initialize()
-{
-  MOZ_ASSERT(NS_IsMainThread());
-
-  // Let's cache all the values on the main-thread.
-#if !(defined(DEBUG) || defined(MOZ_ENABLE_JS_DUMP))
-  DOMPreferences::DumpEnabled();
-#endif
-
-#define PREF(name, pref) DOMPreferences::name();
-#include "DOMPreferencesInternal.h"
-#undef PREF
-}
-
-#define PREF(name, pref)                               \
-  /* static */ bool                                    \
-  DOMPreferences::name()                               \
-  {                                                    \
-    static bool initialized = false;                   \
-    static Atomic<bool> cachedValue;                   \
-    if (!initialized) {                                \
-      initialized = true;                              \
-      Preferences::AddAtomicBoolVarCache(&cachedValue, \
-                                         pref, false); \
-    }                                                  \
-    return cachedValue;                                \
-  }
-
-#if !(defined(DEBUG) || defined(MOZ_ENABLE_JS_DUMP))
-PREF(DumpEnabled, "browser.dom.window.dump.enabled")
-#else
-/* static */ bool
-DOMPreferences::DumpEnabled()
-{
-  return true;
-}
-#endif
-
-#include "DOMPreferencesInternal.h"
-#undef PREF
-
-#define PREF_WEBIDL(name)                              \
-  /* static */ bool                                    \
-  DOMPreferences::name(JSContext* aCx, JSObject* aObj) \
-  {                                                    \
-    return DOMPreferences::name();                     \
-  }
-
-PREF_WEBIDL(ImageBitmapExtensionsEnabled)
-PREF_WEBIDL(DOMCachesEnabled)
-PREF_WEBIDL(NotificationEnabledInServiceWorkers)
-PREF_WEBIDL(NotificationRIEnabled)
-PREF_WEBIDL(ServiceWorkersEnabled)
-PREF_WEBIDL(StorageManagerEnabled)
-PREF_WEBIDL(PromiseRejectionEventsEnabled)
-PREF_WEBIDL(PushEnabled)
-PREF_WEBIDL(StreamsEnabled)
-PREF_WEBIDL(RequestContextEnabled)
-PREF_WEBIDL(OffscreenCanvasEnabled)
-PREF_WEBIDL(WebkitBlinkDirectoryPickerEnabled)
-PREF_WEBIDL(NetworkInformationEnabled)
-PREF_WEBIDL(FetchObserverEnabled)
-
-#undef PREF_WEBIDL
-
-} // dom namespace
-} // mozilla namespace
deleted file mode 100644
--- a/dom/base/DOMPreferences.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/* -*- 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/. */
-
-#ifndef mozilla_dom_DOMPreferences_h
-#define mozilla_dom_DOMPreferences_h
-
-namespace mozilla {
-namespace dom {
-
-class DOMPreferences final
-{
-public:
-  // This must be called on the main-thread.
-  static void Initialize();
-
-  // Returns true if the browser.dom.window.dump.enabled pref is set.
-  static bool DumpEnabled();
-
-  // Returns true if the canvas.imagebitmap_extensions.enabled pref is set.
-  static bool ImageBitmapExtensionsEnabled();
-  static bool ImageBitmapExtensionsEnabled(JSContext* aCx, JSObject* aObj);
-
-  // Returns true if the dom.caches.enabled pref is set.
-  static bool DOMCachesEnabled();
-  static bool DOMCachesEnabled(JSContext* aCx, JSObject* aObj);
-
-  // Returns true if the dom.caches.testing.enabled pref is set.
-  static bool DOMCachesTestingEnabled();
-
-  // Returns true if the dom.performance.enable_user_timing_logging pref is set.
-  static bool PerformanceLoggingEnabled();
-
-  // Returns true if the dom.webnotifications.enabled pref is set.
-  // Note that you should use NotificationEnabledInServiceWorkers if you need to
-  // enable Notification API for ServiceWorkers
-  static bool NotificationEnabled();
-
-  // Returns true if the dom.webnotifications.serviceworker.enabled pref is set.
-  static bool NotificationEnabledInServiceWorkers();
-  static bool NotificationEnabledInServiceWorkers(JSContext* aCx,
-                                                  JSObject* aObj);
-
-  // Returns true if the dom.webnotifications.requireinteraction.enabled pref is
-  // set.
-  static bool NotificationRIEnabled();
-  static bool NotificationRIEnabled(JSContext* aCx, JSObject* aObj);
-
-  // Returns true if the dom.serviceWorkers.enabled pref is set.
-  static bool ServiceWorkersEnabled();
-  static bool ServiceWorkersEnabled(JSContext* aCx, JSObject* aObj);
-
-  // Returns true if the dom.serviceWorkers.testing.enabled pref is set.
-  static bool ServiceWorkersTestingEnabled();
-
-  // Returns true if the dom.storageManager.enabled pref is set.
-  static bool StorageManagerEnabled();
-  static bool StorageManagerEnabled(JSContext* aCx, JSObject* aObj);
-
-  // Returns true if the dom.promise_rejection_events.enabled pref is set.
-  static bool PromiseRejectionEventsEnabled();
-  static bool PromiseRejectionEventsEnabled(JSContext* aCx, JSObject* aObj);
-
-  // Returns true if the dom.push.enabled pref is set.
-  static bool PushEnabled();
-  static bool PushEnabled(JSContext* aCx, JSObject* aObj);
-
-  // Returns true if the dom.streams.enabled pref is set.
-  static bool StreamsEnabled();
-  static bool StreamsEnabled(JSContext* aCx, JSObject* aObj);
-
-  // Returns true if the dom.requestcontext.enabled pref is set.
-  static bool RequestContextEnabled();
-  static bool RequestContextEnabled(JSContext* aCx, JSObject* aObj);
-
-  // Returns true if the gfx.offscreencanvas.enabled pref is set.
-  static bool OffscreenCanvasEnabled();
-  static bool OffscreenCanvasEnabled(JSContext* aCx, JSObject* aObj);
-
-  // Returns true if the dom.webkitBlink.dirPicker.enabled pref is set.
-  static bool WebkitBlinkDirectoryPickerEnabled();
-  static bool WebkitBlinkDirectoryPickerEnabled(JSContext* aCx, JSObject* aObj);
-
-  // Returns true if the dom.netinfo.enabled pref is set.
-  static bool NetworkInformationEnabled();
-  static bool NetworkInformationEnabled(JSContext* aCx, JSObject* aObj);
-
-  // Returns true if the dom.fetchObserver.enabled pref is set.
-  static bool FetchObserverEnabled();
-  static bool FetchObserverEnabled(JSContext* aCx, JSObject* aObj);
-
-  // Returns true if the privacy.resistFingerprinting pref is set.
-  static bool ResistFingerprintingEnabled();
-
-  // Returns true if the devtools.enabled pref is set.
-  static bool DevToolsEnabled();
-};
-
-} // dom namespace
-} // mozilla namespace
-
-#endif // mozilla_dom_DOMPreferences_h
deleted file mode 100644
--- a/dom/base/DOMPreferencesInternal.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/* -*- 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/. */
-
-PREF(ImageBitmapExtensionsEnabled, "canvas.imagebitmap_extensions.enabled")
-PREF(DOMCachesEnabled, "dom.caches.enabled")
-PREF(DOMCachesTestingEnabled, "dom.caches.testing.enabled")
-PREF(PerformanceLoggingEnabled, "dom.performance.enable_user_timing_logging")
-PREF(NotificationEnabled, "dom.webnotifications.enabled")
-PREF(NotificationEnabledInServiceWorkers, "dom.webnotifications.serviceworker.enabled")
-PREF(NotificationRIEnabled, "dom.webnotifications.requireinteraction.enabled")
-PREF(ServiceWorkersEnabled, "dom.serviceWorkers.enabled")
-PREF(ServiceWorkersTestingEnabled, "dom.serviceWorkers.testing.enabled")
-PREF(StorageManagerEnabled, "dom.storageManager.enabled")
-PREF(PromiseRejectionEventsEnabled, "dom.promise_rejection_events.enabled")
-PREF(PushEnabled, "dom.push.enabled")
-PREF(StreamsEnabled, "dom.streams.enabled")
-PREF(RequestContextEnabled, "dom.requestcontext.enabled")
-PREF(OffscreenCanvasEnabled, "gfx.offscreencanvas.enabled")
-PREF(WebkitBlinkDirectoryPickerEnabled, "dom.webkitBlink.dirPicker.enabled")
-PREF(NetworkInformationEnabled, "dom.netinfo.enabled")
-PREF(FetchObserverEnabled, "dom.fetchObserver.enabled")
-PREF(ResistFingerprintingEnabled, "privacy.resistFingerprinting")
-PREF(DevToolsEnabled, "devtools.enabled")
--- a/dom/base/FuzzingFunctions.h
+++ b/dom/base/FuzzingFunctions.h
@@ -3,19 +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/. */
 
 #ifndef mozilla_dom_FuzzingFunctions
 #define mozilla_dom_FuzzingFunctions
 
 namespace mozilla {
-
-class ErrorResult;
-
 namespace dom {
 
 class GlobalObject;
 
 class FuzzingFunctions final
 {
 public:
   static void
--- a/dom/base/IntlUtils.cpp
+++ b/dom/base/IntlUtils.cpp
@@ -5,20 +5,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "IntlUtils.h"
 
 #include "mozilla/dom/ToJSValue.h"
 #include "mozIMozIntl.h"
 #include "nsContentUtils.h"
 
-#ifdef XP_WIN
-#undef GetLocaleInfo
-#endif
-
 namespace mozilla {
 namespace dom {
 
 NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(IntlUtils, mWindow)
 NS_IMPL_CYCLE_COLLECTING_ADDREF(IntlUtils)
 NS_IMPL_CYCLE_COLLECTING_RELEASE(IntlUtils)
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(IntlUtils)
   NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
--- a/dom/base/IntlUtils.h
+++ b/dom/base/IntlUtils.h
@@ -5,20 +5,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 #ifndef mozilla_dom_IntlUtils_h
 #define mozilla_dom_IntlUtils_h
 
 #include "mozilla/dom/IntlUtilsBinding.h"
 #include "nsWrapperCache.h"
 #include "xpcprivate.h"
 
-#ifdef XP_WIN
-#undef GetLocaleInfo
-#endif
-
 class nsPIDOMWindowInner;
 
 namespace mozilla {
 namespace dom {
 
 class IntlUtils final : public nsISupports
                       , public nsWrapperCache
 {
--- a/dom/base/moz.build
+++ b/dom/base/moz.build
@@ -166,17 +166,16 @@ EXPORTS.mozilla.dom += [
     'DOMCursor.h',
     'DOMError.h',
     'DOMException.h',
     'DOMImplementation.h',
     'DOMIntersectionObserver.h',
     'DOMMatrix.h',
     'DOMParser.h',
     'DOMPoint.h',
-    'DOMPreferences.h',
     'DOMQuad.h',
     'DOMRect.h',
     'DOMRequest.h',
     'DOMStringList.h',
     'DOMTokenListSupportedTokens.h',
     'Element.h',
     'ElementInlines.h',
     'EventSource.h',
@@ -244,17 +243,16 @@ UNIFIED_SOURCES += [
     'DocumentType.cpp',
     'DOMCursor.cpp',
     'DOMError.cpp',
     'DOMException.cpp',
     'DOMImplementation.cpp',
     'DOMMatrix.cpp',
     'DOMParser.cpp',
     'DOMPoint.cpp',
-    'DOMPreferences.cpp',
     'DOMQuad.cpp',
     'DOMRect.cpp',
     'DOMRequest.cpp',
     'DOMStringList.cpp',
     'Element.cpp',
     'EventSource.cpp',
     'FormData.cpp',
     'FragmentOrElement.cpp',
--- a/dom/base/nsContentUtils.cpp
+++ b/dom/base/nsContentUtils.cpp
@@ -290,19 +290,21 @@ bool nsContentUtils::sInitialized = fals
 bool nsContentUtils::sIsFullScreenApiEnabled = false;
 bool nsContentUtils::sIsUnprefixedFullscreenApiEnabled = false;
 bool nsContentUtils::sTrustedFullScreenOnly = true;
 bool nsContentUtils::sIsCutCopyAllowed = true;
 bool nsContentUtils::sIsFrameTimingPrefEnabled = false;
 bool nsContentUtils::sIsPerformanceTimingEnabled = false;
 bool nsContentUtils::sIsResourceTimingEnabled = false;
 bool nsContentUtils::sIsPerformanceNavigationTimingEnabled = false;
+bool nsContentUtils::sIsUserTimingLoggingEnabled = false;
 bool nsContentUtils::sIsFormAutofillAutocompleteEnabled = false;
 bool nsContentUtils::sIsWebComponentsEnabled = false;
 bool nsContentUtils::sIsCustomElementsEnabled = false;
+bool nsContentUtils::sDevToolsEnabled = false;
 bool nsContentUtils::sSendPerformanceTimingNotifications = false;
 bool nsContentUtils::sUseActivityCursor = false;
 bool nsContentUtils::sAnimationsAPICoreEnabled = false;
 bool nsContentUtils::sAnimationsAPIElementAnimateEnabled = false;
 bool nsContentUtils::sAnimationsAPIPendingMemberEnabled = false;
 bool nsContentUtils::sGetBoxQuadsEnabled = false;
 bool nsContentUtils::sSkipCursorMoveForSameValueSet = false;
 bool nsContentUtils::sRequestIdleCallbackEnabled = false;
@@ -330,16 +332,20 @@ uint32_t nsContentUtils::sHandlingInputT
 uint32_t nsContentUtils::sCookiesLifetimePolicy = nsICookieService::ACCEPT_NORMALLY;
 uint32_t nsContentUtils::sCookiesBehavior = nsICookieService::BEHAVIOR_ACCEPT;
 
 nsHtml5StringParser* nsContentUtils::sHTMLFragmentParser = nullptr;
 nsIParser* nsContentUtils::sXMLFragmentParser = nullptr;
 nsIFragmentContentSink* nsContentUtils::sXMLFragmentSink = nullptr;
 bool nsContentUtils::sFragmentParsingActive = false;
 
+#if !(defined(DEBUG) || defined(MOZ_ENABLE_JS_DUMP))
+bool nsContentUtils::sDOMWindowDumpEnabled;
+#endif
+
 bool nsContentUtils::sDoNotTrackEnabled = false;
 
 mozilla::LazyLogModule nsContentUtils::sDOMDumpLog("Dump");
 
 PopupControlState nsContentUtils::sPopupControlState = openAbused;
 
 int32_t nsContentUtils::sInnerOrOuterWindowCount = 0;
 uint32_t nsContentUtils::sInnerOrOuterWindowSerialCounter = 0;
@@ -647,28 +653,34 @@ nsContentUtils::Init()
                                "dom.enable_performance", true);
 
   Preferences::AddBoolVarCache(&sIsResourceTimingEnabled,
                                "dom.enable_resource_timing", true);
 
   Preferences::AddBoolVarCache(&sIsPerformanceNavigationTimingEnabled,
                                "dom.enable_performance_navigation_timing", true);
 
+  Preferences::AddBoolVarCache(&sIsUserTimingLoggingEnabled,
+                               "dom.performance.enable_user_timing_logging", false);
+
   Preferences::AddBoolVarCache(&sIsFrameTimingPrefEnabled,
                                "dom.enable_frame_timing", false);
 
   Preferences::AddBoolVarCache(&sIsFormAutofillAutocompleteEnabled,
                                "dom.forms.autocomplete.formautofill", false);
 
   Preferences::AddBoolVarCache(&sIsWebComponentsEnabled,
                                "dom.webcomponents.enabled", false);
 
   Preferences::AddBoolVarCache(&sIsCustomElementsEnabled,
                                "dom.webcomponents.customelements.enabled", false);
 
+  Preferences::AddBoolVarCache(&sDevToolsEnabled,
+                               "devtools.enabled");
+
   Preferences::AddIntVarCache(&sPrivacyMaxInnerWidth,
                               "privacy.window.maxInnerWidth",
                               1000);
 
   Preferences::AddIntVarCache(&sPrivacyMaxInnerHeight,
                               "privacy.window.maxInnerHeight",
                               1000);
 
@@ -682,16 +694,21 @@ nsContentUtils::Init()
   Preferences::AddUintVarCache(&sCookiesLifetimePolicy,
                                "network.cookie.lifetimePolicy",
                                nsICookieService::ACCEPT_NORMALLY);
 
   Preferences::AddUintVarCache(&sCookiesBehavior,
                                "network.cookie.cookieBehavior",
                                nsICookieService::BEHAVIOR_ACCEPT);
 
+#if !(defined(DEBUG) || defined(MOZ_ENABLE_JS_DUMP))
+  Preferences::AddBoolVarCache(&sDOMWindowDumpEnabled,
+                               "browser.dom.window.dump.enabled");
+#endif
+
   Preferences::AddBoolVarCache(&sDoNotTrackEnabled,
                                "privacy.donottrackheader.enabled", false);
 
   Preferences::AddBoolVarCache(&sUseActivityCursor,
                                "ui.use_activity_cursor", false);
 
   Preferences::AddBoolVarCache(&sAnimationsAPICoreEnabled,
                                "dom.animations-api.core.enabled", false);
@@ -2369,17 +2386,27 @@ nsContentUtils::IsCallerChrome()
   // If the check failed, look for UniversalXPConnect on the cx compartment.
   return xpc::IsUniversalXPConnectEnabled(GetCurrentJSContext());
 }
 
 /* static */
 bool
 nsContentUtils::ShouldResistFingerprinting()
 {
-  return DOMPreferences::ResistFingerprintingEnabled();
+  if (NS_IsMainThread()) {
+    return nsRFPService::IsResistFingerprintingEnabled();
+  }
+
+  workers::WorkerPrivate* workerPrivate = workers::GetCurrentThreadWorkerPrivate();
+  if (NS_WARN_IF(!workerPrivate)) {
+    return false;
+  }
+  workerPrivate->AssertIsOnWorkerThread();
+
+  return workerPrivate->ResistFingerprintingEnabled();
 }
 
 bool
 nsContentUtils::ShouldResistFingerprinting(nsIDocShell* aDocShell)
 {
   if (!aDocShell) {
     return false;
   }
@@ -7580,16 +7607,29 @@ nsContentUtils::IsAllowedNonCorsContentT
   }
 
   return contentType.LowerCaseEqualsLiteral("text/plain") ||
          contentType.LowerCaseEqualsLiteral("application/x-www-form-urlencoded") ||
          contentType.LowerCaseEqualsLiteral("multipart/form-data");
 }
 
 bool
+nsContentUtils::DOMWindowDumpEnabled()
+{
+#if !(defined(DEBUG) || defined(MOZ_ENABLE_JS_DUMP))
+  // In optimized builds we check a pref that controls if we should
+  // enable output from dump() or not, in debug builds it's always
+  // enabled.
+  return nsContentUtils::sDOMWindowDumpEnabled;
+#else
+  return true;
+#endif
+}
+
+bool
 nsContentUtils::DoNotTrackEnabled()
 {
   return nsContentUtils::sDoNotTrackEnabled;
 }
 
 mozilla::LogModule*
 nsContentUtils::DOMDumpLog()
 {
@@ -8893,16 +8933,73 @@ nsContentUtils::GetReferrerPolicyFromHea
       referrerPolicy = policy;
     }
   }
   return referrerPolicy;
 }
 
 // static
 bool
+nsContentUtils::PromiseRejectionEventsEnabled(JSContext* aCx, JSObject* aObj)
+{
+  if (NS_IsMainThread()) {
+    return Preferences::GetBool("dom.promise_rejection_events.enabled", false);
+  }
+
+  using namespace workers;
+
+  // Otherwise, check the pref via the WorkerPrivate
+  WorkerPrivate* workerPrivate = GetWorkerPrivateFromContext(aCx);
+  if (!workerPrivate) {
+    return false;
+  }
+
+  return workerPrivate->PromiseRejectionEventsEnabled();
+}
+
+// static
+bool
+nsContentUtils::PushEnabled(JSContext* aCx, JSObject* aObj)
+{
+  if (NS_IsMainThread()) {
+    return Preferences::GetBool("dom.push.enabled", false);
+  }
+
+  using namespace workers;
+
+  // Otherwise, check the pref via the WorkerPrivate
+  WorkerPrivate* workerPrivate = GetWorkerPrivateFromContext(aCx);
+  if (!workerPrivate) {
+    return false;
+  }
+
+  return workerPrivate->PushEnabled();
+}
+
+// static
+bool
+nsContentUtils::StreamsEnabled(JSContext* aCx, JSObject* aObj)
+{
+  if (NS_IsMainThread()) {
+    return Preferences::GetBool("dom.streams.enabled", false);
+  }
+
+  using namespace workers;
+
+  // Otherwise, check the pref via the WorkerPrivate
+  WorkerPrivate* workerPrivate = GetWorkerPrivateFromContext(aCx);
+  if (!workerPrivate) {
+    return false;
+  }
+
+  return workerPrivate->StreamsEnabled();
+}
+
+// static
+bool
 nsContentUtils::IsNonSubresourceRequest(nsIChannel* aChannel)
 {
   nsLoadFlags loadFlags = 0;
   aChannel->GetLoadFlags(&loadFlags);
   if (loadFlags & nsIChannel::LOAD_DOCUMENT_URI) {
     return true;
   }
 
@@ -11019,16 +11116,31 @@ nsContentUtils::ExtractErrorValues(JSCon
       JS_ClearPendingException(aCx);
     }
   }
 }
 
 #undef EXTRACT_EXN_VALUES
 
 /* static */ bool
+nsContentUtils::DevToolsEnabled(JSContext* aCx)
+{
+  if (NS_IsMainThread()) {
+    return sDevToolsEnabled;
+  }
+
+  workers::WorkerPrivate* workerPrivate = workers::GetWorkerPrivateFromContext(aCx);
+  if (!workerPrivate) {
+    return false;
+  }
+
+  return workerPrivate->DevToolsEnabled();
+}
+
+/* static */ bool
 nsContentUtils::ContentIsLink(nsIContent* aContent)
 {
   return aContent && (aContent->IsHTMLElement(nsGkAtoms::a) ||
                       aContent->AttrValueIs(kNameSpaceID_XLink, nsGkAtoms::type,
                                             nsGkAtoms::simple, eCaseMatters));
 }
 
 /* static */ already_AddRefed<EventTarget>
--- a/dom/base/nsContentUtils.h
+++ b/dom/base/nsContentUtils.h
@@ -2272,16 +2272,24 @@ public:
    * Returns true if the performance timing APIs are enabled.
    */
   static bool IsPerformanceTimingEnabled()
   {
     return sIsPerformanceTimingEnabled;
   }
 
   /*
+   * Returns true if user timing API should print to console.
+   */
+  static bool IsUserTimingLoggingEnabled()
+  {
+    return sIsUserTimingLoggingEnabled;
+  }
+
+  /*
    * Returns true if the performance timing APIs are enabled.
    */
   static bool IsResourceTimingEnabled()
   {
     return sIsResourceTimingEnabled;
   }
 
   /*
@@ -2678,16 +2686,21 @@ public:
    * Returns pointer to HTML editor instance for the aPresContext when there is.
    * The HTML editor is shared by contenteditable elements or used in
    * designMode.  When there are no contenteditable elements and the document
    * is not in designMode, this returns nullptr.
    */
   static mozilla::HTMLEditor* GetHTMLEditor(nsPresContext* aPresContext);
 
   /**
+   * Returns true if the browser.dom.window.dump.enabled pref is set.
+   */
+  static bool DOMWindowDumpEnabled();
+
+  /**
    * Returns true if the privacy.donottrackheader.enabled pref is set.
    */
   static bool DoNotTrackEnabled();
 
   /**
    * Returns a LogModule that dump calls from content script are logged to.
    * This can be enabled with the 'Dump' module, and is useful for synchronizing
    * content JS to other logging modules.
@@ -2913,16 +2926,22 @@ public:
    * Parse a referrer policy from a Referrer-Policy header
    * https://www.w3.org/TR/referrer-policy/#parse-referrer-policy-from-header
    *
    * @param aHeader the response's Referrer-Policy header to parse
    * @return referrer policy from the response header.
    */
   static mozilla::net::ReferrerPolicy GetReferrerPolicyFromHeader(const nsAString& aHeader);
 
+  static bool PromiseRejectionEventsEnabled(JSContext* aCx, JSObject* aObj);
+
+  static bool PushEnabled(JSContext* aCx, JSObject* aObj);
+
+  static bool StreamsEnabled(JSContext* aCx, JSObject* aObj);
+
   static bool IsNonSubresourceRequest(nsIChannel* aChannel);
 
   static uint32_t CookiesBehavior()
   {
     return sCookiesBehavior;
   }
 
   // The order of these entries matters, as we use std::min for total ordering
@@ -3396,20 +3415,22 @@ private:
   static bool sIsFullScreenApiEnabled;
   static bool sIsUnprefixedFullscreenApiEnabled;
   static bool sTrustedFullScreenOnly;
   static bool sIsCutCopyAllowed;
   static uint32_t sHandlingInputTimeout;
   static bool sIsPerformanceTimingEnabled;
   static bool sIsResourceTimingEnabled;
   static bool sIsPerformanceNavigationTimingEnabled;
+  static bool sIsUserTimingLoggingEnabled;
   static bool sIsFrameTimingPrefEnabled;
   static bool sIsFormAutofillAutocompleteEnabled;
   static bool sIsWebComponentsEnabled;
   static bool sIsCustomElementsEnabled;
+  static bool sDevToolsEnabled;
   static bool sSendPerformanceTimingNotifications;
   static bool sUseActivityCursor;
   static bool sAnimationsAPICoreEnabled;
   static bool sAnimationsAPIElementAnimateEnabled;
   static bool sAnimationsAPIPendingMemberEnabled;
   static bool sGetBoxQuadsEnabled;
   static bool sSkipCursorMoveForSameValueSet;
   static bool sRequestIdleCallbackEnabled;
@@ -3448,16 +3469,19 @@ private:
   static nsString* sOSText;
   static nsString* sAltText;
   static nsString* sModifierSeparator;
 
   // Alternate data mime type, used by the ScriptLoader to register and read the
   // bytecode out of the nsCacheInfoChannel.
   static nsCString* sJSBytecodeMimeType;
 
+#if !(defined(DEBUG) || defined(MOZ_ENABLE_JS_DUMP))
+  static bool sDOMWindowDumpEnabled;
+#endif
   static bool sDoNotTrackEnabled;
   static mozilla::LazyLogModule sDOMDumpLog;
 
   static PopupControlState sPopupControlState;
 
   static int32_t sInnerOrOuterWindowCount;
   static uint32_t sInnerOrOuterWindowSerialCounter;
 };
--- a/dom/base/nsFrameMessageManager.cpp
+++ b/dom/base/nsFrameMessageManager.cpp
@@ -31,17 +31,16 @@
 #include "nsIScriptSecurityManager.h"
 #include "nsIDOMClassInfo.h"
 #include "xpcpublic.h"
 #include "mozilla/CycleCollectedJSContext.h"
 #include "mozilla/IntentionalCrash.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/ScriptPreloader.h"
 #include "mozilla/Telemetry.h"
-#include "mozilla/dom/DOMPreferences.h"
 #include "mozilla/dom/File.h"
 #include "mozilla/dom/MessagePort.h"
 #include "mozilla/dom/ContentParent.h"
 #include "mozilla/dom/PermissionMessageUtils.h"
 #include "mozilla/dom/ProcessGlobal.h"
 #include "mozilla/dom/SameProcessMessageQueue.h"
 #include "mozilla/dom/ScriptSettings.h"
 #include "mozilla/dom/ipc/StructuredCloneData.h"
@@ -801,17 +800,17 @@ nsFrameMessageManager::ReleaseCachedProc
   return NS_OK;
 }
 
 // nsIContentFrameMessageManager
 
 NS_IMETHODIMP
 nsFrameMessageManager::Dump(const nsAString& aStr)
 {
-  if (!DOMPreferences::DumpEnabled()) {
+  if (!nsContentUtils::DOMWindowDumpEnabled()) {
     return NS_OK;
   }
 
 #ifdef ANDROID
   __android_log_print(ANDROID_LOG_INFO, "Gecko", "%s", NS_ConvertUTF16toUTF8(aStr).get());
 #endif
 #ifdef XP_WIN
   if (IsDebuggerPresent()) {
--- a/dom/base/nsGlobalWindowInner.cpp
+++ b/dom/base/nsGlobalWindowInner.cpp
@@ -12,17 +12,16 @@
 
 // Local Includes
 #include "Navigator.h"
 #include "nsContentSecurityManager.h"
 #include "nsScreen.h"
 #include "nsHistory.h"
 #include "nsDOMNavigationTiming.h"
 #include "nsIDOMStorageManager.h"
-#include "mozilla/dom/DOMPreferences.h"
 #include "mozilla/dom/LocalStorage.h"
 #include "mozilla/dom/Storage.h"
 #include "mozilla/dom/IdleRequest.h"
 #include "mozilla/dom/Performance.h"
 #include "mozilla/dom/StorageEvent.h"
 #include "mozilla/dom/StorageEventBinding.h"
 #include "mozilla/dom/StorageNotifierService.h"
 #include "mozilla/dom/StorageUtils.h"
@@ -3378,17 +3377,17 @@ nsGlobalWindowInner::GetFullScreen()
   bool fullscreen = GetFullScreen(dummy);
   dummy.SuppressException();
   return fullscreen;
 }
 
 void
 nsGlobalWindowInner::Dump(const nsAString& aStr)
 {
-  if (!DOMPreferences::DumpEnabled()) {
+  if (!nsContentUtils::DOMWindowDumpEnabled()) {
     return;
   }
 
   char *cstr = ToNewUTF8String(aStr);
 
 #if defined(XP_MACOSX)
   // have to convert \r to \n so that printing to the console works
   char *c = cstr, *cEnd = cstr + strlen(cstr);
@@ -7581,17 +7580,17 @@ nsGlobalWindowInner::CreateImageBitmap(J
 already_AddRefed<mozilla::dom::Promise>
 nsGlobalWindowInner::CreateImageBitmap(JSContext* aCx,
                                        const ImageBitmapSource& aImage,
                                        int32_t aOffset, int32_t aLength,
                                        ImageBitmapFormat aFormat,
                                        const Sequence<ChannelPixelLayout>& aLayout,
                                        ErrorResult& aRv)
 {
-  if (!DOMPreferences::ImageBitmapExtensionsEnabled()) {
+  if (!ImageBitmap::ExtensionsEnabled(aCx)) {
     aRv.Throw(NS_ERROR_TYPE_ERR);
     return nullptr;
   }
   if (aImage.IsArrayBuffer() || aImage.IsArrayBufferView()) {
     return ImageBitmap::Create(this, aImage, aOffset, aLength, aFormat, aLayout,
                                aRv);
   }
   aRv.Throw(NS_ERROR_TYPE_ERR);
--- a/dom/base/nsGlobalWindowInner.h
+++ b/dom/base/nsGlobalWindowInner.h
@@ -32,17 +32,16 @@
 #include "nsIScriptObjectPrincipal.h"
 #include "nsITimer.h"
 #include "nsIDOMModalContentWindow.h"
 #include "mozilla/EventListenerManager.h"
 #include "nsIPrincipal.h"
 #include "nsSize.h"
 #include "mozilla/FlushType.h"
 #include "prclist.h"
-#include "mozilla/dom/DOMPreferences.h"
 #include "mozilla/dom/BindingDeclarations.h"
 #include "mozilla/dom/StorageEvent.h"
 #include "mozilla/dom/StorageEventBinding.h"
 #include "mozilla/dom/UnionTypes.h"
 #include "mozilla/ErrorResult.h"
 #include "nsFrameMessageManager.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/GuardObjects.h"
--- a/dom/cache/Cache.cpp
+++ b/dom/cache/Cache.cpp
@@ -12,17 +12,16 @@
 #include "mozilla/dom/PromiseNativeHandler.h"
 #include "mozilla/dom/Response.h"
 #include "mozilla/dom/WorkerPrivate.h"
 #include "mozilla/dom/CacheBinding.h"
 #include "mozilla/dom/cache/AutoUtils.h"
 #include "mozilla/dom/cache/CacheChild.h"
 #include "mozilla/dom/cache/CacheWorkerHolder.h"
 #include "mozilla/dom/cache/ReadStream.h"
-#include "mozilla/dom/DOMPreferences.h"
 #include "mozilla/ErrorResult.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/Unused.h"
 #include "nsIGlobalObject.h"
 
 namespace mozilla {
 namespace dom {
 namespace cache {
@@ -513,16 +512,39 @@ Cache::Keys(JSContext* aCx, const Option
     if (NS_WARN_IF(aRv.Failed())) {
       return nullptr;
     }
   }
 
   return ExecuteOp(args, aRv);
 }
 
+// static
+bool
+Cache::PrefEnabled(JSContext* aCx, JSObject* aObj)
+{
+  using mozilla::dom::workers::WorkerPrivate;
+  using mozilla::dom::workers::GetWorkerPrivateFromContext;
+
+  // If we're on the main thread, then check the pref directly.
+  if (NS_IsMainThread()) {
+    bool enabled = false;
+    Preferences::GetBool("dom.caches.enabled", &enabled);
+    return enabled;
+  }
+
+  // Otherwise check the pref via the work private helper
+  WorkerPrivate* workerPrivate = GetWorkerPrivateFromContext(aCx);
+  if (!workerPrivate) {
+    return false;
+  }
+
+  return workerPrivate->DOMCachesEnabled();
+}
+
 nsISupports*
 Cache::GetParentObject() const
 {
   return mGlobal;
 }
 
 JSObject*
 Cache::WrapObject(JSContext* aContext, JS::Handle<JSObject*> aGivenProto)
--- a/dom/cache/Cache.h
+++ b/dom/cache/Cache.h
@@ -63,16 +63,18 @@ public:
   already_AddRefed<Promise>
   Delete(JSContext* aCx, const RequestOrUSVString& aRequest,
          const CacheQueryOptions& aOptions, ErrorResult& aRv);
   already_AddRefed<Promise>
   Keys(JSContext* aCx, const Optional<RequestOrUSVString>& aRequest,
        const CacheQueryOptions& aParams, ErrorResult& aRv);
 
   // binding methods
+  static bool PrefEnabled(JSContext* aCx, JSObject* aObj);
+
   nsISupports* GetParentObject() const;
   virtual JSObject* WrapObject(JSContext* aContext, JS::Handle<JSObject*> aGivenProto) override;
 
   // Called when CacheChild actor is being destroyed
   void DestroyInternal(CacheChild* aActor);
 
   // TypeUtils methods
   virtual nsIGlobalObject*
--- a/dom/cache/CacheStorage.cpp
+++ b/dom/cache/CacheStorage.cpp
@@ -4,17 +4,16 @@
  * 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/cache/CacheStorage.h"
 
 #include "mozilla/Unused.h"
 #include "mozilla/dom/CacheBinding.h"
 #include "mozilla/dom/CacheStorageBinding.h"
-#include "mozilla/dom/DOMPreferences.h"
 #include "mozilla/dom/InternalRequest.h"
 #include "mozilla/dom/Promise.h"
 #include "mozilla/dom/Response.h"
 #include "mozilla/dom/cache/AutoUtils.h"
 #include "mozilla/dom/cache/Cache.h"
 #include "mozilla/dom/cache/CacheChild.h"
 #include "mozilla/dom/cache/CacheStorageChild.h"
 #include "mozilla/dom/cache/CacheWorkerHolder.h"
@@ -157,17 +156,17 @@ CacheStorage::CreateOnMainThread(Namespa
   nsresult rv = PrincipalToPrincipalInfo(aPrincipal, &principalInfo);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     aRv.Throw(rv);
     return nullptr;
   }
 
   bool testingEnabled = aForceTrustedOrigin ||
     Preferences::GetBool("dom.caches.testing.enabled", false) ||
-    DOMPreferences::ServiceWorkersTestingEnabled();
+    Preferences::GetBool("dom.serviceWorkers.testing.enabled", false);
 
   if (!IsTrusted(principalInfo, testingEnabled)) {
     NS_WARNING("CacheStorage not supported on untrusted origins.");
     RefPtr<CacheStorage> ref = new CacheStorage(NS_ERROR_DOM_SECURITY_ERR);
     return ref.forget();
   }
 
   RefPtr<CacheStorage> ref = new CacheStorage(aNamespace, aGlobal,
@@ -215,18 +214,18 @@ CacheStorage::CreateOnWorker(Namespace a
   //    is mainly because most sites using SWs will expect Cache to work if
   //    SWs are enabled.
   // 3) If the window that created this worker has the devtools SW testing
   //    option enabled.  Same reasoning as (2).
   // 4) If the worker itself is a ServiceWorker, then we always skip the
   //    origin checks.  The ServiceWorker has its own trusted origin checks
   //    that are better than ours.  In addition, we don't have information
   //    about the window any more, so we can't do our own checks.
-  bool testingEnabled = DOMPreferences::DOMCachesTestingEnabled() ||
-                        DOMPreferences::ServiceWorkersTestingEnabled() ||
+  bool testingEnabled = aWorkerPrivate->DOMCachesTestingEnabled() ||
+                        aWorkerPrivate->ServiceWorkersTestingEnabled() ||
                         aWorkerPrivate->ServiceWorkersTestingInWindow() ||
                         aWorkerPrivate->IsServiceWorker();
 
   if (!IsTrusted(principalInfo, testingEnabled)) {
     NS_WARNING("CacheStorage not supported on untrusted origins.");
     RefPtr<CacheStorage> ref = new CacheStorage(NS_ERROR_DOM_SECURITY_ERR);
     return ref.forget();
   }
@@ -441,16 +440,23 @@ CacheStorage::Keys(ErrorResult& aRv)
   entry->mArgs = StorageKeysArgs();
 
   RunRequest(Move(entry));
 
   return promise.forget();
 }
 
 // static
+bool
+CacheStorage::PrefEnabled(JSContext* aCx, JSObject* aObj)
+{
+  return Cache::PrefEnabled(aCx, aObj);
+}
+
+// static
 already_AddRefed<CacheStorage>
 CacheStorage::Constructor(const GlobalObject& aGlobal,
                           CacheStorageNamespace aNamespace,
                           nsIPrincipal* aPrincipal, ErrorResult& aRv)
 {
   if (NS_WARN_IF(!NS_IsMainThread())) {
     aRv.Throw(NS_ERROR_FAILURE);
     return nullptr;
--- a/dom/cache/CacheStorage.h
+++ b/dom/cache/CacheStorage.h
@@ -68,16 +68,18 @@ public:
   already_AddRefed<Promise> Keys(ErrorResult& aRv);
 
   // chrome-only webidl interface methods
   static already_AddRefed<CacheStorage>
   Constructor(const GlobalObject& aGlobal, CacheStorageNamespace aNamespace,
               nsIPrincipal* aPrincipal, ErrorResult& aRv);
 
   // binding methods
+  static bool PrefEnabled(JSContext* aCx, JSObject* aObj);
+
   nsISupports* GetParentObject() const;
   virtual JSObject* WrapObject(JSContext* aContext, JS::Handle<JSObject*> aGivenProto) override;
 
   // Called when CacheStorageChild actor is being destroyed
   void DestroyInternal(CacheStorageChild* aActor);
 
   // TypeUtils methods
   virtual nsIGlobalObject* GetGlobalObject() const override;
--- a/dom/canvas/ImageBitmap.cpp
+++ b/dom/canvas/ImageBitmap.cpp
@@ -1,17 +1,16 @@
 /* -*- 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 "mozilla/dom/ImageBitmap.h"
 #include "mozilla/CheckedInt.h"
-#include "mozilla/dom/DOMPreferences.h"
 #include "mozilla/dom/ImageBitmapBinding.h"
 #include "mozilla/dom/Promise.h"
 #include "mozilla/dom/StructuredCloneTags.h"
 #include "mozilla/dom/WorkerPrivate.h"
 #include "mozilla/dom/WorkerRunnable.h"
 #include "mozilla/gfx/2D.h"
 #include "mozilla/gfx/Swizzle.h"
 #include "mozilla/Mutex.h"
@@ -1430,16 +1429,28 @@ ImageBitmap::WriteStructuredClone(JSStru
                                                  true);
   }
   MOZ_ASSERT(dstDataSurface);
   Factory::CopyDataSourceSurface(snapshot, dstDataSurface);
   aClonedSurfaces.AppendElement(dstDataSurface);
   return true;
 }
 
+/*static*/ bool
+ImageBitmap::ExtensionsEnabled(JSContext* aCx, JSObject*)
+{
+  if (NS_IsMainThread()) {
+    return Preferences::GetBool("canvas.imagebitmap_extensions.enabled");
+  } else {
+    WorkerPrivate* workerPrivate = GetWorkerPrivateFromContext(aCx);
+    MOZ_ASSERT(workerPrivate);
+    return workerPrivate->ImageBitmapExtensionsEnabled();
+  }
+}
+
 // ImageBitmap extensions.
 ImageBitmapFormat
 ImageBitmap::FindOptimalFormat(const Optional<Sequence<ImageBitmapFormat>>& aPossibleFormats,
                                ErrorResult& aRv)
 {
   MOZ_ASSERT(mDataWrapper, "No ImageBitmapFormatUtils functionalities.");
 
   ImageBitmapFormat platformFormat = mDataWrapper->GetFormat();
--- a/dom/canvas/ImageBitmap.h
+++ b/dom/canvas/ImageBitmap.h
@@ -147,16 +147,22 @@ public:
                       const nsTArray<RefPtr<gfx::DataSourceSurface>>& aClonedSurfaces,
                       uint32_t aIndex);
 
   static bool
   WriteStructuredClone(JSStructuredCloneWriter* aWriter,
                        nsTArray<RefPtr<gfx::DataSourceSurface>>& aClonedSurfaces,
                        ImageBitmap* aImageBitmap);
 
+  // Mozilla Extensions
+  // aObj is an optional argument that isn't used by ExtensionsEnabled() and
+  // only exists because the bindings layer insists on passing it to us.  All
+  // other consumers of this function should only call it passing one argument.
+  static bool ExtensionsEnabled(JSContext* aCx, JSObject* aObj = nullptr);
+
   friend CreateImageBitmapFromBlob;
   friend CreateImageBitmapFromBlobTask;
   friend CreateImageBitmapFromBlobWorkerTask;
 
   template<typename T>
   friend class MapDataIntoBufferSource;
 
   // Mozilla Extensions
--- a/dom/canvas/OffscreenCanvas.cpp
+++ b/dom/canvas/OffscreenCanvas.cpp
@@ -1,17 +1,16 @@
 /* -*- 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 "OffscreenCanvas.h"
 
-#include "mozilla/dom/DOMPreferences.h"
 #include "mozilla/dom/OffscreenCanvasBinding.h"
 #include "mozilla/dom/WorkerPrivate.h"
 #include "mozilla/dom/WorkerScope.h"
 #include "mozilla/layers/AsyncCanvasRenderer.h"
 #include "mozilla/layers/CanvasClient.h"
 #include "mozilla/layers/ImageBridgeChild.h"
 #include "mozilla/Telemetry.h"
 #include "CanvasRenderingContext2D.h"
@@ -329,23 +328,35 @@ OffscreenCanvas::CreateFromCloneData(nsI
                         aData->mCompositorBackendType, aData->mRenderer);
   if (aData->mNeutered) {
     wc->SetNeutered();
   }
   return wc.forget();
 }
 
 /* static */ bool
+OffscreenCanvas::PrefEnabled(JSContext* aCx, JSObject* aObj)
+{
+  if (NS_IsMainThread()) {
+    return Preferences::GetBool("gfx.offscreencanvas.enabled");
+  } else {
+    WorkerPrivate* workerPrivate = GetWorkerPrivateFromContext(aCx);
+    MOZ_ASSERT(workerPrivate);
+    return workerPrivate->OffscreenCanvasEnabled();
+  }
+}
+
+/* static */ bool
 OffscreenCanvas::PrefEnabledOnWorkerThread(JSContext* aCx, JSObject* aObj)
 {
   if (NS_IsMainThread()) {
     return true;
   }
 
-  return DOMPreferences::OffscreenCanvasEnabled(aCx, aObj);
+  return PrefEnabled(aCx, aObj);
 }
 
 NS_IMPL_CYCLE_COLLECTION_INHERITED(OffscreenCanvas, DOMEventTargetHelper, mCurrentContext)
 
 NS_IMPL_ADDREF_INHERITED(OffscreenCanvas, DOMEventTargetHelper)
 NS_IMPL_RELEASE_INHERITED(OffscreenCanvas, DOMEventTargetHelper)
 
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(OffscreenCanvas)
--- a/dom/canvas/OffscreenCanvas.h
+++ b/dom/canvas/OffscreenCanvas.h
@@ -4,17 +4,16 @@
  * 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_OFFSCREENCANVAS_H_
 #define MOZILLA_DOM_OFFSCREENCANVAS_H_
 
 #include "gfxTypes.h"
 #include "mozilla/DOMEventTargetHelper.h"
-#include "mozilla/dom/DOMPreferences.h"
 #include "mozilla/layers/LayersTypes.h"
 #include "mozilla/RefPtr.h"
 #include "CanvasRenderingContextHelper.h"
 #include "nsCycleCollectionParticipant.h"
 
 struct JSContext;
 
 namespace mozilla {
@@ -126,16 +125,18 @@ public:
     return mCurrentContext;
   }
 
   already_AddRefed<gfx::SourceSurface> GetSurfaceSnapshot(gfxAlphaType* aOutAlphaType = nullptr);
 
   static already_AddRefed<OffscreenCanvas>
   CreateFromCloneData(nsIGlobalObject* aGlobal, OffscreenCanvasCloneData* aData);
 
+  static bool PrefEnabled(JSContext* aCx, JSObject* aObj);
+
   // Return true on main-thread, and return gfx.offscreencanvas.enabled
   // on worker thread.
   static bool PrefEnabledOnWorkerThread(JSContext* aCx, JSObject* aObj);
 
   OffscreenCanvasCloneData* ToCloneData();
 
   void CommitFrameToCompositor();
 
--- a/dom/console/Console.cpp
+++ b/dom/console/Console.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 "mozilla/dom/Console.h"
 #include "mozilla/dom/ConsoleBinding.h"
 
 #include "mozilla/dom/BlobBinding.h"
-#include "mozilla/dom/DOMPreferences.h"
 #include "mozilla/dom/Exceptions.h"
 #include "mozilla/dom/File.h"
 #include "mozilla/dom/FunctionBinding.h"
 #include "mozilla/dom/Performance.h"
 #include "mozilla/dom/ScriptSettings.h"
 #include "mozilla/dom/StructuredCloneHolder.h"
 #include "mozilla/dom/ToJSValue.h"
 #include "mozilla/dom/WorkletGlobalScope.h"
@@ -1050,17 +1049,17 @@ Console::ProfileMethod(const GlobalObjec
   console->ProfileMethodInternal(cx, aAction, aData);
 }
 
 void
 Console::ProfileMethodInternal(JSContext* aCx, const nsAString& aAction,
                                const Sequence<JS::Value>& aData)
 {
   // Make all Console API no-op if DevTools aren't enabled.
-  if (!DOMPreferences::DevToolsEnabled()) {
+  if (!nsContentUtils::DevToolsEnabled(aCx)) {
     return;
   }
 
   if (!NS_IsMainThread()) {
     // Here we are in a worker thread.
     RefPtr<ConsoleProfileRunnable> runnable =
       new ConsoleProfileRunnable(this, aAction, aData);
 
@@ -1203,17 +1202,17 @@ Console::Method(const GlobalObject& aGlo
 }
 
 void
 Console::MethodInternal(JSContext* aCx, MethodName aMethodName,
                         const nsAString& aMethodString,
                         const Sequence<JS::Value>& aData)
 {
   // Make all Console API no-op if DevTools aren't enabled.
-  if (!DOMPreferences::DevToolsEnabled()) {
+  if (!nsContentUtils::DevToolsEnabled(aCx)) {
     return;
   }
   AssertIsOnOwningThread();
 
   RefPtr<ConsoleCallData> callData(new ConsoleCallData());
 
   ClearException ce(aCx);
 
--- a/dom/fetch/FetchObserver.cpp
+++ b/dom/fetch/FetchObserver.cpp
@@ -21,16 +21,34 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_IN
 NS_IMPL_CYCLE_COLLECTION_UNLINK_END
 
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(FetchObserver)
 NS_INTERFACE_MAP_END_INHERITING(DOMEventTargetHelper)
 
 NS_IMPL_ADDREF_INHERITED(FetchObserver, DOMEventTargetHelper)
 NS_IMPL_RELEASE_INHERITED(FetchObserver, DOMEventTargetHelper)
 
+/* static */ bool
+FetchObserver::IsEnabled(JSContext* aCx, JSObject* aGlobal)
+{
+  if (NS_IsMainThread()) {
+    return Preferences::GetBool("dom.fetchObserver.enabled", false);
+  }
+
+  using namespace workers;
+
+  // Otherwise, check the pref via the WorkerPrivate
+  WorkerPrivate* workerPrivate = GetWorkerPrivateFromContext(aCx);
+  if (!workerPrivate) {
+    return false;
+  }
+
+  return workerPrivate->FetchObserverEnabled();
+}
+
 FetchObserver::FetchObserver(nsIGlobalObject* aGlobal,
                              AbortSignal* aSignal)
   : DOMEventTargetHelper(aGlobal)
   , mState(FetchState::Requesting)
 {
   if (aSignal) {
     Follow(aSignal);
   }
--- a/dom/fetch/FetchObserver.h
+++ b/dom/fetch/FetchObserver.h
@@ -16,16 +16,19 @@ namespace dom {
 
 class FetchObserver final : public DOMEventTargetHelper
                           , public AbortFollower
 {
 public:
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(FetchObserver, DOMEventTargetHelper)
 
+  static bool
+  IsEnabled(JSContext* aCx, JSObject* aGlobal);
+
   FetchObserver(nsIGlobalObject* aGlobal, AbortSignal* aSignal);
 
   JSObject*
   WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
 
   FetchState
   State() const;
 
--- a/dom/fetch/Request.cpp
+++ b/dom/fetch/Request.cpp
@@ -72,16 +72,35 @@ Request::Request(nsIGlobalObject* aOwner
     }
   }
 }
 
 Request::~Request()
 {
 }
 
+// static
+bool
+Request::RequestContextEnabled(JSContext* aCx, JSObject* aObj)
+{
+  if (NS_IsMainThread()) {
+    return Preferences::GetBool("dom.requestcontext.enabled", false);
+  }
+
+  using namespace workers;
+
+  // Otherwise, check the pref via the WorkerPrivate
+  WorkerPrivate* workerPrivate = GetWorkerPrivateFromContext(aCx);
+  if (!workerPrivate) {
+    return false;
+  }
+
+  return workerPrivate->RequestContextEnabled();
+}
+
 already_AddRefed<InternalRequest>
 Request::GetInternalRequest()
 {
   RefPtr<InternalRequest> r = mRequest;
   return r.forget();
 }
 
 namespace {
--- a/dom/fetch/Request.h
+++ b/dom/fetch/Request.h
@@ -30,16 +30,19 @@ class Request final : public nsISupports
 {
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(Request)
 
 public:
   Request(nsIGlobalObject* aOwner, InternalRequest* aRequest,
           AbortSignal* aSignal);
 
+  static bool
+  RequestContextEnabled(JSContext* aCx, JSObject* aObj);
+
   JSObject*
   WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override
   {
     return RequestBinding::Wrap(aCx, this, aGivenProto);
   }
 
   void
   GetUrl(nsAString& aUrl) const
--- a/dom/filesystem/Directory.cpp
+++ b/dom/filesystem/Directory.cpp
@@ -42,16 +42,34 @@ NS_IMPL_CYCLE_COLLECTION_TRACE_WRAPPERCA
 
 NS_IMPL_CYCLE_COLLECTING_ADDREF(Directory)
 NS_IMPL_CYCLE_COLLECTING_RELEASE(Directory)
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(Directory)
   NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
   NS_INTERFACE_MAP_ENTRY(nsISupports)
 NS_INTERFACE_MAP_END
 
+/* static */ bool
+Directory::WebkitBlinkDirectoryPickerEnabled(JSContext* aCx, JSObject* aObj)
+{
+  if (NS_IsMainThread()) {
+    return Preferences::GetBool("dom.webkitBlink.dirPicker.enabled", false);
+  }
+
+  // aCx can be null when this function is called by something else than WebIDL
+  // binding code.
+  workers::WorkerPrivate* workerPrivate =
+    workers::GetCurrentThreadWorkerPrivate();
+  if (!workerPrivate) {
+    return false;
+  }
+
+  return workerPrivate->WebkitBlinkDirectoryPickerEnabled();
+}
+
 /* static */ already_AddRefed<Directory>
 Directory::Constructor(const GlobalObject& aGlobal,
                        const nsAString& aRealPath,
                        ErrorResult& aRv)
 {
   nsCOMPtr<nsIFile> path;
   aRv = NS_NewLocalFile(aRealPath, true, getter_AddRefs(path));
   if (NS_WARN_IF(aRv.Failed())) {
--- a/dom/filesystem/Directory.h
+++ b/dom/filesystem/Directory.h
@@ -24,16 +24,19 @@ class StringOrFileOrDirectory;
 class Directory final
   : public nsISupports
   , public nsWrapperCache
 {
 public:
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(Directory)
 
+  static bool
+  WebkitBlinkDirectoryPickerEnabled(JSContext* aCx, JSObject* aObj);
+
   static already_AddRefed<Directory>
   Constructor(const GlobalObject& aGlobal,
               const nsAString& aRealPath,
               ErrorResult& aRv);
 
   static already_AddRefed<Directory>
   Create(nsISupports* aParent, nsIFile* aDirectory,
          FileSystemBase* aFileSystem = 0);
--- a/dom/html/HTMLFormSubmission.cpp
+++ b/dom/html/HTMLFormSubmission.cpp
@@ -31,17 +31,16 @@
 #include "nsIConsoleService.h"
 #include "nsIScriptError.h"
 #include "nsIStringBundle.h"
 #include "nsCExternalHandlerService.h"
 #include "nsIFileStreams.h"
 #include "nsContentUtils.h"
 
 #include "mozilla/dom/Directory.h"
-#include "mozilla/dom/DOMPreferences.h"
 #include "mozilla/dom/File.h"
 
 namespace mozilla {
 namespace dom {
 
 namespace {
 
 void
@@ -483,17 +482,17 @@ FSMultipartFormData::AddNameBlobOrNullPa
 
   if (aBlob) {
     nsAutoString filename16;
 
     RefPtr<File> file = aBlob->ToFile();
     if (file) {
       nsAutoString relativePath;
       file->GetRelativePath(relativePath);
-      if (DOMPreferences::WebkitBlinkDirectoryPickerEnabled() &&
+      if (Directory::WebkitBlinkDirectoryPickerEnabled(nullptr, nullptr) &&
           !relativePath.IsEmpty()) {
         filename16 = relativePath;
       }
 
       if (filename16.IsEmpty()) {
         RetrieveFileName(aBlob, filename16);
       }
     }
@@ -542,17 +541,17 @@ FSMultipartFormData::AddNameBlobOrNullPa
   AddDataChunk(nameStr, filename, contentType, fileStream, size);
   return NS_OK;
 }
 
 nsresult
 FSMultipartFormData::AddNameDirectoryPair(const nsAString& aName,
                                           Directory* aDirectory)
 {
-  if (!DOMPreferences::WebkitBlinkDirectoryPickerEnabled()) {
+  if (!Directory::WebkitBlinkDirectoryPickerEnabled(nullptr, nullptr)) {
     return NS_OK;
   }
 
   // Encode the control name
   nsAutoCString nameStr;
   nsresult rv = EncodeVal(aName, nameStr, true);
   NS_ENSURE_SUCCESS(rv, rv);
 
--- a/dom/html/HTMLInputElement.cpp
+++ b/dom/html/HTMLInputElement.cpp
@@ -6,17 +6,16 @@
 
 #include "mozilla/dom/HTMLInputElement.h"
 
 #include "mozilla/ArrayUtils.h"
 #include "mozilla/AsyncEventDispatcher.h"
 #include "mozilla/DebugOnly.h"
 #include "mozilla/dom/Date.h"
 #include "mozilla/dom/Directory.h"
-#include "mozilla/dom/DOMPreferences.h"
 #include "mozilla/dom/HTMLFormSubmission.h"
 #include "mozilla/dom/FileSystemUtils.h"
 #include "mozilla/dom/GetFilesHelper.h"
 #include "nsAttrValueInlines.h"
 #include "nsCRTGlue.h"
 
 #include "nsIDOMHTMLInputElement.h"
 #include "nsITextControlElement.h"
@@ -681,17 +680,17 @@ HTMLInputElement::nsFilePickerShownCallb
   // The text control frame (if there is one) isn't going to send a change
   // event because it will think this is done by a script.
   // So, we can safely send one by ourself.
   mInput->SetFilesOrDirectories(newFilesOrDirectories, true);
 
   RefPtr<DispatchChangeEventCallback> dispatchChangeEventCallback =
     new DispatchChangeEventCallback(mInput);
 
-  if (DOMPreferences::WebkitBlinkDirectoryPickerEnabled() &&
+  if (IsWebkitDirPickerEnabled() &&
       mInput->HasAttr(kNameSpaceID_None, nsGkAtoms::webkitdirectory)) {
     ErrorResult error;
     GetFilesHelper* helper = mInput->GetOrCreateGetFilesHelper(true, error);
     if (NS_WARN_IF(error.Failed())) {
       return error.StealNSResult();
     }
 
     helper->AddCallback(dispatchChangeEventCallback);
@@ -2742,17 +2741,17 @@ HTMLInputElement::GetDisplayFileName(nsA
     GetDOMFileOrDirectoryName(mFileData->mFilesOrDirectories[0], aValue);
     return;
   }
 
   nsAutoString value;
 
   if (mFileData->mFilesOrDirectories.IsEmpty()) {
     if ((IsDirPickerEnabled() && Allowdirs()) ||
-        (DOMPreferences::WebkitBlinkDirectoryPickerEnabled() &&
+        (IsWebkitDirPickerEnabled() &&
          HasAttr(kNameSpaceID_None, nsGkAtoms::webkitdirectory))) {
       nsContentUtils::GetLocalizedString(nsContentUtils::eFORMS_PROPERTIES,
                                          "NoDirSelected", value);
     } else if (HasAttr(kNameSpaceID_None, nsGkAtoms::multiple)) {
       nsContentUtils::GetLocalizedString(nsContentUtils::eFORMS_PROPERTIES,
                                          "NoFilesSelected", value);
     } else {
       nsContentUtils::GetLocalizedString(nsContentUtils::eFORMS_PROPERTIES,
@@ -2835,17 +2834,17 @@ HTMLInputElement::MozSetDndFilesAndDirec
 
   if (IsWebkitFileSystemEnabled()) {
     UpdateEntries(aFilesOrDirectories);
   }
 
   RefPtr<DispatchChangeEventCallback> dispatchChangeEventCallback =
     new DispatchChangeEventCallback(this);
 
-  if (DOMPreferences::WebkitBlinkDirectoryPickerEnabled() &&
+  if (IsWebkitDirPickerEnabled() &&
       HasAttr(kNameSpaceID_None, nsGkAtoms::webkitdirectory)) {
     ErrorResult rv;
     GetFilesHelper* helper = GetOrCreateGetFilesHelper(true /* recursionFlag */,
                                                        rv);
     if (NS_WARN_IF(rv.Failed())) {
       rv.SuppressException();
       return;
     }
@@ -2917,17 +2916,17 @@ HTMLInputElement::FireChangeEventIfNeede
 FileList*
 HTMLInputElement::GetFiles()
 {
   if (mType != NS_FORM_INPUT_FILE) {
     return nullptr;
   }
 
   if (IsDirPickerEnabled() && Allowdirs() &&
-      (!DOMPreferences::WebkitBlinkDirectoryPickerEnabled() ||
+      (!IsWebkitDirPickerEnabled() ||
        !HasAttr(kNameSpaceID_None, nsGkAtoms::webkitdirectory))) {
     return nullptr;
   }
 
   if (!mFileData->mFileList) {
     mFileData->mFileList = new FileList(static_cast<nsIContent*>(this));
     UpdateFileList();
   }
@@ -4168,17 +4167,17 @@ HTMLInputElement::MaybeInitPickers(Event
     // If the user clicked on the "Choose folder..." button we open the
     // directory picker, else we open the file picker.
     FilePickerType type = FILE_PICKER_FILE;
     nsCOMPtr<nsIContent> target =
       do_QueryInterface(aVisitor.mEvent->mOriginalTarget);
     if (target &&
         target->FindFirstNonChromeOnlyAccessContent() == this &&
         ((IsDirPickerEnabled() && Allowdirs()) ||
-         (DOMPreferences::WebkitBlinkDirectoryPickerEnabled() &&
+         (IsWebkitDirPickerEnabled() &&
           HasAttr(kNameSpaceID_None, nsGkAtoms::webkitdirectory)))) {
       type = FILE_PICKER_DIRECTORY;
     }
     return InitFilePicker(type);
   }
   if (mType == NS_FORM_INPUT_COLOR) {
     return InitColorPicker();
   }
@@ -5630,16 +5629,31 @@ HTMLInputElement::IsDateTimeTypeSupporte
           (IsInputDateTimeEnabled() || IsExperimentalFormsEnabled())) ||
          ((aDateTimeInputType == NS_FORM_INPUT_MONTH ||
            aDateTimeInputType == NS_FORM_INPUT_WEEK ||
            aDateTimeInputType == NS_FORM_INPUT_DATETIME_LOCAL) &&
           IsInputDateTimeOthersEnabled());
 }
 
 /* static */ bool
+HTMLInputElement::IsWebkitDirPickerEnabled()
+{
+  static bool sWebkitDirPickerEnabled = false;
+  static bool sWebkitDirPickerPrefCached = false;
+  if (!sWebkitDirPickerPrefCached) {
+    sWebkitDirPickerPrefCached = true;
+    Preferences::AddBoolVarCache(&sWebkitDirPickerEnabled,
+                                 "dom.webkitBlink.dirPicker.enabled",
+                                 false);
+  }
+
+  return sWebkitDirPickerEnabled;
+}
+
+/* static */ bool
 HTMLInputElement::IsWebkitFileSystemEnabled()
 {
   static bool sWebkitFileSystemEnabled = false;
   static bool sWebkitFileSystemPrefCached = false;
   if (!sWebkitFileSystemPrefCached) {
     sWebkitFileSystemPrefCached = true;
     Preferences::AddBoolVarCache(&sWebkitFileSystemEnabled,
                                  "dom.webkitBlink.filesystem.enabled",
--- a/dom/html/HTMLInputElement.h
+++ b/dom/html/HTMLInputElement.h
@@ -1723,16 +1723,23 @@ private:
   /**
    * Checks if aDateTimeInputType should be supported based on "dom.forms.datetime",
    * and "dom.experimental_forms".
    */
   static bool
   IsDateTimeTypeSupported(uint8_t aDateTimeInputType);
 
   /**
+   * Checks preference "dom.webkitBlink.dirPicker.enabled" to determine if
+   * webkitdirectory should be supported.
+   */
+  static bool
+  IsWebkitDirPickerEnabled();
+
+  /**
    * Checks preference "dom.webkitBlink.filesystem.enabled" to determine if
    * webkitEntries should be supported.
    */
   static bool
   IsWebkitFileSystemEnabled();
 
   /**
    * Checks preference "dom.input.dirpicker" to determine if file and directory
--- a/dom/html/ImageDocument.cpp
+++ b/dom/html/ImageDocument.cpp
@@ -1,16 +1,15 @@
 /* -*- 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 "ImageDocument.h"
-#include "mozilla/dom/DOMPreferences.h"
 #include "mozilla/dom/ImageDocumentBinding.h"
 #include "mozilla/dom/HTMLImageElement.h"
 #include "nsRect.h"
 #include "nsIImageLoadingContent.h"
 #include "nsGenericHTMLElement.h"
 #include "nsDocShell.h"
 #include "nsIDocumentInlines.h"
 #include "nsDOMTokenList.h"
@@ -45,17 +44,17 @@
 #include <algorithm>
 
 #define AUTOMATIC_IMAGE_RESIZING_PREF "browser.enable_automatic_image_resizing"
 #define CLICK_IMAGE_RESIZING_PREF "browser.enable_click_image_resizing"
 
 //XXX A hack needed for Firefox's site specific zoom.
 static bool IsSiteSpecific()
 {
-  return !mozilla::dom::DOMPreferences::ResistFingerprintingEnabled() &&
+  return !mozilla::Preferences::GetBool("privacy.resistFingerprinting", false) &&
          mozilla::Preferences::GetBool("browser.zoom.siteSpecific", false);
 }
 
 namespace mozilla {
 namespace dom {
 
 class ImageListener : public MediaDocumentStreamListener
 {
--- a/dom/ipc/TabContext.cpp
+++ b/dom/ipc/TabContext.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 "mozilla/dom/TabContext.h"
 #include "mozilla/dom/PTabContext.h"
 #include "mozilla/dom/TabParent.h"
 #include "mozilla/dom/TabChild.h"
-#include "mozilla/dom/DOMPreferences.h"
 #include "nsIScriptSecurityManager.h"
 #include "nsServiceManagerUtils.h"
 
 #define NO_APP_ID (nsIScriptSecurityManager::NO_APP_ID)
 
 using namespace mozilla::dom::ipc;
 using namespace mozilla::layout;
 
@@ -242,17 +241,17 @@ MaybeInvalidTabContext::MaybeInvalidTabC
       originAttributes = ipcContext.originAttributes();
       break;
     }
     case IPCTabContext::TUnsafeIPCTabContext: {
       // XXXcatalinb: This used *only* by ServiceWorkerClients::OpenWindow.
       // It is meant as a temporary solution until service workers can
       // provide a TabChild equivalent. Don't allow this on b2g since
       // it might be used to escalate privileges.
-      if (!DOMPreferences::ServiceWorkersEnabled()) {
+      if (!Preferences::GetBool("dom.serviceWorkers.enabled", false)) {
         mInvalidReason = "ServiceWorkers should be enabled.";
         return;
       }
 
       break;
     }
     default: {
       MOZ_CRASH();
--- a/dom/network/Connection.cpp
+++ b/dom/network/Connection.cpp
@@ -101,16 +101,28 @@ Connection::Update(ConnectionType aType,
   mDHCPGateway = aDHCPGateway;
 
   if (aNotify && previousType != aType &&
       !nsContentUtils::ShouldResistFingerprinting()) {
     DispatchTrustedEvent(CHANGE_EVENT_NAME);
   }
 }
 
+/* static */ bool
+Connection::IsEnabled(JSContext* aCx, JSObject* aObj)
+{
+  if (NS_IsMainThread()) {
+    return Preferences::GetBool("dom.netinfo.enabled");
+  }
+
+  WorkerPrivate* workerPrivate = GetWorkerPrivateFromContext(aCx);
+  MOZ_ASSERT(workerPrivate);
+  return workerPrivate->NetworkInformationEnabled();
+}
+
 /* static */ Connection*
 Connection::CreateForWindow(nsPIDOMWindowInner* aWindow)
 {
   MOZ_ASSERT(aWindow);
   return new ConnectionMainThread(aWindow);
 }
 
 /* static */ already_AddRefed<Connection>
--- a/dom/network/Connection.h
+++ b/dom/network/Connection.h
@@ -32,16 +32,18 @@ class Connection : public DOMEventTarget
 {
 public:
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_NSINETWORKPROPERTIES
   NS_DECL_OWNINGTHREAD
 
   NS_REALLY_FORWARD_NSIDOMEVENTTARGET(DOMEventTargetHelper)
 
+  static bool IsEnabled(JSContext* aCx, JSObject* aObj);
+
   static Connection*
   CreateForWindow(nsPIDOMWindowInner* aWindow);
 
   static already_AddRefed<Connection>
   CreateForWorker(workers::WorkerPrivate* aWorkerPrivate,
                   ErrorResult& aRv);
 
   void Shutdown();
--- a/dom/notification/Notification.cpp
+++ b/dom/notification/Notification.cpp
@@ -14,17 +14,16 @@
 #include "mozilla/Preferences.h"
 #include "mozilla/Services.h"
 #include "mozilla/Telemetry.h"
 #include "mozilla/Unused.h"
 
 #include "mozilla/dom/AppNotificationServiceOptionsBinding.h"
 #include "mozilla/dom/BindingUtils.h"
 #include "mozilla/dom/ContentChild.h"
-#include "mozilla/dom/DOMPreferences.h"
 #include "mozilla/dom/NotificationEvent.h"
 #include "mozilla/dom/PermissionMessageUtils.h"
 #include "mozilla/dom/Promise.h"
 #include "mozilla/dom/PromiseWorkerProxy.h"
 #include "mozilla/dom/ServiceWorkerGlobalScopeBinding.h"
 
 #include "nsAlertsUtils.h"
 #include "nsComponentManagerUtils.h"
@@ -889,32 +888,49 @@ NotificationTask::Run()
   } else {
     MOZ_CRASH("Invalid action");
   }
 
   MOZ_ASSERT(!mNotificationRef);
   return NS_OK;
 }
 
+bool
+Notification::RequireInteractionEnabled(JSContext* aCx, JSObject* aOjb)
+{
+  if (NS_IsMainThread()) {
+    return Preferences::GetBool("dom.webnotifications.requireinteraction.enabled", false);
+  }
+
+  WorkerPrivate* workerPrivate = GetWorkerPrivateFromContext(aCx);
+  if (!workerPrivate) {
+    return false;
+  }
+
+  return workerPrivate->DOMWorkerNotificationRIEnabled();
+}
+
 // static
 bool
 Notification::PrefEnabled(JSContext* aCx, JSObject* aObj)
 {
-  if (!NS_IsMainThread()) {
-    WorkerPrivate* workerPrivate = GetWorkerPrivateFromContext(aCx);
-    if (!workerPrivate) {
-      return false;
-    }
-
-    if (workerPrivate->IsServiceWorker()) {
-      return DOMPreferences::NotificationEnabledInServiceWorkers();
-    }
+  if (NS_IsMainThread()) {
+    return Preferences::GetBool("dom.webnotifications.enabled", false);
   }
 
-  return DOMPreferences::NotificationEnabled();
+  WorkerPrivate* workerPrivate = GetWorkerPrivateFromContext(aCx);
+  if (!workerPrivate) {
+    return false;
+  }
+
+  if (workerPrivate->IsServiceWorker()) {
+    return workerPrivate->DOMServiceWorkerNotificationEnabled();
+  }
+
+  return workerPrivate->DOMWorkerNotificationEnabled();
 }
 
 // static
 bool
 Notification::IsGetEnabled(JSContext* aCx, JSObject* aObj)
 {
   return NS_IsMainThread();
 }
@@ -1719,17 +1735,17 @@ Notification::ShowInternal()
 
   // In the case of IPC, the parent process uses the cookie to map to
   // nsIObserver. Thus the cookie must be unique to differentiate observers.
   nsString uniqueCookie = NS_LITERAL_STRING("notification:");
   uniqueCookie.AppendInt(sCount++);
   bool inPrivateBrowsing = IsInPrivateBrowsing();
 
   bool requireInteraction = mRequireInteraction;
-  if (!DOMPreferences::NotificationRIEnabled()) {
+  if (!Preferences::GetBool("dom.webnotifications.requireinteraction.enabled", false)) {
     requireInteraction = false;
   }
 
   nsAutoString alertName;
   GetAlertName(alertName);
   nsCOMPtr<nsIAlertNotification> alert =
     do_CreateInstance(ALERT_NOTIFICATION_CONTRACTID);
   NS_ENSURE_TRUE_VOID(alert);
--- a/dom/notification/Notification.h
+++ b/dom/notification/Notification.h
@@ -147,16 +147,17 @@ public:
   IMPL_EVENT_HANDLER(show)
   IMPL_EVENT_HANDLER(error)
   IMPL_EVENT_HANDLER(close)
 
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(Notification, DOMEventTargetHelper)
   NS_DECL_NSIOBSERVER
 
+  static bool RequireInteractionEnabled(JSContext* aCx, JSObject* aObj);
   static bool PrefEnabled(JSContext* aCx, JSObject* aObj);
   // Returns if Notification.get() is allowed for the current global.
   static bool IsGetEnabled(JSContext* aCx, JSObject* aObj);
 
   static already_AddRefed<Notification> Constructor(const GlobalObject& aGlobal,
                                                     const nsAString& aTitle,
                                                     const NotificationOptions& aOption,
                                                     ErrorResult& aRv);
--- a/dom/performance/PerformanceMainThread.cpp
+++ b/dom/performance/PerformanceMainThread.cpp
@@ -1,17 +1,16 @@
 /* -*- 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 "PerformanceMainThread.h"
 #include "PerformanceNavigation.h"
-#include "mozilla/dom/DOMPreferences.h"
 #include "nsICacheInfoChannel.h"
 
 namespace mozilla {
 namespace dom {
 
 NS_IMPL_CYCLE_COLLECTION_CLASS(PerformanceMainThread)
 
 NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(PerformanceMainThread,
@@ -278,31 +277,31 @@ PerformanceMainThread::GetPerformanceTim
 void
 PerformanceMainThread::InsertUserEntry(PerformanceEntry* aEntry)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   nsAutoCString uri;
   uint64_t markCreationEpoch = 0;
 
-  if (DOMPreferences::PerformanceLoggingEnabled() ||
+  if (nsContentUtils::IsUserTimingLoggingEnabled() ||
       nsContentUtils::SendPerformanceTimingNotifications()) {
     nsresult rv = NS_ERROR_FAILURE;
     nsCOMPtr<nsPIDOMWindowInner> owner = GetOwner();
     if (owner && owner->GetDocumentURI()) {
       rv = owner->GetDocumentURI()->GetHost(uri);
     }
 
     if(NS_FAILED(rv)) {
       // If we have no URI, just put in "none".
       uri.AssignLiteral("none");
     }
     markCreationEpoch = static_cast<uint64_t>(PR_Now() / PR_USEC_PER_MSEC);
 
-    if (DOMPreferences::PerformanceLoggingEnabled()) {
+    if (nsContentUtils::IsUserTimingLoggingEnabled()) {
       Performance::LogEntry(aEntry, uri);
     }
   }
 
   if (nsContentUtils::SendPerformanceTimingNotifications()) {
     TimingNotification(aEntry, uri, markCreationEpoch);
   }
 
--- a/dom/performance/PerformanceWorker.cpp
+++ b/dom/performance/PerformanceWorker.cpp
@@ -1,16 +1,15 @@
 /* -*- 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 "PerformanceWorker.h"
-#include "mozilla/dom/DOMPreferences.h"
 #include "WorkerPrivate.h"
 
 namespace mozilla {
 namespace dom {
 
 using namespace workers;
 
 PerformanceWorker::PerformanceWorker(WorkerPrivate* aWorkerPrivate)
@@ -22,17 +21,17 @@ PerformanceWorker::PerformanceWorker(Wor
 PerformanceWorker::~PerformanceWorker()
 {
   mWorkerPrivate->AssertIsOnWorkerThread();
 }
 
 void
 PerformanceWorker::InsertUserEntry(PerformanceEntry* aEntry)
 {
-  if (DOMPreferences::PerformanceLoggingEnabled()) {
+  if (mWorkerPrivate->PerformanceLoggingEnabled()) {
     nsAutoCString uri;
     nsCOMPtr<nsIURI> scriptURI = mWorkerPrivate->GetResolvedScriptURI();
     if (!scriptURI || NS_FAILED(scriptURI->GetHost(uri))) {
       // If we have no URI, just put in "none".
       uri.AssignLiteral("none");
     }
     Performance::LogEntry(aEntry, uri);
   }
--- a/dom/push/PushManager.h
+++ b/dom/push/PushManager.h
@@ -27,19 +27,19 @@
 #define mozilla_dom_PushManager_h
 
 #include "nsWrapperCache.h"
 
 #include "mozilla/AlreadyAddRefed.h"
 #include "mozilla/ErrorResult.h"
 #include "mozilla/dom/BindingDeclarations.h"
 #include "mozilla/dom/TypedArray.h"
-#include "mozilla/dom/DOMPreferences.h"
 
 #include "nsCOMPtr.h"
+#include "nsContentUtils.h" // Required for nsContentUtils::PushEnabled
 #include "mozilla/RefPtr.h"
 
 class nsIGlobalObject;
 class nsIPrincipal;
 
 namespace mozilla {
 namespace dom {
 
--- a/dom/push/PushSubscription.h
+++ b/dom/push/PushSubscription.h
@@ -5,23 +5,23 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_dom_PushSubscription_h
 #define mozilla_dom_PushSubscription_h
 
 #include "jsapi.h"
 #include "nsCOMPtr.h"
 #include "nsWrapperCache.h"
+#include "nsContentUtils.h" // Required for nsContentUtils::PushEnabled
 
 #include "mozilla/AlreadyAddRefed.h"
 #include "mozilla/ErrorResult.h"
 #include "mozilla/RefPtr.h"
 
 #include "mozilla/dom/BindingDeclarations.h"
-#include "mozilla/dom/DOMPreferences.h"
 #include "mozilla/dom/PushSubscriptionBinding.h"
 #include "mozilla/dom/PushSubscriptionOptionsBinding.h"
 #include "mozilla/dom/TypedArray.h"
 
 class nsIGlobalObject;
 
 namespace mozilla {
 namespace dom {
--- a/dom/push/PushSubscriptionOptions.h
+++ b/dom/push/PushSubscriptionOptions.h
@@ -3,19 +3,19 @@
 /* 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 mozilla_dom_PushSubscriptionOptions_h
 #define mozilla_dom_PushSubscriptionOptions_h
 
 #include "nsCycleCollectionParticipant.h"
+#include "nsContentUtils.h" // Required for nsContentUtils::PushEnabled
 #include "nsTArray.h"
 #include "nsWrapperCache.h"
-#include "mozilla/dom/DOMPreferences.h"
 
 class nsIGlobalObject;
 
 namespace mozilla {
 
 class ErrorResult;
 
 namespace dom {
--- a/dom/quota/StorageManager.cpp
+++ b/dom/quota/StorageManager.cpp
@@ -1,17 +1,16 @@
 /* -*- 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 "StorageManager.h"
 
-#include "mozilla/dom/DOMPreferences.h"
 #include "mozilla/dom/PromiseWorkerProxy.h"
 #include "mozilla/dom/quota/QuotaManagerService.h"
 #include "mozilla/dom/StorageManagerBinding.h"
 #include "mozilla/dom/WorkerPrivate.h"
 #include "mozilla/ErrorResult.h"
 #include "mozilla/EventStateManager.h"
 #include "mozilla/Telemetry.h"
 #include "nsContentPermissionHelper.h"
@@ -861,16 +860,30 @@ StorageManager::Estimate(ErrorResult& aR
 
   Telemetry::ScalarAdd(Telemetry::ScalarID::NAVIGATOR_STORAGE_ESTIMATE_COUNT,
                        1);
   return ExecuteOpOnMainOrWorkerThread(mOwner,
                                        RequestResolver::Type::Estimate,
                                        aRv);
 }
 
+// static
+bool
+StorageManager::PrefEnabled(JSContext* aCx, JSObject* aObj)
+{
+  if (NS_IsMainThread()) {
+    return Preferences::GetBool("dom.storageManager.enabled");
+  }
+
+  WorkerPrivate* workerPrivate = GetWorkerPrivateFromContext(aCx);
+  MOZ_ASSERT(workerPrivate);
+
+  return workerPrivate->StorageManagerEnabled();
+}
+
 NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(StorageManager, mOwner)
 
 NS_IMPL_CYCLE_COLLECTING_ADDREF(StorageManager)
 NS_IMPL_CYCLE_COLLECTING_RELEASE(StorageManager)
 
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(StorageManager)
   NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
   NS_INTERFACE_MAP_ENTRY(nsISupports)
--- a/dom/quota/StorageManager.h
+++ b/dom/quota/StorageManager.h
@@ -20,16 +20,20 @@ struct StorageEstimate;
 
 class StorageManager final
   : public nsISupports
   , public nsWrapperCache
 {
   nsCOMPtr<nsIGlobalObject> mOwner;
 
 public:
+  // Return dom.quota.storageManager.enabled on main/worker thread.
+  static bool
+  PrefEnabled(JSContext* aCx, JSObject* aObj);
+
   explicit
   StorageManager(nsIGlobalObject* aGlobal);
 
   nsIGlobalObject*
   GetParentObject() const
   {
     return mOwner;
   }
--- a/dom/webidl/Cache.webidl
+++ b/dom/webidl/Cache.webidl
@@ -6,17 +6,17 @@
  * The origin of this IDL file is
  * http://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html
  *
  */
 
 // https://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html#cache
 
 [Exposed=(Window,Worker),
- Func="mozilla::dom::DOMPreferences::DOMCachesEnabled"]
+ Func="mozilla::dom::cache::Cache::PrefEnabled"]
 interface Cache {
   [NewObject]
   Promise<Response> match(RequestInfo request, optional CacheQueryOptions options);
   [NewObject]
   Promise<sequence<Response>> matchAll(optional RequestInfo request, optional CacheQueryOptions options);
   [NewObject, NeedsCallerType]
   Promise<void> add(RequestInfo request);
   [NewObject, NeedsCallerType]
--- a/dom/webidl/CacheStorage.webidl
+++ b/dom/webidl/CacheStorage.webidl
@@ -9,17 +9,17 @@
  */
 
 // https://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html#cache-storage
 
 interface Principal;
 
 [Exposed=(Window,Worker),
  ChromeConstructor(CacheStorageNamespace namespace, Principal principal),
- Func="mozilla::dom::DOMPreferences::DOMCachesEnabled"]
+ Func="mozilla::dom::cache::CacheStorage::PrefEnabled"]
 interface CacheStorage {
   [NewObject]
   Promise<Response> match(RequestInfo request, optional CacheQueryOptions options);
   [NewObject]
   Promise<boolean> has(DOMString cacheName);
   [NewObject]
   Promise<Cache> open(DOMString cacheName);
   [NewObject]
--- a/dom/webidl/FetchObserver.webidl
+++ b/dom/webidl/FetchObserver.webidl
@@ -11,17 +11,17 @@ callback interface ObserverCallback {
 enum FetchState {
   // Pending states
   "requesting", "responding",
   // Final states
   "aborted", "errored", "complete"
 };
 
 [Exposed=(Window,Worker),
- Func="mozilla::dom::DOMPreferences::FetchObserverEnabled"]
+ Func="FetchObserver::IsEnabled"]
 interface FetchObserver : EventTarget {
   readonly attribute FetchState state;
 
   // Events
   attribute EventHandler onstatechange;
   attribute EventHandler onrequestprogress;
   attribute EventHandler onresponseprogress;
 };
--- a/dom/webidl/File.webidl
+++ b/dom/webidl/File.webidl
@@ -29,17 +29,17 @@ dictionary ChromeFilePropertyBag : FileP
   boolean existenceCheck = true;
 };
 
 // Mozilla extensions
 partial interface File {
   [GetterThrows, Deprecated="FileLastModifiedDate"]
   readonly attribute Date lastModifiedDate;
 
-  [BinaryName="relativePath", Func="mozilla::dom::DOMPreferences::WebkitBlinkDirectoryPickerEnabled"]
+  [BinaryName="relativePath", Func="mozilla::dom::Directory::WebkitBlinkDirectoryPickerEnabled"]
   readonly attribute USVString webkitRelativePath;
 
   [GetterThrows, ChromeOnly, NeedsCallerType]
   readonly attribute DOMString mozFullPath;
 };
 
 // Mozilla extensions
 // These 2 methods can be used only in these conditions:
--- a/dom/webidl/ImageBitmap.webidl
+++ b/dom/webidl/ImageBitmap.webidl
@@ -398,15 +398,15 @@ dictionary ChannelPixelLayout {
     required ChannelPixelLayoutDataType dataType;
     required unsigned long              stride;
     required unsigned long              skip;
 };
 
 typedef sequence<ChannelPixelLayout> ImagePixelLayout;
 
 partial interface ImageBitmap {
-    [Throws, Func="mozilla::dom::DOMPreferences::ImageBitmapExtensionsEnabled"]
+    [Throws, Func="mozilla::dom::ImageBitmap::ExtensionsEnabled"]
     ImageBitmapFormat               findOptimalFormat (optional sequence<ImageBitmapFormat> aPossibleFormats);
-    [Throws, Func="mozilla::dom::DOMPreferences::ImageBitmapExtensionsEnabled"]
+    [Throws, Func="mozilla::dom::ImageBitmap::ExtensionsEnabled"]
     long                            mappedDataLength (ImageBitmapFormat aFormat);
-    [Throws, Func="mozilla::dom::DOMPreferences::ImageBitmapExtensionsEnabled"]
+    [Throws, Func="mozilla::dom::ImageBitmap::ExtensionsEnabled"]
     Promise<ImagePixelLayout> mapDataInto (ImageBitmapFormat aFormat, BufferSource aBuffer, long aOffset);
 };
--- a/dom/webidl/Navigator.webidl
+++ b/dom/webidl/Navigator.webidl
@@ -84,17 +84,17 @@ interface NavigatorContentUtils {
   //DOMString isProtocolHandlerRegistered(DOMString scheme, DOMString url);
   //DOMString isContentHandlerRegistered(DOMString mimeType, DOMString url);
   //void unregisterProtocolHandler(DOMString scheme, DOMString url);
   //void unregisterContentHandler(DOMString mimeType, DOMString url);
 };
 
 [SecureContext, NoInterfaceObject, Exposed=(Window,Worker)]
 interface NavigatorStorage {
-  [Func="mozilla::dom::DOMPreferences::StorageManagerEnabled"]
+  [Func="mozilla::dom::StorageManager::PrefEnabled"]
   readonly attribute StorageManager storage;
 };
 
 [NoInterfaceObject]
 interface NavigatorStorageUtils {
   // NOT IMPLEMENTED
   //void yieldForStorageUpdates();
 };
--- a/dom/webidl/NetworkInformation.webidl
+++ b/dom/webidl/NetworkInformation.webidl
@@ -13,14 +13,14 @@ enum ConnectionType {
     "bluetooth",
     "ethernet",
     "wifi",
     "other",
     "none",
     "unknown"
 };
 
-[Func="mozilla::dom::DOMPreferences::NetworkInformationEnabled",
+[Func="mozilla::dom::network::Connection::IsEnabled",
  Exposed=(Window,Worker)]
 interface NetworkInformation : EventTarget {
     readonly    attribute ConnectionType type;
                 attribute EventHandler   ontypechange;
 };
--- a/dom/webidl/Notification.webidl
+++ b/dom/webidl/Notification.webidl
@@ -46,17 +46,17 @@ interface Notification : EventTarget {
   readonly attribute DOMString? body;
 
   [Constant]
   readonly attribute DOMString? tag;
 
   [Pure]
   readonly attribute DOMString? icon;
 
-  [Constant, Func="mozilla::dom::DOMPreferences::NotificationRIEnabled"]
+  [Constant, Func="mozilla::dom::Notification::RequireInteractionEnabled"]
   readonly attribute boolean requireInteraction;
 
   [Constant]
   readonly attribute any data;
 
   void close();
 };
 
--- a/dom/webidl/OffscreenCanvas.webidl
+++ b/dom/webidl/OffscreenCanvas.webidl
@@ -4,17 +4,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  *
  * For more information on this interface, please see
  * https://wiki.whatwg.org/wiki/OffscreenCanvas
  */
 
 [Constructor(unsigned long width, unsigned long height),
  Exposed=(Window,Worker),
- Func="mozilla::dom::DOMPreferences::OffscreenCanvasEnabled"]
+ Func="mozilla::dom::OffscreenCanvas::PrefEnabled"]
 interface OffscreenCanvas : EventTarget {
   [Pure, SetterThrows]
   attribute unsigned long width;
   [Pure, SetterThrows]
   attribute unsigned long height;
 
   [Throws]
   nsISupports? getContext(DOMString contextId,
--- a/dom/webidl/PromiseRejectionEvent.webidl
+++ b/dom/webidl/PromiseRejectionEvent.webidl
@@ -1,17 +1,17 @@
 /* -*- Mode: IDL; 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/.
  */
 
 [Constructor(DOMString type, PromiseRejectionEventInit eventInitDict),
  Exposed=(Window,Worker),
- Func="mozilla::dom::DOMPreferences::PromiseRejectionEventsEnabled"]
+ Func="nsContentUtils::PromiseRejectionEventsEnabled"]
 interface PromiseRejectionEvent : Event
 {
   [BinaryName="rejectedPromise"]
   readonly attribute Promise<any> promise;
   readonly attribute any reason;
 };
 
 dictionary PromiseRejectionEventInit : EventInit {
--- a/dom/webidl/PushEvent.webidl
+++ b/dom/webidl/PushEvent.webidl
@@ -3,17 +3,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/.
  *
  * The origin of this IDL file is
  * https://w3c.github.io/push-api/
  */
 
 [Constructor(DOMString type, optional PushEventInit eventInitDict),
- Func="mozilla::dom::DOMPreferences::PushEnabled",
+ Func="nsContentUtils::PushEnabled",
  Exposed=ServiceWorker]
 interface PushEvent : ExtendableEvent {
   readonly attribute PushMessageData? data;
 };
 
 typedef (BufferSource or USVString) PushMessageDataInit;
 
 dictionary PushEventInit : ExtendableEventInit {
--- a/dom/webidl/PushManager.webidl
+++ b/dom/webidl/PushManager.webidl
@@ -17,17 +17,17 @@ dictionary PushSubscriptionOptionsInit {
 [JSImplementation="@mozilla.org/push/PushManager;1",
  ChromeOnly, Constructor(DOMString scope)]
 interface PushManagerImpl {
   Promise<PushSubscription>    subscribe(optional PushSubscriptionOptionsInit options);
   Promise<PushSubscription?>   getSubscription();
   Promise<PushPermissionState> permissionState(optional PushSubscriptionOptionsInit options);
 };
 
-[Exposed=(Window,Worker), Func="mozilla::dom::DOMPreferences::PushEnabled",
+[Exposed=(Window,Worker), Func="nsContentUtils::PushEnabled",
  ChromeConstructor(DOMString scope)]
 interface PushManager {
   [Throws, UseCounter]
   Promise<PushSubscription>    subscribe(optional PushSubscriptionOptionsInit options);
   [Throws]
   Promise<PushSubscription?>   getSubscription();
   [Throws]
   Promise<PushPermissionState> permissionState(optional PushSubscriptionOptionsInit options);
--- a/dom/webidl/PushMessageData.webidl
+++ b/dom/webidl/PushMessageData.webidl
@@ -2,17 +2,17 @@
 /* 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 origin of this IDL file is
  * https://w3c.github.io/push-api/
  */
 
-[Func="mozilla::dom::DOMPreferences::PushEnabled",
+[Func="nsContentUtils::PushEnabled",
  Exposed=ServiceWorker]
 interface PushMessageData
 {
     [Throws]
     ArrayBuffer arrayBuffer();
     [Throws]
     Blob        blob();
     [Throws]
--- a/dom/webidl/PushSubscription.webidl
+++ b/dom/webidl/PushSubscription.webidl
@@ -31,17 +31,17 @@ dictionary PushSubscriptionInit
 {
   required USVString endpoint;
   required USVString scope;
   ArrayBuffer? p256dhKey;
   ArrayBuffer? authSecret;
   BufferSource? appServerKey;
 };
 
-[Exposed=(Window,Worker), Func="mozilla::dom::DOMPreferences::PushEnabled",
+[Exposed=(Window,Worker), Func="nsContentUtils::PushEnabled",
  ChromeConstructor(PushSubscriptionInit initDict)]
 interface PushSubscription
 {
   readonly attribute USVString endpoint;
   readonly attribute PushSubscriptionOptions options;
   [Throws]
   ArrayBuffer? getKey(PushEncryptionKeyName name);
   [Throws, UseCounter]
--- a/dom/webidl/PushSubscriptionOptions.webidl
+++ b/dom/webidl/PushSubscriptionOptions.webidl
@@ -2,14 +2,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/.
 *
 * The origin of this IDL file is
 * https://w3c.github.io/push-api/
 */
 
-[Exposed=(Window,Worker), Func="mozilla::dom::DOMPreferences::PushEnabled"]
+[Exposed=(Window,Worker), Func="nsContentUtils::PushEnabled"]
 interface PushSubscriptionOptions
 {
   [SameObject, Throws]
   readonly attribute ArrayBuffer? applicationServerKey;
 };
--- a/dom/webidl/Request.webidl
+++ b/dom/webidl/Request.webidl
@@ -12,17 +12,17 @@ typedef unsigned long nsContentPolicyTyp
 
 [Constructor(RequestInfo input, optional RequestInit init),
  Exposed=(Window,Worker)]
 interface Request {
   readonly attribute ByteString method;
   readonly attribute USVString url;
   [SameObject] readonly attribute Headers headers;
 
-  [Func="mozilla::dom::DOMPreferences::RequestContextEnabled"]
+  [Func="mozilla::dom::Request::RequestContextEnabled"]
   readonly attribute RequestContext context;
   readonly attribute USVString referrer;
   readonly attribute ReferrerPolicy referrerPolicy;
   readonly attribute RequestMode mode;
   readonly attribute RequestCredentials credentials;
   readonly attribute RequestCache cache;
   readonly attribute RequestRedirect redirect;
   readonly attribute DOMString integrity;
@@ -56,17 +56,17 @@ dictionary RequestInit {
   RequestRedirect redirect;
   DOMString integrity;
 
   [ChromeOnly]
   boolean mozErrors;
 
   AbortSignal? signal;
 
-  [Func="mozilla::dom::DOMPreferences::FetchObserverEnabled"]
+  [Func="FetchObserver::IsEnabled"]
   ObserverCallback observe;
 };
 
 // Gecko currently does not ship RequestContext, so please don't use it in IDL
 // that is exposed to script.
 enum RequestContext {
   "audio", "beacon", "cspreport", "download", "embed", "eventsource", "favicon", "fetch",
   "font", "form", "frame", "hyperlink", "iframe", "image", "imageset", "import",
--- a/dom/webidl/Response.webidl
+++ b/dom/webidl/Response.webidl
@@ -30,17 +30,17 @@ interface Response {
 
   [ChromeOnly, NewObject, Throws] Response cloneUnfiltered();
 };
 Response implements Body;
 
 // This should be part of Body but we don't want to expose body to request yet.
 // See bug 1387483.
 partial interface Response {
-  [GetterThrows, Func="mozilla::dom::DOMPreferences::StreamsEnabled"]
+  [GetterThrows, Func="nsContentUtils::StreamsEnabled"]
   readonly attribute ReadableStream? body;
 };
 
 dictionary ResponseInit {
   unsigned short status = 200;
   ByteString statusText = "OK";
   HeadersInit headers;
 };
--- a/dom/webidl/ServiceWorkerRegistration.webidl
+++ b/dom/webidl/ServiceWorkerRegistration.webidl
@@ -4,17 +4,17 @@
  * You can obtain one at http://mozilla.org/MPL/2.0/.
  *
  * The origin of this IDL file is
  * http://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html
  * https://w3c.github.io/push-api/
  * https://notifications.spec.whatwg.org/
  */
 
-[Func="mozilla::dom::DOMPreferences::ServiceWorkersEnabled",
+[Func="mozilla::dom::ServiceWorkerRegistration::Visible",
  Exposed=(Window,Worker)]
 interface ServiceWorkerRegistration : EventTarget {
   [Unforgeable] readonly attribute ServiceWorker? installing;
   [Unforgeable] readonly attribute ServiceWorker? waiting;
   [Unforgeable] readonly attribute ServiceWorker? active;
 
   readonly attribute USVString scope;
   [Throws]
@@ -33,19 +33,19 @@ interface ServiceWorkerRegistration : Ev
 enum ServiceWorkerUpdateViaCache {
   "imports",
   "all",
   "none"
 };
 
 // https://w3c.github.io/push-api/
 partial interface ServiceWorkerRegistration {
-  [Throws, Exposed=(Window,Worker), Func="mozilla::dom::DOMPreferences::PushEnabled"]
+  [Throws, Exposed=(Window,Worker), Func="nsContentUtils::PushEnabled"]
   readonly attribute PushManager pushManager;
 };
 
 // https://notifications.spec.whatwg.org/
 partial interface ServiceWorkerRegistration {
-  [Throws, Func="mozilla::dom::DOMPreferences::NotificationEnabledInServiceWorkers"]
+  [Throws, Func="mozilla::dom::ServiceWorkerRegistration::NotificationAPIVisible"]
   Promise<void> showNotification(DOMString title, optional NotificationOptions options);
-  [Throws, Func="mozilla::dom::DOMPreferences::NotificationEnabledInServiceWorkers"]
+  [Throws, Func="mozilla::dom::ServiceWorkerRegistration::NotificationAPIVisible"]
   Promise<sequence<Notification>> getNotifications(optional GetNotificationOptions filter);
 };
--- a/dom/webidl/StorageManager.webidl
+++ b/dom/webidl/StorageManager.webidl
@@ -5,17 +5,17 @@
  *
  * The origin of this IDL file is
  * https://storage.spec.whatwg.org/#storagemanager
  *
  */
 
 [SecureContext,
  Exposed=(Window,Worker),
- Func="mozilla::dom::DOMPreferences::StorageManagerEnabled"]
+ Func="mozilla::dom::StorageManager::PrefEnabled"]
 interface StorageManager {
   [Throws]
   Promise<boolean> persisted();
 
   [Exposed=Window, Throws]
   Promise<boolean> persist();
 
   [Throws]
--- a/dom/webidl/WebGLRenderingContext.webidl
+++ b/dom/webidl/WebGLRenderingContext.webidl
@@ -798,17 +798,17 @@ interface WebGLRenderingContext {
 };
 
 WebGLRenderingContext implements WebGLRenderingContextBase;
 
 // For OffscreenCanvas
 // Reference: https://wiki.whatwg.org/wiki/OffscreenCanvas
 [Exposed=(Window,Worker)]
 partial interface WebGLRenderingContext {
-    [Func="mozilla::dom::DOMPreferences::OffscreenCanvasEnabled"]
+    [Func="mozilla::dom::OffscreenCanvas::PrefEnabled"]
     void commit();
 };
 
 ////////////////////////////////////////
 // specific extension interfaces
 
 [NoInterfaceObject]
 interface WEBGL_compressed_texture_s3tc
--- a/dom/webidl/WindowOrWorkerGlobalScope.webidl
+++ b/dom/webidl/WindowOrWorkerGlobalScope.webidl
@@ -57,17 +57,17 @@ partial interface WindowOrWorkerGlobalSc
 partial interface WindowOrWorkerGlobalScope {
    // readonly attribute IDBFactory indexedDB;
    [Throws]
    readonly attribute IDBFactory? indexedDB;
 };
 
 // https://w3c.github.io/ServiceWorker/#self-caches
 partial interface WindowOrWorkerGlobalScope {
-  [Throws, Func="mozilla::dom::DOMPreferences::DOMCachesEnabled", SameObject]
+  [Throws, Func="mozilla::dom::cache::CacheStorage::PrefEnabled", SameObject]
   readonly attribute CacheStorage caches;
 };
 
 // Mozilla extensions
 partial interface WindowOrWorkerGlobalScope {
   // Extensions to ImageBitmap bits.
   // Bug 1141979 - [FoxEye] Extend ImageBitmap with interfaces to access its
   // underlying image data
--- a/dom/webidl/WorkerNavigator.webidl
+++ b/dom/webidl/WorkerNavigator.webidl
@@ -11,11 +11,11 @@ WorkerNavigator implements NavigatorID;
 WorkerNavigator implements NavigatorLanguage;
 WorkerNavigator implements NavigatorOnLine;
 WorkerNavigator implements NavigatorConcurrentHardware;
 WorkerNavigator implements NavigatorStorage;
 
 // http://wicg.github.io/netinfo/#extensions-to-the-navigator-interface
 [Exposed=(Worker)]
 partial interface WorkerNavigator {
-    [Func="mozilla::dom::DOMPreferences::NetworkInformationEnabled", Throws]
+    [Func="mozilla::dom::network::Connection::IsEnabled", Throws]
     readonly attribute NetworkInformation connection;
 };
--- a/dom/workers/RuntimeService.cpp
+++ b/dom/workers/RuntimeService.cpp
@@ -1437,16 +1437,17 @@ END_WORKERS_NAMESPACE
 struct RuntimeService::IdleThreadInfo
 {
   RefPtr<WorkerThread> mThread;
   mozilla::TimeStamp mExpirationTime;
 };
 
 // This is only touched on the main thread. Initialized in Init() below.
 JSSettings RuntimeService::sDefaultJSSettings;
+bool RuntimeService::sDefaultPreferences[WORKERPREF_COUNT] = { false };
 
 RuntimeService::RuntimeService()
 : mMutex("RuntimeService::mMutex"), mObserved(false),
   mShuttingDown(false), mNavigatorPropertiesLoaded(false)
 {
   AssertIsOnMainThread();
   NS_ASSERTION(!gRuntimeService, "More than one service!");
 }
@@ -1960,27 +1961,27 @@ RuntimeService::Init()
                             LoadJSGCMemoryOptions,
                             PREF_WORKERS_OPTIONS_PREFIX PREF_MEM_OPTIONS_PREFIX)) ||
 #ifdef JS_GC_ZEAL
       NS_FAILED(Preferences::RegisterCallback(
                                              LoadGCZealOptions,
                                              PREF_JS_OPTIONS_PREFIX PREF_GCZEAL)) ||
 #endif
 
+#define WORKER_SIMPLE_PREF(name, getter, NAME)                                \
+      NS_FAILED(Preferences::RegisterCallbackAndCall(                         \
+                  WorkerPrefChanged,                                          \
+                  name,                                                       \
+                  reinterpret_cast<void*>(WORKERPREF_##NAME))) ||
 #define WORKER_PREF(name, callback)                                           \
       NS_FAILED(Preferences::RegisterCallbackAndCall(                         \
                   callback,                                                   \
                   name)) ||
-      WORKER_PREF("intl.accept_languages", PrefLanguagesChanged)
-      WORKER_PREF("general.appname.override", AppNameOverrideChanged)
-      WORKER_PREF("general.appversion.override", AppVersionOverrideChanged)
-      WORKER_PREF("general.platform.override", PlatformOverrideChanged)
-#ifdef JS_GC_ZEAL
-      WORKER_PREF("dom.workers.options.gcZeal", LoadGCZealOptions)
-#endif
+#include "WorkerPrefs.h"
+#undef WORKER_SIMPLE_PREF
 #undef WORKER_PREF
 
       NS_FAILED(Preferences::RegisterPrefixCallbackAndCall(
                                                    LoadContextOptions,
                                                    PREF_WORKERS_OPTIONS_PREFIX)) ||
       NS_FAILED(Preferences::RegisterPrefixCallback(LoadContextOptions,
                                                     PREF_JS_OPTIONS_PREFIX))) {
     NS_WARNING("Failed to register pref callbacks!");
@@ -2256,27 +2257,27 @@ RuntimeService::Cleanup()
   NS_ASSERTION(!mWindowMap.Count(), "All windows should have been released!");
 
   if (mObserved) {
     if (NS_FAILED(Preferences::UnregisterPrefixCallback(LoadContextOptions,
                                                         PREF_JS_OPTIONS_PREFIX)) ||
         NS_FAILED(Preferences::UnregisterPrefixCallback(LoadContextOptions,
                                                         PREF_WORKERS_OPTIONS_PREFIX)) ||
 
+#define WORKER_SIMPLE_PREF(name, getter, NAME)                                \
+      NS_FAILED(Preferences::UnregisterCallback(                              \
+                  WorkerPrefChanged,                                          \
+                  name,                                                       \
+                  reinterpret_cast<void*>(WORKERPREF_##NAME))) ||
 #define WORKER_PREF(name, callback)                                           \
       NS_FAILED(Preferences::UnregisterCallback(                              \
                   callback,                                                   \
                   name)) ||
-      WORKER_PREF("intl.accept_languages", PrefLanguagesChanged)
-      WORKER_PREF("general.appname.override", AppNameOverrideChanged)
-      WORKER_PREF("general.appversion.override", AppVersionOverrideChanged)
-      WORKER_PREF("general.platform.override", PlatformOverrideChanged)
-#ifdef JS_GC_ZEAL
-      WORKER_PREF("dom.workers.options.gcZeal", LoadGCZealOptions)
-#endif
+#include "WorkerPrefs.h"
+#undef WORKER_SIMPLE_PREF
 #undef WORKER_PREF
 
 #ifdef JS_GC_ZEAL
         NS_FAILED(Preferences::UnregisterCallback(
                                              LoadGCZealOptions,
                                              PREF_JS_OPTIONS_PREFIX PREF_GCZEAL)) ||
 #endif
         NS_FAILED(Preferences::UnregisterPrefixCallback(
@@ -2667,16 +2668,22 @@ RuntimeService::UpdateAppVersionOverride
 void
 RuntimeService::UpdatePlatformOverridePreference(const nsAString& aValue)
 {
   AssertIsOnMainThread();
   mNavigatorProperties.mPlatformOverridden = aValue;
 }
 
 void
+RuntimeService::UpdateAllWorkerPreference(WorkerPreference aPref, bool aValue)
+{
+  BROADCAST_ALL_WORKERS(UpdatePreference, aPref, aValue);
+}
+
+void
 RuntimeService::UpdateAllWorkerLanguages(const nsTArray<nsString>& aLanguages)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   mNavigatorProperties.mLanguages = aLanguages;
   BROADCAST_ALL_WORKERS(UpdateLanguages, aLanguages);
 }
 
@@ -2785,16 +2792,44 @@ RuntimeService::Observe(nsISupports* aSu
     SendOfflineStatusChangeEventToAllWorkers(NS_IsOffline());
     return NS_OK;
   }
 
   NS_NOTREACHED("Unknown observer topic!");
   return NS_OK;
 }
 
+/* static */ void
+RuntimeService::WorkerPrefChanged(const char* aPrefName, void* aClosure)
+{
+  AssertIsOnMainThread();
+
+  const WorkerPreference key =
+    static_cast<WorkerPreference>(reinterpret_cast<uintptr_t>(aClosure));
+
+  switch (key) {
+#define WORKER_SIMPLE_PREF(name, getter, NAME) case WORKERPREF_##NAME:
+#define WORKER_PREF(name, callback)
+#include "WorkerPrefs.h"
+#undef WORKER_SIMPLE_PREF
+#undef WORKER_PREF
+      sDefaultPreferences[key] = Preferences::GetBool(aPrefName, false);
+      break;
+
+    default:
+      MOZ_ASSERT_UNREACHABLE("Invalid pref key");
+      break;
+  }
+
+  RuntimeService* rts = RuntimeService::GetService();
+  if (rts) {
+    rts->UpdateAllWorkerPreference(key, sDefaultPreferences[key]);
+  }
+}
+
 bool
 LogViolationDetailsRunnable::MainThreadRun()
 {
   AssertIsOnMainThread();
 
   nsIContentSecurityPolicy* csp = mWorkerPrivate->GetCSP();
   if (csp) {
     NS_NAMED_LITERAL_STRING(scriptSample,
--- a/dom/workers/RuntimeService.h
+++ b/dom/workers/RuntimeService.h
@@ -86,16 +86,17 @@ class RuntimeService final : public nsIO
   // *Not* protected by mMutex.
   nsClassHashtable<nsPtrHashKey<nsPIDOMWindowInner>,
                    nsTArray<WorkerPrivate*> > mWindowMap;
 
   // Only used on the main thread.
   nsCOMPtr<nsITimer> mIdleThreadTimer;
 
   static JSSettings sDefaultJSSettings;
+  static bool sDefaultPreferences[WORKERPREF_COUNT];
 
 public:
   struct NavigatorProperties
   {
     nsString mAppName;
     nsString mAppNameOverridden;
     nsString mAppVersion;
     nsString mAppVersionOverridden;
@@ -168,16 +169,23 @@ public:
   static void
   GetDefaultJSSettings(JSSettings& aSettings)
   {
     AssertIsOnMainThread();
     aSettings = sDefaultJSSettings;
   }
 
   static void
+  GetDefaultPreferences(bool aPreferences[WORKERPREF_COUNT])
+  {
+    AssertIsOnMainThread();
+    memcpy(aPreferences, sDefaultPreferences, WORKERPREF_COUNT * sizeof(bool));
+  }
+
+  static void
   SetDefaultContextOptions(const JS::ContextOptions& aContextOptions)
   {
     AssertIsOnMainThread();
     sDefaultJSSettings.contextOptions = aContextOptions;
   }
 
   void
   UpdateAppNameOverridePreference(const nsAString& aValue);
@@ -189,16 +197,19 @@ public:
   UpdatePlatformOverridePreference(const nsAString& aValue);
 
   void
   UpdateAllWorkerContextOptions();
 
   void
   UpdateAllWorkerLanguages(const nsTArray<nsString>& aLanguages);
 
+  void
+  UpdateAllWorkerPreference(WorkerPreference aPref, bool aValue);
+
   static void
   SetDefaultJSGCSettings(JSGCParamKey aKey, uint32_t aValue)
   {
     AssertIsOnMainThread();
     sDefaultJSSettings.ApplyGCSetting(aKey, aValue);
   }
 
   void
@@ -254,16 +265,19 @@ private:
                       nsTArray<WorkerPrivate*>& aWorkers);
 
   bool
   ScheduleWorker(WorkerPrivate* aWorkerPrivate);
 
   static void
   ShutdownIdleThreads(nsITimer* aTimer, void* aClosure);
 
+  static void
+  WorkerPrefChanged(const char* aPrefName, void* aClosure);
+
   nsresult
   CreateSharedWorkerFromLoadInfo(JSContext* aCx,
                                  WorkerLoadInfo* aLoadInfo,
                                  const nsAString& aScriptURL,
                                  const nsAString& aName,
                                  SharedWorker** aSharedWorker);
 };
 
--- a/dom/workers/ServiceWorker.cpp
+++ b/dom/workers/ServiceWorker.cpp
@@ -7,17 +7,17 @@
 #include "ServiceWorker.h"
 
 #include "nsIDocument.h"
 #include "nsPIDOMWindow.h"
 #include "ServiceWorkerManager.h"
 #include "ServiceWorkerPrivate.h"
 #include "WorkerPrivate.h"
 
-#include "mozilla/dom/DOMPreferences.h"
+#include "mozilla/Preferences.h"
 #include "mozilla/dom/ClientIPCTypes.h"
 #include "mozilla/dom/ClientState.h"
 #include "mozilla/dom/Promise.h"
 #include "mozilla/dom/ServiceWorkerGlobalScopeBinding.h"
 
 #ifdef XP_WIN
 #undef PostMessage
 #endif
@@ -28,17 +28,17 @@ using namespace mozilla::dom;
 namespace mozilla {
 namespace dom {
 namespace workers {
 
 bool
 ServiceWorkerVisible(JSContext* aCx, JSObject* aObj)
 {
   if (NS_IsMainThread()) {
-    return DOMPreferences::ServiceWorkersEnabled();
+    return Preferences::GetBool("dom.serviceWorkers.enabled", false);
   }
 
   return IS_INSTANCE_OF(ServiceWorkerGlobalScope, aObj);
 }
 
 ServiceWorker::ServiceWorker(nsPIDOMWindowInner* aWindow,
                              ServiceWorkerInfo* aInfo)
   : DOMEventTargetHelper(aWindow),
--- a/dom/workers/ServiceWorkerContainer.cpp
+++ b/dom/workers/ServiceWorkerContainer.cpp
@@ -7,22 +7,22 @@
 #include "ServiceWorkerContainer.h"
 
 #include "nsContentUtils.h"
 #include "nsIDocument.h"
 #include "nsIServiceWorkerManager.h"
 #include "nsIURL.h"
 #include "nsNetUtil.h"
 #include "nsPIDOMWindow.h"
+#include "mozilla/Preferences.h"
 #include "mozilla/Services.h"
 
 #include "nsCycleCollectionParticipant.h"
 #include "nsServiceManagerUtils.h"
 
-#include "mozilla/dom/DOMPreferences.h"
 #include "mozilla/dom/Navigator.h"
 #include "mozilla/dom/Promise.h"
 #include "mozilla/dom/ServiceWorkerContainerBinding.h"
 #include "mozilla/dom/workers/bindings/ServiceWorker.h"
 
 #include "ServiceWorker.h"
 
 namespace mozilla {
@@ -48,17 +48,17 @@ ServiceWorkerContainer::IsEnabled(JSCont
     return false;
   }
 
   nsIDocument* doc = window->GetExtantDoc();
   if (!doc || nsContentUtils::IsInPrivateBrowsing(doc)) {
     return false;
   }
 
-  return DOMPreferences::ServiceWorkersEnabled();
+  return Preferences::GetBool("dom.serviceWorkers.enabled", false);
 }
 
 ServiceWorkerContainer::ServiceWorkerContainer(nsPIDOMWindowInner* aWindow)
   : DOMEventTargetHelper(aWindow)
 {
 }
 
 ServiceWorkerContainer::~ServiceWorkerContainer()
--- a/dom/workers/ServiceWorkerManager.cpp
+++ b/dom/workers/ServiceWorkerManager.cpp
@@ -35,17 +35,16 @@
 #include "mozilla/ErrorNames.h"
 #include "mozilla/LoadContext.h"
 #include "mozilla/SystemGroup.h"
 #include "mozilla/Telemetry.h"
 #include "mozilla/dom/BindingUtils.h"
 #include "mozilla/dom/ClientHandle.h"
 #include "mozilla/dom/ClientManager.h"
 #include "mozilla/dom/ContentParent.h"
-#include "mozilla/dom/DOMPreferences.h"
 #include "mozilla/dom/ErrorEvent.h"
 #include "mozilla/dom/Headers.h"
 #include "mozilla/dom/InternalHeaders.h"
 #include "mozilla/dom/Navigator.h"
 #include "mozilla/dom/NotificationEvent.h"
 #include "mozilla/dom/PromiseNativeHandler.h"
 #include "mozilla/dom/PromiseWindowProxy.h"
 #include "mozilla/dom/Request.h"
@@ -752,17 +751,17 @@ ServiceWorkerManager::Register(mozIDOMWi
     return NS_ERROR_DOM_SECURITY_ERR;
   }
 
   nsCOMPtr<nsPIDOMWindowOuter> outerWindow = window->GetOuterWindow();
   bool serviceWorkersTestingEnabled =
     outerWindow->GetServiceWorkersTestingEnabled();
 
   bool authenticatedOrigin;
-  if (DOMPreferences::ServiceWorkersTestingEnabled() ||
+  if (Preferences::GetBool("dom.serviceWorkers.testing.enabled") ||
       serviceWorkersTestingEnabled) {
     authenticatedOrigin = true;
   } else {
     authenticatedOrigin = IsFromAuthenticatedOrigin(doc);
   }
 
   if (!authenticatedOrigin) {
     NS_WARNING("ServiceWorker registration from insecure websites is not allowed.");
--- a/dom/workers/ServiceWorkerPrivate.cpp
+++ b/dom/workers/ServiceWorkerPrivate.cpp
@@ -20,17 +20,16 @@
 #include "nsNetUtil.h"
 #include "nsProxyRelease.h"
 #include "nsQueryObject.h"
 #include "nsStreamUtils.h"
 #include "nsStringStream.h"
 #include "WorkerRunnable.h"
 #include "WorkerScope.h"
 #include "mozilla/Assertions.h"
-#include "mozilla/dom/DOMPreferences.h"
 #include "mozilla/dom/Client.h"
 #include "mozilla/dom/ClientIPCTypes.h"
 #include "mozilla/dom/FetchUtil.h"
 #include "mozilla/dom/IndexedDatabaseManager.h"
 #include "mozilla/dom/InternalHeaders.h"
 #include "mozilla/dom/NotificationEvent.h"
 #include "mozilla/dom/PromiseNativeHandler.h"
 #include "mozilla/dom/PushEventBinding.h"
@@ -1953,17 +1952,17 @@ ServiceWorkerPrivate::RemoveISupports(ns
 void
 ServiceWorkerPrivate::TerminateWorker()
 {
   AssertIsOnMainThread();
 
   mIdleWorkerTimer->Cancel();
   mIdleKeepAliveToken = nullptr;
   if (mWorkerPrivate) {
-    if (DOMPreferences::ServiceWorkersTestingEnabled()) {
+    if (Preferences::GetBool("dom.serviceWorkers.testing.enabled")) {
       nsCOMPtr<nsIObserverService> os = services::GetObserverService();
       if (os) {
         os->NotifyObservers(nullptr, "service-worker-shutdown", nullptr);
       }
     }
 
     Unused << NS_WARN_IF(!mWorkerPrivate->Terminate());
     mWorkerPrivate = nullptr;
--- a/dom/workers/ServiceWorkerRegistration.cpp
+++ b/dom/workers/ServiceWorkerRegistration.cpp
@@ -2,24 +2,24 @@
 /* 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 "ServiceWorkerRegistration.h"
 
 #include "ipc/ErrorIPCUtils.h"
-#include "mozilla/dom/DOMPreferences.h"
 #include "mozilla/dom/Notification.h"
 #include "mozilla/dom/Promise.h"
 #include "mozilla/dom/PromiseWindowProxy.h"
 #include "mozilla/dom/PromiseWorkerProxy.h"
 #include "mozilla/dom/PushManagerBinding.h"
 #include "mozilla/dom/PushManager.h"
 #include "mozilla/dom/ServiceWorkerRegistrationBinding.h"
+#include "mozilla/Preferences.h"
 #include "mozilla/Services.h"
 #include "mozilla/Unused.h"
 #include "nsCycleCollectionParticipant.h"
 #include "nsNetUtil.h"
 #include "nsServiceManagerUtils.h"
 #include "ServiceWorker.h"
 #include "ServiceWorkerManager.h"
 
@@ -33,16 +33,48 @@
 #include "Workers.h"
 #include "WorkerScope.h"
 
 using namespace mozilla::dom::workers;
 
 namespace mozilla {
 namespace dom {
 
+/* static */ bool
+ServiceWorkerRegistration::Visible(JSContext* aCx, JSObject* aObj)
+{
+  if (NS_IsMainThread()) {
+    return Preferences::GetBool("dom.serviceWorkers.enabled", false);
+  }
+
+  // Otherwise check the pref via the work private helper
+  WorkerPrivate* workerPrivate = GetWorkerPrivateFromContext(aCx);
+  if (!workerPrivate) {
+    return false;
+  }
+
+  return workerPrivate->ServiceWorkersEnabled();
+}
+
+/* static */ bool
+ServiceWorkerRegistration::NotificationAPIVisible(JSContext* aCx, JSObject* aObj)
+{
+  if (NS_IsMainThread()) {
+    return Preferences::GetBool("dom.webnotifications.serviceworker.enabled", false);
+  }
+
+  // Otherwise check the pref via the work private helper
+  WorkerPrivate* workerPrivate = GetWorkerPrivateFromContext(aCx);
+  if (!workerPrivate) {
+    return false;
+  }
+
+  return workerPrivate->DOMServiceWorkerNotificationEnabled();
+}
+
 ////////////////////////////////////////////////////
 // Main Thread implementation
 
 class ServiceWorkerRegistrationMainThread final : public ServiceWorkerRegistration,
                                                   public ServiceWorkerRegistrationListener
 {
   friend nsPIDOMWindowInner;
 public:
--- a/dom/workers/ServiceWorkerRegistration.h
+++ b/dom/workers/ServiceWorkerRegistration.h
@@ -3,21 +3,21 @@
 /* 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 mozilla_dom_ServiceWorkerRegistration_h
 #define mozilla_dom_ServiceWorkerRegistration_h
 
 #include "mozilla/DOMEventTargetHelper.h"
-#include "mozilla/dom/DOMPreferences.h"
 #include "mozilla/dom/ServiceWorkerBinding.h"
 #include "mozilla/dom/ServiceWorkerCommon.h"
 #include "mozilla/dom/ServiceWorkerRegistrationBinding.h"
 #include "mozilla/dom/workers/bindings/WorkerHolder.h"
+#include "nsContentUtils.h" // Required for nsContentUtils::PushEnabled
 
 // Support for Notification API extension.
 #include "mozilla/dom/NotificationBinding.h"
 
 class nsPIDOMWindowInner;
 
 namespace mozilla {
 namespace dom {
@@ -56,16 +56,23 @@ public:
 
 class ServiceWorkerRegistration : public DOMEventTargetHelper
 {
 public:
   NS_DECL_ISUPPORTS_INHERITED
 
   IMPL_EVENT_HANDLER(updatefound)
 
+  static bool
+  Visible(JSContext* aCx, JSObject* aObj);
+
+  static bool
+  NotificationAPIVisible(JSContext* aCx, JSObject* aObj);
+
+
   static already_AddRefed<ServiceWorkerRegistration>
   CreateForMainThread(nsPIDOMWindowInner* aWindow,
                       const nsAString& aScope);
 
   static already_AddRefed<ServiceWorkerRegistration>
   CreateForWorker(workers::WorkerPrivate* aWorkerPrivate,
                   const nsAString& aScope);
 
--- a/dom/workers/WorkerNavigator.cpp
+++ b/dom/workers/WorkerNavigator.cpp
@@ -1,16 +1,15 @@
 /* -*- 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 "mozilla/dom/BindingUtils.h"
-#include "mozilla/dom/DOMPreferences.h"
 #include "mozilla/dom/Promise.h"
 #include "mozilla/dom/PromiseWorkerProxy.h"
 #include "mozilla/dom/StorageManager.h"
 #include "mozilla/dom/WorkerNavigator.h"
 #include "mozilla/dom/WorkerNavigatorBinding.h"
 #include "mozilla/dom/network/Connection.h"
 
 #include "nsProxyRelease.h"
@@ -77,59 +76,59 @@ WorkerNavigator::SetLanguages(const nsTA
 
 void
 WorkerNavigator::GetAppName(nsString& aAppName, CallerType aCallerType) const
 {
   WorkerPrivate* workerPrivate = GetCurrentThreadWorkerPrivate();
   MOZ_ASSERT(workerPrivate);
 
   if ((!mProperties.mAppNameOverridden.IsEmpty() ||
-       DOMPreferences::ResistFingerprintingEnabled()) &&
+       workerPrivate->ResistFingerprintingEnabled()) &&
       !workerPrivate->UsesSystemPrincipal()) {
     // We will spoof this value when 'privacy.resistFingerprinting' is true.
     // See nsRFPService.h for spoofed value.
-    aAppName = DOMPreferences::ResistFingerprintingEnabled() ?
+    aAppName = workerPrivate->ResistFingerprintingEnabled() ?
       NS_LITERAL_STRING(SPOOFED_APPNAME) : mProperties.mAppNameOverridden;
   } else {
     aAppName = mProperties.mAppName;
   }
 }
 
 void
 WorkerNavigator::GetAppVersion(nsString& aAppVersion, CallerType aCallerType,
                                ErrorResult& aRv) const
 {
   WorkerPrivate* workerPrivate = GetCurrentThreadWorkerPrivate();
   MOZ_ASSERT(workerPrivate);
 
   if ((!mProperties.mAppVersionOverridden.IsEmpty() ||
-       DOMPreferences::ResistFingerprintingEnabled()) &&
+       workerPrivate->ResistFingerprintingEnabled()) &&
       !workerPrivate->UsesSystemPrincipal()) {
     // We will spoof this value when 'privacy.resistFingerprinting' is true.
     // See nsRFPService.h for spoofed value.
-    aAppVersion = DOMPreferences::ResistFingerprintingEnabled() ?
+    aAppVersion = workerPrivate->ResistFingerprintingEnabled() ?
       NS_LITERAL_STRING(SPOOFED_APPVERSION) : mProperties.mAppVersionOverridden;
   } else {
     aAppVersion = mProperties.mAppVersion;
   }
 }
 
 void
 WorkerNavigator::GetPlatform(nsString& aPlatform, CallerType aCallerType,
                              ErrorResult& aRv) const
 {
   WorkerPrivate* workerPrivate = GetCurrentThreadWorkerPrivate();
   MOZ_ASSERT(workerPrivate);
 
   if ((!mProperties.mPlatformOverridden.IsEmpty() ||
-       DOMPreferences::ResistFingerprintingEnabled()) &&
+       workerPrivate->ResistFingerprintingEnabled()) &&
       !workerPrivate->UsesSystemPrincipal()) {
     // We will spoof this value when 'privacy.resistFingerprinting' is true.
     // See nsRFPService.h for spoofed value.
-    aPlatform = DOMPreferences::ResistFingerprintingEnabled() ?
+    aPlatform = workerPrivate->ResistFingerprintingEnabled() ?
       NS_LITERAL_STRING(SPOOFED_PLATFORM) : mProperties.mPlatformOverridden;
   } else {
     aPlatform = mProperties.mPlatform;
   }
 }
 
 namespace {
 
new file mode 100644
--- /dev/null
+++ b/dom/workers/WorkerPrefs.h
@@ -0,0 +1,53 @@
+/* -*- 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/. */
+
+// This is the list of the preferences that are exposed to workers.
+// The format is as follows:
+//
+//   WORKER_SIMPLE_PREF("foo.bar", FooBar, FOO_BAR, UpdaterFunction)
+//
+//   * First argument is the name of the pref.
+//   * The name of the getter function.  This defines a FindName()
+//     function that returns the value of the pref on WorkerPrivate.
+//   * The macro version of the name.  This defines a WORKERPREF_FOO_BAR
+//     macro in Workers.h.
+//   * The name of the function that updates the new value of a pref.
+//
+//   WORKER_PREF("foo.bar", UpdaterFunction)
+//
+//   * First argument is the name of the pref.
+//   * The name of the function that updates the new value of a pref.
+
+#if !(defined(DEBUG) || defined(MOZ_ENABLE_JS_DUMP))
+WORKER_SIMPLE_PREF("browser.dom.window.dump.enabled", DumpEnabled, DUMP)
+#endif
+WORKER_SIMPLE_PREF("canvas.imagebitmap_extensions.enabled", ImageBitmapExtensionsEnabled, IMAGEBITMAP_EXTENSIONS_ENABLED)
+WORKER_SIMPLE_PREF("dom.caches.enabled", DOMCachesEnabled, DOM_CACHES)
+WORKER_SIMPLE_PREF("dom.caches.testing.enabled", DOMCachesTestingEnabled, DOM_CACHES_TESTING)
+WORKER_SIMPLE_PREF("dom.performance.enable_user_timing_logging", PerformanceLoggingEnabled, PERFORMANCE_LOGGING_ENABLED)
+WORKER_SIMPLE_PREF("dom.webnotifications.enabled", DOMWorkerNotificationEnabled, DOM_WORKERNOTIFICATION)
+WORKER_SIMPLE_PREF("dom.webnotifications.serviceworker.enabled", DOMServiceWorkerNotificationEnabled, DOM_SERVICEWORKERNOTIFICATION)
+WORKER_SIMPLE_PREF("dom.webnotifications.requireinteraction.enabled", DOMWorkerNotificationRIEnabled, DOM_WORKERNOTIFICATIONRI)
+WORKER_SIMPLE_PREF("dom.serviceWorkers.enabled", ServiceWorkersEnabled, SERVICEWORKERS_ENABLED)
+WORKER_SIMPLE_PREF("dom.serviceWorkers.testing.enabled", ServiceWorkersTestingEnabled, SERVICEWORKERS_TESTING_ENABLED)
+WORKER_SIMPLE_PREF("dom.storageManager.enabled", StorageManagerEnabled, STORAGEMANAGER_ENABLED)
+WORKER_SIMPLE_PREF("dom.promise_rejection_events.enabled", PromiseRejectionEventsEnabled, PROMISE_REJECTION_EVENTS_ENABLED)
+WORKER_SIMPLE_PREF("dom.push.enabled", PushEnabled, PUSH_ENABLED)
+WORKER_SIMPLE_PREF("dom.streams.enabled", StreamsEnabled, STREAMS_ENABLED)
+WORKER_SIMPLE_PREF("dom.requestcontext.enabled", RequestContextEnabled, REQUESTCONTEXT_ENABLED)
+WORKER_SIMPLE_PREF("gfx.offscreencanvas.enabled", OffscreenCanvasEnabled, OFFSCREENCANVAS_ENABLED)
+WORKER_SIMPLE_PREF("dom.webkitBlink.dirPicker.enabled", WebkitBlinkDirectoryPickerEnabled, DOM_WEBKITBLINK_DIRPICKER_WEBKITBLINK)
+WORKER_SIMPLE_PREF("dom.netinfo.enabled", NetworkInformationEnabled, NETWORKINFORMATION_ENABLED)
+WORKER_SIMPLE_PREF("dom.fetchObserver.enabled", FetchObserverEnabled, FETCHOBSERVER_ENABLED)
+WORKER_SIMPLE_PREF("privacy.resistFingerprinting", ResistFingerprintingEnabled, RESISTFINGERPRINTING_ENABLED)
+WORKER_SIMPLE_PREF("devtools.enabled", DevToolsEnabled, DEVTOOLS_ENABLED)
+WORKER_PREF("intl.accept_languages", PrefLanguagesChanged)
+WORKER_PREF("general.appname.override", AppNameOverrideChanged)
+WORKER_PREF("general.appversion.override", AppVersionOverrideChanged)
+WORKER_PREF("general.platform.override", PlatformOverrideChanged)
+#ifdef JS_GC_ZEAL
+WORKER_PREF("dom.workers.options.gcZeal", LoadGCZealOptions)
+#endif
--- a/dom/workers/WorkerPrivate.cpp
+++ b/dom/workers/WorkerPrivate.cpp
@@ -1372,16 +1372,38 @@ private:
   virtual bool
   WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate) override
   {
     aWorkerPrivate->UpdateContextOptionsInternal(aCx, mContextOptions);
     return true;
   }
 };
 
+class UpdatePreferenceRunnable final : public WorkerControlRunnable
+{
+  WorkerPreference mPref;
+  bool mValue;
+
+public:
+  UpdatePreferenceRunnable(WorkerPrivate* aWorkerPrivate,
+                           WorkerPreference aPref,
+                           bool aValue)
+    : WorkerControlRunnable(aWorkerPrivate, WorkerThreadUnchangedBusyCount),
+      mPref(aPref),
+      mValue(aValue)
+  { }
+
+  virtual bool
+  WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate) override
+  {
+    aWorkerPrivate->UpdatePreferenceInternal(mPref, mValue);
+    return true;
+  }
+};
+
 class UpdateLanguagesRunnable final : public WorkerRunnable
 {
   nsTArray<nsString> mLanguages;
 
 public:
   UpdateLanguagesRunnable(WorkerPrivate* aWorkerPrivate,
                           const nsTArray<nsString>& aLanguages)
     : WorkerRunnable(aWorkerPrivate),
@@ -3487,16 +3509,30 @@ WorkerPrivateParent<Derived>::UpdateCont
     new UpdateContextOptionsRunnable(ParentAsWorkerPrivate(), aContextOptions);
   if (!runnable->Dispatch()) {
     NS_WARNING("Failed to update worker context options!");
   }
 }
 
 template <class Derived>
 void
+WorkerPrivateParent<Derived>::UpdatePreference(WorkerPreference aPref, bool aValue)
+{
+  AssertIsOnParentThread();
+  MOZ_ASSERT(aPref >= 0 && aPref < WORKERPREF_COUNT);
+
+  RefPtr<UpdatePreferenceRunnable> runnable =
+    new UpdatePreferenceRunnable(ParentAsWorkerPrivate(), aPref, aValue);
+  if (!runnable->Dispatch()) {
+    NS_WARNING("Failed to update worker preferences!");
+  }
+}
+
+template <class Derived>
+void
 WorkerPrivateParent<Derived>::UpdateLanguages(const nsTArray<nsString>& aLanguages)
 {
   AssertIsOnParentThread();
 
   RefPtr<UpdateLanguagesRunnable> runnable =
     new UpdateLanguagesRunnable(ParentAsWorkerPrivate(), aLanguages);
   if (!runnable->Dispatch()) {
     NS_WARNING("Failed to update worker languages!");
@@ -4499,20 +4535,22 @@ WorkerPrivate::WorkerPrivate(WorkerPriva
   , mPeriodicGCTimerRunning(false)
   , mIdleGCTimerRunning(false)
   , mWorkerScriptExecutedSuccessfully(false)
   , mFetchHandlerWasAdded(false)
   , mOnLine(false)
 {
   if (aParent) {
     aParent->AssertIsOnWorkerThread();
+    aParent->GetAllPreferences(mPreferences);
     mOnLine = aParent->OnLine();
   }
   else {
     AssertIsOnMainThread();
+    RuntimeService::GetDefaultPreferences(mPreferences);
     mOnLine = !NS_IsOffline();
   }
 
   nsCOMPtr<nsISerialEventTarget> target;
 
   // A child worker just inherits the parent workers ThrottledEventQueue
   // and main thread target for now.  This is mainly due to the restriction
   // that ThrottledEventQueue can only be created on the main thread at the
@@ -6821,16 +6859,29 @@ WorkerPrivate::UpdateLanguagesInternal(c
   }
 
   for (uint32_t index = 0; index < mChildWorkers.Length(); index++) {
     mChildWorkers[index]->UpdateLanguages(aLanguages);
   }
 }
 
 void
+WorkerPrivate::UpdatePreferenceInternal(WorkerPreference aPref, bool aValue)
+{
+  AssertIsOnWorkerThread();
+  MOZ_ASSERT(aPref >= 0 && aPref < WORKERPREF_COUNT);
+
+  mPreferences[aPref] = aValue;
+
+  for (uint32_t index = 0; index < mChildWorkers.Length(); index++) {
+    mChildWorkers[index]->UpdatePreference(aPref, aValue);
+  }
+}
+
+void
 WorkerPrivate::UpdateJSWorkerMemoryParameterInternal(JSContext* aCx,
                                                      JSGCParamKey aKey,
                                                      uint32_t aValue)
 {
   AssertIsOnWorkerThread();
 
   // XXX aValue might be 0 here (telling us to unset a previous value for child
   // workers). Calling JS_SetGCParameter with a value of 0 isn't actually
--- a/dom/workers/WorkerPrivate.h
+++ b/dom/workers/WorkerPrivate.h
@@ -405,16 +405,19 @@ public:
 
   void
   UpdateContextOptions(const JS::ContextOptions& aContextOptions);
 
   void
   UpdateLanguages(const nsTArray<nsString>& aLanguages);
 
   void
+  UpdatePreference(WorkerPreference aPref, bool aValue);
+
+  void
   UpdateJSWorkerMemoryParameter(JSGCParamKey key, uint32_t value);
 
 #ifdef JS_GC_ZEAL
   void
   UpdateGCZeal(uint8_t aGCZeal, uint32_t aFrequency);
 #endif
 
   void
@@ -1071,16 +1074,17 @@ class WorkerPrivate : public WorkerPriva
   bool mTimerRunning;
   bool mRunningExpiredTimeouts;
   bool mPendingEventQueueClearing;
   bool mCancelAllPendingRunnables;
   bool mPeriodicGCTimerRunning;
   bool mIdleGCTimerRunning;
   bool mWorkerScriptExecutedSuccessfully;
   bool mFetchHandlerWasAdded;
+  bool mPreferences[WORKERPREF_COUNT];
   bool mOnLine;
 
 protected:
   ~WorkerPrivate();
 
 public:
   static already_AddRefed<WorkerPrivate>
   Constructor(const GlobalObject& aGlobal, const nsAString& aScriptURL,
@@ -1278,16 +1282,19 @@ public:
 
   void
   UpdateContextOptionsInternal(JSContext* aCx, const JS::ContextOptions& aContextOptions);
 
   void
   UpdateLanguagesInternal(const nsTArray<nsString>& aLanguages);
 
   void
+  UpdatePreferenceInternal(WorkerPreference aPref, bool aValue);
+
+  void
   UpdateJSWorkerMemoryParameterInternal(JSContext* aCx, JSGCParamKey key, uint32_t aValue);
 
   enum WorkerRanOrNot {
     WorkerNeverRan = 0,
     WorkerRan
   };
 
   void
@@ -1399,16 +1406,28 @@ public:
   CreateDebuggerGlobalScope(JSContext* aCx);
 
   bool
   RegisterBindings(JSContext* aCx, JS::Handle<JSObject*> aGlobal);
 
   bool
   RegisterDebuggerBindings(JSContext* aCx, JS::Handle<JSObject*> aGlobal);
 
+#define WORKER_SIMPLE_PREF(name, getter, NAME)                                \
+  bool                                                                        \
+  getter() const                                                              \
+  {                                                                           \
+    AssertIsOnWorkerThread();                                                 \
+    return mPreferences[WORKERPREF_##NAME];                                   \
+  }
+#define WORKER_PREF(name, callback)
+#include "WorkerPrefs.h"
+#undef WORKER_SIMPLE_PREF
+#undef WORKER_PREF
+
   bool
   OnLine() const
   {
     AssertIsOnWorkerThread();
     return mOnLine;
   }
 
   void
@@ -1559,16 +1578,23 @@ private:
   WaitForWorkerEvents(PRIntervalTime interval = PR_INTERVAL_NO_TIMEOUT);
 
   void
   PostMessageToParentInternal(JSContext* aCx,
                               JS::Handle<JS::Value> aMessage,
                               const Sequence<JSObject*>& aTransferable,
                               ErrorResult& aRv);
 
+  void
+  GetAllPreferences(bool aPreferences[WORKERPREF_COUNT]) const
+  {
+    AssertIsOnWorkerThread();
+    memcpy(aPreferences, mPreferences, WORKERPREF_COUNT * sizeof(bool));
+  }
+
   // If the worker shutdown status is equal or greater then aFailStatus, this
   // operation will fail and nullptr will be returned. See WorkerHolder.h for
   // more information about the correct value to use.
   already_AddRefed<nsIEventTarget>
   CreateNewSyncLoop(Status aFailStatus);
 
   bool
   RunCurrentSyncLoop();
--- a/dom/workers/WorkerScope.cpp
+++ b/dom/workers/WorkerScope.cpp
@@ -7,17 +7,16 @@
 #include "WorkerScope.h"
 
 #include "jsapi.h"
 #include "mozilla/EventListenerManager.h"
 #include "mozilla/dom/BindingDeclarations.h"
 #include "mozilla/dom/Clients.h"
 #include "mozilla/dom/Console.h"
 #include "mozilla/dom/DedicatedWorkerGlobalScopeBinding.h"
-#include "mozilla/dom/DOMPreferences.h"
 #include "mozilla/dom/Fetch.h"
 #include "mozilla/dom/FunctionBinding.h"
 #include "mozilla/dom/IDBFactory.h"
 #include "mozilla/dom/ImageBitmap.h"
 #include "mozilla/dom/ImageBitmapBinding.h"
 #include "mozilla/dom/Performance.h"
 #include "mozilla/dom/Promise.h"
 #include "mozilla/dom/PromiseWorkerProxy.h"
@@ -366,17 +365,17 @@ WorkerGlobalScope::Dump(const Optional<n
 {
   mWorkerPrivate->AssertIsOnWorkerThread();
 
   if (!aString.WasPassed()) {
     return;
   }
 
 #if !(defined(DEBUG) || defined(MOZ_ENABLE_JS_DUMP))
-  if (!DOMPreferences::DumpEnabled()) {
+  if (!mWorkerPrivate->DumpEnabled()) {
     return;
   }
 #endif
 
   NS_ConvertUTF16toUTF8 str(aString.Value());
 
   MOZ_LOG(nsContentUtils::DOMDumpLog(), LogLevel::Debug, ("[Worker.Dump] %s", str.get()));
 #ifdef ANDROID
@@ -475,17 +474,17 @@ WorkerGlobalScope::CreateImageBitmap(JSC
 already_AddRefed<mozilla::dom::Promise>
 WorkerGlobalScope::CreateImageBitmap(JSContext* aCx,
                                      const ImageBitmapSource& aImage,
                                      int32_t aOffset, int32_t aLength,
                                      ImageBitmapFormat aFormat,
                                      const Sequence<ChannelPixelLayout>& aLayout,
                                      ErrorResult& aRv)
 {
-  if (!DOMPreferences::ImageBitmapExtensionsEnabled()) {
+  if (!ImageBitmap::ExtensionsEnabled(aCx)) {
     aRv.Throw(NS_ERROR_TYPE_ERR);
     return nullptr;
   }
 
   if (aImage.IsArrayBuffer() || aImage.IsArrayBufferView()) {
     return ImageBitmap::Create(this, aImage, aOffset, aLength, aFormat, aLayout,
                                aRv);
   } else {
--- a/dom/workers/Workers.h
+++ b/dom/workers/Workers.h
@@ -181,16 +181,26 @@ struct JSSettings
       foundSetting->key.reset();
       return true;
     }
 
     return false;
   }
 };
 
+enum WorkerPreference
+{
+#define WORKER_SIMPLE_PREF(name, getter, NAME) WORKERPREF_ ## NAME,
+#define WORKER_PREF(name, callback)
+#include "mozilla/dom/WorkerPrefs.h"
+#undef WORKER_SIMPLE_PREF
+#undef WORKER_PREF
+  WORKERPREF_COUNT
+};
+
 // Implemented in WorkerPrivate.cpp
 
 struct WorkerLoadInfo
 {
   // All of these should be released in WorkerPrivateParent::ForgetMainThreadObjects.
   nsCOMPtr<nsIURI> mBaseURI;
   nsCOMPtr<nsIURI> mResolvedScriptURI;
 
--- a/dom/workers/moz.build
+++ b/dom/workers/moz.build
@@ -14,16 +14,17 @@ EXPORTS.mozilla.dom += [
     'ServiceWorkerContainer.h',
     'ServiceWorkerDescriptor.h',
     'ServiceWorkerEvents.h',
     'ServiceWorkerIPCUtils.h',
     'ServiceWorkerRegistrar.h',
     'ServiceWorkerRegistration.h',
     'WorkerLocation.h',
     'WorkerNavigator.h',
+    'WorkerPrefs.h',
     'WorkerPrivate.h',
     'WorkerRunnable.h',
     'WorkerScope.h',
 ]
 
 EXPORTS.mozilla.dom.workers += [
     'RuntimeService.h',
     'ServiceWorkerInfo.h',
--- a/dom/worklet/WorkletGlobalScope.cpp
+++ b/dom/worklet/WorkletGlobalScope.cpp
@@ -2,17 +2,17 @@
 /* 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 "WorkletGlobalScope.h"
 #include "mozilla/dom/WorkletGlobalScopeBinding.h"
 #include "mozilla/dom/Console.h"
-#include "mozilla/dom/DOMPreferences.h"
+#include "nsContentUtils.h"
 
 namespace mozilla {
 namespace dom {
 
 NS_IMPL_CYCLE_COLLECTION_CLASS(WorkletGlobalScope)
 
 NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(WorkletGlobalScope)
   NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
@@ -65,17 +65,17 @@ WorkletGlobalScope::GetConsole(ErrorResu
   }
 
   return mConsole;
 }
 
 void
 WorkletGlobalScope::Dump(const Optional<nsAString>& aString) const
 {
-  if (!DOMPreferences::DumpEnabled()) {
+  if (!nsContentUtils::DOMWindowDumpEnabled()) {
     return;
   }
 
   if (!aString.WasPassed()) {
     return;
   }
 
   NS_ConvertUTF16toUTF8 str(aString.Value());
--- a/js/xpconnect/loader/mozJSComponentLoader.cpp
+++ b/js/xpconnect/loader/mozJSComponentLoader.cpp
@@ -45,17 +45,16 @@
 #include "ScriptPreloader-inl.h"
 
 #include "mozilla/AddonPathService.h"
 #include "mozilla/scache/StartupCache.h"
 #include "mozilla/scache/StartupCacheUtils.h"
 #include "mozilla/MacroForEach.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/ScriptPreloader.h"
-#include "mozilla/dom/DOMPreferences.h"
 #include "mozilla/dom/ScriptSettings.h"
 #include "mozilla/UniquePtrExtensions.h"
 #include "mozilla/Unused.h"
 
 using namespace mozilla;
 using namespace mozilla::scache;
 using namespace mozilla::loader;
 using namespace xpc;
@@ -84,17 +83,17 @@ static LazyLogModule gJSCLLog("JSCompone
 #define ERROR_GETTING_ARRAY_LENGTH "%s - Error getting array length of EXPORTED_SYMBOLS."
 #define ERROR_ARRAY_ELEMENT "%s - EXPORTED_SYMBOLS[%d] is not a string."
 #define ERROR_GETTING_SYMBOL "%s - Could not get symbol '%s'."
 #define ERROR_SETTING_SYMBOL "%s - Could not set symbol '%s' on target object."
 
 static bool
 Dump(JSContext* cx, unsigned argc, Value* vp)
 {
-    if (!mozilla::dom::DOMPreferences::DumpEnabled()) {
+    if (!nsContentUtils::DOMWindowDumpEnabled()) {
         return true;
     }
 
     CallArgs args = CallArgsFromVp(argc, vp);
 
     if (args.length() == 0)
         return true;
 
--- a/js/xpconnect/src/Sandbox.cpp
+++ b/js/xpconnect/src/Sandbox.cpp
@@ -27,17 +27,16 @@
 #include "XPCWrapper.h"
 #include "XrayWrapper.h"
 #include "Crypto.h"
 #include "mozilla/dom/BindingUtils.h"
 #include "mozilla/dom/BlobBinding.h"
 #include "mozilla/dom/cache/CacheStorage.h"
 #include "mozilla/dom/CSSBinding.h"
 #include "mozilla/dom/DirectoryBinding.h"
-#include "mozilla/dom/DOMPreferences.h"
 #include "mozilla/dom/IndexedDatabaseManager.h"
 #include "mozilla/dom/Fetch.h"
 #include "mozilla/dom/FileBinding.h"
 #include "mozilla/dom/MessageChannelBinding.h"
 #include "mozilla/dom/MessagePortBinding.h"
 #include "mozilla/dom/PromiseBinding.h"
 #include "mozilla/dom/RequestBinding.h"
 #include "mozilla/dom/ResponseBinding.h"
@@ -110,17 +109,17 @@ xpc::NewSandboxConstructor()
     nsCOMPtr<nsIXPCComponents_utils_Sandbox> sbConstructor =
         new nsXPCComponents_utils_Sandbox();
     return sbConstructor.forget();
 }
 
 static bool
 SandboxDump(JSContext* cx, unsigned argc, Value* vp)
 {
-    if (!DOMPreferences::DumpEnabled()) {
+    if (!nsContentUtils::DOMWindowDumpEnabled()) {
         return true;
     }
 
     CallArgs args = CallArgsFromVp(argc, vp);
 
     if (args.length() == 0)
         return true;
 
--- a/js/xpconnect/src/XPCWrappedJSClass.cpp
+++ b/js/xpconnect/src/XPCWrappedJSClass.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/. */
 
 /* Sharable code and data for wrapper around JSObjects. */
 
 #include "xpcprivate.h"
 #include "jsprf.h"
 #include "nsArrayEnumerator.h"
+#include "nsContentUtils.h"
 #include "nsINamed.h"
 #include "nsIScriptError.h"
 #include "nsWrapperCache.h"
 #include "AccessCheck.h"
 #include "nsJSUtils.h"
 #include "nsPrintfCString.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/dom/BindingUtils.h"
 #include "mozilla/dom/DOMException.h"
 #include "mozilla/dom/DOMExceptionBinding.h"
-#include "mozilla/dom/DOMPreferences.h"
 #include "mozilla/jsipc/CrossProcessObjectWrappers.h"
 
 #include "jsapi.h"
 #include "jsfriendapi.h"
 
 using namespace xpc;
 using namespace JS;
 using namespace mozilla;
@@ -943,17 +943,17 @@ nsXPCWrappedJSClass::CheckForException(X
                 // just so that we can tell the JS engine to pass it back to us via the
                 // error reporting callback. This is all very dumb.
                 JS_SetPendingException(cx, js_exception);
                 aes.ReportException();
                 reportable = false;
             }
 
             if (reportable) {
-                if (DOMPreferences::DumpEnabled()) {
+                if (nsContentUtils::DOMWindowDumpEnabled()) {
                     static const char line[] =
                         "************************************************************\n";
                     static const char preamble[] =
                         "* Call to xpconnect wrapped JSObject produced this error:  *\n";
                     static const char cant_get_text[] =
                         "FAILED TO GET TEXT FROM EXCEPTION\n";
 
                     fputs(line, stdout);
--- a/js/xpconnect/src/nsXPConnect.cpp
+++ b/js/xpconnect/src/nsXPConnect.cpp
@@ -18,17 +18,16 @@
 #include "nsThreadUtils.h"
 #include "nsDOMJSUtils.h"
 
 #include "WrapperFactory.h"
 #include "AccessCheck.h"
 
 #include "mozilla/dom/BindingUtils.h"
 #include "mozilla/dom/DOMException.h"
-#include "mozilla/dom/DOMPreferences.h"
 #include "mozilla/dom/Exceptions.h"
 #include "mozilla/dom/Promise.h"
 
 #include "nsDOMMutationObserver.h"
 #include "nsICycleCollectorListener.h"
 #include "mozilla/XPTInterfaceInfoManager.h"
 #include "nsIObjectInputStream.h"
 #include "nsIObjectOutputStream.h"
@@ -265,31 +264,31 @@ xpc::ErrorBase::AppendErrorDetailsTo(nsC
     error.AppendInt(mLineNumber, 10);
     error.AppendLiteral(": ");
     error.Append(NS_LossyConvertUTF16toASCII(mErrorMsg));
 }
 
 void
 xpc::ErrorNote::LogToStderr()
 {
-    if (!DOMPreferences::DumpEnabled())
+    if (!nsContentUtils::DOMWindowDumpEnabled())
         return;
 
     nsAutoCString error;
     error.AssignLiteral("JavaScript note: ");
     AppendErrorDetailsTo(error);
 
     fprintf(stderr, "%s\n", error.get());
     fflush(stderr);
 }
 
 void
 xpc::ErrorReport::LogToStderr()
 {
-    if (!DOMPreferences::DumpEnabled())
+    if (!nsContentUtils::DOMWindowDumpEnabled())
         return;
 
     nsAutoCString error;
     error.AssignLiteral("JavaScript ");
     if (JSREPORT_IS_STRICT(mFlags))
         error.AppendLiteral("strict ");
     if (JSREPORT_IS_WARNING(mFlags))
         error.AppendLiteral("warning: ");
--- a/layout/build/nsLayoutStatics.cpp
+++ b/layout/build/nsLayoutStatics.cpp
@@ -314,19 +314,16 @@ nsLayoutStatics::Initialize()
   // 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();
-
-  mozilla::dom::DOMPreferences::Initialize();
-
   return NS_OK;
 }
 
 void
 nsLayoutStatics::Shutdown()
 {
   // Don't need to shutdown nsWindowMemoryReporter, that will be done by the
   // memory reporter manager.
--- a/layout/forms/nsFileControlFrame.cpp
+++ b/layout/forms/nsFileControlFrame.cpp
@@ -7,17 +7,16 @@
 #include "nsFileControlFrame.h"
 
 #include "nsGkAtoms.h"
 #include "nsCOMPtr.h"
 #include "nsIDocument.h"
 #include "mozilla/dom/NodeInfo.h"
 #include "mozilla/dom/Element.h"
 #include "mozilla/dom/DataTransfer.h"
-#include "mozilla/dom/DOMPreferences.h"
 #include "mozilla/dom/HTMLButtonElement.h"
 #include "mozilla/dom/HTMLInputElement.h"
 #include "mozilla/Preferences.h"
 #include "nsNodeInfoManager.h"
 #include "nsContentCreatorFunctions.h"
 #include "nsContentUtils.h"
 #include "mozilla/EventStates.h"
 #include "mozilla/dom/DOMStringList.h"
@@ -350,17 +349,17 @@ nsresult
 nsFileControlFrame::DnDListener::GetBlobImplForWebkitDirectory(nsIDOMFileList* aFileList,
                                                                BlobImpl** aBlobImpl)
 {
   *aBlobImpl = nullptr;
 
   HTMLInputElement* inputElement =
     HTMLInputElement::FromContent(mFrame->GetContent());
   bool webkitDirPicker =
-    DOMPreferences::WebkitBlinkDirectoryPickerEnabled() &&
+    Preferences::GetBool("dom.webkitBlink.dirPicker.enabled", false) &&
     inputElement->HasAttr(kNameSpaceID_None, nsGkAtoms::webkitdirectory);
   if (!webkitDirPicker) {
     return NS_OK;
   }
 
   if (!aFileList) {
     return NS_ERROR_FAILURE;
   }
--- a/modules/libpref/Preferences.cpp
+++ b/modules/libpref/Preferences.cpp
@@ -4985,26 +4985,16 @@ Preferences::AddAtomicUintVarCache(Atomi
 
 // Since the definition of template functions is not in a header file, we
 // need to explicitly specify the instantiations that are required. Currently
 // only the order=Relaxed variant is needed.
 template nsresult
 Preferences::AddAtomicBoolVarCache(Atomic<bool, Relaxed>*, const char*, bool);
 
 template nsresult
-Preferences::AddAtomicBoolVarCache(Atomic<bool, ReleaseAcquire>*,
-                                   const char*,
-                                   bool);
-
-template nsresult
-Preferences::AddAtomicBoolVarCache(Atomic<bool, SequentiallyConsistent>*,
-                                   const char*,
-                                   bool);
-
-template nsresult
 Preferences::AddAtomicIntVarCache(Atomic<int32_t, Relaxed>*,
                                   const char*,
                                   int32_t);
 
 template nsresult
 Preferences::AddAtomicUintVarCache(Atomic<uint32_t, Relaxed>*,
                                    const char*,
                                    uint32_t);