Bug 1779000 - Part 3: Remove helper functions for prefs r=asuth

Differential Revision: https://phabricator.services.mozilla.com/D151505
This commit is contained in:
Kagami Sascha Rosylight 2022-07-15 03:22:32 +00:00
Родитель d556fc498d
Коммит c28df77d9b
9 изменённых файлов: 12 добавлений и 48 удалений

Просмотреть файл

@ -15001,7 +15001,7 @@ mozilla::ipc::IPCResult MutableFile::RecvGetFileId(int64_t* aFileId) {
AssertIsOnBackgroundThread();
MOZ_ASSERT(mFileInfo);
if (NS_WARN_IF(!IndexedDatabaseManager::InTestingMode())) {
if (NS_WARN_IF(!StaticPrefs::dom_indexedDB_testing())) {
return IPC_FAIL(this, "IndexedDB must be in testing mode!");
}
@ -21310,8 +21310,8 @@ mozilla::ipc::IPCResult Utils::RecvGetFileReferences(
return IPC_FAIL(this, "No QuotaManager active!");
}
if (NS_WARN_IF(!IndexedDatabaseManager::InTestingMode())) {
return IPC_FAIL(this, "IndexedDatabaseManager is not InTestingMode!");
if (NS_WARN_IF(!StaticPrefs::dom_indexedDB_testing())) {
return IPC_FAIL(this, "IndexedDB is not in testing mode!");
}
if (NS_WARN_IF(!IsValidPersistenceType(aPersistenceType))) {

Просмотреть файл

@ -403,7 +403,7 @@ GetStructuredCloneReadInfoFromExternalBlob(
QM_TRY(OkIf(index < files.Length()), Err(NS_ERROR_UNEXPECTED),
[](const auto&) { MOZ_ASSERT(false, "Bad index value!"); });
if (IndexedDatabaseManager::PreprocessingEnabled()) {
if (StaticPrefs::dom_indexedDB_preprocessing()) {
return StructuredCloneReadInfoParent{
JSStructuredCloneData{JS::StructuredCloneScope::DifferentProcess},
std::move(files), true};

Просмотреть файл

@ -483,7 +483,7 @@ RefPtr<IDBTransaction> IDBDatabase::Transaction(
if ((aMode == IDBTransactionMode::Readwriteflush ||
aMode == IDBTransactionMode::Cleanup) &&
!IndexedDatabaseManager::ExperimentalFeaturesEnabled()) {
!StaticPrefs::dom_indexedDB_experimental()) {
// Pretend that this mode doesn't exist. We don't have a way to annotate
// certain enum values as depending on preferences so we just duplicate the
// normal exception generation here.

Просмотреть файл

@ -335,7 +335,7 @@ RefPtr<IDBOpenDBRequest> IDBOpenDBRequest::Create(
aFactory->AssertIsOnOwningThread();
MOZ_ASSERT(aGlobal);
bool fileHandleDisabled = !IndexedDatabaseManager::IsFileHandleEnabled();
bool fileHandleDisabled = !StaticPrefs::dom_fileHandle_enabled();
RefPtr<IDBOpenDBRequest> request =
new IDBOpenDBRequest(std::move(aFactory), aGlobal, fileHandleDisabled);

Просмотреть файл

@ -421,11 +421,6 @@ mozilla::LogModule* IndexedDatabaseManager::GetLoggingModule() {
#endif // DEBUG
// static
bool IndexedDatabaseManager::InTestingMode() {
return StaticPrefs::dom_indexedDB_testing();
}
// static
bool IndexedDatabaseManager::FullSynchronous() {
MOZ_ASSERT(gDBManager,
@ -434,22 +429,6 @@ bool IndexedDatabaseManager::FullSynchronous() {
return sFullSynchronousMode;
}
// static
bool IndexedDatabaseManager::ExperimentalFeaturesEnabled() {
return StaticPrefs::dom_indexedDB_experimental();
}
// static
bool IndexedDatabaseManager::ExperimentalFeaturesEnabled(JSContext* aCx,
JSObject* aGlobal) {
return ExperimentalFeaturesEnabled();
}
// static
bool IndexedDatabaseManager::IsFileHandleEnabled() {
return StaticPrefs::dom_fileHandle_enabled();
}
// static
uint32_t IndexedDatabaseManager::DataThreshold() {
MOZ_ASSERT(gDBManager,
@ -468,11 +447,6 @@ uint32_t IndexedDatabaseManager::MaxSerializedMsgSize() {
return gMaxSerializedMsgSize;
}
// static
bool IndexedDatabaseManager::PreprocessingEnabled() {
return StaticPrefs::dom_indexedDB_preprocessing();
}
// static
int32_t IndexedDatabaseManager::MaxPreloadExtraRecords() {
MOZ_ASSERT(gDBManager,
@ -561,7 +535,7 @@ nsresult IndexedDatabaseManager::BlockAndGetFileReferences(
int32_t* aDBRefCnt, bool* aResult) {
MOZ_ASSERT(NS_IsMainThread());
if (NS_WARN_IF(!InTestingMode())) {
if (NS_WARN_IF(!StaticPrefs::dom_indexedDB_testing())) {
return NS_ERROR_UNEXPECTED;
}
@ -599,7 +573,7 @@ nsresult IndexedDatabaseManager::BlockAndGetFileReferences(
nsresult IndexedDatabaseManager::FlushPendingFileDeletions() {
MOZ_ASSERT(NS_IsMainThread());
if (NS_WARN_IF(!InTestingMode())) {
if (NS_WARN_IF(!StaticPrefs::dom_indexedDB_testing())) {
return NS_ERROR_UNEXPECTED;
}

Просмотреть файл

@ -65,8 +65,6 @@ class IndexedDatabaseManager final {
}
#endif
static bool InTestingMode();
static bool FullSynchronous();
static LoggingMode GetLoggingMode()
@ -87,18 +85,10 @@ class IndexedDatabaseManager final {
}
#endif
static bool ExperimentalFeaturesEnabled();
static bool ExperimentalFeaturesEnabled(JSContext* aCx, JSObject* aGlobal);
static bool IsFileHandleEnabled();
static uint32_t DataThreshold();
static uint32_t MaxSerializedMsgSize();
static bool PreprocessingEnabled();
// The maximum number of extra entries to preload in an Cursor::OpenOp or
// Cursor::ContinueOp.
static int32_t MaxPreloadExtraRecords();

Просмотреть файл

@ -34,10 +34,10 @@ interface IDBIndex {
// <null>: Not locale-aware, uses normal JS sorting.
// <string>: Sorted based on the rules of the specified locale.
// Note: never returns "auto", only the current locale.
[Func="mozilla::dom::IndexedDatabaseManager::ExperimentalFeaturesEnabled"]
[Pref="dom.indexedDB.experimental"]
readonly attribute DOMString? locale;
[Func="mozilla::dom::IndexedDatabaseManager::ExperimentalFeaturesEnabled"]
[Pref="dom.indexedDB.experimental"]
readonly attribute boolean isAutoLocale;
[Throws]

Просмотреть файл

@ -34,7 +34,7 @@ interface IDBKeyRange {
};
[Exposed=(Window,Worker),
Func="mozilla::dom::IndexedDatabaseManager::ExperimentalFeaturesEnabled"]
Pref="dom.indexedDB.experimental"]
interface IDBLocaleAwareKeyRange : IDBKeyRange {
[NewObject, Throws]
static IDBLocaleAwareKeyRange bound (any lower, any upper, optional boolean lowerOpen = false, optional boolean upperOpen = false);

Просмотреть файл

@ -12,7 +12,7 @@ enum IDBTransactionMode {
"readonly",
"readwrite",
// The "readwriteflush" mode is only available when the
// |IndexedDatabaseManager::ExperimentalFeaturesEnabled()| function returns
// |dom.indexedDB.experimental| pref returns
// true. This mode is not yet part of the standard.
"readwriteflush",
"cleanup",