Bug 1488583 - Remove unsupported, misleading "dom.indexedDB.enabled" preference r=ttung

There were 3 checks for this preference.  Prior to bug 1079355 which ignored the
pref for system principals, the checks were all straightforward pref checks.

The conditionals are somewhat confusing as written.  The main idea is the code
inside the blocks only executes if:
- The preference is disabled.
- The RV was success (we don't want to steal error handling, just prevent
  success.)
- We're not dealing with the system principal.

As such, I'm removing the full conditional blocks.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Andrew Sutherland 2019-11-05 08:13:45 +00:00
Родитель be66409383
Коммит 9f7be5494d
3 изменённых файлов: 0 добавлений и 28 удалений

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

@ -255,8 +255,6 @@ constexpr auto kSQLiteJournalSuffix = NS_LITERAL_STRING(".sqlite-journal");
constexpr auto kSQLiteSHMSuffix = NS_LITERAL_STRING(".sqlite-shm");
constexpr auto kSQLiteWALSuffix = NS_LITERAL_STRING(".sqlite-wal");
const char kPrefIndexedDBEnabled[] = "dom.indexedDB.enabled";
const char kPrefFileHandleEnabled[] = "dom.fileHandle.enabled";
constexpr auto kPermissionStringBase = NS_LITERAL_CSTRING("indexedDB-chrome-");
@ -19655,16 +19653,6 @@ nsresult FactoryOp::CheckPermission(
return NS_ERROR_DOM_INDEXEDDB_NOT_ALLOWED_ERR;
}
if (NS_WARN_IF(!Preferences::GetBool(kPrefIndexedDBEnabled, false))) {
if (aContentParent) {
// The DOM in the other process should have kept us from receiving any
// indexedDB messages so assume that the child is misbehaving.
aContentParent->KillHard("IndexedDB CheckPermission 1");
}
return NS_ERROR_DOM_INDEXEDDB_NOT_ALLOWED_ERR;
}
const ContentPrincipalInfo& contentPrincipalInfo =
principalInfo.get_ContentPrincipalInfo();
if (contentPrincipalInfo.attrs().mPrivateBrowsingId != 0) {

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

@ -54,8 +54,6 @@ using namespace mozilla::ipc;
namespace {
const char kPrefIndexedDBEnabled[] = "dom.indexedDB.enabled";
Telemetry::LABELS_IDB_CUSTOM_OPEN_WITH_OPTIONS_COUNT IdentifyPrincipalType(
const mozilla::ipc::PrincipalInfo& aPrincipalInfo) {
switch (aPrincipalInfo.type()) {
@ -144,12 +142,6 @@ nsresult IDBFactory::CreateForWindow(nsPIDOMWindowInner* aWindow,
nsCOMPtr<nsIPrincipal> principal;
nsresult rv = AllowedForWindowInternal(aWindow, getter_AddRefs(principal));
if (!(NS_SUCCEEDED(rv) && nsContentUtils::IsSystemPrincipal(principal)) &&
NS_WARN_IF(!Preferences::GetBool(kPrefIndexedDBEnabled, false))) {
*aFactory = nullptr;
return NS_ERROR_DOM_INDEXEDDB_NOT_ALLOWED_ERR;
}
if (rv == NS_ERROR_DOM_NOT_SUPPORTED_ERR) {
NS_WARNING("IndexedDB is not permitted in a third-party window.");
*aFactory = nullptr;
@ -268,12 +260,6 @@ nsresult IDBFactory::CreateForMainThreadJSInternal(
MOZ_ASSERT(aGlobal);
MOZ_ASSERT(aPrincipalInfo);
if (aPrincipalInfo->type() != PrincipalInfo::TSystemPrincipalInfo &&
NS_WARN_IF(!Preferences::GetBool(kPrefIndexedDBEnabled, false))) {
*aFactory = nullptr;
return NS_ERROR_DOM_INDEXEDDB_NOT_ALLOWED_ERR;
}
IndexedDatabaseManager* mgr = IndexedDatabaseManager::GetOrCreate();
if (NS_WARN_IF(!mgr)) {
IDB_REPORT_INTERNAL_ERR();

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

@ -233,8 +233,6 @@ pref("browser.download.forbid_open_with", false);
// Insecure registerProtocolHandler is disabled by default
pref("dom.registerProtocolHandler.insecure.enabled", false);
// Whether or not indexedDB is enabled.
pref("dom.indexedDB.enabled", true);
// Whether or not indexedDB experimental features are enabled.
pref("dom.indexedDB.experimental", false);
// Enable indexedDB logging.