Backed out 3 changesets (bug 1551055) for causing xpcshell localStorage perma failures CLOSED TREE
authorCiure Andrei <aciure@mozilla.com>
Mon, 13 May 2019 22:40:22 +0300
changeset 473651 5abfe3566f38af45a7ef67964d10f8b501ba90f6
parent 473650 3e5fe2fc2f17d4f8a39c7cefe61b0fa0cf8bc32f
child 473652 7d59f5e3db1b3f0cbd4b095752535c2d5ef09208
push id36009
push userapavel@mozilla.com
push dateTue, 14 May 2019 04:07:34 +0000
treeherdermozilla-central@96563508f9fe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1551055
milestone68.0a1
backs out21e44ad9c6df3e31355ab73e4fdfb23be8fe255b
8727e61ab69bd9ce729e66f890a74a95e96577cc
d99a6769beb4ec1e6b58591e3dc7be89861fb0a8
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 3 changesets (bug 1551055) for causing xpcshell localStorage perma failures CLOSED TREE Backed out changeset 21e44ad9c6df (bug 1551055) Backed out changeset 8727e61ab69b (bug 1551055) Backed out changeset d99a6769beb4 (bug 1551055)
dom/base/nsGlobalWindowInner.cpp
dom/interfaces/storage/nsIDOMStorageManager.idl
dom/localstorage/ActorsParent.cpp
dom/localstorage/LSObject.cpp
dom/localstorage/LSObject.h
dom/localstorage/LocalStorageManager2.cpp
dom/localstorage/PBackgroundLSSharedTypes.ipdlh
dom/storage/LocalStorage.cpp
dom/storage/LocalStorage.h
dom/storage/LocalStorageManager.cpp
dom/storage/LocalStorageManager.h
dom/storage/PartitionedLocalStorage.cpp
dom/storage/PartitionedLocalStorage.h
dom/storage/SessionStorage.cpp
dom/storage/SessionStorageManager.cpp
dom/storage/Storage.cpp
dom/storage/Storage.h
dom/storage/StorageNotifierService.cpp
dom/storage/StorageNotifierService.h
dom/tests/browser/browser_localStorage_e10s.js
toolkit/components/antitracking/StoragePrincipalHelper.cpp
toolkit/components/antitracking/StoragePrincipalHelper.h
toolkit/components/antitracking/test/browser/browser_partitionedLocalStorage_events.js
toolkit/components/extensions/Extension.jsm
toolkit/components/sessionstore/SessionStoreUtils.cpp
toolkit/components/windowwatcher/nsWindowWatcher.cpp
--- a/dom/base/nsGlobalWindowInner.cpp
+++ b/dom/base/nsGlobalWindowInner.cpp
@@ -384,18 +384,18 @@ class nsGlobalWindowObserver final : pub
                                   const char16_t* aStorageType,
                                   bool aPrivateBrowsing) override {
     if (mWindow) {
       mWindow->ObserveStorageNotification(aEvent, aStorageType,
                                           aPrivateBrowsing);
     }
   }
 
-  nsIPrincipal* GetEffectiveStoragePrincipal() const override {
-    return mWindow ? mWindow->GetEffectiveStoragePrincipal() : nullptr;
+  nsIPrincipal* GetPrincipal() const override {
+    return mWindow ? mWindow->GetPrincipal() : nullptr;
   }
 
   bool IsPrivateBrowsing() const override {
     return mWindow ? mWindow->IsPrivateBrowsing() : false;
   }
 
   nsIEventTarget* GetEventTarget() const override {
     return mWindow ? mWindow->EventTargetFor(TaskCategory::Other) : nullptr;
@@ -4349,19 +4349,18 @@ Storage* nsGlobalWindowInner::GetSession
     nsCOMPtr<nsIDOMStorageManager> storageManager =
         do_QueryInterface(docShell, &rv);
     if (NS_FAILED(rv)) {
       aError.Throw(rv);
       return nullptr;
     }
 
     RefPtr<Storage> storage;
-    // No StoragePrincipal for sessions.
-    aError = storageManager->CreateStorage(this, principal, principal,
-                                           documentURI, IsPrivateBrowsing(),
+    aError = storageManager->CreateStorage(this, principal, documentURI,
+                                           IsPrivateBrowsing(),
                                            getter_AddRefs(storage));
     if (aError.Failed()) {
       return nullptr;
     }
 
     mSessionStorage = storage;
     MOZ_ASSERT(mSessionStorage);
 
@@ -4402,17 +4401,17 @@ Storage* nsGlobalWindowInner::GetLocalSt
 
   nsContentUtils::StorageAccess access =
       nsContentUtils::StorageAllowedForWindow(this);
 
   // We allow partitioned localStorage only to some hosts.
   if (access == nsContentUtils::StorageAccess::ePartitionedOrDeny) {
     if (!mDoc) {
       access = nsContentUtils::StorageAccess::eDeny;
-    } else if (!StaticPrefs::privacy_storagePrincipal_enabledForTrackers()) {
+    } else {
       nsCOMPtr<nsIURI> uri;
       Unused << mDoc->NodePrincipal()->GetURI(getter_AddRefs(uri));
       static const char* kPrefName =
           "privacy.restrict3rdpartystorage.partitionedHosts";
       if (!uri || !nsContentUtils::IsURIInPrefList(uri, kPrefName)) {
         access = nsContentUtils::StorageAccess::eDeny;
       }
     }
@@ -4428,18 +4427,17 @@ Storage* nsGlobalWindowInner::GetLocalSt
     }
     return nullptr;
   }
 
   // Note that this behavior is observable: if we grant storage permission to a
   // tracker, we pass from the partitioned LocalStorage to the 'normal'
   // LocalStorage. The previous data is lost and the 2 window.localStorage
   // objects, before and after the permission granted, will be different.
-  if ((StaticPrefs::privacy_storagePrincipal_enabledForTrackers() ||
-       access != nsContentUtils::StorageAccess::ePartitionedOrDeny) &&
+  if (access != nsContentUtils::StorageAccess::ePartitionedOrDeny &&
       (!mLocalStorage ||
        mLocalStorage->Type() == Storage::ePartitionedLocalStorage)) {
     RefPtr<Storage> storage;
 
     if (NextGenLocalStorageEnabled()) {
       aError = LSObject::CreateForWindow(this, getter_AddRefs(storage));
     } else {
       nsresult rv;
@@ -4459,24 +4457,18 @@ Storage* nsGlobalWindowInner::GetLocalSt
       }
 
       nsIPrincipal* principal = GetPrincipal();
       if (!principal) {
         aError.Throw(NS_ERROR_DOM_SECURITY_ERR);
         return nullptr;
       }
 
-      nsIPrincipal* storagePrincipal = GetEffectiveStoragePrincipal();
-      if (!storagePrincipal) {
-        aError.Throw(NS_ERROR_DOM_SECURITY_ERR);
-        return nullptr;
-      }
-
-      aError = storageManager->CreateStorage(this, principal, storagePrincipal,
-                                             documentURI, IsPrivateBrowsing(),
+      aError = storageManager->CreateStorage(this, principal, documentURI,
+                                             IsPrivateBrowsing(),
                                              getter_AddRefs(storage));
     }
 
     if (aError.Failed()) {
       return nullptr;
     }
 
     mLocalStorage = storage;
@@ -4486,30 +4478,21 @@ Storage* nsGlobalWindowInner::GetLocalSt
   if (access == nsContentUtils::StorageAccess::ePartitionedOrDeny &&
       !mLocalStorage) {
     nsIPrincipal* principal = GetPrincipal();
     if (!principal) {
       aError.Throw(NS_ERROR_DOM_SECURITY_ERR);
       return nullptr;
     }
 
-    nsIPrincipal* storagePrincipal = GetEffectiveStoragePrincipal();
-    if (!storagePrincipal) {
-      aError.Throw(NS_ERROR_DOM_SECURITY_ERR);
-      return nullptr;
-    }
-
-    mLocalStorage =
-        new PartitionedLocalStorage(this, principal, storagePrincipal);
-  }
-
-  MOZ_ASSERT_IF(
-      !StaticPrefs::privacy_storagePrincipal_enabledForTrackers(),
-      (access == nsContentUtils::StorageAccess::ePartitionedOrDeny) ==
-          (mLocalStorage->Type() == Storage::ePartitionedLocalStorage));
+    mLocalStorage = new PartitionedLocalStorage(this, principal);
+  }
+
+  MOZ_ASSERT((access == nsContentUtils::StorageAccess::ePartitionedOrDeny) ==
+             (mLocalStorage->Type() == Storage::ePartitionedLocalStorage));
 
   return mLocalStorage;
 }
 
 IDBFactory* nsGlobalWindowInner::GetIndexedDB(ErrorResult& aError) {
   if (!mIndexedDB) {
     // This may keep mIndexedDB null without setting an error.
     aError = IDBFactory::CreateForWindow(this, getter_AddRefs(mIndexedDB));
@@ -4886,21 +4869,16 @@ void nsGlobalWindowInner::ObserveStorage
     return;
   }
 
   nsIPrincipal* principal = GetPrincipal();
   if (!principal) {
     return;
   }
 
-  nsIPrincipal* storagePrincipal = GetEffectiveStoragePrincipal();
-  if (!storagePrincipal) {
-    return;
-  }
-
   bool fireMozStorageChanged = false;
   nsAutoString eventType;
   eventType.AssignLiteral("storage");
 
   if (!NS_strcmp(aStorageType, u"sessionStorage")) {
     RefPtr<Storage> changingStorage = aEvent->GetStorageArea();
     MOZ_ASSERT(changingStorage);
 
@@ -4931,18 +4909,18 @@ void nsGlobalWindowInner::ObserveStorage
     if (fireMozStorageChanged) {
       eventType.AssignLiteral("MozSessionStorageChanged");
     }
   }
 
   else {
     MOZ_ASSERT(!NS_strcmp(aStorageType, u"localStorage"));
 
-    MOZ_DIAGNOSTIC_ASSERT(StorageUtils::PrincipalsEqual(aEvent->GetPrincipal(),
-                                                        storagePrincipal));
+    MOZ_DIAGNOSTIC_ASSERT(
+        StorageUtils::PrincipalsEqual(aEvent->GetPrincipal(), principal));
 
     fireMozStorageChanged =
         mLocalStorage && mLocalStorage == aEvent->GetStorageArea();
 
     if (fireMozStorageChanged) {
       eventType.AssignLiteral("MozLocalStorageChanged");
     }
   }
--- a/dom/interfaces/storage/nsIDOMStorageManager.idl
+++ b/dom/interfaces/storage/nsIDOMStorageManager.idl
@@ -34,26 +34,23 @@ interface nsIDOMStorageManager : nsISupp
    * Returns instance of DOM storage object for given principal.
    * A new object is always returned and it is ensured there is
    * a storage for the scope created.
    *
    * @param aWindow
    *    The parent window.
    * @param aPrincipal
    *    Principal to bound storage to.
-   * @param aStoragePrincipal
-   *    StoragePrincipal to bound storage to.
    * @param aDocumentURI
    *    URL of the demanding document, used for DOM storage event only.
    * @param aPrivate
    *    Whether the demanding document is running in Private Browsing mode or not.
    */
   Storage createStorage(in mozIDOMWindow aWindow,
                         in nsIPrincipal aPrincipal,
-                        in nsIPrincipal aStoragePrincipal,
                         in AString aDocumentURI,
                         [optional] in bool aPrivate);
   /**
    * DEPRECATED.  The only good reason to use this was if you were writing a
    * test and wanted to hackily determine if a preload happened.  That's now
    * covered by `nsILocalStorageManager.isPreloaded` and you should use that if
    * that's what you want.  If LSNG is in use, this will throw.
    *
@@ -61,24 +58,21 @@ interface nsIDOMStorageManager : nsISupp
    * If there is no storage managed for the scope, then null is returned and
    * no object is created.  Otherwise, an object (new) for the existing storage
    * scope is returned.
    *
    * @param aWindow
    *    The parent window.
    * @param aPrincipal
    *    Principal to bound storage to.
-   * @param aStoragePrincipal
-   *    StoragePrincipal to bound storage to.
    * @param aPrivate
    *    Whether the demanding document is running in Private Browsing mode or not.
    */
   Storage getStorage(in mozIDOMWindow aWindow,
                      in nsIPrincipal aPrincipal,
-                     in nsIPrincipal aStoragePrincipal,
                      [optional] in bool aPrivate);
 
   /**
    * Clones given storage into this storage manager.
    *
    * @param aStorageToCloneFrom
    *    The storage to copy all items from into this manager.  Manager will then
    *    return a new and independent object that contains snapshot of data from
--- a/dom/localstorage/ActorsParent.cpp
+++ b/dom/localstorage/ActorsParent.cpp
@@ -34,17 +34,16 @@
 #include "mozilla/dom/quota/UsageInfo.h"
 #include "mozilla/ipc/BackgroundChild.h"
 #include "mozilla/ipc/BackgroundParent.h"
 #include "mozilla/ipc/PBackgroundChild.h"
 #include "mozilla/ipc/PBackgroundParent.h"
 #include "mozilla/ipc/PBackgroundSharedTypes.h"
 #include "mozilla/Logging.h"
 #include "mozilla/storage/Variant.h"
-#include "mozilla/StoragePrincipalHelper.h"
 #include "nsClassHashtable.h"
 #include "nsDataHashtable.h"
 #include "nsExceptionHandler.h"
 #include "nsInterfaceHashtable.h"
 #include "nsIObjectInputStream.h"
 #include "nsIObjectOutputStream.h"
 #include "nsISimpleEnumerator.h"
 #include "nsNetUtil.h"
@@ -3376,17 +3375,16 @@ bool DeallocPBackgroundLSObserverParent(
   // Transfer ownership back from IPDL.
   RefPtr<Observer> actor = dont_AddRef(static_cast<Observer*>(aActor));
 
   return true;
 }
 
 bool VerifyPrincipalInfo(const Maybe<ContentParentId>& aContentParentId,
                          const PrincipalInfo& aPrincipalInfo,
-                         const PrincipalInfo& aStoragePrincipalInfo,
                          const Maybe<nsID>& aClientId) {
   AssertIsOnBackgroundThread();
 
   if (NS_WARN_IF(!QuotaManager::IsPrincipalInfoValid(aPrincipalInfo))) {
     ASSERT_UNLESS_FUZZING();
     return false;
   }
 
@@ -3394,19 +3392,17 @@ bool VerifyPrincipalInfo(const Maybe<Con
     RefPtr<ClientManagerService> svc = ClientManagerService::GetInstance();
     if (svc &&
         !svc->HasWindow(aContentParentId, aPrincipalInfo, aClientId.ref())) {
       ASSERT_UNLESS_FUZZING();
       return false;
     }
   }
 
-  return StoragePrincipalHelper::
-      VerifyValidStoragePrincipalInfoForPrincipalInfo(aStoragePrincipalInfo,
-                                                      aPrincipalInfo);
+  return true;
 }
 
 bool VerifyOriginKey(const nsACString& aOriginKey,
                      const PrincipalInfo& aPrincipalInfo) {
   AssertIsOnBackgroundThread();
 
   nsCString originAttrSuffix;
   nsCString originKey;
@@ -3431,19 +3427,18 @@ bool VerifyRequestParams(const Maybe<Con
   AssertIsOnBackgroundThread();
   MOZ_ASSERT(aParams.type() != LSRequestParams::T__None);
 
   switch (aParams.type()) {
     case LSRequestParams::TLSRequestPreloadDatastoreParams: {
       const LSRequestCommonParams& params =
           aParams.get_LSRequestPreloadDatastoreParams().commonParams();
 
-      if (NS_WARN_IF(
-              !VerifyPrincipalInfo(aContentParentId, params.principalInfo(),
-                                   params.storagePrincipalInfo(), Nothing()))) {
+      if (NS_WARN_IF(!VerifyPrincipalInfo(aContentParentId,
+                                          params.principalInfo(), Nothing()))) {
         ASSERT_UNLESS_FUZZING();
         return false;
       }
 
       if (NS_WARN_IF(
               !VerifyOriginKey(params.originKey(), params.principalInfo()))) {
         ASSERT_UNLESS_FUZZING();
         return false;
@@ -3452,19 +3447,19 @@ bool VerifyRequestParams(const Maybe<Con
     }
 
     case LSRequestParams::TLSRequestPrepareDatastoreParams: {
       const LSRequestPrepareDatastoreParams& params =
           aParams.get_LSRequestPrepareDatastoreParams();
 
       const LSRequestCommonParams& commonParams = params.commonParams();
 
-      if (NS_WARN_IF(!VerifyPrincipalInfo(
-              aContentParentId, commonParams.principalInfo(),
-              commonParams.storagePrincipalInfo(), params.clientId()))) {
+      if (NS_WARN_IF(!VerifyPrincipalInfo(aContentParentId,
+                                          commonParams.principalInfo(),
+                                          params.clientId()))) {
         ASSERT_UNLESS_FUZZING();
         return false;
       }
 
       if (NS_WARN_IF(!VerifyOriginKey(commonParams.originKey(),
                                       commonParams.principalInfo()))) {
         ASSERT_UNLESS_FUZZING();
         return false;
@@ -3472,18 +3467,17 @@ bool VerifyRequestParams(const Maybe<Con
       break;
     }
 
     case LSRequestParams::TLSRequestPrepareObserverParams: {
       const LSRequestPrepareObserverParams& params =
           aParams.get_LSRequestPrepareObserverParams();
 
       if (NS_WARN_IF(!VerifyPrincipalInfo(
-              aContentParentId, params.principalInfo(),
-              params.storagePrincipalInfo(), params.clientId()))) {
+              aContentParentId, params.principalInfo(), params.clientId()))) {
         ASSERT_UNLESS_FUZZING();
         return false;
       }
       break;
     }
 
     default:
       MOZ_CRASH("Should never get here!");
@@ -3594,19 +3588,18 @@ bool VerifyRequestParams(const Maybe<Con
   AssertIsOnBackgroundThread();
   MOZ_ASSERT(aParams.type() != LSSimpleRequestParams::T__None);
 
   switch (aParams.type()) {
     case LSSimpleRequestParams::TLSSimpleRequestPreloadedParams: {
       const LSSimpleRequestPreloadedParams& params =
           aParams.get_LSSimpleRequestPreloadedParams();
 
-      if (NS_WARN_IF(
-              !VerifyPrincipalInfo(aContentParentId, params.principalInfo(),
-                                   params.storagePrincipalInfo(), Nothing()))) {
+      if (NS_WARN_IF(!VerifyPrincipalInfo(aContentParentId,
+                                          params.principalInfo(), Nothing()))) {
         ASSERT_UNLESS_FUZZING();
         return false;
       }
       break;
     }
 
     default:
       MOZ_CRASH("Should never get here!");
@@ -6606,26 +6599,25 @@ nsresult PrepareDatastoreOp::Open() {
   MOZ_ASSERT(mState == State::Opening);
   MOZ_ASSERT(mNestedState == NestedState::BeforeNesting);
 
   if (NS_WARN_IF(QuotaClient::IsShuttingDownOnBackgroundThread()) ||
       !MayProceedOnNonOwningThread()) {
     return NS_ERROR_FAILURE;
   }
 
-  const PrincipalInfo& storagePrincipalInfo = mParams.storagePrincipalInfo();
-
-  if (storagePrincipalInfo.type() == PrincipalInfo::TSystemPrincipalInfo) {
+  const PrincipalInfo& principalInfo = mParams.principalInfo();
+
+  if (principalInfo.type() == PrincipalInfo::TSystemPrincipalInfo) {
     QuotaManager::GetInfoForChrome(&mSuffix, &mGroup, &mOrigin);
   } else {
-    MOZ_ASSERT(storagePrincipalInfo.type() ==
-               PrincipalInfo::TContentPrincipalInfo);
+    MOZ_ASSERT(principalInfo.type() == PrincipalInfo::TContentPrincipalInfo);
 
     QuotaManager::GetInfoFromValidatedPrincipalInfo(
-        storagePrincipalInfo, &mSuffix, &mGroup, &mMainThreadOrigin);
+        principalInfo, &mSuffix, &mGroup, &mMainThreadOrigin);
   }
 
   mState = State::Nesting;
   mNestedState = NestedState::CheckExistingOperations;
 
   MOZ_ALWAYS_SUCCEEDS(OwningEventTarget()->Dispatch(this, NS_DISPATCH_NORMAL));
 
   return NS_OK;
@@ -6637,29 +6629,27 @@ nsresult PrepareDatastoreOp::CheckExisti
   MOZ_ASSERT(mNestedState == NestedState::CheckExistingOperations);
   MOZ_ASSERT(gPrepareDatastoreOps);
 
   if (NS_WARN_IF(QuotaClient::IsShuttingDownOnBackgroundThread()) ||
       !MayProceed()) {
     return NS_ERROR_FAILURE;
   }
 
-  const PrincipalInfo& storagePrincipalInfo = mParams.storagePrincipalInfo();
+  const PrincipalInfo& principalInfo = mParams.principalInfo();
 
   nsCString originAttrSuffix;
   uint32_t privateBrowsingId;
 
-  if (storagePrincipalInfo.type() == PrincipalInfo::TSystemPrincipalInfo) {
+  if (principalInfo.type() == PrincipalInfo::TSystemPrincipalInfo) {
     privateBrowsingId = 0;
   } else {
-    MOZ_ASSERT(storagePrincipalInfo.type() ==
-               PrincipalInfo::TContentPrincipalInfo);
-
-    const ContentPrincipalInfo& info =
-        storagePrincipalInfo.get_ContentPrincipalInfo();
+    MOZ_ASSERT(principalInfo.type() == PrincipalInfo::TContentPrincipalInfo);
+
+    const ContentPrincipalInfo& info = principalInfo.get_ContentPrincipalInfo();
     const OriginAttributes& attrs = info.attrs();
     attrs.CreateSuffix(originAttrSuffix);
 
     privateBrowsingId = attrs.mPrivateBrowsingId;
   }
 
   mArchivedOriginScope = ArchivedOriginScope::CreateFromOrigin(
       originAttrSuffix, mParams.originKey());
@@ -7915,26 +7905,25 @@ nsresult PrepareObserverOp::Open() {
   AssertIsOnOwningThread();
   MOZ_ASSERT(mState == State::Opening);
 
   if (NS_WARN_IF(QuotaClient::IsShuttingDownOnBackgroundThread()) ||
       !MayProceedOnNonOwningThread()) {
     return NS_ERROR_FAILURE;
   }
 
-  const PrincipalInfo& storagePrincipalInfo = mParams.storagePrincipalInfo();
-
-  if (storagePrincipalInfo.type() == PrincipalInfo::TSystemPrincipalInfo) {
+  const PrincipalInfo& principalInfo = mParams.principalInfo();
+
+  if (principalInfo.type() == PrincipalInfo::TSystemPrincipalInfo) {
     QuotaManager::GetInfoForChrome(nullptr, nullptr, &mOrigin);
   } else {
-    MOZ_ASSERT(storagePrincipalInfo.type() ==
-               PrincipalInfo::TContentPrincipalInfo);
-
-    QuotaManager::GetInfoFromValidatedPrincipalInfo(storagePrincipalInfo,
-                                                    nullptr, nullptr, &mOrigin);
+    MOZ_ASSERT(principalInfo.type() == PrincipalInfo::TContentPrincipalInfo);
+
+    QuotaManager::GetInfoFromValidatedPrincipalInfo(principalInfo, nullptr,
+                                                    nullptr, &mOrigin);
   }
 
   mState = State::SendingReadyMessage;
   MOZ_ALWAYS_SUCCEEDS(OwningEventTarget()->Dispatch(this, NS_DISPATCH_NORMAL));
 
   return NS_OK;
 }
 
@@ -8057,26 +8046,25 @@ nsresult PreloadedOp::Open() {
   AssertIsOnOwningThread();
   MOZ_ASSERT(mState == State::Opening);
 
   if (NS_WARN_IF(QuotaClient::IsShuttingDownOnBackgroundThread()) ||
       !MayProceedOnNonOwningThread()) {
     return NS_ERROR_FAILURE;
   }
 
-  const PrincipalInfo& storagePrincipalInfo = mParams.storagePrincipalInfo();
-
-  if (storagePrincipalInfo.type() == PrincipalInfo::TSystemPrincipalInfo) {
+  const PrincipalInfo& principalInfo = mParams.principalInfo();
+
+  if (principalInfo.type() == PrincipalInfo::TSystemPrincipalInfo) {
     QuotaManager::GetInfoForChrome(nullptr, nullptr, &mOrigin);
   } else {
-    MOZ_ASSERT(storagePrincipalInfo.type() ==
-               PrincipalInfo::TContentPrincipalInfo);
-
-    QuotaManager::GetInfoFromValidatedPrincipalInfo(storagePrincipalInfo,
-                                                    nullptr, nullptr, &mOrigin);
+    MOZ_ASSERT(principalInfo.type() == PrincipalInfo::TContentPrincipalInfo);
+
+    QuotaManager::GetInfoFromValidatedPrincipalInfo(principalInfo, nullptr,
+                                                    nullptr, &mOrigin);
   }
 
   mState = State::SendingResults;
   MOZ_ALWAYS_SUCCEEDS(OwningEventTarget()->Dispatch(this, NS_DISPATCH_NORMAL));
 
   return NS_OK;
 }
 
@@ -8977,21 +8965,21 @@ nsresult QuotaClient::CreateArchivedOrig
                                               &attrs))) {
       return NS_ERROR_FAILURE;
     }
 
     ContentPrincipalInfo contentPrincipalInfo;
     contentPrincipalInfo.attrs() = attrs;
     contentPrincipalInfo.spec() = spec;
 
-    PrincipalInfo storagePrincipalInfo(contentPrincipalInfo);
+    PrincipalInfo principalInfo(contentPrincipalInfo);
 
     nsCString originAttrSuffix;
     nsCString originKey;
-    rv = GenerateOriginKey2(storagePrincipalInfo, originAttrSuffix, originKey);
+    rv = GenerateOriginKey2(principalInfo, originAttrSuffix, originKey);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
 
     archivedOriginScope =
         ArchivedOriginScope::CreateFromOrigin(originAttrSuffix, originKey);
   } else if (aOriginScope.IsPrefix()) {
     nsCString spec;
@@ -9000,21 +8988,21 @@ nsresult QuotaClient::CreateArchivedOrig
                                               spec, &attrs))) {
       return NS_ERROR_FAILURE;
     }
 
     ContentPrincipalInfo contentPrincipalInfo;
     contentPrincipalInfo.attrs() = attrs;
     contentPrincipalInfo.spec() = spec;
 
-    PrincipalInfo storagePrincipalInfo(contentPrincipalInfo);
+    PrincipalInfo principalInfo(contentPrincipalInfo);
 
     nsCString originAttrSuffix;
     nsCString originKey;
-    rv = GenerateOriginKey2(storagePrincipalInfo, originAttrSuffix, originKey);
+    rv = GenerateOriginKey2(principalInfo, originAttrSuffix, originKey);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
 
     archivedOriginScope = ArchivedOriginScope::CreateFromPrefix(originKey);
   } else if (aOriginScope.IsPattern()) {
     archivedOriginScope =
         ArchivedOriginScope::CreateFromPattern(aOriginScope.GetPattern());
--- a/dom/localstorage/LSObject.cpp
+++ b/dom/localstorage/LSObject.cpp
@@ -190,19 +190,18 @@ class RequestHelper final : public Runna
   NS_DECL_NSIRUNNABLE
 
   // LSRequestChildCallback
   void OnResponse(const LSRequestResponse& aResponse) override;
 };
 
 }  // namespace
 
-LSObject::LSObject(nsPIDOMWindowInner* aWindow, nsIPrincipal* aPrincipal,
-                   nsIPrincipal* aStoragePrincipal)
-    : Storage(aWindow, aPrincipal, aStoragePrincipal),
+LSObject::LSObject(nsPIDOMWindowInner* aWindow, nsIPrincipal* aPrincipal)
+    : Storage(aWindow, aPrincipal),
       mPrivateBrowsingId(0),
       mInExplicitSnapshot(false) {
   AssertIsOnOwningThread();
   MOZ_ASSERT(NextGenLocalStorageEnabled());
 }
 
 LSObject::~LSObject() {
   AssertIsOnOwningThread();
@@ -240,80 +239,64 @@ void LSObject::Initialize() {
 
 // static
 nsresult LSObject::CreateForWindow(nsPIDOMWindowInner* aWindow,
                                    Storage** aStorage) {
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(aWindow);
   MOZ_ASSERT(aStorage);
   MOZ_ASSERT(NextGenLocalStorageEnabled());
-  MOZ_ASSERT(nsContentUtils::StorageAllowedForWindow(aWindow) !=
+  MOZ_ASSERT(nsContentUtils::StorageAllowedForWindow(aWindow) >
              nsContentUtils::StorageAccess::eDeny);
 
   nsCOMPtr<nsIScriptObjectPrincipal> sop = do_QueryInterface(aWindow);
   MOZ_ASSERT(sop);
 
   nsCOMPtr<nsIPrincipal> principal = sop->GetPrincipal();
   if (NS_WARN_IF(!principal)) {
     return NS_ERROR_FAILURE;
   }
 
-  nsCOMPtr<nsIPrincipal> storagePrincipal = sop->GetEffectiveStoragePrincipal();
-  if (NS_WARN_IF(!storagePrincipal)) {
-    return NS_ERROR_FAILURE;
-  }
-
   if (nsContentUtils::IsSystemPrincipal(principal)) {
     return NS_ERROR_NOT_AVAILABLE;
   }
 
   // localStorage is not available on some pages on purpose, for example
   // about:home. Match the old implementation by using GenerateOriginKey
   // for the check.
   nsCString originAttrSuffix;
   nsCString originKey;
-  nsresult rv =
-      GenerateOriginKey(storagePrincipal, originAttrSuffix, originKey);
+  nsresult rv = GenerateOriginKey(principal, originAttrSuffix, originKey);
   if (NS_FAILED(rv)) {
     return NS_ERROR_NOT_AVAILABLE;
   }
 
   nsAutoPtr<PrincipalInfo> principalInfo(new PrincipalInfo());
   rv = PrincipalToPrincipalInfo(principal, principalInfo);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   MOZ_ASSERT(principalInfo->type() == PrincipalInfo::TContentPrincipalInfo);
 
-  nsAutoPtr<PrincipalInfo> storagePrincipalInfo(new PrincipalInfo());
-  rv = PrincipalToPrincipalInfo(storagePrincipal, storagePrincipalInfo);
-  if (NS_WARN_IF(NS_FAILED(rv))) {
-    return rv;
-  }
-
-  MOZ_ASSERT(storagePrincipalInfo->type() ==
-             PrincipalInfo::TContentPrincipalInfo);
-
-  if (NS_WARN_IF(!QuotaManager::IsPrincipalInfoValid(*storagePrincipalInfo))) {
+  if (NS_WARN_IF(!QuotaManager::IsPrincipalInfoValid(*principalInfo))) {
     return NS_ERROR_FAILURE;
   }
 
   nsCString suffix;
   nsCString origin;
-  rv = QuotaManager::GetInfoFromPrincipal(storagePrincipal, &suffix, nullptr,
-                                          &origin);
+  rv = QuotaManager::GetInfoFromPrincipal(principal, &suffix, nullptr, &origin);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   MOZ_ASSERT(originAttrSuffix == suffix);
 
   uint32_t privateBrowsingId;
-  rv = storagePrincipal->GetPrivateBrowsingId(&privateBrowsingId);
+  rv = principal->GetPrivateBrowsingId(&privateBrowsingId);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   Maybe<ClientInfo> clientInfo = aWindow->GetClientInfo();
   if (clientInfo.isNothing()) {
     return NS_ERROR_FAILURE;
   }
@@ -323,75 +306,61 @@ nsresult LSObject::CreateForWindow(nsPID
   nsString documentURI;
   if (nsCOMPtr<Document> doc = aWindow->GetExtantDoc()) {
     rv = doc->GetDocumentURI(documentURI);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
   }
 
-  RefPtr<LSObject> object = new LSObject(aWindow, principal, storagePrincipal);
+  RefPtr<LSObject> object = new LSObject(aWindow, principal);
   object->mPrincipalInfo = std::move(principalInfo);
-  object->mStoragePrincipalInfo = std::move(storagePrincipalInfo);
   object->mPrivateBrowsingId = privateBrowsingId;
   object->mClientId = clientId;
   object->mOrigin = origin;
   object->mOriginKey = originKey;
   object->mDocumentURI = documentURI;
 
   object.forget(aStorage);
   return NS_OK;
 }
 
 // static
 nsresult LSObject::CreateForPrincipal(nsPIDOMWindowInner* aWindow,
                                       nsIPrincipal* aPrincipal,
-                                      nsIPrincipal* aStoragePrincipal,
                                       const nsAString& aDocumentURI,
                                       bool aPrivate, LSObject** aObject) {
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(aPrincipal);
-  MOZ_ASSERT(aStoragePrincipal);
   MOZ_ASSERT(aObject);
 
   nsCString originAttrSuffix;
   nsCString originKey;
-  nsresult rv =
-      GenerateOriginKey(aStoragePrincipal, originAttrSuffix, originKey);
+  nsresult rv = GenerateOriginKey(aPrincipal, originAttrSuffix, originKey);
   if (NS_FAILED(rv)) {
     return NS_ERROR_NOT_AVAILABLE;
   }
 
   nsAutoPtr<PrincipalInfo> principalInfo(new PrincipalInfo());
   rv = PrincipalToPrincipalInfo(aPrincipal, principalInfo);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   MOZ_ASSERT(principalInfo->type() == PrincipalInfo::TContentPrincipalInfo ||
              principalInfo->type() == PrincipalInfo::TSystemPrincipalInfo);
 
-  nsAutoPtr<PrincipalInfo> storagePrincipalInfo(new PrincipalInfo());
-  rv = PrincipalToPrincipalInfo(aStoragePrincipal, storagePrincipalInfo);
-  if (NS_WARN_IF(NS_FAILED(rv))) {
-    return rv;
-  }
-
-  MOZ_ASSERT(
-      storagePrincipalInfo->type() == PrincipalInfo::TContentPrincipalInfo ||
-      storagePrincipalInfo->type() == PrincipalInfo::TSystemPrincipalInfo);
-
-  if (NS_WARN_IF(!QuotaManager::IsPrincipalInfoValid(*storagePrincipalInfo))) {
+  if (NS_WARN_IF(!QuotaManager::IsPrincipalInfoValid(*principalInfo))) {
     return NS_ERROR_FAILURE;
   }
 
   nsCString suffix;
   nsCString origin;
 
-  if (storagePrincipalInfo->type() == PrincipalInfo::TSystemPrincipalInfo) {
+  if (principalInfo->type() == PrincipalInfo::TSystemPrincipalInfo) {
     QuotaManager::GetInfoForChrome(&suffix, nullptr, &origin);
   } else {
     rv = QuotaManager::GetInfoFromPrincipal(aPrincipal, &suffix, nullptr,
                                             &origin);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
   }
@@ -403,20 +372,18 @@ nsresult LSObject::CreateForPrincipal(ns
     Maybe<ClientInfo> clientInfo = aWindow->GetClientInfo();
     if (clientInfo.isNothing()) {
       return NS_ERROR_FAILURE;
     }
 
     clientId = Some(clientInfo.ref().Id());
   }
 
-  RefPtr<LSObject> object =
-      new LSObject(aWindow, aPrincipal, aStoragePrincipal);
+  RefPtr<LSObject> object = new LSObject(aWindow, aPrincipal);
   object->mPrincipalInfo = std::move(principalInfo);
-  object->mStoragePrincipalInfo = std::move(storagePrincipalInfo);
   object->mPrivateBrowsingId = aPrivate ? 1 : 0;
   object->mClientId = clientId;
   object->mOrigin = origin;
   object->mOriginKey = originKey;
   object->mDocumentURI = aDocumentURI;
 
   object.forget(aObject);
   return NS_OK;
@@ -839,17 +806,16 @@ nsresult LSObject::EnsureDatabase() {
   PBackgroundChild* backgroundActor =
       BackgroundChild::GetOrCreateForCurrentThread();
   if (NS_WARN_IF(!backgroundActor)) {
     return NS_ERROR_FAILURE;
   }
 
   LSRequestCommonParams commonParams;
   commonParams.principalInfo() = *mPrincipalInfo;
-  commonParams.storagePrincipalInfo() = *mStoragePrincipalInfo;
   commonParams.originKey() = mOriginKey;
 
   LSRequestPrepareDatastoreParams params;
   params.commonParams() = commonParams;
   params.clientId() = mClientId;
 
   LSRequestResponse response;
 
@@ -873,17 +839,17 @@ nsresult LSObject::EnsureDatabase() {
   // Note that we now can't error out, otherwise parent will keep an extra
   // strong reference to the datastore.
 
   RefPtr<LSDatabase> database = new LSDatabase(mOrigin);
 
   LSDatabaseChild* actor = new LSDatabaseChild(database);
 
   MOZ_ALWAYS_TRUE(backgroundActor->SendPBackgroundLSDatabaseConstructor(
-      actor, *mStoragePrincipalInfo, mPrivateBrowsingId, datastoreId));
+      actor, *mPrincipalInfo, mPrivateBrowsingId, datastoreId));
 
   database->SetActor(actor);
 
   mDatabase = std::move(database);
 
   return NS_OK;
 }
 
@@ -908,17 +874,16 @@ nsresult LSObject::EnsureObserver() {
   mObserver = LSObserver::Get(mOrigin);
 
   if (mObserver) {
     return NS_OK;
   }
 
   LSRequestPrepareObserverParams params;
   params.principalInfo() = *mPrincipalInfo;
-  params.storagePrincipalInfo() = *mStoragePrincipalInfo;
   params.clientId() = mClientId;
 
   LSRequestResponse response;
 
   nsresult rv = DoRequestSynchronously(params, response);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
@@ -962,18 +927,18 @@ void LSObject::DropObserver() {
     mObserver = nullptr;
   }
 }
 
 void LSObject::OnChange(const nsAString& aKey, const nsAString& aOldValue,
                         const nsAString& aNewValue) {
   AssertIsOnOwningThread();
 
-  NotifyChange(/* aStorage */ this, StoragePrincipal(), aKey, aOldValue,
-               aNewValue, /* aStorageType */ kLocalStorageType, mDocumentURI,
+  NotifyChange(/* aStorage */ this, Principal(), aKey, aOldValue, aNewValue,
+               /* aStorageType */ kLocalStorageType, mDocumentURI,
                /* aIsPrivate */ !!mPrivateBrowsingId,
                /* aImmediateDispatch */ false);
 }
 
 nsresult LSObject::EndExplicitSnapshotInternal() {
   AssertIsOnOwningThread();
 
   // Can be only called if the mInExplicitSnapshot flag is true.
--- a/dom/localstorage/LSObject.h
+++ b/dom/localstorage/LSObject.h
@@ -56,17 +56,16 @@ class LSRequestResponse;
  * parent Datastore at the moment the Snapshot was created.
  */
 class LSObject final : public Storage {
   typedef mozilla::ipc::PrincipalInfo PrincipalInfo;
 
   friend nsGlobalWindowInner;
 
   nsAutoPtr<PrincipalInfo> mPrincipalInfo;
-  nsAutoPtr<PrincipalInfo> mStoragePrincipalInfo;
 
   RefPtr<LSDatabase> mDatabase;
   RefPtr<LSObserver> mObserver;
 
   uint32_t mPrivateBrowsingId;
   Maybe<nsID> mClientId;
   nsCString mOrigin;
   nsCString mOriginKey;
@@ -88,17 +87,16 @@ class LSObject final : public Storage {
    * system principal where CreateForWindow does not.  This is also why aPrivate
    * exists separate from the principal; because the system principal can never
    * be mutated to have a private browsing id even though it can be used in a
    * window/document marked as private browsing.  That's a legacy issue that is
    * being dealt with, but it's why it exists here.
    */
   static nsresult CreateForPrincipal(nsPIDOMWindowInner* aWindow,
                                      nsIPrincipal* aPrincipal,
-                                     nsIPrincipal* aStoragePrincipal,
                                      const nsAString& aDocumentURI,
                                      bool aPrivate, LSObject** aObject);
 
   /**
    * Used for requests from the parent process to the parent process; in that
    * case we want ActorsParent to know our event-target and this is better than
    * trying to tunnel the pointer through IPC.
    */
@@ -174,18 +172,17 @@ class LSObject final : public Storage {
                            ErrorResult& aError) override;
 
   //////////////////////////////////////////////////////////////////////////////
 
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(LSObject, Storage)
 
  private:
-  LSObject(nsPIDOMWindowInner* aWindow, nsIPrincipal* aPrincipal,
-           nsIPrincipal* aStoragePrincipal);
+  LSObject(nsPIDOMWindowInner* aWindow, nsIPrincipal* aPrincipal);
 
   ~LSObject();
 
   nsresult DoRequestSynchronously(const LSRequestParams& aParams,
                                   LSRequestResponse& aResponse);
 
   nsresult EnsureDatabase();
 
--- a/dom/localstorage/LocalStorageManager2.cpp
+++ b/dom/localstorage/LocalStorageManager2.cpp
@@ -186,46 +186,41 @@ LocalStorageManager2::PrecacheStorage(ns
   // process, triggered by the official preloading spot,
   // ContentParent::AboutToLoadHttpFtpDocumentForChild.
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP
 LocalStorageManager2::CreateStorage(mozIDOMWindow* aWindow,
                                     nsIPrincipal* aPrincipal,
-                                    nsIPrincipal* aStoragePrincipal,
                                     const nsAString& aDocumentURI,
                                     bool aPrivate, Storage** _retval) {
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(aPrincipal);
-  MOZ_ASSERT(aStoragePrincipal);
   MOZ_ASSERT(_retval);
 
   nsCOMPtr<nsPIDOMWindowInner> inner = nsPIDOMWindowInner::From(aWindow);
 
   RefPtr<LSObject> object;
-  nsresult rv = LSObject::CreateForPrincipal(inner, aPrincipal,
-                                             aStoragePrincipal, aDocumentURI,
+  nsresult rv = LSObject::CreateForPrincipal(inner, aPrincipal, aDocumentURI,
                                              aPrivate, getter_AddRefs(object));
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   object.forget(_retval);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 LocalStorageManager2::GetStorage(mozIDOMWindow* aWindow,
-                                 nsIPrincipal* aPrincipal,
-                                 nsIPrincipal* aStoragePrincipal, bool aPrivate,
+                                 nsIPrincipal* aPrincipal, bool aPrivate,
                                  Storage** _retval) {
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(aPrincipal);
-  MOZ_ASSERT(aStoragePrincipal);
   MOZ_ASSERT(_retval);
 
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP
 LocalStorageManager2::CloneStorage(Storage* aStorageToCloneFrom) {
   MOZ_ASSERT(NS_IsMainThread());
@@ -283,17 +278,16 @@ LocalStorageManager2::Preload(nsIPrincip
     rv = CreatePromise(aContext, getter_AddRefs(promise));
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
   }
 
   LSRequestCommonParams commonParams;
   commonParams.principalInfo() = *principalInfo;
-  commonParams.storagePrincipalInfo() = *principalInfo;
   commonParams.originKey() = originKey;
 
   LSRequestPreloadDatastoreParams params(commonParams);
 
   RefPtr<AsyncRequestHelper> helper =
       new AsyncRequestHelper(this, promise, params);
 
   // This will start and finish the async request on the DOM File thread.
--- a/dom/localstorage/PBackgroundLSSharedTypes.ipdlh
+++ b/dom/localstorage/PBackgroundLSSharedTypes.ipdlh
@@ -11,17 +11,16 @@ using mozilla::dom::LSValue
   from "mozilla/dom/LSValue.h";
 
 namespace mozilla {
 namespace dom {
 
 struct LSRequestCommonParams
 {
   PrincipalInfo principalInfo;
-  PrincipalInfo storagePrincipalInfo;
   nsCString originKey;
 };
 
 struct LSRequestPreloadDatastoreParams
 {
   LSRequestCommonParams commonParams;
 };
 
@@ -29,31 +28,29 @@ struct LSRequestPrepareDatastoreParams
 {
   LSRequestCommonParams commonParams;
   nsID? clientId;
 };
 
 struct LSRequestPrepareObserverParams
 {
   PrincipalInfo principalInfo;
-  PrincipalInfo storagePrincipalInfo;
   nsID? clientId;
 };
 
 union LSRequestParams
 {
   LSRequestPreloadDatastoreParams;
   LSRequestPrepareDatastoreParams;
   LSRequestPrepareObserverParams;
 };
 
 struct LSSimpleRequestPreloadedParams
 {
   PrincipalInfo principalInfo;
-  PrincipalInfo storagePrincipalInfo;
 };
 
 union LSSimpleRequestParams
 {
   LSSimpleRequestPreloadedParams;
 };
 
 /**
--- a/dom/storage/LocalStorage.cpp
+++ b/dom/storage/LocalStorage.cpp
@@ -49,19 +49,18 @@ NS_INTERFACE_MAP_END_INHERITING(Storage)
 
 NS_IMPL_ADDREF_INHERITED(LocalStorage, Storage)
 NS_IMPL_RELEASE_INHERITED(LocalStorage, Storage)
 
 LocalStorage::LocalStorage(nsPIDOMWindowInner* aWindow,
                            LocalStorageManager* aManager,
                            LocalStorageCache* aCache,
                            const nsAString& aDocumentURI,
-                           nsIPrincipal* aPrincipal,
-                           nsIPrincipal* aStoragePrincipal, bool aIsPrivate)
-    : Storage(aWindow, aPrincipal, aStoragePrincipal),
+                           nsIPrincipal* aPrincipal, bool aIsPrivate)
+    : Storage(aWindow, aPrincipal),
       mManager(aManager),
       mCache(aCache),
       mDocumentURI(aDocumentURI),
       mIsPrivate(aIsPrivate) {
   mCache->Preload();
 }
 
 LocalStorage::~LocalStorage() {}
@@ -159,19 +158,19 @@ void LocalStorage::Clear(nsIPrincipal& a
 
   if (!aRv.ErrorCodeIs(NS_SUCCESS_DOM_NO_OPERATION)) {
     OnChange(VoidString(), VoidString(), VoidString());
   }
 }
 
 void LocalStorage::OnChange(const nsAString& aKey, const nsAString& aOldValue,
                             const nsAString& aNewValue) {
-  NotifyChange(/* aStorage */ this, StoragePrincipal(), aKey, aOldValue,
-               aNewValue, /* aStorageType */ u"localStorage", mDocumentURI,
-               mIsPrivate, /* aImmediateDispatch */ false);
+  NotifyChange(/* aStorage */ this, Principal(), aKey, aOldValue, aNewValue,
+               /* aStorageType */ u"localStorage", mDocumentURI, mIsPrivate,
+               /* aImmediateDispatch */ false);
 }
 
 void LocalStorage::ApplyEvent(StorageEvent* aStorageEvent) {
   MOZ_ASSERT(aStorageEvent);
 
   nsAutoString key;
   nsAutoString old;
   nsAutoString value;
--- a/dom/storage/LocalStorage.h
+++ b/dom/storage/LocalStorage.h
@@ -27,18 +27,17 @@ class LocalStorage final : public Storag
   LocalStorageManager* GetManager() const { return mManager; }
 
   LocalStorageCache const* GetCache() const { return mCache; }
 
   const nsString& DocumentURI() const { return mDocumentURI; }
 
   LocalStorage(nsPIDOMWindowInner* aWindow, LocalStorageManager* aManager,
                LocalStorageCache* aCache, const nsAString& aDocumentURI,
-               nsIPrincipal* aPrincipal, nsIPrincipal* aStoragePrincipal,
-               bool aIsPrivate);
+               nsIPrincipal* aPrincipal, bool aIsPrivate);
 
   bool IsForkOf(const Storage* aOther) const override;
 
   // WebIDL
 
   int64_t GetOriginQuotaUsage() const override;
 
   uint32_t GetLength(nsIPrincipal& aSubjectPrincipal,
--- a/dom/storage/LocalStorageManager.cpp
+++ b/dom/storage/LocalStorageManager.cpp
@@ -193,18 +193,17 @@ void LocalStorageManager::DropCache(Loca
   }
 
   CacheOriginHashtable* table = mCaches.LookupOrAdd(aCache->OriginSuffix());
   table->RemoveEntry(aCache->OriginNoSuffix());
 }
 
 nsresult LocalStorageManager::GetStorageInternal(
     CreateMode aCreateMode, mozIDOMWindow* aWindow, nsIPrincipal* aPrincipal,
-    nsIPrincipal* aStoragePrincipal, const nsAString& aDocumentURI,
-    bool aPrivate, Storage** aRetval) {
+    const nsAString& aDocumentURI, bool aPrivate, Storage** aRetval) {
   nsAutoCString originAttrSuffix;
   nsAutoCString originKey;
 
   nsresult rv = GenerateOriginKey(aPrincipal, originAttrSuffix, originKey);
   if (NS_FAILED(rv)) {
     return NS_ERROR_NOT_AVAILABLE;
   }
 
@@ -266,51 +265,46 @@ nsresult LocalStorageManager::GetStorage
 
     cache->SetActor(actor);
 #endif
   }
 
   if (aRetval) {
     nsCOMPtr<nsPIDOMWindowInner> inner = nsPIDOMWindowInner::From(aWindow);
 
-    RefPtr<Storage> storage =
-        new LocalStorage(inner, this, cache, aDocumentURI, aPrincipal,
-                         aStoragePrincipal, aPrivate);
+    RefPtr<Storage> storage = new LocalStorage(inner, this, cache, aDocumentURI,
+                                               aPrincipal, aPrivate);
     storage.forget(aRetval);
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 LocalStorageManager::PrecacheStorage(nsIPrincipal* aPrincipal,
                                      Storage** aRetval) {
   return GetStorageInternal(CreateMode::CreateIfShouldPreload, nullptr,
-                            aPrincipal, aPrincipal, EmptyString(), false,
-                            aRetval);
+                            aPrincipal, EmptyString(), false, aRetval);
 }
 
 NS_IMETHODIMP
 LocalStorageManager::CreateStorage(mozIDOMWindow* aWindow,
                                    nsIPrincipal* aPrincipal,
-                                   nsIPrincipal* aStoragePrincipal,
                                    const nsAString& aDocumentURI, bool aPrivate,
                                    Storage** aRetval) {
   return GetStorageInternal(CreateMode::CreateAlways, aWindow, aPrincipal,
-                            aStoragePrincipal, aDocumentURI, aPrivate, aRetval);
+                            aDocumentURI, aPrivate, aRetval);
 }
 
 NS_IMETHODIMP
 LocalStorageManager::GetStorage(mozIDOMWindow* aWindow,
-                                nsIPrincipal* aPrincipal,
-                                nsIPrincipal* aStoragePrincipal, bool aPrivate,
+                                nsIPrincipal* aPrincipal, bool aPrivate,
                                 Storage** aRetval) {
   return GetStorageInternal(CreateMode::UseIfExistsNeverCreate, aWindow,
-                            aPrincipal, aStoragePrincipal, EmptyString(),
-                            aPrivate, aRetval);
+                            aPrincipal, EmptyString(), aPrivate, aRetval);
 }
 
 NS_IMETHODIMP
 LocalStorageManager::CloneStorage(Storage* aStorage) {
   // Cloning is supported only for sessionStorage
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
--- a/dom/storage/LocalStorageManager.h
+++ b/dom/storage/LocalStorageManager.h
@@ -96,17 +96,16 @@ class LocalStorageManager final : public
     CreateAlways,
     // PrecacheStorage: Create only if the database says we ShouldPreloadOrigin.
     CreateIfShouldPreload
   };
 
   // Helper for creation of DOM storage objects
   nsresult GetStorageInternal(CreateMode aCreate, mozIDOMWindow* aWindow,
                               nsIPrincipal* aPrincipal,
-                              nsIPrincipal* aStoragePrincipal,
                               const nsAString& aDocumentURI, bool aPrivate,
                               Storage** aRetval);
 
   // Suffix->origin->cache map
   typedef nsTHashtable<LocalStorageCacheHashKey> CacheOriginHashtable;
   nsClassHashtable<nsCStringHashKey, CacheOriginHashtable> mCaches;
 
   void ClearCaches(uint32_t aUnloadFlags,
--- a/dom/storage/PartitionedLocalStorage.cpp
+++ b/dom/storage/PartitionedLocalStorage.cpp
@@ -15,21 +15,19 @@ namespace dom {
 NS_IMPL_CYCLE_COLLECTION_INHERITED(PartitionedLocalStorage, Storage);
 
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(PartitionedLocalStorage)
 NS_INTERFACE_MAP_END_INHERITING(Storage)
 
 NS_IMPL_ADDREF_INHERITED(PartitionedLocalStorage, Storage)
 NS_IMPL_RELEASE_INHERITED(PartitionedLocalStorage, Storage)
 
-PartitionedLocalStorage::PartitionedLocalStorage(
-    nsPIDOMWindowInner* aWindow, nsIPrincipal* aPrincipal,
-    nsIPrincipal* aStoragePrincipal)
-    : Storage(aWindow, aPrincipal, aStoragePrincipal),
-      mCache(new SessionStorageCache()) {}
+PartitionedLocalStorage::PartitionedLocalStorage(nsPIDOMWindowInner* aWindow,
+                                                 nsIPrincipal* aPrincipal)
+    : Storage(aWindow, aPrincipal), mCache(new SessionStorageCache()) {}
 
 PartitionedLocalStorage::~PartitionedLocalStorage() {}
 
 int64_t PartitionedLocalStorage::GetOriginQuotaUsage() const {
   return mCache->GetOriginQuotaUsage(SessionStorageCache::eSessionSetType);
 }
 
 uint32_t PartitionedLocalStorage::GetLength(nsIPrincipal& aSubjectPrincipal,
--- a/dom/storage/PartitionedLocalStorage.h
+++ b/dom/storage/PartitionedLocalStorage.h
@@ -19,18 +19,18 @@ class SessionStorageCache;
 // PartitionedLocalStorage is a in-memory-only storage exposed to trackers. It
 // doesn't share data with other contexts.
 
 class PartitionedLocalStorage final : public Storage {
  public:
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(PartitionedLocalStorage, Storage)
 
-  PartitionedLocalStorage(nsPIDOMWindowInner* aWindow, nsIPrincipal* aPrincipal,
-                          nsIPrincipal* aStoragePrincipal);
+  PartitionedLocalStorage(nsPIDOMWindowInner* aWindow,
+                          nsIPrincipal* aPrincipal);
 
   StorageType Type() const override { return ePartitionedLocalStorage; }
 
   int64_t GetOriginQuotaUsage() const override;
 
   bool IsForkOf(const Storage* aStorage) const override;
 
   // WebIDL
--- a/dom/storage/SessionStorage.cpp
+++ b/dom/storage/SessionStorage.cpp
@@ -30,28 +30,27 @@ NS_INTERFACE_MAP_END_INHERITING(Storage)
 NS_IMPL_ADDREF_INHERITED(SessionStorage, Storage)
 NS_IMPL_RELEASE_INHERITED(SessionStorage, Storage)
 
 SessionStorage::SessionStorage(nsPIDOMWindowInner* aWindow,
                                nsIPrincipal* aPrincipal,
                                SessionStorageCache* aCache,
                                SessionStorageManager* aManager,
                                const nsAString& aDocumentURI, bool aIsPrivate)
-    : Storage(aWindow, aPrincipal, aPrincipal),
+    : Storage(aWindow, aPrincipal),
       mCache(aCache),
       mManager(aManager),
       mDocumentURI(aDocumentURI),
       mIsPrivate(aIsPrivate) {
   MOZ_ASSERT(aCache);
 }
 
 SessionStorage::~SessionStorage() {}
 
 already_AddRefed<SessionStorage> SessionStorage::Clone() const {
-  MOZ_ASSERT(Principal() == StoragePrincipal());
   RefPtr<SessionStorage> storage =
       new SessionStorage(GetParentObject(), Principal(), mCache, mManager,
                          mDocumentURI, mIsPrivate);
   return storage.forget();
 }
 
 int64_t SessionStorage::GetOriginQuotaUsage() const {
   return mCache->GetOriginQuotaUsage(DATASET);
--- a/dom/storage/SessionStorageManager.cpp
+++ b/dom/storage/SessionStorageManager.cpp
@@ -66,17 +66,16 @@ SessionStorageManager::PrecacheStorage(n
                                        Storage** aRetval) {
   // Nothing to preload.
   return NS_OK;
 }
 
 NS_IMETHODIMP
 SessionStorageManager::CreateStorage(mozIDOMWindow* aWindow,
                                      nsIPrincipal* aPrincipal,
-                                     nsIPrincipal* aStoragePrincipal,
                                      const nsAString& aDocumentURI,
                                      bool aPrivate, Storage** aRetval) {
   nsAutoCString originKey;
   nsAutoCString originAttributes;
   nsresult rv = GenerateOriginKey(aPrincipal, originAttributes, originKey);
   if (NS_FAILED(rv)) {
     return NS_ERROR_NOT_AVAILABLE;
   }
@@ -90,29 +89,27 @@ SessionStorageManager::CreateStorage(moz
   RefPtr<SessionStorageCache> cache;
   if (!table->Get(originKey, getter_AddRefs(cache))) {
     cache = new SessionStorageCache();
     table->Put(originKey, cache);
   }
 
   nsCOMPtr<nsPIDOMWindowInner> inner = nsPIDOMWindowInner::From(aWindow);
 
-  // No StoragePrincipal for sessionStorage.
   RefPtr<SessionStorage> storage = new SessionStorage(
       inner, aPrincipal, cache, this, aDocumentURI, aPrivate);
 
   storage.forget(aRetval);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 SessionStorageManager::GetStorage(mozIDOMWindow* aWindow,
-                                  nsIPrincipal* aPrincipal,
-                                  nsIPrincipal* aStoragePrincipal,
-                                  bool aPrivate, Storage** aRetval) {
+                                  nsIPrincipal* aPrincipal, bool aPrivate,
+                                  Storage** aRetval) {
   *aRetval = nullptr;
 
   nsAutoCString originKey;
   nsAutoCString originAttributes;
   nsresult rv = GenerateOriginKey(aPrincipal, originAttributes, originKey);
   if (NS_FAILED(rv)) {
     return rv;
   }
--- a/dom/storage/Storage.cpp
+++ b/dom/storage/Storage.cpp
@@ -11,33 +11,28 @@
 #include "nsIPrincipal.h"
 #include "nsPIDOMWindow.h"
 
 namespace mozilla {
 namespace dom {
 
 static const char kStorageEnabled[] = "dom.storage.enabled";
 
-NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(Storage, mWindow, mPrincipal,
-                                      mStoragePrincipal)
+NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(Storage, mWindow, mPrincipal)
 
 NS_IMPL_CYCLE_COLLECTING_ADDREF(Storage)
 NS_IMPL_CYCLE_COLLECTING_RELEASE_WITH_LAST_RELEASE(Storage, LastRelease())
 
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(Storage)
   NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
   NS_INTERFACE_MAP_ENTRY(nsISupports)
 NS_INTERFACE_MAP_END
 
-Storage::Storage(nsPIDOMWindowInner* aWindow, nsIPrincipal* aPrincipal,
-                 nsIPrincipal* aStoragePrincipal)
-    : mWindow(aWindow),
-      mPrincipal(aPrincipal),
-      mStoragePrincipal(aStoragePrincipal),
-      mIsSessionOnly(false) {
+Storage::Storage(nsPIDOMWindowInner* aWindow, nsIPrincipal* aPrincipal)
+    : mWindow(aWindow), mPrincipal(aPrincipal), mIsSessionOnly(false) {
   MOZ_ASSERT(aPrincipal);
 
   if (nsContentUtils::IsSystemPrincipal(mPrincipal)) {
     mIsSessionOnly = false;
   } else if (mWindow) {
     uint32_t rejectedReason = 0;
     nsContentUtils::StorageAccess access =
         nsContentUtils::StorageAllowedForWindow(mWindow, &rejectedReason);
@@ -45,17 +40,17 @@ Storage::Storage(nsPIDOMWindowInner* aWi
     MOZ_ASSERT(access != nsContentUtils::StorageAccess::eDeny ||
                rejectedReason ==
                    nsIWebProgressListener::STATE_COOKIES_BLOCKED_FOREIGN);
 
     mIsSessionOnly = access <= nsContentUtils::StorageAccess::eSessionScoped;
   }
 }
 
-Storage::~Storage() = default;
+Storage::~Storage() {}
 
 /* static */
 bool Storage::StoragePrefIsEnabled() {
   return mozilla::Preferences::GetBool(kStorageEnabled);
 }
 
 bool Storage::CanUseStorage(nsIPrincipal& aSubjectPrincipal) {
   if (!StoragePrefIsEnabled()) {
--- a/dom/storage/Storage.h
+++ b/dom/storage/Storage.h
@@ -21,18 +21,17 @@ class nsPIDOMWindowInner;
 namespace mozilla {
 namespace dom {
 
 class Storage : public nsISupports, public nsWrapperCache {
  public:
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(Storage)
 
-  Storage(nsPIDOMWindowInner* aWindow, nsIPrincipal* aPrincipal,
-          nsIPrincipal* aStoragePrincipal);
+  Storage(nsPIDOMWindowInner* aWindow, nsIPrincipal* aPrincipal);
 
   static bool StoragePrefIsEnabled();
 
   enum StorageType {
     eSessionStorage,
     eLocalStorage,
     ePartitionedLocalStorage,
   };
@@ -40,18 +39,16 @@ class Storage : public nsISupports, publ
   virtual StorageType Type() const = 0;
 
   virtual bool IsForkOf(const Storage* aStorage) const = 0;
 
   virtual int64_t GetOriginQuotaUsage() const = 0;
 
   nsIPrincipal* Principal() const { return mPrincipal; }
 
-  nsIPrincipal* StoragePrincipal() const { return mStoragePrincipal; }
-
   // WebIDL
   JSObject* WrapObject(JSContext* aCx,
                        JS::Handle<JSObject*> aGivenProto) override;
 
   nsPIDOMWindowInner* GetParentObject() const { return mWindow; }
 
   virtual uint32_t GetLength(nsIPrincipal& aSubjectPrincipal,
                              ErrorResult& aRv) = 0;
@@ -139,17 +136,16 @@ class Storage : public nsISupports, publ
   // The method checks whether the caller can use a storage.
   bool CanUseStorage(nsIPrincipal& aSubjectPrincipal);
 
   virtual void LastRelease() {}
 
  private:
   nsCOMPtr<nsPIDOMWindowInner> mWindow;
   nsCOMPtr<nsIPrincipal> mPrincipal;
-  nsCOMPtr<nsIPrincipal> mStoragePrincipal;
 
   // Whether storage is set to persist data only per session, may change
   // dynamically and is set by CanUseStorage function that is called
   // before any operation on the storage.
   bool mIsSessionOnly : 1;
 };
 
 }  // namespace dom
--- a/dom/storage/StorageNotifierService.cpp
+++ b/dom/storage/StorageNotifierService.cpp
@@ -71,17 +71,17 @@ void StorageNotifierService::Broadcast(S
     // principal).
     if (aPrivateBrowsing != observer->IsPrivateBrowsing()) {
       continue;
     }
 
     // No reasons to continue if the principal of the event doesn't match with
     // the window's one.
     if (!StorageUtils::PrincipalsEqual(aEvent->GetPrincipal(),
-                                       observer->GetEffectiveStoragePrincipal())) {
+                                       observer->GetPrincipal())) {
       continue;
     }
 
     RefPtr<Runnable> r = NS_NewRunnableFunction(
         "StorageNotifierService::Broadcast",
         [observer, event, aStorageType, aPrivateBrowsing]() {
           observer->ObserveStorageNotification(event, aStorageType,
                                                aPrivateBrowsing);
--- a/dom/storage/StorageNotifierService.h
+++ b/dom/storage/StorageNotifierService.h
@@ -26,17 +26,17 @@ class StorageNotificationObserver {
   NS_INLINE_DECL_PURE_VIRTUAL_REFCOUNTING
 
   virtual void ObserveStorageNotification(StorageEvent* aEvent,
                                           const char16_t* aStorageType,
                                           bool aPrivateBrowsing) = 0;
 
   virtual bool IsPrivateBrowsing() const = 0;
 
-  virtual nsIPrincipal* GetEffectiveStoragePrincipal() const = 0;
+  virtual nsIPrincipal* GetPrincipal() const = 0;
 
   virtual nsIEventTarget* GetEventTarget() const = 0;
 };
 
 /**
  * A specialized version of the observer service that uses the custom
  * StorageNotificationObserver so that principal checks can happen in this class
  * rather than in the nsIObserver::observe method where they used to happen.
--- a/dom/tests/browser/browser_localStorage_e10s.js
+++ b/dom/tests/browser/browser_localStorage_e10s.js
@@ -102,17 +102,17 @@ async function verifyTabPreload(knownTab
     HELPER_PAGE_ORIGIN,
     function(origin) {
       let principal =
         Services.scriptSecurityManager.createCodebasePrincipalFromOrigin(
           origin);
       if (Services.lsm.nextGenLocalStorageEnabled) {
         return Services.lsm.isPreloaded(principal);
       }
-      return !!Services.domStorageManager.getStorage(null, principal, principal);
+      return !!Services.domStorageManager.getStorage(null, principal);
     });
   is(storageExists, expectStorageExists, "Storage existence === preload");
 }
 
 /**
  * Instruct the given tab to execute the given series of mutations.  For
  * simplicity, the mutations representation matches the expected events rep.
  */
--- a/toolkit/components/antitracking/StoragePrincipalHelper.cpp
+++ b/toolkit/components/antitracking/StoragePrincipalHelper.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 "StoragePrincipalHelper.h"
 
-#include "mozilla/ipc/PBackgroundSharedTypes.h"
 #include "mozilla/ScopeExit.h"
 #include "mozilla/StaticPrefs.h"
 #include "nsContentUtils.h"
 #include "nsIHttpChannel.h"
 
 namespace mozilla {
 
 namespace {
@@ -93,93 +92,9 @@ nsresult StoragePrincipalHelper::Prepare
     return NS_OK;
   }
 
   aOriginAttributes.SetFirstPartyDomain(false, principalURI,
                                         true /* aForced */);
   return NS_OK;
 }
 
-// static
-bool StoragePrincipalHelper::VerifyValidStoragePrincipalInfoForPrincipalInfo(
-    const mozilla::ipc::PrincipalInfo& aStoragePrincipalInfo,
-    const mozilla::ipc::PrincipalInfo& aPrincipalInfo) {
-  if (aStoragePrincipalInfo.type() != aPrincipalInfo.type()) {
-    return false;
-  }
-
-  if (aStoragePrincipalInfo.type() ==
-      mozilla::ipc::PrincipalInfo::TContentPrincipalInfo) {
-    const mozilla::ipc::ContentPrincipalInfo& spInfo =
-        aStoragePrincipalInfo.get_ContentPrincipalInfo();
-    const mozilla::ipc::ContentPrincipalInfo& pInfo =
-        aPrincipalInfo.get_ContentPrincipalInfo();
-
-    if (!spInfo.attrs().EqualsIgnoringFPD(pInfo.attrs()) ||
-        spInfo.originNoSuffix() != pInfo.originNoSuffix() ||
-        spInfo.spec() != pInfo.spec() || spInfo.domain() != pInfo.domain() ||
-        spInfo.baseDomain() != pInfo.baseDomain() ||
-        spInfo.securityPolicies().Length() !=
-            pInfo.securityPolicies().Length()) {
-      return false;
-    }
-
-    for (uint32_t i = 0; i < spInfo.securityPolicies().Length(); ++i) {
-      if (spInfo.securityPolicies()[i].policy() !=
-              pInfo.securityPolicies()[i].policy() ||
-          spInfo.securityPolicies()[i].reportOnlyFlag() !=
-              pInfo.securityPolicies()[i].reportOnlyFlag() ||
-          spInfo.securityPolicies()[i].deliveredViaMetaTagFlag() !=
-              pInfo.securityPolicies()[i].deliveredViaMetaTagFlag()) {
-        return false;
-      }
-    }
-
-    return true;
-  }
-
-  if (aStoragePrincipalInfo.type() ==
-      mozilla::ipc::PrincipalInfo::TSystemPrincipalInfo) {
-    // Nothing to check here.
-    return true;
-  }
-
-  if (aStoragePrincipalInfo.type() ==
-      mozilla::ipc::PrincipalInfo::TNullPrincipalInfo) {
-    const mozilla::ipc::NullPrincipalInfo& spInfo =
-        aStoragePrincipalInfo.get_NullPrincipalInfo();
-    const mozilla::ipc::NullPrincipalInfo& pInfo =
-        aPrincipalInfo.get_NullPrincipalInfo();
-
-    return spInfo.spec() == pInfo.spec() &&
-           spInfo.attrs().EqualsIgnoringFPD(pInfo.attrs());
-  }
-
-  if (aStoragePrincipalInfo.type() ==
-      mozilla::ipc::PrincipalInfo::TExpandedPrincipalInfo) {
-    const mozilla::ipc::ExpandedPrincipalInfo& spInfo =
-        aStoragePrincipalInfo.get_ExpandedPrincipalInfo();
-    const mozilla::ipc::ExpandedPrincipalInfo& pInfo =
-        aPrincipalInfo.get_ExpandedPrincipalInfo();
-
-    if (!spInfo.attrs().EqualsIgnoringFPD(pInfo.attrs())) {
-      return false;
-    }
-
-    if (spInfo.allowlist().Length() != pInfo.allowlist().Length()) {
-      return false;
-    }
-
-    for (uint32_t i = 0; i < spInfo.allowlist().Length(); ++i) {
-      if (!VerifyValidStoragePrincipalInfoForPrincipalInfo(
-              spInfo.allowlist()[i], pInfo.allowlist()[i])) {
-        return false;
-      }
-    }
-
-    return true;
-  }
-
-  MOZ_CRASH("Invalid principalInfo type");
-  return false;
-}
-
 }  // namespace mozilla
--- a/toolkit/components/antitracking/StoragePrincipalHelper.h
+++ b/toolkit/components/antitracking/StoragePrincipalHelper.h
@@ -116,30 +116,22 @@
  * ServiceWorkers in partitioned context, this part must be revisited.
  */
 
 class nsIChannel;
 class nsIPrincipal;
 
 namespace mozilla {
 
-namespace ipc {
-class PrincipalInfo;
-}
-
 class OriginAttributes;
 
 class StoragePrincipalHelper final {
  public:
   static nsresult Create(nsIChannel* aChannel, nsIPrincipal* aPrincipal,
                          nsIPrincipal** aStoragePrincipal);
 
   static nsresult PrepareOriginAttributes(nsIChannel* aChannel,
                                           OriginAttributes& aOriginAttributes);
-
-  static bool VerifyValidStoragePrincipalInfoForPrincipalInfo(
-      const mozilla::ipc::PrincipalInfo& aStoragePrincipalInfo,
-      const mozilla::ipc::PrincipalInfo& aPrincipalInfo);
 };
 
 }  // namespace mozilla
 
 #endif  // mozilla_StoragePrincipalHelper_h
--- a/toolkit/components/antitracking/test/browser/browser_partitionedLocalStorage_events.js
+++ b/toolkit/components/antitracking/test/browser/browser_partitionedLocalStorage_events.js
@@ -1,564 +1,530 @@
-function runAllTests(withStoragePrincipalEnabled, lsngEnabled) {
-  // A same origin (and same-process via setting "dom.ipc.processCount" to 1)
-  // top-level window with access to real localStorage does not share storage
-  // with an ePartitionOrDeny iframe that should have PartitionedLocalStorage and
-  // no storage events are received in either direction.  (Same-process in order
-  // to avoid having to worry about any e10s propagation issues.)
-  add_task(async _ => {
-    await SpecialPowers.pushPrefEnv({"set": [
-      ["dom.ipc.processCount", 1],
-      ["network.cookie.cookieBehavior", Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER],
-      ["privacy.trackingprotection.enabled", false],
-      ["privacy.trackingprotection.pbmode.enabled", false],
-      ["privacy.trackingprotection.annotate_channels", true],
-      ["privacy.restrict3rdpartystorage.partitionedHosts", "tracking.example.org,tracking.example.com"],
-      ["privacy.storagePrincipal.enabledForTrackers", withStoragePrincipalEnabled],
-      ["dom.storage.next_gen", lsngEnabled],
-    ]});
+// A same origin (and same-process via setting "dom.ipc.processCount" to 1)
+// top-level window with access to real localStorage does not share storage
+// with an ePartitionOrDeny iframe that should have PartitionedLocalStorage and
+// no storage events are received in either direction.  (Same-process in order
+// to avoid having to worry about any e10s propagation issues.)
+add_task(async _ => {
+  await SpecialPowers.pushPrefEnv({"set": [
+    ["dom.ipc.processCount", 1],
+    ["network.cookie.cookieBehavior", Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER],
+    ["privacy.trackingprotection.enabled", false],
+    ["privacy.trackingprotection.pbmode.enabled", false],
+    ["privacy.trackingprotection.annotate_channels", true],
+    ["privacy.restrict3rdpartystorage.partitionedHosts", "tracking.example.org,tracking.example.com"],
+  ]});
 
-    await UrlClassifierTestUtils.addTestTrackers();
+  await UrlClassifierTestUtils.addTestTrackers();
 
-    info("Creating a non-tracker top-level context");
-    let normalTab = BrowserTestUtils.addTab(gBrowser, TEST_DOMAIN + TEST_PATH + "page.html");
-    let normalBrowser = gBrowser.getBrowserForTab(normalTab);
-    await BrowserTestUtils.browserLoaded(normalBrowser);
+  info("Creating a non-tracker top-level context");
+  let normalTab = BrowserTestUtils.addTab(gBrowser, TEST_DOMAIN + TEST_PATH + "page.html");
+  let normalBrowser = gBrowser.getBrowserForTab(normalTab);
+  await BrowserTestUtils.browserLoaded(normalBrowser);
 
-    info("Creating a tracker top-level context");
-    let trackerTab = BrowserTestUtils.addTab(gBrowser, TEST_3RD_PARTY_DOMAIN + TEST_PATH + "page.html");
-    let trackerBrowser = gBrowser.getBrowserForTab(trackerTab);
-    await BrowserTestUtils.browserLoaded(trackerBrowser);
+  info("Creating a tracker top-level context");
+  let trackerTab = BrowserTestUtils.addTab(gBrowser, TEST_3RD_PARTY_DOMAIN + TEST_PATH + "page.html");
+  let trackerBrowser = gBrowser.getBrowserForTab(trackerTab);
+  await BrowserTestUtils.browserLoaded(trackerBrowser);
 
-    info("The non-tracker page opens a tracker iframe");
-    await ContentTask.spawn(normalBrowser, {
-        page: TEST_3RD_PARTY_DOMAIN + TEST_PATH + "localStorageEvents.html",
-      }, async obj => {
-        let ifr = content.document.createElement("iframe");
-        ifr.setAttribute("id", "ifr");
-        ifr.setAttribute("src", obj.page);
+  info("The non-tracker page opens a tracker iframe");
+  await ContentTask.spawn(normalBrowser, {
+      page: TEST_3RD_PARTY_DOMAIN + TEST_PATH + "localStorageEvents.html",
+    }, async obj => {
+      let ifr = content.document.createElement("iframe");
+      ifr.setAttribute("id", "ifr");
+      ifr.setAttribute("src", obj.page);
 
-        info("Iframe loading...");
-        await new content.Promise(resolve => {
-          ifr.onload = resolve;
-          content.document.body.appendChild(ifr);
-        });
+      info("Iframe loading...");
+      await new content.Promise(resolve => {
+        ifr.onload = resolve;
+        content.document.body.appendChild(ifr);
+      });
 
-        info("Setting localStorage value...");
-        ifr.contentWindow.postMessage("setValue", "*");
+      info("Setting localStorage value...");
+      ifr.contentWindow.postMessage("setValue", "*");
 
-        info("Getting the value...");
-        let value = await new Promise(resolve => {
-          content.addEventListener("message", e => {
-            resolve(e.data);
-          }, {once: true});
-          ifr.contentWindow.postMessage("getValue", "*");
-        });
+      info("Getting the value...");
+      let value = await new Promise(resolve => {
+        content.addEventListener("message", e => {
+          resolve(e.data);
+        }, {once: true});
+        ifr.contentWindow.postMessage("getValue", "*");
+      });
 
-        ok(value.startsWith("tracker-"), "The value is correctly set by the tracker");
-      }
-    );
+      ok(value.startsWith("tracker-"), "The value is correctly set by the tracker");
+    }
+  );
 
-    info("The tracker page should not have received events");
-    await ContentTask.spawn(trackerBrowser, null, async _ => {
-        is(content.localStorage.foo, undefined, "Undefined value!");
-        content.localStorage.foo = "normal-" + Math.random();
-      }
-    );
+  info("The tracker page should not have received events");
+  await ContentTask.spawn(trackerBrowser, null, async _ => {
+      is(content.localStorage.foo, undefined, "Undefined value!");
+      content.localStorage.foo = "normal-" + Math.random();
+    }
+  );
 
-    info("Let's see if non-tracker page has received events");
-    await ContentTask.spawn(normalBrowser, null, async _ => {
-        let ifr = content.document.getElementById("ifr");
+  info("Let's see if non-tracker page has received events");
+  await ContentTask.spawn(normalBrowser, null, async _ => {
+      let ifr = content.document.getElementById("ifr");
 
-        info("Getting the value...");
-        let value = await new Promise(resolve => {
-          content.addEventListener("message", e => {
-            resolve(e.data);
-          }, {once: true});
-          ifr.contentWindow.postMessage("getValue", "*");
-        });
+      info("Getting the value...");
+      let value = await new Promise(resolve => {
+        content.addEventListener("message", e => {
+          resolve(e.data);
+        }, {once: true});
+        ifr.contentWindow.postMessage("getValue", "*");
+      });
 
-        ok(value.startsWith("tracker-"), "The value is correctly set by the tracker");
+      ok(value.startsWith("tracker-"), "The value is correctly set by the tracker");
 
-        info("Getting the events...");
-        let events = await new Promise(resolve => {
-          content.addEventListener("message", e => {
-            resolve(e.data);
-          }, {once: true});
-          ifr.contentWindow.postMessage("getEvents", "*");
-        });
+      info("Getting the events...");
+      let events = await new Promise(resolve => {
+        content.addEventListener("message", e => {
+          resolve(e.data);
+        }, {once: true});
+        ifr.contentWindow.postMessage("getEvents", "*");
+      });
 
-        is(events, 0, "No events");
-      }
-    );
+      is(events, 0, "No events");
+    }
+  );
 
-    BrowserTestUtils.removeTab(trackerTab);
-    BrowserTestUtils.removeTab(normalTab);
-  });
+  BrowserTestUtils.removeTab(trackerTab);
+  BrowserTestUtils.removeTab(normalTab);
+});
 
-  // Two ePartitionOrDeny iframes in the same tab in the same origin don't see
-  // the same localStorage values and no storage events are received from each
-  // other.
-  add_task(async _ => {
-    await SpecialPowers.pushPrefEnv({"set": [
-      ["dom.ipc.processCount", 1],
-      ["network.cookie.cookieBehavior", Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER],
-      ["privacy.trackingprotection.enabled", false],
-      ["privacy.trackingprotection.pbmode.enabled", false],
-      ["privacy.trackingprotection.annotate_channels", true],
-      ["privacy.restrict3rdpartystorage.partitionedHosts", "tracking.example.org,tracking.example.com"],
-      ["privacy.storagePrincipal.enabledForTrackers", withStoragePrincipalEnabled],
-    ]});
+// Two ePartitionOrDeny iframes in the same tab in the same origin don"t see
+// the same localStorage values and no storage events are received from each
+// other.
+add_task(async _ => {
+  await SpecialPowers.pushPrefEnv({"set": [
+    ["dom.ipc.processCount", 1],
+    ["network.cookie.cookieBehavior", Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER],
+    ["privacy.trackingprotection.enabled", false],
+    ["privacy.trackingprotection.pbmode.enabled", false],
+    ["privacy.trackingprotection.annotate_channels", true],
+    ["privacy.restrict3rdpartystorage.partitionedHosts", "tracking.example.org,tracking.example.com"],
+  ]});
 
-    await UrlClassifierTestUtils.addTestTrackers();
+  await UrlClassifierTestUtils.addTestTrackers();
 
-    info("Creating a non-tracker top-level context");
-    let normalTab = BrowserTestUtils.addTab(gBrowser, TEST_DOMAIN + TEST_PATH + "page.html");
-    let normalBrowser = gBrowser.getBrowserForTab(normalTab);
-    await BrowserTestUtils.browserLoaded(normalBrowser);
+  info("Creating a non-tracker top-level context");
+  let normalTab = BrowserTestUtils.addTab(gBrowser, TEST_DOMAIN + TEST_PATH + "page.html");
+  let normalBrowser = gBrowser.getBrowserForTab(normalTab);
+  await BrowserTestUtils.browserLoaded(normalBrowser);
 
-    info("The non-tracker page opens a tracker iframe");
-    await ContentTask.spawn(normalBrowser, {
-        page: TEST_3RD_PARTY_DOMAIN + TEST_PATH + "localStorageEvents.html",
-        withStoragePrincipalEnabled,
-      }, async obj => {
-        let ifr1 = content.document.createElement("iframe");
-        ifr1.setAttribute("id", "ifr1");
-        ifr1.setAttribute("src", obj.page);
+  info("The non-tracker page opens a tracker iframe");
+  await ContentTask.spawn(normalBrowser, {
+      page: TEST_3RD_PARTY_DOMAIN + TEST_PATH + "localStorageEvents.html",
+    }, async obj => {
+      let ifr1 = content.document.createElement("iframe");
+      ifr1.setAttribute("id", "ifr1");
+      ifr1.setAttribute("src", obj.page);
 
-        info("Iframe 1 loading...");
-        await new content.Promise(resolve => {
-          ifr1.onload = resolve;
-          content.document.body.appendChild(ifr1);
-        });
+      info("Iframe 1 loading...");
+      await new content.Promise(resolve => {
+        ifr1.onload = resolve;
+        content.document.body.appendChild(ifr1);
+      });
 
-        let ifr2 = content.document.createElement("iframe");
-        ifr2.setAttribute("id", "ifr2");
-        ifr2.setAttribute("src", obj.page);
+      let ifr2 = content.document.createElement("iframe");
+      ifr2.setAttribute("id", "ifr2");
+      ifr2.setAttribute("src", obj.page);
 
-        info("Iframe 2 loading...");
-        await new content.Promise(resolve => {
-          ifr2.onload = resolve;
-          content.document.body.appendChild(ifr2);
-        });
+      info("Iframe 2 loading...");
+      await new content.Promise(resolve => {
+        ifr2.onload = resolve;
+        content.document.body.appendChild(ifr2);
+      });
+
+      info("Setting localStorage value in ifr1...");
+      ifr1.contentWindow.postMessage("setValue", "*");
 
-        info("Setting localStorage value in ifr1...");
-        ifr1.contentWindow.postMessage("setValue", "*");
+      info("Getting the value from ifr1...");
+      let value = await new Promise(resolve => {
+        content.addEventListener("message", e => {
+          resolve(e.data);
+        }, {once: true});
+        ifr1.contentWindow.postMessage("getValue", "*");
+      });
 
-        info("Getting the value from ifr1...");
-        let value = await new Promise(resolve => {
-          content.addEventListener("message", e => {
-            resolve(e.data);
-          }, {once: true});
-          ifr1.contentWindow.postMessage("getValue", "*");
-        });
+      ok(value.startsWith("tracker-"), "The value is correctly set in ifr1");
 
-        ok(value.startsWith("tracker-"), "The value is correctly set in ifr1");
+      info("Getting the value from ifr2...");
+      value = await new Promise(resolve => {
+        content.addEventListener("message", e => {
+          resolve(e.data);
+        }, {once: true});
+        ifr2.contentWindow.postMessage("getValue", "*");
+      });
 
-        info("Getting the value from ifr2...");
-        value = await new Promise(resolve => {
-          content.addEventListener("message", e => {
-            resolve(e.data);
-          }, {once: true});
-          ifr2.contentWindow.postMessage("getValue", "*");
-        });
+      is(value, null, "The value is nt set in ifr2");
 
-        if (obj.withStoragePrincipalEnabled) {
-          ok(value.startsWith("tracker-"), "The value is correctly set in ifr2");
-        } else {
-          is(value, null, "The value is not set in ifr2");
-        }
+      info("Getting the events received by ifr2...");
+      let events = await new Promise(resolve => {
+        content.addEventListener("message", e => {
+          resolve(e.data);
+        }, {once: true});
+        ifr2.contentWindow.postMessage("getEvents", "*");
+      });
+
+      is(events, 0, "No events");
+    }
+  );
 
-        info("Getting the events received by ifr2...");
-        let events = await new Promise(resolve => {
-          content.addEventListener("message", e => {
-            resolve(e.data);
-          }, {once: true});
-          ifr2.contentWindow.postMessage("getEvents", "*");
-        });
+  BrowserTestUtils.removeTab(normalTab);
+});
 
-        if (obj.withStoragePrincipalEnabled) {
-          is(events, 1, "1 event received");
-        } else {
-          is(events, 0, "No events");
-        }
-      }
-    );
+// Same as the previous test but with a cookie behavior of BEHAVIOR_ACCEPT
+// instead of BEHAVIOR_REJECT_TRACKER so the iframes get real, persistent
+// localStorage instead of partitioned localStorage.
+add_task(async _ => {
+  await SpecialPowers.pushPrefEnv({"set": [
+    ["dom.ipc.processCount", 1],
+    ["network.cookie.cookieBehavior", Ci.nsICookieService.BEHAVIOR_ACCEPT],
+    ["privacy.trackingprotection.enabled", false],
+    ["privacy.trackingprotection.pbmode.enabled", false],
+    ["privacy.trackingprotection.annotate_channels", true],
+    ["privacy.restrict3rdpartystorage.partitionedHosts", "tracking.example.org,tracking.example.com"],
+  ]});
 
-    BrowserTestUtils.removeTab(normalTab);
-  });
+  await UrlClassifierTestUtils.addTestTrackers();
 
-  // Same as the previous test but with a cookie behavior of BEHAVIOR_ACCEPT
-  // instead of BEHAVIOR_REJECT_TRACKER so the iframes get real, persistent
-  // localStorage instead of partitioned localStorage.
-  add_task(async _ => {
-    await SpecialPowers.pushPrefEnv({"set": [
-      ["dom.ipc.processCount", 1],
-      ["network.cookie.cookieBehavior", Ci.nsICookieService.BEHAVIOR_ACCEPT],
-      ["privacy.trackingprotection.enabled", false],
-      ["privacy.trackingprotection.pbmode.enabled", false],
-      ["privacy.trackingprotection.annotate_channels", true],
-      ["privacy.restrict3rdpartystorage.partitionedHosts", "tracking.example.org,tracking.example.com"],
-      ["privacy.storagePrincipal.enabledForTrackers", withStoragePrincipalEnabled],
-    ]});
+  info("Creating a non-tracker top-level context");
+  let normalTab = BrowserTestUtils.addTab(gBrowser, TEST_DOMAIN + TEST_PATH + "page.html");
+  let normalBrowser = gBrowser.getBrowserForTab(normalTab);
+  await BrowserTestUtils.browserLoaded(normalBrowser);
 
-    await UrlClassifierTestUtils.addTestTrackers();
+  info("The non-tracker page opens a tracker iframe");
+  await ContentTask.spawn(normalBrowser, {
+      page: TEST_3RD_PARTY_DOMAIN + TEST_PATH + "localStorageEvents.html",
+    }, async obj => {
+      let ifr1 = content.document.createElement("iframe");
+      ifr1.setAttribute("id", "ifr1");
+      ifr1.setAttribute("src", obj.page);
 
-    info("Creating a non-tracker top-level context");
-    let normalTab = BrowserTestUtils.addTab(gBrowser, TEST_DOMAIN + TEST_PATH + "page.html");
-    let normalBrowser = gBrowser.getBrowserForTab(normalTab);
-    await BrowserTestUtils.browserLoaded(normalBrowser);
+      info("Iframe 1 loading...");
+      await new content.Promise(resolve => {
+        ifr1.onload = resolve;
+        content.document.body.appendChild(ifr1);
+      });
 
-    info("The non-tracker page opens a tracker iframe");
-    await ContentTask.spawn(normalBrowser, {
-        page: TEST_3RD_PARTY_DOMAIN + TEST_PATH + "localStorageEvents.html",
-      }, async obj => {
-        let ifr1 = content.document.createElement("iframe");
-        ifr1.setAttribute("id", "ifr1");
-        ifr1.setAttribute("src", obj.page);
+      let ifr2 = content.document.createElement("iframe");
+      ifr2.setAttribute("id", "ifr2");
+      ifr2.setAttribute("src", obj.page);
 
-        info("Iframe 1 loading...");
-        await new content.Promise(resolve => {
-          ifr1.onload = resolve;
-          content.document.body.appendChild(ifr1);
-        });
+      info("Iframe 2 loading...");
+      await new content.Promise(resolve => {
+        ifr2.onload = resolve;
+        content.document.body.appendChild(ifr2);
+      });
 
-        let ifr2 = content.document.createElement("iframe");
-        ifr2.setAttribute("id", "ifr2");
-        ifr2.setAttribute("src", obj.page);
+      info("Setting localStorage value in ifr1...");
+      ifr1.contentWindow.postMessage("setValue", "*");
 
-        info("Iframe 2 loading...");
-        await new content.Promise(resolve => {
-          ifr2.onload = resolve;
-          content.document.body.appendChild(ifr2);
-        });
-
-        info("Setting localStorage value in ifr1...");
-        ifr1.contentWindow.postMessage("setValue", "*");
+      info("Getting the value from ifr1...");
+      let value1 = await new Promise(resolve => {
+        content.addEventListener("message", e => {
+          resolve(e.data);
+        }, {once: true});
+        ifr1.contentWindow.postMessage("getValue", "*");
+      });
 
-        info("Getting the value from ifr1...");
-        let value1 = await new Promise(resolve => {
-          content.addEventListener("message", e => {
-            resolve(e.data);
-          }, {once: true});
-          ifr1.contentWindow.postMessage("getValue", "*");
-        });
-
-        ok(value1.startsWith("tracker-"), "The value is correctly set in ifr1");
+      ok(value1.startsWith("tracker-"), "The value is correctly set in ifr1");
 
-        info("Getting the value from ifr2...");
-        let value2 = await new Promise(resolve => {
-          content.addEventListener("message", e => {
-            resolve(e.data);
-          }, {once: true});
-          ifr2.contentWindow.postMessage("getValue", "*");
-        });
+      info("Getting the value from ifr2...");
+      let value2 = await new Promise(resolve => {
+        content.addEventListener("message", e => {
+          resolve(e.data);
+        }, {once: true});
+        ifr2.contentWindow.postMessage("getValue", "*");
+      });
 
-        is(value2, value1, "The values match");
+      is(value2, value1, "The values match");
 
-        info("Getting the events received by ifr2...");
-        let events = await new Promise(resolve => {
-          content.addEventListener("message", e => {
-            resolve(e.data);
-          }, {once: true});
-          ifr2.contentWindow.postMessage("getEvents", "*");
-        });
+      info("Getting the events received by ifr2...");
+      let events = await new Promise(resolve => {
+        content.addEventListener("message", e => {
+          resolve(e.data);
+        }, {once: true});
+        ifr2.contentWindow.postMessage("getEvents", "*");
+      });
 
-        is(events, 1, "One event");
-      }
-    );
+      is(events, 1, "One event");
+    }
+  );
 
-    BrowserTestUtils.removeTab(normalTab);
-  });
+  BrowserTestUtils.removeTab(normalTab);
+});
 
-  // An ePartitionOrDeny iframe navigated between two distinct pages on the same
-  // origin does not see the values stored by the previous iframe.
-  add_task(async _ => {
-    await SpecialPowers.pushPrefEnv({"set": [
-      ["dom.ipc.processCount", 1],
-      ["network.cookie.cookieBehavior", Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER],
-      ["privacy.trackingprotection.enabled", false],
-      ["privacy.trackingprotection.pbmode.enabled", false],
-      ["privacy.trackingprotection.annotate_channels", true],
-      ["privacy.restrict3rdpartystorage.partitionedHosts", "tracking.example.org,tracking.example.com"],
-      ["privacy.storagePrincipal.enabledForTrackers", withStoragePrincipalEnabled],
-    ]});
-
-    await UrlClassifierTestUtils.addTestTrackers();
+// An ePartitionOrDeny iframe navigated between two distinct pages on the same
+// origin does not see the values stored by the previous iframe.
+add_task(async _ => {
+  await SpecialPowers.pushPrefEnv({"set": [
+    ["dom.ipc.processCount", 1],
+    ["network.cookie.cookieBehavior", Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER],
+    ["privacy.trackingprotection.enabled", false],
+    ["privacy.trackingprotection.pbmode.enabled", false],
+    ["privacy.trackingprotection.annotate_channels", true],
+    ["privacy.restrict3rdpartystorage.partitionedHosts", "tracking.example.org,tracking.example.com"],
+  ]});
 
-    info("Creating a non-tracker top-level context");
-    let normalTab = BrowserTestUtils.addTab(gBrowser, TEST_DOMAIN + TEST_PATH + "page.html");
-    let normalBrowser = gBrowser.getBrowserForTab(normalTab);
-    await BrowserTestUtils.browserLoaded(normalBrowser);
+  await UrlClassifierTestUtils.addTestTrackers();
+
+  info("Creating a non-tracker top-level context");
+  let normalTab = BrowserTestUtils.addTab(gBrowser, TEST_DOMAIN + TEST_PATH + "page.html");
+  let normalBrowser = gBrowser.getBrowserForTab(normalTab);
+  await BrowserTestUtils.browserLoaded(normalBrowser);
 
-    info("The non-tracker page opens a tracker iframe");
-    await ContentTask.spawn(normalBrowser, {
-        page: TEST_3RD_PARTY_DOMAIN + TEST_PATH + "localStorageEvents.html",
-        withStoragePrincipalEnabled,
-      }, async obj => {
-        let ifr = content.document.createElement("iframe");
-        ifr.setAttribute("id", "ifr");
-        ifr.setAttribute("src", obj.page);
-
-        info("Iframe loading...");
-        await new content.Promise(resolve => {
-          ifr.onload = resolve;
-          content.document.body.appendChild(ifr);
-        });
+  info("The non-tracker page opens a tracker iframe");
+  await ContentTask.spawn(normalBrowser, {
+      page: TEST_3RD_PARTY_DOMAIN + TEST_PATH + "localStorageEvents.html",
+    }, async obj => {
+      let ifr = content.document.createElement("iframe");
+      ifr.setAttribute("id", "ifr");
+      ifr.setAttribute("src", obj.page);
 
-        info("Setting localStorage value in ifr...");
-        ifr.contentWindow.postMessage("setValue", "*");
+      info("Iframe loading...");
+      await new content.Promise(resolve => {
+        ifr.onload = resolve;
+        content.document.body.appendChild(ifr);
+      });
 
-        info("Getting the value from ifr...");
-        let value = await new Promise(resolve => {
-          content.addEventListener("message", e => {
-            resolve(e.data);
-          }, {once: true});
-          ifr.contentWindow.postMessage("getValue", "*");
-        });
+      info("Setting localStorage value in ifr...");
+      ifr.contentWindow.postMessage("setValue", "*");
 
-        ok(value.startsWith("tracker-"), "The value is correctly set in ifr");
+      info("Getting the value from ifr...");
+      let value = await new Promise(resolve => {
+        content.addEventListener("message", e => {
+          resolve(e.data);
+        }, {once: true});
+        ifr.contentWindow.postMessage("getValue", "*");
+      });
 
-        info("Navigate...");
-        await new content.Promise(resolve => {
-          ifr.onload = resolve;
-          ifr.setAttribute("src", obj.page + "?" + Math.random());
-        });
+      ok(value.startsWith("tracker-"), "The value is correctly set in ifr");
+
+      info("Navigate...");
+      await new content.Promise(resolve => {
+        ifr.onload = resolve;
+        ifr.setAttribute("src", obj.page + "?" + Math.random());
+      });
 
-        info("Getting the value from ifr...");
-        let value2 = await new Promise(resolve => {
-          content.addEventListener("message", e => {
-            resolve(e.data);
-          }, {once: true});
-          ifr.contentWindow.postMessage("getValue", "*");
-        });
+      info("Getting the value from ifr...");
+      value = await new Promise(resolve => {
+        content.addEventListener("message", e => {
+          resolve(e.data);
+        }, {once: true});
+        ifr.contentWindow.postMessage("getValue", "*");
+      });
 
-        if (obj.withStoragePrincipalEnabled) {
-          is(value, value2, "The value is received");
-        } else {
-          is(value2, null, "The value is undefined");
-        }
-      }
-    );
+      is(value, null, "The value is undefined");
+    }
+  );
 
-    BrowserTestUtils.removeTab(normalTab);
-  });
+  BrowserTestUtils.removeTab(normalTab);
+});
 
-  // Like the previous test, but accepting trackers
-  add_task(async _ => {
-    await SpecialPowers.pushPrefEnv({"set": [
-      ["dom.ipc.processCount", 1],
-      ["network.cookie.cookieBehavior", Ci.nsICookieService.BEHAVIOR_ACCEPT],
-      ["privacy.trackingprotection.enabled", false],
-      ["privacy.trackingprotection.pbmode.enabled", false],
-      ["privacy.trackingprotection.annotate_channels", true],
-      ["privacy.restrict3rdpartystorage.partitionedHosts", "tracking.example.org,tracking.example.com"],
-      ["privacy.storagePrincipal.enabledForTrackers", withStoragePrincipalEnabled],
-    ]});
+// Like the previous test, but accepting trackers
+add_task(async _ => {
+  await SpecialPowers.pushPrefEnv({"set": [
+    ["dom.ipc.processCount", 1],
+    ["network.cookie.cookieBehavior", Ci.nsICookieService.BEHAVIOR_ACCEPT],
+    ["privacy.trackingprotection.enabled", false],
+    ["privacy.trackingprotection.pbmode.enabled", false],
+    ["privacy.trackingprotection.annotate_channels", true],
+    ["privacy.restrict3rdpartystorage.partitionedHosts", "tracking.example.org,tracking.example.com"],
+  ]});
 
-    await UrlClassifierTestUtils.addTestTrackers();
+  await UrlClassifierTestUtils.addTestTrackers();
 
-    info("Creating a non-tracker top-level context");
-    let normalTab = BrowserTestUtils.addTab(gBrowser, TEST_DOMAIN + TEST_PATH + "page.html");
-    let normalBrowser = gBrowser.getBrowserForTab(normalTab);
-    await BrowserTestUtils.browserLoaded(normalBrowser);
+  info("Creating a non-tracker top-level context");
+  let normalTab = BrowserTestUtils.addTab(gBrowser, TEST_DOMAIN + TEST_PATH + "page.html");
+  let normalBrowser = gBrowser.getBrowserForTab(normalTab);
+  await BrowserTestUtils.browserLoaded(normalBrowser);
 
-    info("The non-tracker page opens a tracker iframe");
-    await ContentTask.spawn(normalBrowser, {
-        page: TEST_3RD_PARTY_DOMAIN + TEST_PATH + "localStorageEvents.html",
-      }, async obj => {
-        let ifr = content.document.createElement("iframe");
-        ifr.setAttribute("id", "ifr");
-        ifr.setAttribute("src", obj.page);
+  info("The non-tracker page opens a tracker iframe");
+  await ContentTask.spawn(normalBrowser, {
+      page: TEST_3RD_PARTY_DOMAIN + TEST_PATH + "localStorageEvents.html",
+    }, async obj => {
+      let ifr = content.document.createElement("iframe");
+      ifr.setAttribute("id", "ifr");
+      ifr.setAttribute("src", obj.page);
 
-        info("Iframe loading...");
-        await new content.Promise(resolve => {
-          ifr.onload = resolve;
-          content.document.body.appendChild(ifr);
-        });
+      info("Iframe loading...");
+      await new content.Promise(resolve => {
+        ifr.onload = resolve;
+        content.document.body.appendChild(ifr);
+      });
 
-        info("Setting localStorage value in ifr...");
-        ifr.contentWindow.postMessage("setValue", "*");
+      info("Setting localStorage value in ifr...");
+      ifr.contentWindow.postMessage("setValue", "*");
 
-        info("Getting the value from ifr...");
-        let value = await new Promise(resolve => {
-          content.addEventListener("message", e => {
-            resolve(e.data);
-          }, {once: true});
-          ifr.contentWindow.postMessage("getValue", "*");
-        });
+      info("Getting the value from ifr...");
+      let value = await new Promise(resolve => {
+        content.addEventListener("message", e => {
+          resolve(e.data);
+        }, {once: true});
+        ifr.contentWindow.postMessage("getValue", "*");
+      });
 
-        ok(value.startsWith("tracker-"), "The value is correctly set in ifr");
+      ok(value.startsWith("tracker-"), "The value is correctly set in ifr");
 
-        info("Navigate...");
-        await new content.Promise(resolve => {
-          ifr.onload = resolve;
-          ifr.setAttribute("src", obj.page + "?" + Math.random());
-        });
+      info("Navigate...");
+      await new content.Promise(resolve => {
+        ifr.onload = resolve;
+        ifr.setAttribute("src", obj.page + "?" + Math.random());
+      });
 
-        info("Getting the value from ifr...");
-        let value2 = await new Promise(resolve => {
-          content.addEventListener("message", e => {
-            resolve(e.data);
-          }, {once: true});
-          ifr.contentWindow.postMessage("getValue", "*");
-        });
+      info("Getting the value from ifr...");
+      let value2 = await new Promise(resolve => {
+        content.addEventListener("message", e => {
+          resolve(e.data);
+        }, {once: true});
+        ifr.contentWindow.postMessage("getValue", "*");
+      });
 
-        is(value, value2, "The value is received");
-      }
-    );
+      is(value, value2, "The value is undefined");
+    }
+  );
 
-    BrowserTestUtils.removeTab(normalTab);
-  });
+  BrowserTestUtils.removeTab(normalTab);
+});
 
-  // An ePartitionOrDeny iframe on the same origin that is navigated to itself
-  // via window.location.reload() or equivalent does not see the values stored
-  // by its previous self.
-  add_task(async _ => {
-    await SpecialPowers.pushPrefEnv({"set": [
-      ["dom.ipc.processCount", 1],
-      ["network.cookie.cookieBehavior", Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER],
-      ["privacy.trackingprotection.enabled", false],
-      ["privacy.trackingprotection.pbmode.enabled", false],
-      ["privacy.trackingprotection.annotate_channels", true],
-      ["privacy.restrict3rdpartystorage.partitionedHosts", "tracking.example.org,tracking.example.com"],
-      ["privacy.storagePrincipal.enabledForTrackers", withStoragePrincipalEnabled],
-    ]});
+// An ePartitionOrDeny iframe on the same origin that is navigated to itself
+// via window.location.reload() or equivalent does not see the values stored by
+// its previous self.
+add_task(async _ => {
+  await SpecialPowers.pushPrefEnv({"set": [
+    ["dom.ipc.processCount", 1],
+    ["network.cookie.cookieBehavior", Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER],
+    ["privacy.trackingprotection.enabled", false],
+    ["privacy.trackingprotection.pbmode.enabled", false],
+    ["privacy.trackingprotection.annotate_channels", true],
+    ["privacy.restrict3rdpartystorage.partitionedHosts", "tracking.example.org,tracking.example.com"],
+  ]});
 
-    await UrlClassifierTestUtils.addTestTrackers();
+  await UrlClassifierTestUtils.addTestTrackers();
 
-    info("Creating a non-tracker top-level context");
-    let normalTab = BrowserTestUtils.addTab(gBrowser, TEST_DOMAIN + TEST_PATH + "page.html");
-    let normalBrowser = gBrowser.getBrowserForTab(normalTab);
-    await BrowserTestUtils.browserLoaded(normalBrowser);
+  info("Creating a non-tracker top-level context");
+  let normalTab = BrowserTestUtils.addTab(gBrowser, TEST_DOMAIN + TEST_PATH + "page.html");
+  let normalBrowser = gBrowser.getBrowserForTab(normalTab);
+  await BrowserTestUtils.browserLoaded(normalBrowser);
 
-    info("The non-tracker page opens a tracker iframe");
-    await ContentTask.spawn(normalBrowser, {
-        page: TEST_3RD_PARTY_DOMAIN + TEST_PATH + "localStorageEvents.html",
-        withStoragePrincipalEnabled,
-      }, async obj => {
-        let ifr = content.document.createElement("iframe");
-        ifr.setAttribute("id", "ifr");
-        ifr.setAttribute("src", obj.page);
+  info("The non-tracker page opens a tracker iframe");
+  await ContentTask.spawn(normalBrowser, {
+      page: TEST_3RD_PARTY_DOMAIN + TEST_PATH + "localStorageEvents.html",
+    }, async obj => {
+      let ifr = content.document.createElement("iframe");
+      ifr.setAttribute("id", "ifr");
+      ifr.setAttribute("src", obj.page);
 
-        info("Iframe loading...");
-        await new content.Promise(resolve => {
-          ifr.onload = resolve;
-          content.document.body.appendChild(ifr);
-        });
+      info("Iframe loading...");
+      await new content.Promise(resolve => {
+        ifr.onload = resolve;
+        content.document.body.appendChild(ifr);
+      });
 
-        info("Setting localStorage value in ifr...");
-        ifr.contentWindow.postMessage("setValue", "*");
+      info("Setting localStorage value in ifr...");
+      ifr.contentWindow.postMessage("setValue", "*");
 
-        info("Getting the value from ifr...");
-        let value = await new Promise(resolve => {
-          content.addEventListener("message", e => {
-            resolve(e.data);
-          }, {once: true});
-          ifr.contentWindow.postMessage("getValue", "*");
-        });
+      info("Getting the value from ifr...");
+      let value = await new Promise(resolve => {
+        content.addEventListener("message", e => {
+          resolve(e.data);
+        }, {once: true});
+        ifr.contentWindow.postMessage("getValue", "*");
+      });
 
-        ok(value.startsWith("tracker-"), "The value is correctly set in ifr");
-
-        info("Reload...");
-        await new content.Promise(resolve => {
-          ifr.onload = resolve;
-          ifr.contentWindow.postMessage("reload", "*");
-        });
+      ok(value.startsWith("tracker-"), "The value is correctly set in ifr");
 
-        info("Getting the value from ifr...");
-        let value2 = await new Promise(resolve => {
-          content.addEventListener("message", e => {
-            resolve(e.data);
-          }, {once: true});
-          ifr.contentWindow.postMessage("getValue", "*");
-        });
+      info("Reload...");
+      await new content.Promise(resolve => {
+        ifr.onload = resolve;
+        ifr.contentWindow.postMessage("reload", "*");
+      });
 
-        if (obj.withStoragePrincipalEnabled) {
-          is(value, value2, "The value is equal");
-        } else {
-          is(value2, null, "The value is undefined");
-        }
-      }
-    );
+      info("Getting the value from ifr...");
+      value = await new Promise(resolve => {
+        content.addEventListener("message", e => {
+          resolve(e.data);
+        }, {once: true});
+        ifr.contentWindow.postMessage("getValue", "*");
+      });
 
-    BrowserTestUtils.removeTab(normalTab);
-  });
+      is(value, null, "The value is undefined");
+    }
+  );
+
+  BrowserTestUtils.removeTab(normalTab);
+});
 
-  // Like the previous test, but accepting trackers
-  add_task(async _ => {
-    await SpecialPowers.pushPrefEnv({"set": [
-      ["dom.ipc.processCount", 1],
-      ["network.cookie.cookieBehavior", Ci.nsICookieService.BEHAVIOR_ACCEPT],
-      ["privacy.trackingprotection.enabled", false],
-      ["privacy.trackingprotection.pbmode.enabled", false],
-      ["privacy.trackingprotection.annotate_channels", true],
-      ["privacy.restrict3rdpartystorage.partitionedHosts", "tracking.example.org,tracking.example.com"],
-      ["privacy.storagePrincipal.enabledForTrackers", withStoragePrincipalEnabled],
-    ]});
+// Like the previous test, but accepting trackers
+add_task(async _ => {
+  await SpecialPowers.pushPrefEnv({"set": [
+    ["dom.ipc.processCount", 1],
+    ["network.cookie.cookieBehavior", Ci.nsICookieService.BEHAVIOR_ACCEPT],
+    ["privacy.trackingprotection.enabled", false],
+    ["privacy.trackingprotection.pbmode.enabled", false],
+    ["privacy.trackingprotection.annotate_channels", true],
+    ["privacy.restrict3rdpartystorage.partitionedHosts", "tracking.example.org,tracking.example.com"],
+  ]});
 
-    await UrlClassifierTestUtils.addTestTrackers();
+  await UrlClassifierTestUtils.addTestTrackers();
 
-    info("Creating a non-tracker top-level context");
-    let normalTab = BrowserTestUtils.addTab(gBrowser, TEST_DOMAIN + TEST_PATH + "page.html");
-    let normalBrowser = gBrowser.getBrowserForTab(normalTab);
-    await BrowserTestUtils.browserLoaded(normalBrowser);
+  info("Creating a non-tracker top-level context");
+  let normalTab = BrowserTestUtils.addTab(gBrowser, TEST_DOMAIN + TEST_PATH + "page.html");
+  let normalBrowser = gBrowser.getBrowserForTab(normalTab);
+  await BrowserTestUtils.browserLoaded(normalBrowser);
 
-    info("The non-tracker page opens a tracker iframe");
-    await ContentTask.spawn(normalBrowser, {
-        page: TEST_3RD_PARTY_DOMAIN + TEST_PATH + "localStorageEvents.html",
-      }, async obj => {
-        let ifr = content.document.createElement("iframe");
-        ifr.setAttribute("id", "ifr");
-        ifr.setAttribute("src", obj.page);
+  info("The non-tracker page opens a tracker iframe");
+  await ContentTask.spawn(normalBrowser, {
+      page: TEST_3RD_PARTY_DOMAIN + TEST_PATH + "localStorageEvents.html",
+    }, async obj => {
+      let ifr = content.document.createElement("iframe");
+      ifr.setAttribute("id", "ifr");
+      ifr.setAttribute("src", obj.page);
 
-        info("Iframe loading...");
-        await new content.Promise(resolve => {
-          ifr.onload = resolve;
-          content.document.body.appendChild(ifr);
-        });
+      info("Iframe loading...");
+      await new content.Promise(resolve => {
+        ifr.onload = resolve;
+        content.document.body.appendChild(ifr);
+      });
 
-        info("Setting localStorage value in ifr...");
-        ifr.contentWindow.postMessage("setValue", "*");
+      info("Setting localStorage value in ifr...");
+      ifr.contentWindow.postMessage("setValue", "*");
 
-        info("Getting the value from ifr...");
-        let value = await new Promise(resolve => {
-          content.addEventListener("message", e => {
-            resolve(e.data);
-          }, {once: true});
-          ifr.contentWindow.postMessage("getValue", "*");
-        });
+      info("Getting the value from ifr...");
+      let value = await new Promise(resolve => {
+        content.addEventListener("message", e => {
+          resolve(e.data);
+        }, {once: true});
+        ifr.contentWindow.postMessage("getValue", "*");
+      });
 
-        ok(value.startsWith("tracker-"), "The value is correctly set in ifr");
+      ok(value.startsWith("tracker-"), "The value is correctly set in ifr");
 
-        info("Reload...");
-        await new content.Promise(resolve => {
-          ifr.onload = resolve;
-          ifr.contentWindow.postMessage("reload", "*");
-        });
+      info("Reload...");
+      await new content.Promise(resolve => {
+        ifr.onload = resolve;
+        ifr.contentWindow.postMessage("reload", "*");
+      });
 
-        info("Getting the value from ifr...");
-        let value2 = await new Promise(resolve => {
-          content.addEventListener("message", e => {
-            resolve(e.data);
-          }, {once: true});
-          ifr.contentWindow.postMessage("getValue", "*");
-        });
+      info("Getting the value from ifr...");
+      let value2 = await new Promise(resolve => {
+        content.addEventListener("message", e => {
+          resolve(e.data);
+        }, {once: true});
+        ifr.contentWindow.postMessage("getValue", "*");
+      });
 
-        is(value, value2, "The value is equal");
-      }
-    );
+      is(value, value2, "The value is undefined");
+    }
+  );
 
-    BrowserTestUtils.removeTab(normalTab);
+  BrowserTestUtils.removeTab(normalTab);
+});
+
+// Cleanup data.
+add_task(async _ => {
+  await new Promise(resolve => {
+    Services.clearData.deleteData(Ci.nsIClearDataService.CLEAR_ALL, value => resolve());
   });
-
-  // Cleanup data.
-  add_task(async _ => {
-    await new Promise(resolve => {
-      Services.clearData.deleteData(Ci.nsIClearDataService.CLEAR_ALL, value => resolve());
-    });
-  });
-}
-
-runAllTests(false, true);
-runAllTests(false, false);
-runAllTests(true, true);
-runAllTests(true, false);
+});
--- a/toolkit/components/extensions/Extension.jsm
+++ b/toolkit/components/extensions/Extension.jsm
@@ -267,17 +267,17 @@ var UninstallObserver = {
       Services.qms.clearStoragesForPrincipal(storagePrincipal);
 
       ExtensionStorageIDB.clearMigratedExtensionPref(addon.id);
 
       // If LSNG is not enabled, we need to clear localStorage explicitly using
       // the old API.
       if (!Services.lsm.nextGenLocalStorageEnabled) {
         // Clear localStorage created by the extension
-        let storage = Services.domStorageManager.getStorage(null, principal, storagePrincipal);
+        let storage = Services.domStorageManager.getStorage(null, principal);
         if (storage) {
           storage.clear();
         }
       }
 
       // Remove any permissions related to the unlimitedStorage permission
       // if we are also removing all the data stored by the extension.
       Services.perms.removeFromPrincipal(principal, "WebExtensions-unlimitedStorage");
--- a/toolkit/components/sessionstore/SessionStoreUtils.cpp
+++ b/toolkit/components/sessionstore/SessionStoreUtils.cpp
@@ -1013,42 +1013,36 @@ static void ReadAllEntriesFromStorage(
   if (!docShell) {
     return;
   }
 
   Document* doc = aWindow->GetDoc();
   if (!doc) {
     return;
   }
-
   nsCOMPtr<nsIPrincipal> principal = doc->NodePrincipal();
   if (!principal) {
     return;
   }
 
-  nsCOMPtr<nsIPrincipal> storagePrincipal = doc->EffectiveStoragePrincipal();
-  if (!storagePrincipal) {
-    return;
-  }
-
   nsAutoCString origin;
   nsresult rv = principal->GetOrigin(origin);
   if (NS_FAILED(rv) || aVisitedOrigins.Contains(origin)) {
     // Don't read a host twice.
     return;
   }
 
   /* Completed checking for recursion and is about to read storage*/
   nsCOMPtr<nsIDOMStorageManager> storageManager = do_QueryInterface(docShell);
   if (!storageManager) {
     return;
   }
   RefPtr<Storage> storage;
-  storageManager->GetStorage(aWindow->GetCurrentInnerWindow(), principal,
-                             storagePrincipal, false, getter_AddRefs(storage));
+  storageManager->GetStorage(aWindow->GetCurrentInnerWindow(), principal, false,
+                             getter_AddRefs(storage));
   if (!storage) {
     return;
   }
   mozilla::IgnoredErrorResult result;
   uint32_t len = storage->GetLength(*principal, result);
   if (result.Failed() || len == 0) {
     return;
   }
@@ -1166,18 +1160,18 @@ void SessionStoreUtils::RestoreSessionSt
     }
     RefPtr<Storage> storage;
     // There is no need to pass documentURI, it's only used to fill documentURI
     // property of domstorage event, which in this case has no consumer.
     // Prevention of events in case of missing documentURI will be solved in a
     // followup bug to bug 600307.
     // Null window because the current window doesn't match the principal yet
     // and loads about:blank.
-    storageManager->CreateStorage(nullptr, principal, principal, EmptyString(),
-                                  false, getter_AddRefs(storage));
+    storageManager->CreateStorage(nullptr, principal, EmptyString(), false,
+                                  getter_AddRefs(storage));
     if (!storage) {
       continue;
     }
     for (auto& InnerEntry : entry.mValue.Entries()) {
       IgnoredErrorResult result;
       storage->SetItem(InnerEntry.mKey, InnerEntry.mValue, *principal, result);
       if (result.Failed()) {
         NS_WARNING("storage set item failed!");
--- a/toolkit/components/windowwatcher/nsWindowWatcher.cpp
+++ b/toolkit/components/windowwatcher/nsWindowWatcher.cpp
@@ -1179,19 +1179,19 @@ nsresult nsWindowWatcher::OpenWindowInte
         do_QueryInterface(parentDocShell);
     nsCOMPtr<nsIDOMStorageManager> newStorageManager =
         do_QueryInterface(newDocShell);
 
     if (parentStorageManager && newStorageManager) {
       RefPtr<Storage> storage;
       nsCOMPtr<nsPIDOMWindowInner> pInnerWin =
           parentWindow->GetCurrentInnerWindow();
-      parentStorageManager->GetStorage(
-          pInnerWin, subjectPrincipal, subjectPrincipal,
-          isPrivateBrowsingWindow, getter_AddRefs(storage));
+      parentStorageManager->GetStorage(pInnerWin, subjectPrincipal,
+                                       isPrivateBrowsingWindow,
+                                       getter_AddRefs(storage));
       if (storage) {
         newStorageManager->CloneStorage(storage);
       }
     }
   }
 
   if (isNewToplevelWindow) {
     nsCOMPtr<nsIDocShellTreeOwner> newTreeOwner;