Bug 1555564 - Part 3: Make sure local storage manager caches the partitioned origins separately from each other; r=baku
authorEhsan Akhgari <ehsan@mozilla.com>
Thu, 30 May 2019 12:09:42 +0000
changeset 476233 9cd79017eae85369865c6992003d9ccfde5abef0
parent 476232 441094863251d25debebf98ad09cf02e665a6eed
child 476234 306934f9f182f055adfb33f9cf088e136ca1cb6a
push id86736
push usereakhgari@mozilla.com
push dateThu, 30 May 2019 16:45:20 +0000
treeherderautoland@9cd79017eae8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku
bugs1555564
milestone69.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 1555564 - Part 3: Make sure local storage manager caches the partitioned origins separately from each other; r=baku Differential Revision: https://phabricator.services.mozilla.com/D33118
dom/storage/LocalStorageManager.cpp
--- a/dom/storage/LocalStorageManager.cpp
+++ b/dom/storage/LocalStorageManager.cpp
@@ -198,17 +198,18 @@ void LocalStorageManager::DropCache(Loca
 
 nsresult LocalStorageManager::GetStorageInternal(
     CreateMode aCreateMode, mozIDOMWindow* aWindow, nsIPrincipal* aPrincipal,
     nsIPrincipal* aStoragePrincipal, const nsAString& aDocumentURI,
     bool aPrivate, Storage** aRetval) {
   nsAutoCString originAttrSuffix;
   nsAutoCString originKey;
 
-  nsresult rv = GenerateOriginKey(aPrincipal, originAttrSuffix, originKey);
+  nsresult rv =
+      GenerateOriginKey(aStoragePrincipal, originAttrSuffix, originKey);
   if (NS_FAILED(rv)) {
     return NS_ERROR_NOT_AVAILABLE;
   }
 
   RefPtr<LocalStorageCache> cache = GetCache(originAttrSuffix, originKey);
 
   // Get or create a cache for the given scope
   if (!cache) {
@@ -250,17 +251,17 @@ nsresult LocalStorageManager::GetStorage
     rv = aPrincipal->GetPrivateBrowsingId(&privateBrowsingId);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
 #endif
 
     // There is always a single instance of a cache per scope
     // in a single instance of a DOM storage manager.
-    cache = PutCache(originAttrSuffix, originKey, aPrincipal);
+    cache = PutCache(originAttrSuffix, originKey, aStoragePrincipal);
 
 #if !defined(MOZ_WIDGET_ANDROID)
     LocalStorageCacheChild* actor = new LocalStorageCacheChild(cache);
 
     MOZ_ALWAYS_TRUE(
         backgroundActor->SendPBackgroundLocalStorageCacheConstructor(
             actor, principalInfo, originKey, privateBrowsingId));