Bug 1490044 - Remove DOMPrefs. r=bzbarsky

Differential Revision: https://phabricator.services.mozilla.com/D33510

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Andrea Marchesini 2019-06-13 09:02:03 +00:00
parent dbaf607895
commit bb718d74fc
35 changed files with 27 additions and 104 deletions

View File

@ -1,34 +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 "DOMPrefs.h"
#include "mozilla/Atomics.h"
#include "mozilla/Preferences.h"
#include "mozilla/StaticPrefs.h"
namespace mozilla {
namespace dom {
void DOMPrefs::Initialize() {
MOZ_ASSERT(NS_IsMainThread());
// Let's cache all the values on the main-thread.
#if !(defined(DEBUG) || defined(MOZ_ENABLE_JS_DUMP))
DOMPrefs::DumpEnabled();
#endif
}
/* static */
bool DOMPrefs::DumpEnabled() {
#if !(defined(DEBUG) || defined(MOZ_ENABLE_JS_DUMP))
return StaticPrefs::browser_dom_window_dump_enabled();
#else
return true;
#endif
}
} // namespace dom
} // namespace mozilla

View File

@ -1,25 +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_DOMPrefs_h
#define mozilla_dom_DOMPrefs_h
namespace mozilla {
namespace dom {
class DOMPrefs 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();
};
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_DOMPrefs_h

View File

@ -6,8 +6,8 @@
#include "mozilla/dom/MessageManagerGlobal.h"
#include "mozilla/IntentionalCrash.h"
#include "mozilla/dom/DOMPrefs.h"
#include "nsContentUtils.h"
#include "nsJSUtils.h"
#ifdef ANDROID
# include <android/log.h>
@ -20,7 +20,7 @@ namespace mozilla {
namespace dom {
void MessageManagerGlobal::Dump(const nsAString& aStr) {
if (!DOMPrefs::DumpEnabled()) {
if (!nsJSUtils::DumpEnabled()) {
return;
}

View File

@ -13,7 +13,6 @@
#include "mozilla/dom/StructuredCloneBlob.h"
#include "mozilla/dom/Directory.h"
#include "mozilla/dom/DirectoryBinding.h"
#include "mozilla/dom/DOMPrefs.h"
#include "mozilla/dom/File.h"
#include "mozilla/dom/FileList.h"
#include "mozilla/dom/FileListBinding.h"

View File

@ -174,7 +174,6 @@ EXPORTS.mozilla.dom += [
'DOMMozPromiseRequestHolder.h',
'DOMParser.h',
'DOMPoint.h',
'DOMPrefs.h',
'DOMQuad.h',
'DOMRect.h',
'DOMRequest.h',
@ -291,7 +290,6 @@ UNIFIED_SOURCES += [
'DOMMatrix.cpp',
'DOMParser.cpp',
'DOMPoint.cpp',
'DOMPrefs.cpp',
'DOMQuad.cpp',
'DOMRect.cpp',
'DOMRequest.cpp',

View File

@ -20,7 +20,6 @@
#include "mozilla/dom/ContentFrameMessageManager.h"
#include "mozilla/dom/DocumentInlines.h"
#include "mozilla/dom/DOMJSProxyHandler.h"
#include "mozilla/dom/DOMPrefs.h"
#include "mozilla/dom/EventTarget.h"
#include "mozilla/dom/LocalStorage.h"
#include "mozilla/dom/LocalStorageCommon.h"
@ -3412,7 +3411,7 @@ bool nsGlobalWindowInner::GetFullScreen() {
}
void nsGlobalWindowInner::Dump(const nsAString& aStr) {
if (!DOMPrefs::DumpEnabled()) {
if (!nsJSUtils::DumpEnabled()) {
return;
}

View File

@ -34,7 +34,6 @@
#include "nsSize.h"
#include "mozilla/FlushType.h"
#include "prclist.h"
#include "mozilla/dom/DOMPrefs.h"
#include "mozilla/dom/BindingDeclarations.h"
#include "mozilla/dom/ChromeMessageBroadcaster.h"
#include "mozilla/dom/NavigatorBinding.h"

View File

@ -32,6 +32,7 @@
#include "nsGlobalWindow.h"
#include "nsXBLPrototypeBinding.h"
#include "mozilla/CycleCollectedJSContext.h"
#include "mozilla/StaticPrefs.h"
#include "mozilla/dom/BindingUtils.h"
#include "mozilla/dom/Date.h"
#include "mozilla/dom/Element.h"
@ -584,6 +585,15 @@ bool nsJSUtils::GetScopeChainForXBL(
/* static */
void nsJSUtils::ResetTimeZone() { JS::ResetTimeZone(); }
/* static */
bool nsJSUtils::DumpEnabled() {
#if defined(DEBUG) || defined(MOZ_ENABLE_JS_DUMP)
return true;
#else
return StaticPrefs::browser_dom_window_dump_enabled();
#endif
}
//
// nsDOMJSUtils.h
//

View File

@ -237,6 +237,8 @@ class nsJSUtils {
JS::MutableHandleVector<JSObject*> aScopeChain);
static void ResetTimeZone();
static bool DumpEnabled();
};
template <typename T>

1
dom/cache/Cache.cpp vendored
View File

@ -17,7 +17,6 @@
#include "mozilla/dom/cache/CacheChild.h"
#include "mozilla/dom/cache/CacheWorkerHolder.h"
#include "mozilla/dom/cache/ReadStream.h"
#include "mozilla/dom/DOMPrefs.h"
#include "mozilla/ErrorResult.h"
#include "mozilla/Preferences.h"
#include "mozilla/Unused.h"

View File

@ -6,7 +6,6 @@
#include "mozilla/dom/ImageBitmap.h"
#include "mozilla/CheckedInt.h"
#include "mozilla/dom/DOMPrefs.h"
#include "mozilla/dom/HTMLMediaElementBinding.h"
#include "mozilla/dom/ImageBitmapBinding.h"
#include "mozilla/dom/Promise.h"

View File

@ -6,7 +6,6 @@
#include "OffscreenCanvas.h"
#include "mozilla/dom/DOMPrefs.h"
#include "mozilla/dom/OffscreenCanvasBinding.h"
#include "mozilla/dom/WorkerPrivate.h"
#include "mozilla/dom/WorkerScope.h"

View File

@ -9,7 +9,6 @@
#include "gfxTypes.h"
#include "mozilla/DOMEventTargetHelper.h"
#include "mozilla/dom/DOMPrefs.h"
#include "mozilla/layers/LayersTypes.h"
#include "mozilla/RefPtr.h"
#include "CanvasRenderingContextHelper.h"

View File

@ -11,7 +11,6 @@
#include "mozilla/dom/BlobBinding.h"
#include "mozilla/dom/Document.h"
#include "mozilla/dom/DOMPrefs.h"
#include "mozilla/dom/Exceptions.h"
#include "mozilla/dom/File.h"
#include "mozilla/dom/FunctionBinding.h"

View File

@ -36,7 +36,6 @@
#include "mozilla/dom/ClientOpenWindowOpActors.h"
#include "mozilla/dom/ChildProcessMessageManager.h"
#include "mozilla/dom/ContentProcessMessageManager.h"
#include "mozilla/dom/DOMPrefs.h"
#include "mozilla/dom/ContentParent.h"
#include "mozilla/dom/DataTransfer.h"
#include "mozilla/dom/DocGroup.h"
@ -1346,8 +1345,6 @@ void ContentChild::InitXPCOM(
// Set the dynamic scalar definitions for this process.
TelemetryIPC::AddDynamicScalarDefinitions(aXPCOMInit.dynamicScalarDefs());
DOMPrefs::Initialize();
}
mozilla::ipc::IPCResult ContentChild::RecvRequestMemoryReport(

View File

@ -9,7 +9,6 @@
#include "mozilla/Attributes.h"
#include "mozilla/DOMEventTargetHelper.h"
#include "mozilla/dom/DOMPrefs.h"
#include "nsCOMPtr.h"
#include "nsDOMNavigationTiming.h"

View File

@ -11,7 +11,6 @@
#include "nsISupports.h"
#include "nsTArray.h"
#include "nsWrapperCache.h"
#include "mozilla/dom/DOMPrefs.h"
#include "mozilla/dom/PerformanceEntryBinding.h"
namespace mozilla {

View File

@ -32,7 +32,6 @@
#include "mozilla/ErrorResult.h"
#include "mozilla/dom/BindingDeclarations.h"
#include "mozilla/dom/TypedArray.h"
#include "mozilla/dom/DOMPrefs.h"
#include "nsCOMPtr.h"
#include "mozilla/RefPtr.h"

View File

@ -16,7 +16,6 @@
#include "mozilla/RefPtr.h"
#include "mozilla/dom/BindingDeclarations.h"
#include "mozilla/dom/DOMPrefs.h"
#include "mozilla/dom/PushSubscriptionBinding.h"
#include "mozilla/dom/PushSubscriptionOptionsBinding.h"
#include "mozilla/dom/TypedArray.h"

View File

@ -10,7 +10,6 @@
#include "nsCycleCollectionParticipant.h"
#include "nsTArray.h"
#include "nsWrapperCache.h"
#include "mozilla/dom/DOMPrefs.h"
class nsIGlobalObject;

View File

@ -6,7 +6,6 @@
#include "StorageManager.h"
#include "mozilla/dom/DOMPrefs.h"
#include "mozilla/dom/PromiseWorkerProxy.h"
#include "mozilla/dom/quota/QuotaManagerService.h"
#include "mozilla/dom/StorageManagerBinding.h"

View File

@ -7,7 +7,6 @@
#ifndef mozilla_dom_serviceworkerevents_h__
#define mozilla_dom_serviceworkerevents_h__
#include "mozilla/dom/DOMPrefs.h"
#include "mozilla/dom/Event.h"
#include "mozilla/dom/ExtendableEventBinding.h"
#include "mozilla/dom/ExtendableMessageEventBinding.h"

View File

@ -40,7 +40,6 @@
#include "mozilla/dom/ClientSource.h"
#include "mozilla/dom/ConsoleUtils.h"
#include "mozilla/dom/ContentParent.h"
#include "mozilla/dom/DOMPrefs.h"
#include "mozilla/dom/ErrorEvent.h"
#include "mozilla/dom/Headers.h"
#include "mozilla/dom/InternalHeaders.h"

View File

@ -8,7 +8,6 @@
#define mozilla_dom_ServiceWorkerRegistration_h
#include "mozilla/DOMEventTargetHelper.h"
#include "mozilla/dom/DOMPrefs.h"
#include "mozilla/dom/ServiceWorkerBinding.h"
#include "mozilla/dom/ServiceWorkerRegistrationBinding.h"
#include "mozilla/dom/ServiceWorkerRegistrationDescriptor.h"

View File

@ -7,7 +7,6 @@
#include "ServiceWorkerRegistrationImpl.h"
#include "ipc/ErrorIPCUtils.h"
#include "mozilla/dom/DOMPrefs.h"
#include "mozilla/dom/Promise.h"
#include "mozilla/dom/PromiseWorkerProxy.h"
#include "mozilla/dom/PushManagerBinding.h"

View File

@ -14,7 +14,6 @@
#include "mozilla/dom/ClientState.h"
#include "mozilla/dom/Console.h"
#include "mozilla/dom/DedicatedWorkerGlobalScopeBinding.h"
#include "mozilla/dom/DOMPrefs.h"
#include "mozilla/dom/Fetch.h"
#include "mozilla/dom/FunctionBinding.h"
#include "mozilla/dom/IDBFactory.h"
@ -31,8 +30,9 @@
#include "mozilla/dom/WorkerLocation.h"
#include "mozilla/dom/WorkerNavigator.h"
#include "mozilla/dom/cache/CacheStorage.h"
#include "mozilla/StaticPrefs.h"
#include "mozilla/StorageAccess.h"
#include "nsContentUtils.h"
#include "nsJSUtils.h"
#include "nsServiceManagerUtils.h"
#include "mozilla/dom/Document.h"
@ -347,11 +347,9 @@ void WorkerGlobalScope::Dump(const Optional<nsAString>& aString) const {
return;
}
#if !(defined(DEBUG) || defined(MOZ_ENABLE_JS_DUMP))
if (!DOMPrefs::DumpEnabled()) {
if (!nsJSUtils::DumpEnabled()) {
return;
}
#endif
NS_ConvertUTF16toUTF8 str(aString.Value());

View File

@ -10,7 +10,6 @@
#include "mozilla/Attributes.h"
#include "mozilla/dom/WorkerCommon.h"
#include "mozilla/DOMEventTargetHelper.h"
#include "mozilla/dom/DOMPrefs.h"
#include "mozilla/dom/Headers.h"
#include "mozilla/dom/RequestBinding.h"
#include "nsWeakReference.h"

View File

@ -16,6 +16,7 @@
#include "mozilla/dom/ScriptSettings.h"
#include "mozilla/dom/ScriptLoader.h"
#include "mozilla/dom/WorkletImpl.h"
#include "mozilla/StaticPrefs.h"
#include "js/CompilationAndEvaluation.h"
#include "js/SourceText.h"
#include "nsIInputStreamPump.h"

View File

@ -8,7 +8,7 @@
#include "mozilla/dom/WorkletGlobalScopeBinding.h"
#include "mozilla/dom/WorkletImpl.h"
#include "mozilla/dom/Console.h"
#include "mozilla/StaticPrefs.h"
#include "nsJSUtils.h"
namespace mozilla {
namespace dom {
@ -66,7 +66,7 @@ already_AddRefed<Console> WorkletGlobalScope::GetConsole(JSContext* aCx,
void WorkletGlobalScope::Dump(const Optional<nsAString>& aString) const {
WorkletThread::AssertIsOnWorkletThread();
if (!StaticPrefs::browser_dom_window_dump_enabled()) {
if (!nsJSUtils::DumpEnabled()) {
return;
}

View File

@ -55,7 +55,6 @@
#include "mozilla/Preferences.h"
#include "mozilla/ResultExtensions.h"
#include "mozilla/ScriptPreloader.h"
#include "mozilla/dom/DOMPrefs.h"
#include "mozilla/dom/ScriptSettings.h"
#include "mozilla/ResultExtensions.h"
#include "mozilla/UniquePtrExtensions.h"
@ -93,7 +92,7 @@ static LazyLogModule gJSCLLog("JSComponentLoader");
#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::DOMPrefs::DumpEnabled()) {
if (!nsJSUtils::DumpEnabled()) {
return true;
}

View File

@ -37,7 +37,6 @@
#include "mozilla/dom/CSSRuleBinding.h"
#include "mozilla/dom/DirectoryBinding.h"
#include "mozilla/dom/DOMParserBinding.h"
#include "mozilla/dom/DOMPrefs.h"
#include "mozilla/dom/ElementBinding.h"
#include "mozilla/dom/EventBinding.h"
#include "mozilla/dom/IndexedDatabaseManager.h"
@ -125,7 +124,7 @@ already_AddRefed<nsIXPCComponents_utils_Sandbox> xpc::NewSandboxConstructor() {
}
static bool SandboxDump(JSContext* cx, unsigned argc, Value* vp) {
if (!DOMPrefs::DumpEnabled()) {
if (!nsJSUtils::DumpEnabled()) {
return true;
}

View File

@ -19,7 +19,6 @@
#include "mozilla/dom/BindingUtils.h"
#include "mozilla/dom/DOMException.h"
#include "mozilla/dom/DOMExceptionBinding.h"
#include "mozilla/dom/DOMPrefs.h"
#include "mozilla/dom/MozQueryInterface.h"
#include "mozilla/jsipc/CrossProcessObjectWrappers.h"
@ -657,7 +656,7 @@ nsresult nsXPCWrappedJS::CheckForException(XPCCallContext& ccx,
}
if (reportable) {
if (DOMPrefs::DumpEnabled()) {
if (nsJSUtils::DumpEnabled()) {
static const char line[] =
"************************************************************\n";
static const char preamble[] =

View File

@ -24,7 +24,6 @@
#include "mozilla/dom/BindingUtils.h"
#include "mozilla/dom/DOMException.h"
#include "mozilla/dom/DOMPrefs.h"
#include "mozilla/dom/Exceptions.h"
#include "mozilla/dom/Promise.h"
@ -38,6 +37,7 @@
#include "nsIScriptError.h"
#include "nsContentUtils.h"
#include "nsScriptError.h"
#include "nsJSUtils.h"
using namespace mozilla;
using namespace mozilla::dom;
@ -259,7 +259,7 @@ void xpc::ErrorBase::AppendErrorDetailsTo(nsCString& error) {
}
void xpc::ErrorNote::LogToStderr() {
if (!DOMPrefs::DumpEnabled()) {
if (!nsJSUtils::DumpEnabled()) {
return;
}
@ -272,7 +272,7 @@ void xpc::ErrorNote::LogToStderr() {
}
void xpc::ErrorReport::LogToStderr() {
if (!DOMPrefs::DumpEnabled()) {
if (!nsJSUtils::DumpEnabled()) {
return;
}

View File

@ -302,7 +302,6 @@ nsresult nsLayoutStatics::Initialize() {
if (XRE_IsParentProcess()) {
// On content process we initialize these components when PContentChild is
// fully initialized.
mozilla::dom::DOMPrefs::Initialize();
mozilla::dom::RemoteWorkerService::Initialize();
// This one should be initialized on the parent only
mozilla::dom::BrowserParent::InitializeStatics();

View File

@ -9,7 +9,6 @@
#include "mozilla/AbstractThread.h"
#include "mozilla/Preferences.h"
#include "mozilla/dom/DocGroup.h"
#include "mozilla/dom/DOMPrefs.h"
#include "mozilla/dom/TabGroup.h"
#include "mozilla/SchedulerGroup.h"
#include "mozilla/TaskCategory.h"