Bug 1516023 - Remove LocalStorage::mPrincipal because unused, r=asuth
authorAndrea Marchesini <amarchesini@mozilla.com>
Fri, 04 Jan 2019 00:12:22 +0100
changeset 509602 167735f407393b851817d77915c5d0be05523f23
parent 509601 35b1ac7c831b76815e5614a94ee80665210a2798
child 509603 ce9872f98d6274a8db6592cc8f0ad19ea332fafd
child 509635 1979ad1abb92120daf45e949079b1a818b17b285
push id10547
push userffxbld-merge
push dateMon, 21 Jan 2019 13:03:58 +0000
treeherdermozilla-beta@24ec1916bffe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersasuth
bugs1516023
milestone66.0a1
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
Bug 1516023 - Remove LocalStorage::mPrincipal because unused, r=asuth
dom/storage/LocalStorage.cpp
dom/storage/LocalStorage.h
dom/storage/LocalStorageManager.cpp
--- a/dom/storage/LocalStorage.cpp
+++ b/dom/storage/LocalStorage.cpp
@@ -190,20 +190,16 @@ void LocalStorage::ApplyEvent(StorageEve
     mCache->RemoveItem(this, key, old, LocalStorageCache::E10sPropagated);
     return;
   }
 
   // Otherwise, we set the new value.
   mCache->SetItem(this, key, value, old, LocalStorageCache::E10sPropagated);
 }
 
-bool LocalStorage::PrincipalEquals(nsIPrincipal* aPrincipal) {
-  return StorageUtils::PrincipalsEqual(mPrincipal, aPrincipal);
-}
-
 void LocalStorage::GetSupportedNames(nsTArray<nsString>& aKeys) {
   if (!CanUseStorage(*nsContentUtils::SubjectPrincipal())) {
     // return just an empty array
     aKeys.Clear();
     return;
   }
 
   mCache->GetKeys(this, aKeys);
--- a/dom/storage/LocalStorage.h
+++ b/dom/storage/LocalStorage.h
@@ -25,18 +25,16 @@ class LocalStorage final : public Storag
   StorageType Type() const override { return eLocalStorage; }
 
   LocalStorageManager* GetManager() const { return mManager; }
 
   LocalStorageCache const* GetCache() const { return mCache; }
 
   const nsString& DocumentURI() const { return mDocumentURI; }
 
-  bool PrincipalEquals(nsIPrincipal* aPrincipal);
-
   LocalStorage(nsPIDOMWindowInner* aWindow, LocalStorageManager* aManager,
                LocalStorageCache* aCache, const nsAString& aDocumentURI,
                nsIPrincipal* aPrincipal, bool aIsPrivate);
 
   bool IsForkOf(const Storage* aOther) const override;
 
   // WebIDL
 
@@ -70,20 +68,16 @@ class LocalStorage final : public Storag
 
   friend class LocalStorageManager;
   friend class LocalStorageCache;
 
   RefPtr<LocalStorageManager> mManager;
   RefPtr<LocalStorageCache> mCache;
   nsString mDocumentURI;
 
-  // Principal this Storage (i.e. localStorage or sessionStorage) has
-  // been created for
-  nsCOMPtr<nsIPrincipal> mPrincipal;
-
   // Whether this storage is running in private-browsing window.
   bool mIsPrivate : 1;
 
   void OnChange(const nsAString& aKey, const nsAString& aOldValue,
                 const nsAString& aNewValue);
 };
 
 }  // namespace dom
--- a/dom/storage/LocalStorageManager.cpp
+++ b/dom/storage/LocalStorageManager.cpp
@@ -306,46 +306,23 @@ NS_IMETHODIMP
 LocalStorageManager::CloneStorage(Storage* aStorage) {
   // Cloning is supported only for sessionStorage
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP
 LocalStorageManager::CheckStorage(nsIPrincipal* aPrincipal, Storage* aStorage,
                                   bool* aRetval) {
-  if (!aStorage || aStorage->Type() != Storage::eLocalStorage) {
-    return NS_ERROR_UNEXPECTED;
-  }
-
-  RefPtr<LocalStorage> storage = static_cast<LocalStorage*>(aStorage);
-
-  *aRetval = false;
-
-  if (!aPrincipal) {
-    return NS_ERROR_NOT_AVAILABLE;
-  }
+  MOZ_ASSERT(NS_IsMainThread());
+  MOZ_ASSERT(aPrincipal);
+  MOZ_ASSERT(aStorage);
+  MOZ_ASSERT(aRetval);
 
-  nsAutoCString suffix;
-  nsAutoCString origin;
-  nsresult rv = GenerateOriginKey(aPrincipal, suffix, origin);
-  if (NS_WARN_IF(NS_FAILED(rv))) {
-    return rv;
-  }
-
-  LocalStorageCache* cache = GetCache(suffix, origin);
-  if (cache != storage->GetCache()) {
-    return NS_OK;
-  }
-
-  if (!storage->PrincipalEquals(aPrincipal)) {
-    return NS_OK;
-  }
-
-  *aRetval = true;
-  return NS_OK;
+  // Only used by sessionStorage.
+  return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP
 LocalStorageManager::GetNextGenLocalStorageEnabled(bool* aResult) {
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(aResult);
 
   *aResult = NextGenLocalStorageEnabled();