Commit 0b8b4186 authored by Mike Perry's avatar Mike Perry Committed by Georg Koppen
Browse files

Bug 16528: Prevent indexedDB Modernizr breakage (e10s highrisk).

This change should make the indexedDB failure mode for pref checks equivalent
to the private browsing failure mode. Sites that use Modernizr are accustomed
to the failure modes for Private Browsing usage of IndexedDB, but not for when
the pref is disabled.

This patch may cause serious issues with e10s in the future. We'll need to
keep an eye on it for FF52.
parent 8842d78d
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -19407,6 +19407,7 @@ FactoryOp::CheckPermission(ContentParent* aContentParent,
    if (aContentParent) {
      // The DOM in the other process should have kept us from receiving any
      // indexedDB messages so assume that the child is misbehaving.
      // XXX: Does this happen with e10s due to Bug #16528?
      aContentParent->KillHard("IndexedDB CheckPermission 1");
    }
    return NS_ERROR_DOM_INDEXEDDB_NOT_ALLOWED_ERR;
+5 −1
Original line number Diff line number Diff line
@@ -132,11 +132,13 @@ IDBFactory::CreateForWindow(nsPIDOMWindow* aWindow,
  nsCOMPtr<nsIPrincipal> principal;
  nsresult rv = AllowedForWindowInternal(aWindow, getter_AddRefs(principal));

  // XXX: Check Removed due to Bug #16528
  /*
  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.");
@@ -273,11 +275,13 @@ IDBFactory::CreateForMainThreadJSInternal(
  MOZ_ASSERT(NS_IsMainThread());
  MOZ_ASSERT(aPrincipalInfo);

  /* XXX: Check Removed to due #16528
  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)) {