Bug 1639833 - IntrisincStoragePrincipal should always be partitioned - part 2 - Expose PartitionedPrincipal, r=dimi
authorAndrea Marchesini <amarchesini@mozilla.com>
Wed, 03 Jun 2020 06:09:52 +0000
changeset 533661 344054b10c44ef135413b110e2239039b73a80d0
parent 533660 f7b36f2053d6e55d8ee3838da8b3a1f84f14332c
child 533662 08c6e70f7541d7e23ba14d2f0981918bccf6ade5
push id37475
push userbtara@mozilla.com
push dateWed, 03 Jun 2020 16:12:12 +0000
treeherdermozilla-central@ea34fd156c89 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdimi
bugs1639833
milestone79.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 1639833 - IntrisincStoragePrincipal should always be partitioned - part 2 - Expose PartitionedPrincipal, r=dimi Differential Revision: https://phabricator.services.mozilla.com/D76915
caps/nsIScriptSecurityManager.idl
caps/nsScriptSecurityManager.cpp
docshell/base/nsDocShell.cpp
docshell/base/nsDocShell.h
docshell/base/nsDocShellLoadState.cpp
docshell/base/nsDocShellLoadState.h
docshell/base/nsIDocShell.idl
docshell/shistory/SessionHistoryEntry.cpp
docshell/shistory/nsISHEntry.idl
docshell/shistory/nsSHEntry.cpp
docshell/shistory/nsSHEntryShared.cpp
docshell/shistory/nsSHEntryShared.h
dom/base/Document.cpp
dom/base/Document.h
dom/base/nsGlobalWindowInner.cpp
dom/base/nsGlobalWindowInner.h
dom/base/nsGlobalWindowOuter.cpp
dom/base/nsGlobalWindowOuter.h
dom/base/nsIScriptObjectPrincipal.h
dom/broadcastchannel/BroadcastChannel.cpp
dom/html/nsHTMLDocument.cpp
dom/html/nsHTMLDocument.h
dom/interfaces/base/nsIBrowser.idl
dom/ipc/BrowserChild.cpp
dom/ipc/BrowserParent.cpp
dom/ipc/DOMTypes.ipdlh
dom/ipc/PBrowser.ipdl
dom/serviceworkers/ServiceWorkerPrivate.cpp
dom/serviceworkers/ServiceWorkerPrivateImpl.cpp
dom/webidl/Document.webidl
dom/workers/ScriptLoader.cpp
dom/workers/WorkerLoadInfo.cpp
dom/workers/WorkerLoadInfo.h
dom/workers/WorkerPrivate.cpp
dom/workers/WorkerPrivate.h
dom/workers/remoteworkers/RemoteWorkerChild.cpp
dom/workers/remoteworkers/RemoteWorkerTypes.ipdlh
dom/workers/sharedworkers/SharedWorker.cpp
dom/workers/sharedworkers/SharedWorkerManager.cpp
dom/workers/sharedworkers/SharedWorkerManager.h
dom/workers/sharedworkers/SharedWorkerService.cpp
dom/xml/XMLDocument.cpp
dom/xml/XMLDocument.h
dom/xslt/base/txURIUtils.cpp
image/ImageCacheKey.h
js/xpconnect/src/BackstagePass.h
js/xpconnect/src/SandboxPrivate.h
layout/build/nsContentDLF.cpp
layout/build/nsContentDLF.h
toolkit/components/antitracking/StoragePrincipalHelper.cpp
toolkit/components/antitracking/StoragePrincipalHelper.h
toolkit/components/sessionstore/SessionStoreUtils.cpp
toolkit/content/browser-child.js
toolkit/content/widgets/browser-custom-element.js
toolkit/modules/sessionstore/SessionHistory.jsm
--- a/caps/nsIScriptSecurityManager.idl
+++ b/caps/nsIScriptSecurityManager.idl
@@ -226,24 +226,25 @@ interface nsIScriptSecurityManager : nsI
     /**
      * Get the storage principal for the given channel.  This is basically the
      * same of getChannelResultPrincipal() execept for trackers, where we
      * return a principal with a different OriginAttributes.
      */
     nsIPrincipal getChannelResultStoragePrincipal(in nsIChannel aChannel);
 
     /**
-     * This method does getChannelResultPrincipal() +
-     * getChannelResultStoragePrincipal().
-     * This method is mainly done for Document::Reset(). There are no other
-     * reasons to use this method.
+     * This method returns 2 principals from a nsIChannel:
+     * - aPrincipal is the regular principal.
+     * - aPartitionedPrincipal is aPrincipal plus an isolation key in its
+     *   originAttributes.
+     * See more in StoragePrincipalHelper.h
      */
     void getChannelResultPrincipals(in nsIChannel aChannel,
                                     out nsIPrincipal aPrincipal,
-                                    out nsIPrincipal aStoragePrincipal);
+                                    out nsIPrincipal aPartitionedPrincipal);
 
     /**
      * Temporary API until bug 1220687 is fixed.
      *
      * Returns the same value as getChannelResultPrincipal, but ignoring
      * sandboxing.  Specifically, if sandboxing would have prevented the
      * channel's triggering principal from being returned by
      * getChannelResultPrincipal, the triggering principal will be returned
--- a/caps/nsScriptSecurityManager.cpp
+++ b/caps/nsScriptSecurityManager.cpp
@@ -246,40 +246,41 @@ nsScriptSecurityManager::GetChannelResul
     nsIChannel* aChannel, nsIPrincipal** aPrincipal) {
   nsCOMPtr<nsIPrincipal> principal;
   nsresult rv = GetChannelResultPrincipal(aChannel, getter_AddRefs(principal),
                                           /*aIgnoreSandboxing*/ false);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
-  return StoragePrincipalHelper::Create(aChannel, principal, aPrincipal);
+  return StoragePrincipalHelper::Create(
+      aChannel, principal, /* aForceIsolation */ false, aPrincipal);
 }
 
 NS_IMETHODIMP
 nsScriptSecurityManager::GetChannelResultPrincipals(
     nsIChannel* aChannel, nsIPrincipal** aPrincipal,
-    nsIPrincipal** aStoragePrincipal) {
+    nsIPrincipal** aPartitionedPrincipal) {
   nsresult rv = GetChannelResultPrincipal(aChannel, aPrincipal,
                                           /*aIgnoreSandboxing*/ false);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   if (!(*aPrincipal)->GetIsContentPrincipal()) {
     // If for some reason we don't have a content principal here, just reuse our
     // principal for the storage principal too, since attempting to create a
     // storage principal would fail anyway.
     nsCOMPtr<nsIPrincipal> copy = *aPrincipal;
-    copy.forget(aStoragePrincipal);
+    copy.forget(aPartitionedPrincipal);
     return NS_OK;
   }
 
-  return StoragePrincipalHelper::Create(aChannel, *aPrincipal,
-                                        aStoragePrincipal);
+  return StoragePrincipalHelper::Create(
+      aChannel, *aPrincipal, /* aForceIsolation */ true, aPartitionedPrincipal);
 }
 
 nsresult nsScriptSecurityManager::GetChannelResultPrincipal(
     nsIChannel* aChannel, nsIPrincipal** aPrincipal, bool aIgnoreSandboxing) {
   MOZ_ASSERT(aChannel, "Must have channel!");
 
   // Check whether we have an nsILoadInfo that says what we should do.
   nsCOMPtr<nsILoadInfo> loadInfo = aChannel->LoadInfo();
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -6249,32 +6249,32 @@ nsresult nsDocShell::EnsureContentViewer
   }
   if (mIsBeingDestroyed) {
     return NS_ERROR_FAILURE;
   }
 
   nsCOMPtr<nsIContentSecurityPolicy> cspToInheritForAboutBlank;
   nsCOMPtr<nsIURI> baseURI;
   nsIPrincipal* principal = GetInheritedPrincipal(false);
-  nsIPrincipal* storagePrincipal = GetInheritedPrincipal(false, true);
+  nsIPrincipal* partitionedPrincipal = GetInheritedPrincipal(false, true);
 
   nsCOMPtr<nsIDocShellTreeItem> parentItem;
   GetInProcessSameTypeParent(getter_AddRefs(parentItem));
   if (parentItem) {
     if (nsCOMPtr<nsPIDOMWindowOuter> domWin = GetWindow()) {
       nsCOMPtr<Element> parentElement = domWin->GetFrameElementInternal();
       if (parentElement) {
         baseURI = parentElement->GetBaseURI();
         cspToInheritForAboutBlank = parentElement->GetCsp();
       }
     }
   }
 
   nsresult rv = CreateAboutBlankContentViewer(
-      principal, storagePrincipal, cspToInheritForAboutBlank, baseURI);
+      principal, partitionedPrincipal, cspToInheritForAboutBlank, baseURI);
 
   NS_ENSURE_STATE(mContentViewer);
 
   if (NS_SUCCEEDED(rv)) {
     RefPtr<Document> doc(GetDocument());
     NS_ASSERTION(doc,
                  "Should have doc if CreateAboutBlankContentViewer "
                  "succeeded!");
@@ -6290,17 +6290,17 @@ nsresult nsDocShell::EnsureContentViewer
     // assertion here than to avoid creating the extra document.
     doc->IgnoreDocGroupMismatches();
   }
 
   return rv;
 }
 
 nsresult nsDocShell::CreateAboutBlankContentViewer(
-    nsIPrincipal* aPrincipal, nsIPrincipal* aStoragePrincipal,
+    nsIPrincipal* aPrincipal, nsIPrincipal* aPartitionedPrincipal,
     nsIContentSecurityPolicy* aCSP, nsIURI* aBaseURI,
     bool aTryToSaveOldPresentation, bool aCheckPermitUnload,
     WindowGlobalChild* aActor) {
   RefPtr<Document> blankDoc;
   nsCOMPtr<nsIContentViewer> viewer;
   nsresult rv = NS_ERROR_FAILURE;
 
   MOZ_ASSERT_IF(aActor, aActor->DocumentPrincipal() == aPrincipal);
@@ -6384,41 +6384,41 @@ nsresult nsDocShell::CreateAboutBlankCon
   // too, of course.
   mFiredUnloadEvent = false;
 
   nsCOMPtr<nsIDocumentLoaderFactory> docFactory =
       nsContentUtils::FindInternalContentViewer(
           NS_LITERAL_CSTRING("text/html"));
 
   if (docFactory) {
-    nsCOMPtr<nsIPrincipal> principal, storagePrincipal;
+    nsCOMPtr<nsIPrincipal> principal, partitionedPrincipal;
     uint32_t sandboxFlags = mBrowsingContext->GetSandboxFlags();
     // If we're sandboxed, then create a new null principal. We skip
     // this if we're being created from WindowGlobalChild, since in
     // that case we already have a null principal if required.
     // We can't compare againt the BrowsingContext sandbox flag, since
     // the value was taken when the load initiated and may have since
     // changed.
     if ((sandboxFlags & SANDBOXED_ORIGIN) && !aActor) {
       if (aPrincipal) {
         principal = NullPrincipal::CreateWithInheritedAttributes(aPrincipal);
       } else {
         principal = NullPrincipal::CreateWithInheritedAttributes(this);
       }
-      storagePrincipal = principal;
+      partitionedPrincipal = principal;
     } else {
       principal = aPrincipal;
-      storagePrincipal = aStoragePrincipal;
+      partitionedPrincipal = aPartitionedPrincipal;
     }
 
     MaybeCreateInitialClientSource(principal);
 
     // generate (about:blank) document to load
     blankDoc = nsContentDLF::CreateBlankDocument(mLoadGroup, principal,
-                                                 storagePrincipal, this);
+                                                 partitionedPrincipal, this);
     if (blankDoc) {
       // Hack: manually set the CSP for the new document
       // Please create an actual copy of the CSP (do not share the same
       // reference) otherwise appending a new policy within the new
       // document will be incorrectly propagated to the opening doc.
       if (aCSP) {
         RefPtr<nsCSPContext> cspToInherit = new nsCSPContext();
         cspToInherit->InitFromOther(static_cast<nsCSPContext*>(aCSP));
@@ -6460,27 +6460,27 @@ nsresult nsDocShell::CreateAboutBlankCon
     mBlankTiming = true;
   }
 
   return rv;
 }
 
 NS_IMETHODIMP
 nsDocShell::CreateAboutBlankContentViewer(nsIPrincipal* aPrincipal,
-                                          nsIPrincipal* aStoragePrincipal,
+                                          nsIPrincipal* aPartitionedPrincipal,
                                           nsIContentSecurityPolicy* aCSP) {
-  return CreateAboutBlankContentViewer(aPrincipal, aStoragePrincipal, aCSP,
+  return CreateAboutBlankContentViewer(aPrincipal, aPartitionedPrincipal, aCSP,
                                        nullptr);
 }
 
 nsresult nsDocShell::CreateContentViewerForActor(
     WindowGlobalChild* aWindowActor) {
   MOZ_ASSERT(aWindowActor);
 
-  // FIXME: WindowGlobalChild should provide the StoragePrincipal.
+  // FIXME: WindowGlobalChild should provide the PartitionedPrincipal.
   nsresult rv = CreateAboutBlankContentViewer(
       aWindowActor->DocumentPrincipal(), aWindowActor->DocumentPrincipal(),
       /* aCsp */ nullptr,
       /* aBaseURI */ nullptr,
       /* aTryToSaveOldPresentation */ true,
       /* aCheckPermitUnload */ true, aWindowActor);
   if (NS_SUCCEEDED(rv)) {
     RefPtr<Document> doc(GetDocument());
@@ -8360,40 +8360,41 @@ nsresult nsDocShell::HandleSameDocumentN
   NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE);
   doc->SetDocumentURI(aLoadState->URI());
 
   /* This is a anchor traversal within the same page.
    * call OnNewURI() so that, this traversal will be
    * recorded in session and global history.
    */
   nsCOMPtr<nsIPrincipal> newURITriggeringPrincipal, newURIPrincipalToInherit,
-      newURIStoragePrincipalToInherit;
+      newURIPartitionedPrincipalToInherit;
   nsCOMPtr<nsIContentSecurityPolicy> newCsp;
   if (mOSHE) {
     newURITriggeringPrincipal = mOSHE->GetTriggeringPrincipal();
     newURIPrincipalToInherit = mOSHE->GetPrincipalToInherit();
-    newURIStoragePrincipalToInherit = mOSHE->GetStoragePrincipalToInherit();
+    newURIPartitionedPrincipalToInherit =
+        mOSHE->GetPartitionedPrincipalToInherit();
     newCsp = mOSHE->GetCsp();
   } else {
     newURITriggeringPrincipal = aLoadState->TriggeringPrincipal();
     newURIPrincipalToInherit = doc->NodePrincipal();
-    newURIStoragePrincipalToInherit = doc->IntrinsicStoragePrincipal();
+    newURIPartitionedPrincipalToInherit = doc->PartitionedPrincipal();
     newCsp = doc->GetCsp();
   }
   // Pass true for aCloneSHChildren, since we're not
   // changing documents here, so all of our subframes are
   // still relevant to the new session history entry.
   //
   // It also makes OnNewURI(...) set LOCATION_CHANGE_SAME_DOCUMENT
   // flag on firing onLocationChange(...).
   // Anyway, aCloneSHChildren param is simply reflecting
   // doSameDocumentNavigation in this scope.
   OnNewURI(aLoadState->URI(), nullptr, newURITriggeringPrincipal,
-           newURIPrincipalToInherit, newURIStoragePrincipalToInherit, mLoadType,
-           newCsp, true, true, true);
+           newURIPrincipalToInherit, newURIPartitionedPrincipalToInherit,
+           mLoadType, newCsp, true, true, true);
 
   nsCOMPtr<nsIInputStream> postData;
   uint32_t cacheKey = 0;
 
   bool scrollRestorationIsManual = false;
   if (mOSHE) {
     /* save current position of scroller(s) (bug 59774) */
     mOSHE->SetScrollPosition(scrollPos.x, scrollPos.y);
@@ -8962,17 +8963,17 @@ bool nsDocShell::CanLoadInParentProcess(
   if (xpc::IsInAutomation() &&
       StaticPrefs::security_allow_unsafe_parent_loads()) {
     return true;
   }
   return false;
 }
 
 nsIPrincipal* nsDocShell::GetInheritedPrincipal(
-    bool aConsiderCurrentDocument, bool aConsiderStoragePrincipal) {
+    bool aConsiderCurrentDocument, bool aConsiderPartitionedPrincipal) {
   RefPtr<Document> document;
   bool inheritedFromCurrent = false;
 
   if (aConsiderCurrentDocument && mContentViewer) {
     document = mContentViewer->GetDocument();
     inheritedFromCurrent = true;
   }
 
@@ -8995,18 +8996,18 @@ nsIPrincipal* nsDocShell::GetInheritedPr
     if (!mContentViewer) {
       return nullptr;
     }
     document = mContentViewer->GetDocument();
   }
 
   //-- Get the document's principal
   if (document) {
-    nsIPrincipal* docPrincipal = aConsiderStoragePrincipal
-                                     ? document->IntrinsicStoragePrincipal()
+    nsIPrincipal* docPrincipal = aConsiderPartitionedPrincipal
+                                     ? document->PartitionedPrincipal()
                                      : document->NodePrincipal();
 
     // Don't allow loads in typeContent docShells to inherit the system
     // principal from existing documents.
     if (inheritedFromCurrent && mItemType == typeContent &&
         docPrincipal->IsSystemPrincipal()) {
       return nullptr;
     }
@@ -10019,17 +10020,17 @@ void nsDocShell::SetupReferrerInfoFromCh
     nsCOMPtr<nsIReferrerInfo> referrerInfo = httpChannel->GetReferrerInfo();
     SetReferrerInfo(referrerInfo);
   }
 }
 
 bool nsDocShell::OnNewURI(nsIURI* aURI, nsIChannel* aChannel,
                           nsIPrincipal* aTriggeringPrincipal,
                           nsIPrincipal* aPrincipalToInherit,
-                          nsIPrincipal* aStoragePrincipalToInherit,
+                          nsIPrincipal* aPartitionedPrincipalToInherit,
                           uint32_t aLoadType, nsIContentSecurityPolicy* aCsp,
                           bool aFireOnLocationChange, bool aAddToGlobalHistory,
                           bool aCloneSHChildren) {
   MOZ_ASSERT(aURI, "uri is null");
   MOZ_ASSERT(!aChannel || !aTriggeringPrincipal, "Shouldn't have both set");
 
   MOZ_ASSERT(!aPrincipalToInherit ||
              (aPrincipalToInherit && aTriggeringPrincipal));
@@ -10184,18 +10185,19 @@ bool nsDocShell::OnNewURI(nsIURI* aURI, 
   if (updateSHistory) {
     // Update session history if necessary...
     if (!mLSHE && (mItemType == typeContent) && mURIResultedInDocument) {
       /* This is  a fresh page getting loaded for the first time
        *.Create a Entry for it and add it to SH, if this is the
        * rootDocShell
        */
       (void)AddToSessionHistory(aURI, aChannel, aTriggeringPrincipal,
-                                aPrincipalToInherit, aStoragePrincipalToInherit,
-                                aCsp, aCloneSHChildren, getter_AddRefs(mLSHE));
+                                aPrincipalToInherit,
+                                aPartitionedPrincipalToInherit, aCsp,
+                                aCloneSHChildren, getter_AddRefs(mLSHE));
     }
   } else if (GetSessionHistory() && mLSHE && mURIResultedInDocument) {
     // Even if we don't add anything to SHistory, ensure the current index
     // points to the same SHEntry as our mLSHE.
 
     GetSessionHistory()->LegacySHistory()->EnsureCorrectEntryAtCurrIndex(mLSHE);
   }
 
@@ -10654,17 +10656,18 @@ bool nsDocShell::ShouldAddToSessionHisto
     }
   }
 
   return true;
 }
 
 nsresult nsDocShell::AddToSessionHistory(
     nsIURI* aURI, nsIChannel* aChannel, nsIPrincipal* aTriggeringPrincipal,
-    nsIPrincipal* aPrincipalToInherit, nsIPrincipal* aStoragePrincipalToInherit,
+    nsIPrincipal* aPrincipalToInherit,
+    nsIPrincipal* aPartitionedPrincipalToInherit,
     nsIContentSecurityPolicy* aCsp, bool aCloneChildren,
     nsISHEntry** aNewEntry) {
   MOZ_ASSERT(aURI, "uri is null");
   MOZ_ASSERT(!aChannel || !aTriggeringPrincipal, "Shouldn't have both set");
 
 #if defined(DEBUG)
   if (MOZ_LOG_TEST(gDocShellLog, LogLevel::Debug)) {
     nsAutoCString chanName;
@@ -10713,17 +10716,18 @@ nsresult nsDocShell::AddToSessionHistory
   nsCOMPtr<nsIInputStream> inputStream;
   nsCOMPtr<nsIURI> originalURI;
   nsCOMPtr<nsIURI> resultPrincipalURI;
   bool loadReplace = false;
   nsCOMPtr<nsIReferrerInfo> referrerInfo;
   uint32_t cacheKey = 0;
   nsCOMPtr<nsIPrincipal> triggeringPrincipal = aTriggeringPrincipal;
   nsCOMPtr<nsIPrincipal> principalToInherit = aPrincipalToInherit;
-  nsCOMPtr<nsIPrincipal> storagePrincipalToInherit = aStoragePrincipalToInherit;
+  nsCOMPtr<nsIPrincipal> partitionedPrincipalToInherit =
+      aPartitionedPrincipalToInherit;
   nsCOMPtr<nsIContentSecurityPolicy> csp = aCsp;
   bool expired = false;  // by default the page is not expired
   bool discardLayoutState = false;
   nsCOMPtr<nsICacheInfoChannel> cacheChannel;
   if (aChannel) {
     cacheChannel = do_QueryInterface(aChannel);
 
     /* If there is a caching channel, get the Cache Key and store it
@@ -10775,22 +10779,22 @@ nsresult nsDocShell::AddToSessionHistory
           loadInfo->GetOriginAttributes(&attrs);
           principalToInherit = NullPrincipal::Create(attrs);
         }
       } else {
         principalToInherit = loadInfo->PrincipalToInherit();
       }
     }
 
-    if (!storagePrincipalToInherit) {
+    if (!partitionedPrincipalToInherit) {
       // XXXehsan is it correct to fall back to the principal to inherit in all
       // cases?  For example, what about the cases where we are using the load
       // info's principal to inherit?  Do we need to add a similar concept to
-      // load info for storage principal?
-      storagePrincipalToInherit = principalToInherit;
+      // load info for partitioned principal?
+      partitionedPrincipalToInherit = principalToInherit;
     }
   }
 
   nsAutoString srcdoc;
   bool srcdocEntry = false;
   nsCOMPtr<nsIURI> baseURI;
 
   nsCOMPtr<nsIInputStreamChannel> inStrmChan = do_QueryInterface(aChannel);
@@ -10823,20 +10827,20 @@ nsresult nsDocShell::AddToSessionHistory
 
   // Title is set in nsDocShell::SetTitle()
   entry->Create(aURI,                 // uri
                 EmptyString(),        // Title
                 inputStream,          // Post data stream
                 cacheKey,             // CacheKey
                 mContentTypeHint,     // Content-type
                 triggeringPrincipal,  // Channel or provided principal
-                principalToInherit, storagePrincipalToInherit, csp, HistoryID(),
-                mDynamicallyCreated, originalURI, resultPrincipalURI,
-                loadReplace, referrerInfo, srcdoc, srcdocEntry, baseURI,
-                saveLayoutState, expired);
+                principalToInherit, partitionedPrincipalToInherit, csp,
+                HistoryID(), mDynamicallyCreated, originalURI,
+                resultPrincipalURI, loadReplace, referrerInfo, srcdoc,
+                srcdocEntry, baseURI, saveLayoutState, expired);
 
   if (root == static_cast<nsIDocShellTreeItem*>(this) && GetSessionHistory()) {
     bool shouldPersist = ShouldAddToSessionHistory(aURI, aChannel);
     Maybe<int32_t> previousEntryIndex;
     Maybe<int32_t> loadedEntryIndex;
     rv = GetSessionHistory()->LegacySHistory()->AddToRootSessionHistory(
         aCloneChildren, mOSHE, mBrowsingContext, entry, mLoadType,
         shouldPersist, &previousEntryIndex, &loadedEntryIndex);
@@ -10889,19 +10893,20 @@ nsresult nsDocShell::LoadHistoryEntry(ns
   if (SchemeIsJavascript(loadState->URI())) {
     // We're loading a URL that will execute script from inside asyncOpen.
     // Replace the current document with about:blank now to prevent
     // anything from the current document from leaking into any JavaScript
     // code in the URL.
     // Don't cache the presentation if we're going to just reload the
     // current entry. Caching would lead to trying to save the different
     // content viewers in the same nsISHEntry object.
-    rv = CreateAboutBlankContentViewer(loadState->PrincipalToInherit(),
-                                       loadState->StoragePrincipalToInherit(),
-                                       nullptr, nullptr, aEntry != mOSHE);
+    rv = CreateAboutBlankContentViewer(
+        loadState->PrincipalToInherit(),
+        loadState->PartitionedPrincipalToInherit(), nullptr, nullptr,
+        aEntry != mOSHE);
 
     if (NS_FAILED(rv)) {
       // The creation of the intermittent about:blank content
       // viewer failed for some reason (potentially because the
       // user prevented it). Interrupt the history load.
       return NS_OK;
     }
 
@@ -12096,17 +12101,17 @@ nsDocShell::InitOrReusePrintPreviewViewe
     // time we enter here seems overwork. We could skip ahead to where
     // we QI the mContentViewer if the current URI is either about:blank
     // or about:printpreview.
     Stop(nsIWebNavigation::STOP_ALL);
     nsCOMPtr<nsIPrincipal> principal =
         NullPrincipal::CreateWithInheritedAttributes(this);
     nsCOMPtr<nsIURI> uri;
     NS_NewURI(getter_AddRefs(uri), NS_LITERAL_CSTRING("about:printpreview"));
-    // Reuse the null principal for the storage principal.
+    // Reuse the null principal for the partitioned principal.
     // XXXehsan is that the right principal to use here?
     nsresult rv = CreateAboutBlankContentViewer(principal, principal,
                                                 /* aCsp = */ nullptr, uri);
     NS_ENSURE_SUCCESS(rv, rv);
     // Here we manually set current URI since we have just created a
     // brand new content viewer (about:blank) to host preview.
     SetCurrentURI(uri, nullptr, true, 0);
     print = do_QueryInterface(mContentViewer);
--- a/docshell/base/nsDocShell.h
+++ b/docshell/base/nsDocShell.h
@@ -597,17 +597,17 @@ class nsDocShell final : public nsDocLoa
   //
 
   nsresult EnsureContentViewer();
 
   // aPrincipal can be passed in if the caller wants. If null is
   // passed in, the about:blank principal will end up being used.
   // aCSP, if any, will be used for the new about:blank load.
   nsresult CreateAboutBlankContentViewer(
-      nsIPrincipal* aPrincipal, nsIPrincipal* aStoragePrincipal,
+      nsIPrincipal* aPrincipal, nsIPrincipal* aPartitionedPrincipal,
       nsIContentSecurityPolicy* aCSP, nsIURI* aBaseURI,
       bool aTryToSaveOldPresentation = true, bool aCheckPermitUnload = true,
       mozilla::dom::WindowGlobalChild* aActor = nullptr);
 
   nsresult CreateContentViewer(const nsACString& aContentType,
                                nsIRequest* aRequest,
                                nsIStreamListener** aContentHandler);
 
@@ -637,17 +637,17 @@ class nsDocShell final : public nsDocLoa
   // aCsp is the CSP to be used for the load. That is *not* the CSP
   // that will be applied to subresource loads within that document
   // but the CSP for the document load itself. E.g. if that CSP
   // includes upgrade-insecure-requests, then the new top-level load
   // will be upgraded to HTTPS.
   nsresult AddToSessionHistory(nsIURI* aURI, nsIChannel* aChannel,
                                nsIPrincipal* aTriggeringPrincipal,
                                nsIPrincipal* aPrincipalToInherit,
-                               nsIPrincipal* aStoragePrincipalToInherit,
+                               nsIPrincipal* aPartitionedPrincipalToInherit,
                                nsIContentSecurityPolicy* aCsp,
                                bool aCloneChildren, nsISHEntry** aNewEntry);
 
   nsresult AddChildSHEntryToParent(nsISHEntry* aNewEntry, int32_t aChildOffset,
                                    bool aCloneChildren);
 
   nsresult AddChildSHEntryInternal(nsISHEntry* aCloneRef, nsISHEntry* aNewEntry,
                                    int32_t aChildOffset, uint32_t aLoadType,
@@ -712,19 +712,20 @@ class nsDocShell final : public nsDocLoa
   // aCsp is the CSP to be used for the load. That is *not* the CSP
   // that will be applied to subresource loads within that document
   // but the CSP for the document load itself. E.g. if that CSP
   // includes upgrade-insecure-requests, then the new top-level load
   // will be upgraded to HTTPS.
   bool OnNewURI(nsIURI* aURI, nsIChannel* aChannel,
                 nsIPrincipal* aTriggeringPrincipal,
                 nsIPrincipal* aPrincipalToInherit,
-                nsIPrincipal* aStoragePrincipalToInehrit, uint32_t aLoadType,
-                nsIContentSecurityPolicy* aCsp, bool aFireOnLocationChange,
-                bool aAddToGlobalHistory, bool aCloneSHChildren);
+                nsIPrincipal* aPartitionedPrincipalToInehrit,
+                uint32_t aLoadType, nsIContentSecurityPolicy* aCsp,
+                bool aFireOnLocationChange, bool aAddToGlobalHistory,
+                bool aCloneSHChildren);
 
   // Helper method that is called when a new document (including any
   // sub-documents - ie. frames) has been completely loaded.
   MOZ_CAN_RUN_SCRIPT_BOUNDARY
   nsresult EndPageLoad(nsIWebProgress* aProgress, nsIChannel* aChannel,
                        nsresult aResult);
 
   // Builds an error page URI (e.g. about:neterror?etc) for the given aURI
@@ -752,20 +753,21 @@ class nsDocShell final : public nsDocLoa
   //
 
   // Get the principal that we'll set on the channel if we're inheriting. If
   // aConsiderCurrentDocument is true, we try to use the current document if
   // at all possible. If that fails, we fall back on the parent document.
   // If that fails too, we force creation of a content viewer and use the
   // resulting principal. If aConsiderCurrentDocument is false, we just look
   // at the parent.
-  // If aConsiderStoragePrincipal is true, we consider the storage principal
-  // instead of the node principal.
-  nsIPrincipal* GetInheritedPrincipal(bool aConsiderCurrentDocument,
-                                      bool aConsiderStoragePrincipal = false);
+  // If aConsiderPartitionedPrincipal is true, we consider the partitioned
+  // principal instead of the node principal.
+  nsIPrincipal* GetInheritedPrincipal(
+      bool aConsiderCurrentDocument,
+      bool aConsiderPartitionedPrincipal = false);
 
   /**
    * Helper function that caches a URI and a transition for saving later.
    *
    * @param aChannel
    *        Channel that will have these properties saved
    * @param aURI
    *        The URI to save for later
--- a/docshell/base/nsDocShellLoadState.cpp
+++ b/docshell/base/nsDocShellLoadState.cpp
@@ -122,17 +122,17 @@ nsDocShellLoadState::nsDocShellLoadState
       aLoadState.IsFromProcessingFrameAttributes();
   mReferrerInfo = aLoadState.ReferrerInfo();
   mURI = aLoadState.URI();
   mOriginalURI = aLoadState.OriginalURI();
   mSourceBrowsingContext = aLoadState.SourceBrowsingContext();
   mBaseURI = aLoadState.BaseURI();
   mTriggeringPrincipal = aLoadState.TriggeringPrincipal();
   mPrincipalToInherit = aLoadState.PrincipalToInherit();
-  mStoragePrincipalToInherit = aLoadState.StoragePrincipalToInherit();
+  mPartitionedPrincipalToInherit = aLoadState.PartitionedPrincipalToInherit();
   mCsp = aLoadState.Csp();
   mOriginalURIString = aLoadState.OriginalURIString();
   mCancelContentJSEpoch = aLoadState.CancelContentJSEpoch();
   mPostDataStream = aLoadState.PostDataStream();
   mHeadersStream = aLoadState.HeadersStream();
   mSrcdocData = aLoadState.SrcdocData();
   mLoadIdentifier = aLoadState.LoadIdentifier();
 }
@@ -145,17 +145,17 @@ nsDocShellLoadState::nsDocShellLoadState
       mResultPrincipalURIIsSome(aOther.mResultPrincipalURIIsSome),
       mTriggeringPrincipal(aOther.mTriggeringPrincipal),
       mCsp(aOther.mCsp),
       mKeepResultPrincipalURIIfSet(aOther.mKeepResultPrincipalURIIfSet),
       mLoadReplace(aOther.mLoadReplace),
       mInheritPrincipal(aOther.mInheritPrincipal),
       mPrincipalIsExplicit(aOther.mPrincipalIsExplicit),
       mPrincipalToInherit(aOther.mPrincipalToInherit),
-      mStoragePrincipalToInherit(aOther.mStoragePrincipalToInherit),
+      mPartitionedPrincipalToInherit(aOther.mPartitionedPrincipalToInherit),
       mForceAllowDataURI(aOther.mForceAllowDataURI),
       mOriginalFrameSrc(aOther.mOriginalFrameSrc),
       mIsFormSubmission(aOther.mIsFormSubmission),
       mLoadType(aOther.mLoadType),
       mSHEntry(aOther.mSHEntry),
       mTarget(aOther.mTarget),
       mPostDataStream(aOther.mPostDataStream),
       mHeadersStream(aOther.mHeadersStream),
@@ -427,23 +427,23 @@ nsIPrincipal* nsDocShellLoadState::Princ
   return mPrincipalToInherit;
 }
 
 void nsDocShellLoadState::SetPrincipalToInherit(
     nsIPrincipal* aPrincipalToInherit) {
   mPrincipalToInherit = aPrincipalToInherit;
 }
 
-nsIPrincipal* nsDocShellLoadState::StoragePrincipalToInherit() const {
-  return mStoragePrincipalToInherit;
+nsIPrincipal* nsDocShellLoadState::PartitionedPrincipalToInherit() const {
+  return mPartitionedPrincipalToInherit;
 }
 
-void nsDocShellLoadState::SetStoragePrincipalToInherit(
-    nsIPrincipal* aStoragePrincipalToInherit) {
-  mStoragePrincipalToInherit = aStoragePrincipalToInherit;
+void nsDocShellLoadState::SetPartitionedPrincipalToInherit(
+    nsIPrincipal* aPartitionedPrincipalToInherit) {
+  mPartitionedPrincipalToInherit = aPartitionedPrincipalToInherit;
 }
 
 void nsDocShellLoadState::SetCsp(nsIContentSecurityPolicy* aCsp) {
   mCsp = aCsp;
 }
 
 nsIContentSecurityPolicy* nsDocShellLoadState::Csp() const { return mCsp; }
 
@@ -880,17 +880,17 @@ DocShellLoadStateInit nsDocShellLoadStat
   loadState.IsFromProcessingFrameAttributes() =
       mIsFromProcessingFrameAttributes;
   loadState.URI() = mURI;
   loadState.OriginalURI() = mOriginalURI;
   loadState.SourceBrowsingContext() = mSourceBrowsingContext;
   loadState.BaseURI() = mBaseURI;
   loadState.TriggeringPrincipal() = mTriggeringPrincipal;
   loadState.PrincipalToInherit() = mPrincipalToInherit;
-  loadState.StoragePrincipalToInherit() = mStoragePrincipalToInherit;
+  loadState.PartitionedPrincipalToInherit() = mPartitionedPrincipalToInherit;
   loadState.Csp() = mCsp;
   loadState.OriginalURIString() = mOriginalURIString;
   loadState.CancelContentJSEpoch() = mCancelContentJSEpoch;
   loadState.ReferrerInfo() = mReferrerInfo;
   loadState.PostDataStream() = mPostDataStream;
   loadState.HeadersStream() = mHeadersStream;
   loadState.SrcdocData() = mSrcdocData;
   loadState.ResultPrincipalURI() = mResultPrincipalURI;
--- a/docshell/base/nsDocShellLoadState.h
+++ b/docshell/base/nsDocShellLoadState.h
@@ -80,19 +80,20 @@ class nsDocShellLoadState final {
   bool KeepResultPrincipalURIIfSet() const;
 
   void SetKeepResultPrincipalURIIfSet(bool aKeep);
 
   nsIPrincipal* PrincipalToInherit() const;
 
   void SetPrincipalToInherit(nsIPrincipal* aPrincipalToInherit);
 
-  nsIPrincipal* StoragePrincipalToInherit() const;
+  nsIPrincipal* PartitionedPrincipalToInherit() const;
 
-  void SetStoragePrincipalToInherit(nsIPrincipal* aStoragePrincipalToInherit);
+  void SetPartitionedPrincipalToInherit(
+      nsIPrincipal* aPartitionedPrincipalToInherit);
 
   bool LoadReplace() const;
 
   void SetLoadReplace(bool aLoadReplace);
 
   nsIPrincipal* TriggeringPrincipal() const;
 
   void SetTriggeringPrincipal(nsIPrincipal* aTriggeringPrincipal);
@@ -327,17 +328,17 @@ class nsDocShellLoadState final {
   // of SetupInheritingPrincipal for more info.
   //
   // When passed to InternalLoad, If this argument is null then
   // principalToInherit is computed differently. See nsDocShell::InternalLoad
   // for more comments.
 
   nsCOMPtr<nsIPrincipal> mPrincipalToInherit;
 
-  nsCOMPtr<nsIPrincipal> mStoragePrincipalToInherit;
+  nsCOMPtr<nsIPrincipal> mPartitionedPrincipalToInherit;
 
   // If this attribute is true, then a top-level navigation
   // to a data URI will be allowed.
   bool mForceAllowDataURI;
 
   // If this attribute is true, this load corresponds to a frame
   // element loading its original src (or srcdoc) attribute.
   bool mOriginalFrameSrc;
--- a/docshell/base/nsIDocShell.idl
+++ b/docshell/base/nsIDocShell.idl
@@ -540,21 +540,22 @@ interface nsIDocShell : nsIDocShellTreeI
    * differently than a non-app tab docshell in some cases, such as when
    * handling link clicks. Docshells are not app tabs unless told otherwise.
    */
   attribute boolean isAppTab;
 
   /**
    * Create a new about:blank document and content viewer.
    * @param aPrincipal the principal to use for the new document.
-   * @param aStoragePrincipal the storage principal to use for the new document.
+   * @param aPartitionedPrincipal the partitioned principal to use for the new
+   *        document.
    * @param aCsp the CSP to use for the new document.
    */
   void createAboutBlankContentViewer(in nsIPrincipal aPrincipal,
-                                     in nsIPrincipal aStoragePrincipal,
+                                     in nsIPrincipal aPartitionedPrincipal,
                                      [optional] in nsIContentSecurityPolicy aCSP);
 
   /**
    * Upon getting, returns the canonical encoding label of the document
    * currently loaded into this docshell.
    *
    * Upon setting, sets forcedCharset for compatibility with legacy callers.
    */
--- a/docshell/shistory/SessionHistoryEntry.cpp
+++ b/docshell/shistory/SessionHistoryEntry.cpp
@@ -42,18 +42,18 @@ static uint32_t gEntryID;
 SessionHistoryEntry::SessionHistoryEntry(nsISHistory* aSessionHistory,
                                          nsDocShellLoadState* aLoadState,
                                          nsIChannel* aChannel)
     : mInfo(new SessionHistoryInfo(aLoadState, aChannel)),
       mSharedInfo(new SHEntrySharedParentState(aSessionHistory)),
       mID(++gEntryID) {
   mSharedInfo->mTriggeringPrincipal = aLoadState->TriggeringPrincipal();
   mSharedInfo->mPrincipalToInherit = aLoadState->PrincipalToInherit();
-  mSharedInfo->mStoragePrincipalToInherit =
-      aLoadState->StoragePrincipalToInherit();
+  mSharedInfo->mPartitionedPrincipalToInherit =
+      aLoadState->PartitionedPrincipalToInherit();
   mSharedInfo->mCsp = aLoadState->Csp();
   // FIXME Set remaining shared fields!
 }
 
 NS_IMPL_ISUPPORTS(SessionHistoryEntry, nsISHEntry)
 
 NS_IMETHODIMP
 SessionHistoryEntry::GetURI(nsIURI** aURI) {
@@ -343,28 +343,28 @@ SessionHistoryEntry::GetPrincipalToInher
 
 NS_IMETHODIMP
 SessionHistoryEntry::SetPrincipalToInherit(nsIPrincipal* aPrincipalToInherit) {
   mSharedInfo->mPrincipalToInherit = aPrincipalToInherit;
   return NS_OK;
 }
 
 NS_IMETHODIMP
-SessionHistoryEntry::GetStoragePrincipalToInherit(
-    nsIPrincipal** aStoragePrincipalToInherit) {
-  nsCOMPtr<nsIPrincipal> storagePrincipalToInherit =
-      mSharedInfo->mStoragePrincipalToInherit;
-  storagePrincipalToInherit.forget(aStoragePrincipalToInherit);
+SessionHistoryEntry::GetPartitionedPrincipalToInherit(
+    nsIPrincipal** aPartitionedPrincipalToInherit) {
+  nsCOMPtr<nsIPrincipal> partitionedPrincipalToInherit =
+      mSharedInfo->mPartitionedPrincipalToInherit;
+  partitionedPrincipalToInherit.forget(aPartitionedPrincipalToInherit);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-SessionHistoryEntry::SetStoragePrincipalToInherit(
-    nsIPrincipal* aStoragePrincipalToInherit) {
-  mSharedInfo->mStoragePrincipalToInherit = aStoragePrincipalToInherit;
+SessionHistoryEntry::SetPartitionedPrincipalToInherit(
+    nsIPrincipal* aPartitionedPrincipalToInherit) {
+  mSharedInfo->mPartitionedPrincipalToInherit = aPartitionedPrincipalToInherit;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 SessionHistoryEntry::GetCsp(nsIContentSecurityPolicy** aCsp) {
   nsCOMPtr<nsIContentSecurityPolicy> csp = mSharedInfo->mCsp;
   csp.forget(aCsp);
   return NS_OK;
@@ -548,21 +548,21 @@ SessionHistoryEntry::InitLayoutHistorySt
   return GetLayoutHistoryState(aLayoutHistoryState);
 }
 
 NS_IMETHODIMP
 SessionHistoryEntry::Create(
     nsIURI* aURI, const nsAString& aTitle, nsIInputStream* aInputStream,
     uint32_t aCacheKey, const nsACString& aContentType,
     nsIPrincipal* aTriggeringPrincipal, nsIPrincipal* aPrincipalToInherit,
-    nsIPrincipal* aStoragePrincipalToInherit, nsIContentSecurityPolicy* aCsp,
-    const nsID& aDocshellID, bool aDynamicCreation, nsIURI* aOriginalURI,
-    nsIURI* aResultPrincipalURI, bool aLoadReplace,
-    nsIReferrerInfo* aReferrerInfo, const nsAString& aSrcdoc, bool aSrcdocEntry,
-    nsIURI* aBaseURI, bool aSaveLayoutState, bool aExpired) {
+    nsIPrincipal* aPartitionedPrincipalToInherit,
+    nsIContentSecurityPolicy* aCsp, const nsID& aDocshellID,
+    bool aDynamicCreation, nsIURI* aOriginalURI, nsIURI* aResultPrincipalURI,
+    bool aLoadReplace, nsIReferrerInfo* aReferrerInfo, const nsAString& aSrcdoc,
+    bool aSrcdocEntry, nsIURI* aBaseURI, bool aSaveLayoutState, bool aExpired) {
   MOZ_CRASH("Might need to implement this");
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP
 SessionHistoryEntry::Clone(nsISHEntry** _retval) {
   MOZ_CRASH("Might need to implement this");
   return NS_ERROR_NOT_IMPLEMENTED;
@@ -685,18 +685,18 @@ SessionHistoryEntry::CreateLoadInfo(nsDo
   loadState->SetMaybeResultPrincipalURI(Some(mInfo->mResultPrincipalURI));
   loadState->SetLoadReplace(mInfo->mLoadReplace);
   loadState->SetPostDataStream(mInfo->mPostData);
   loadState->SetReferrerInfo(mInfo->mReferrerInfo);
 
   loadState->SetTypeHint(mSharedInfo->mContentType);
   loadState->SetTriggeringPrincipal(mSharedInfo->mTriggeringPrincipal);
   loadState->SetPrincipalToInherit(mSharedInfo->mPrincipalToInherit);
-  loadState->SetStoragePrincipalToInherit(
-      mSharedInfo->mStoragePrincipalToInherit);
+  loadState->SetPartitionedPrincipalToInherit(
+      mSharedInfo->mPartitionedPrincipalToInherit);
   loadState->SetCsp(mSharedInfo->mCsp);
 
   // Do not inherit principal from document (security-critical!);
   uint32_t flags = nsDocShell::InternalLoad::INTERNAL_LOAD_FLAGS_NONE;
 
   // Passing nullptr as aSourceDocShell gives the same behaviour as before
   // aSourceDocShell was introduced. According to spec we should be passing
   // the source browsing context that was used when the history entry was
--- a/docshell/shistory/nsISHEntry.idl
+++ b/docshell/shistory/nsISHEntry.idl
@@ -159,17 +159,17 @@ interface nsISHEntry : nsISupports
      * is set.
      */
     [infallible] attribute nsIPrincipal principalToInherit;
 
     /**
      * Get the storage principal, if any, that is used when the inherit flag is
      * set.
      */
-    [infallible] attribute nsIPrincipal storagePrincipalToInherit;
+    [infallible] attribute nsIPrincipal partitionedPrincipalToInherit;
 
     /**
      * Get the csp, if any, that was used for this document load. That
      * is not the CSP that was applied to subresource loads within the
      * document, but the CSP that was applied to this document load.
      */
     [infallible] attribute nsIContentSecurityPolicy csp;
 
@@ -293,17 +293,17 @@ interface nsISHEntry : nsISupports
 
     /** Additional ways to create an entry */
     [noscript] void create(in nsIURI URI, in AString title,
                            in nsIInputStream inputStream,
                            in unsigned long cacheKey,
                            in ACString contentType,
                            in nsIPrincipal triggeringPrincipal,
                            in nsIPrincipal principalToInherit,
-                           in nsIPrincipal storagePrincipalToInherit,
+                           in nsIPrincipal partitionedPrincipalToInherit,
                            in nsIContentSecurityPolicy aCsp,
                            in nsIDRef docshellID,
                            in boolean dynamicCreation,
                            in nsIURI originalURI,
                            in nsIURI resultPrincipalURI,
                            in bool loadReplace,
                            in nsIReferrerInfo referrerInfo,
                            in AString srcdoc,
--- a/docshell/shistory/nsSHEntry.cpp
+++ b/docshell/shistory/nsSHEntry.cpp
@@ -318,41 +318,44 @@ nsSHEntry::GetContentType(nsACString& aC
 
 NS_IMETHODIMP
 nsSHEntry::SetContentType(const nsACString& aContentType) {
   mShared->mContentType = aContentType;
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsSHEntry::Create(
-    nsIURI* aURI, const nsAString& aTitle, nsIInputStream* aInputStream,
-    uint32_t aCacheKey, const nsACString& aContentType,
-    nsIPrincipal* aTriggeringPrincipal, nsIPrincipal* aPrincipalToInherit,
-    nsIPrincipal* aStoragePrincipalToInherit, nsIContentSecurityPolicy* aCsp,
-    const nsID& aDocShellID, bool aDynamicCreation, nsIURI* aOriginalURI,
-    nsIURI* aResultPrincipalURI, bool aLoadReplace,
-    nsIReferrerInfo* aReferrerInfo, const nsAString& aSrcdocData,
-    bool aSrcdocEntry, nsIURI* aBaseURI, bool aSaveLayoutState, bool aExpired) {
+nsSHEntry::Create(nsIURI* aURI, const nsAString& aTitle,
+                  nsIInputStream* aInputStream, uint32_t aCacheKey,
+                  const nsACString& aContentType,
+                  nsIPrincipal* aTriggeringPrincipal,
+                  nsIPrincipal* aPrincipalToInherit,
+                  nsIPrincipal* aPartitionedPrincipalToInherit,
+                  nsIContentSecurityPolicy* aCsp, const nsID& aDocShellID,
+                  bool aDynamicCreation, nsIURI* aOriginalURI,
+                  nsIURI* aResultPrincipalURI, bool aLoadReplace,
+                  nsIReferrerInfo* aReferrerInfo, const nsAString& aSrcdocData,
+                  bool aSrcdocEntry, nsIURI* aBaseURI, bool aSaveLayoutState,
+                  bool aExpired) {
   MOZ_ASSERT(
       aTriggeringPrincipal,
       "need a valid triggeringPrincipal to create a session history entry");
 
   mURI = aURI;
   mTitle = aTitle;
   mPostData = aInputStream;
 
   // Set the LoadType by default to loadHistory during creation
   mLoadType = LOAD_HISTORY;
 
   mShared->mCacheKey = aCacheKey;
   mShared->mContentType = aContentType;
   mShared->mTriggeringPrincipal = aTriggeringPrincipal;
   mShared->mPrincipalToInherit = aPrincipalToInherit;
-  mShared->mStoragePrincipalToInherit = aStoragePrincipalToInherit;
+  mShared->mPartitionedPrincipalToInherit = aPartitionedPrincipalToInherit;
   mShared->mCsp = aCsp;
   mShared->mDocShellID = aDocShellID;
   mShared->mDynamicallyCreated = aDynamicCreation;
 
   // By default all entries are set false for subframe flag.
   // nsDocShell::CloneAndReplace() which creates entries for
   // all subframe navigations, sets the flag to true.
   mShared->mIsFrameNavigation = false;
@@ -426,27 +429,27 @@ nsSHEntry::GetPrincipalToInherit(nsIPrin
 
 NS_IMETHODIMP
 nsSHEntry::SetPrincipalToInherit(nsIPrincipal* aPrincipalToInherit) {
   mShared->mPrincipalToInherit = aPrincipalToInherit;
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsSHEntry::GetStoragePrincipalToInherit(
-    nsIPrincipal** aStoragePrincipalToInherit) {
-  NS_IF_ADDREF(*aStoragePrincipalToInherit =
-                   mShared->mStoragePrincipalToInherit);
+nsSHEntry::GetPartitionedPrincipalToInherit(
+    nsIPrincipal** aPartitionedPrincipalToInherit) {
+  NS_IF_ADDREF(*aPartitionedPrincipalToInherit =
+                   mShared->mPartitionedPrincipalToInherit);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsSHEntry::SetStoragePrincipalToInherit(
-    nsIPrincipal* aStoragePrincipalToInherit) {
-  mShared->mStoragePrincipalToInherit = aStoragePrincipalToInherit;
+nsSHEntry::SetPartitionedPrincipalToInherit(
+    nsIPrincipal* aPartitionedPrincipalToInherit) {
+  mShared->mPartitionedPrincipalToInherit = aPartitionedPrincipalToInherit;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsSHEntry::GetCsp(nsIContentSecurityPolicy** aCsp) {
   NS_IF_ADDREF(*aCsp = mShared->mCsp);
   return NS_OK;
 }
@@ -844,19 +847,19 @@ nsSHEntry::CreateLoadInfo(nsDocShellLoad
   nsAutoCString contentType;
   GetContentType(contentType);
   loadState->SetTypeHint(contentType);
 
   nsCOMPtr<nsIPrincipal> triggeringPrincipal = GetTriggeringPrincipal();
   loadState->SetTriggeringPrincipal(triggeringPrincipal);
   nsCOMPtr<nsIPrincipal> principalToInherit = GetPrincipalToInherit();
   loadState->SetPrincipalToInherit(principalToInherit);
-  nsCOMPtr<nsIPrincipal> storagePrincipalToInherit =
-      GetStoragePrincipalToInherit();
-  loadState->SetStoragePrincipalToInherit(storagePrincipalToInherit);
+  nsCOMPtr<nsIPrincipal> partitionedPrincipalToInherit =
+      GetPartitionedPrincipalToInherit();
+  loadState->SetPartitionedPrincipalToInherit(partitionedPrincipalToInherit);
   nsCOMPtr<nsIContentSecurityPolicy> csp = GetCsp();
   loadState->SetCsp(csp);
   nsCOMPtr<nsIReferrerInfo> referrerInfo = GetReferrerInfo();
   loadState->SetReferrerInfo(referrerInfo);
 
   // Do not inherit principal from document (security-critical!);
   uint32_t flags = nsDocShell::InternalLoad::INTERNAL_LOAD_FLAGS_NONE;
 
--- a/docshell/shistory/nsSHEntryShared.cpp
+++ b/docshell/shistory/nsSHEntryShared.cpp
@@ -46,17 +46,17 @@ SHEntrySharedParentState::SHEntrySharedP
       mSaveLayoutState(true) {}
 
 SHEntrySharedParentState::~SHEntrySharedParentState() {}
 
 void SHEntrySharedParentState::CopyFrom(SHEntrySharedParentState* aEntry) {
   mDocShellID = aEntry->mDocShellID;
   mTriggeringPrincipal = aEntry->mTriggeringPrincipal;
   mPrincipalToInherit = aEntry->mPrincipalToInherit;
-  mStoragePrincipalToInherit = aEntry->mStoragePrincipalToInherit;
+  mPartitionedPrincipalToInherit = aEntry->mPartitionedPrincipalToInherit;
   mCsp = aEntry->mCsp;
   mSaveLayoutState = aEntry->mSaveLayoutState;
   mContentType.Assign(aEntry->mContentType);
   mIsFrameNavigation = aEntry->mIsFrameNavigation;
   mSticky = aEntry->mSticky;
   mDynamicallyCreated = aEntry->mDynamicallyCreated;
   mCacheKey = aEntry->mCacheKey;
   mLastTouched = aEntry->mLastTouched;
--- a/docshell/shistory/nsSHEntryShared.h
+++ b/docshell/shistory/nsSHEntryShared.h
@@ -67,17 +67,17 @@ class SHEntrySharedParentState {
 
   void CopyFrom(SHEntrySharedParentState* aSource);
 
   // These members are copied by SHEntrySharedParentState::CopyFrom(). If you
   // add a member here, be sure to update the CopyFrom() implementation.
   nsID mDocShellID;
   nsCOMPtr<nsIPrincipal> mTriggeringPrincipal;
   nsCOMPtr<nsIPrincipal> mPrincipalToInherit;
-  nsCOMPtr<nsIPrincipal> mStoragePrincipalToInherit;
+  nsCOMPtr<nsIPrincipal> mPartitionedPrincipalToInherit;
   nsCOMPtr<nsIContentSecurityPolicy> mCsp;
   // Child side updates layout history state when page is being unloaded or
   // moved to bfcache.
   nsCOMPtr<nsILayoutHistoryState> mLayoutHistoryState;
   nsCString mContentType;
 
   nsIntRect mViewerBounds;
 
--- a/dom/base/Document.cpp
+++ b/dom/base/Document.cpp
@@ -2407,43 +2407,43 @@ bool Document::IsVisibleConsideringAnces
   } while ((parent = parent->GetInProcessParentDocument()));
 
   return true;
 }
 
 void Document::Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup) {
   nsCOMPtr<nsIURI> uri;
   nsCOMPtr<nsIPrincipal> principal;
-  nsCOMPtr<nsIPrincipal> storagePrincipal;
+  nsCOMPtr<nsIPrincipal> partitionedPrincipal;
   if (aChannel) {
     // Note: this code is duplicated in PrototypeDocumentContentSink::Init and
     // nsScriptSecurityManager::GetChannelResultPrincipals.
     // Note: this should match the uri used for the OnNewURI call in
     //       nsDocShell::CreateContentViewer.
     NS_GetFinalChannelURI(aChannel, getter_AddRefs(uri));
 
     nsIScriptSecurityManager* securityManager =
         nsContentUtils::GetSecurityManager();
     if (securityManager) {
       securityManager->GetChannelResultPrincipals(
           aChannel, getter_AddRefs(principal),
-          getter_AddRefs(storagePrincipal));
-    }
-  }
-
-  bool equal = principal->Equals(storagePrincipal);
+          getter_AddRefs(partitionedPrincipal));
+    }
+  }
+
+  bool equal = principal->Equals(partitionedPrincipal);
 
   principal = MaybeDowngradePrincipal(principal);
   if (equal) {
-    storagePrincipal = principal;
+    partitionedPrincipal = principal;
   } else {
-    storagePrincipal = MaybeDowngradePrincipal(storagePrincipal);
-  }
-
-  ResetToURI(uri, aLoadGroup, principal, storagePrincipal);
+    partitionedPrincipal = MaybeDowngradePrincipal(partitionedPrincipal);
+  }
+
+  ResetToURI(uri, aLoadGroup, principal, partitionedPrincipal);
 
   // Note that, since mTiming does not change during a reset, the
   // navigationStart time remains unchanged and therefore any future new
   // timeline will have the same global clock time as the old one.
   mDocumentTimeline = nullptr;
 
   nsCOMPtr<nsIPropertyBag2> bag = do_QueryInterface(aChannel);
   if (bag) {
@@ -2495,19 +2495,19 @@ void Document::DisconnectNodeTree() {
     MOZ_ASSERT(!mCachedRootElement,
                "After removing all children, there should be no root elem");
   }
   mInUnlinkOrDeletion = oldVal;
 }
 
 void Document::ResetToURI(nsIURI* aURI, nsILoadGroup* aLoadGroup,
                           nsIPrincipal* aPrincipal,
-                          nsIPrincipal* aStoragePrincipal) {
+                          nsIPrincipal* aPartitionedPrincipal) {
   MOZ_ASSERT(aURI, "Null URI passed to ResetToURI");
-  MOZ_ASSERT(!!aPrincipal == !!aStoragePrincipal);
+  MOZ_ASSERT(!!aPrincipal == !!aPartitionedPrincipal);
 
   MOZ_LOG(gDocumentLeakPRLog, LogLevel::Debug,
           ("DOCUMENT %p ResetToURI %s", this, aURI->GetSpecOrDefault().get()));
 
   mSecurityInfo = nullptr;
 
   nsCOMPtr<nsILoadGroup> group = do_QueryReferent(mDocumentLoadGroup);
   if (!aLoadGroup || group != aLoadGroup) {
@@ -2582,17 +2582,17 @@ void Document::ResetToURI(nsIURI* aURI, 
   SetContentTypeInternal(EmptyCString());
   mContentLanguage.Truncate();
   mBaseTarget.Truncate();
 
   mXMLDeclarationBits = 0;
 
   // Now get our new principal
   if (aPrincipal) {
-    SetPrincipals(aPrincipal, aStoragePrincipal);
+    SetPrincipals(aPrincipal, aPartitionedPrincipal);
   } else {
     nsIScriptSecurityManager* securityManager =
         nsContentUtils::GetSecurityManager();
     if (securityManager) {
       nsCOMPtr<nsILoadContext> loadContext(mDocumentContainer);
 
       if (!loadContext && aLoadGroup) {
         nsCOMPtr<nsIInterfaceRequestor> cbs;
@@ -3712,26 +3712,26 @@ void Document::RemoveFromIdTable(Element
     IncrementExpandoGeneration(*this);
   }
   if (entry->IsEmpty()) {
     mIdentifierMap.RemoveEntry(entry);
   }
 }
 
 void Document::SetPrincipals(nsIPrincipal* aNewPrincipal,
-                             nsIPrincipal* aNewStoragePrincipal) {
-  MOZ_ASSERT(!!aNewPrincipal == !!aNewStoragePrincipal);
+                             nsIPrincipal* aNewPartitionedPrincipal) {
+  MOZ_ASSERT(!!aNewPrincipal == !!aNewPartitionedPrincipal);
   if (aNewPrincipal && mAllowDNSPrefetch &&
       StaticPrefs::network_dns_disablePrefetchFromHTTPS()) {
     if (aNewPrincipal->SchemeIs("https")) {
       mAllowDNSPrefetch = false;
     }
   }
   mNodeInfoManager->SetDocumentPrincipal(aNewPrincipal);
-  mIntrinsicStoragePrincipal = aNewStoragePrincipal;
+  mPartitionedPrincipal = aNewPartitionedPrincipal;
 
   ContentBlockingAllowList::ComputePrincipal(
       aNewPrincipal, getter_AddRefs(mContentBlockingAllowListPrincipal));
 
 #ifdef DEBUG
   // Validate that the docgroup is set correctly by calling its getter and
   // triggering its sanity check.
   //
@@ -11052,18 +11052,17 @@ nsresult Document::CloneDocHelper(Docume
     nsCOMPtr<nsIURI> uri;
     if (channel) {
       NS_GetFinalChannelURI(channel, getter_AddRefs(uri));
     } else {
       uri = Document::GetDocumentURI();
     }
     clone->mChannel = channel;
     if (uri) {
-      clone->ResetToURI(uri, loadGroup, NodePrincipal(),
-                        EffectiveStoragePrincipal());
+      clone->ResetToURI(uri, loadGroup, NodePrincipal(), mPartitionedPrincipal);
     }
 
     clone->SetContainer(mDocumentContainer);
 
     // Setup the navigation time. This will be needed by any animations in the
     // document, even if they are only paused.
     MOZ_ASSERT(!clone->GetNavigationTiming(),
                "Navigation time was already set?");
@@ -11077,17 +11076,17 @@ nsresult Document::CloneDocHelper(Docume
   // Now ensure that our clone has the same URI, base URI, and principal as us.
   // We do this after the mCreatingStaticClone block above, because that block
   // can set the base URI to an incorrect value in cases when base URI
   // information came from the channel.  So we override explicitly, and do it
   // for all these properties, in case ResetToURI messes with any of the rest of
   // them.
   clone->SetDocumentURI(Document::GetDocumentURI());
   clone->SetChromeXHRDocURI(mChromeXHRDocURI);
-  clone->SetPrincipals(NodePrincipal(), mIntrinsicStoragePrincipal);
+  clone->SetPrincipals(NodePrincipal(), mPartitionedPrincipal);
   clone->mActiveStoragePrincipal = mActiveStoragePrincipal;
   clone->mDocumentBaseURI = mDocumentBaseURI;
   clone->SetChromeXHRDocBaseURI(mChromeXHRDocBaseURI);
   clone->mReferrerInfo =
       static_cast<dom::ReferrerInfo*>(mReferrerInfo.get())->Clone();
   clone->mPreloadReferrerInfo = clone->mReferrerInfo;
 
   bool hasHadScriptObject = true;
@@ -16297,17 +16296,17 @@ nsIPrincipal* Document::EffectiveStorage
   // jar. When the permission is granted, access will be different and the
   // normal principal will be used.
   if (ShouldPartitionStorage(rejectedReason) &&
       !StoragePartitioningEnabled(
           rejectedReason, const_cast<Document*>(this)->CookieJarSettings())) {
     return mActiveStoragePrincipal = NodePrincipal();
   }
 
-  return mActiveStoragePrincipal = mIntrinsicStoragePrincipal;
+  return mActiveStoragePrincipal = mPartitionedPrincipal;
 }
 
 void Document::SetIsInitialDocument(bool aIsInitialDocument) {
   mIsInitialDocumentInWindow = aIsInitialDocument;
 
   // Asynchronously tell the parent process that we are, or are no longer, the
   // initial document. This happens async.
   if (auto* wgc = GetWindowGlobalChild()) {
--- a/dom/base/Document.h
+++ b/dom/base/Document.h
@@ -573,23 +573,21 @@ class Document : public nsINode,
 
   // nsIScriptObjectPrincipal
   nsIPrincipal* GetPrincipal() final { return NodePrincipal(); }
 
   nsIPrincipal* GetEffectiveStoragePrincipal() final {
     return EffectiveStoragePrincipal();
   }
 
-  // You should probably not be using this function, since it performs no
-  // checks to ensure that the intrinsic storage principal should really be
-  // used here.  It is only designed to be used in very specific circumstances,
-  // such as when inheriting the document/storage principal.
-  nsIPrincipal* IntrinsicStoragePrincipal() final {
-    return mIntrinsicStoragePrincipal;
-  }
+  // You should probably not be using this function, since it performs no checks
+  // to ensure that the partitioned principal should really be used here.  It is
+  // only designed to be used in very specific circumstances, such as when
+  // inheriting the document/storage principal.
+  nsIPrincipal* PartitionedPrincipal() final { return mPartitionedPrincipal; }
 
   void ClearActiveStoragePrincipal() { mActiveStoragePrincipal = nullptr; }
 
   nsIPrincipal* GetContentBlockingAllowListPrincipal() const {
     return mContentBlockingAllowListPrincipal;
   }
 
   // EventTarget
@@ -850,17 +848,18 @@ class Document : public nsINode,
               ->CloneWithNewPolicy(policy);
     }
   }
 
   /**
    * Set the principals responsible for this document.  Chances are, you do not
    * want to be using this.
    */
-  void SetPrincipals(nsIPrincipal* aPrincipal, nsIPrincipal* aStoragePrincipal);
+  void SetPrincipals(nsIPrincipal* aPrincipal,
+                     nsIPrincipal* aPartitionedPrincipal);
 
   /**
    * Get the list of ancestor principals for a document.  This is the same as
    * the ancestor list for the document's docshell the last time SetContainer()
    * was called with a non-null argument. See the documentation for the
    * corresponding getter in docshell for how this list is determined.  We store
    * a copy of the list, because we may lose the ability to reach our docshell
    * before people stop asking us for this information.
@@ -2084,23 +2083,23 @@ class Document : public nsINode,
   /**
    * Reset the document using the given channel and loadgroup.  This works
    * like ResetToURI, but also sets the document's channel to aChannel.
    * The principal of the document will be set from the channel.
    */
   virtual void Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup);
 
   /**
-   * Reset this document to aURI, aLoadGroup, aPrincipal and aStoragePrincipal.
-   * aURI must not be null.  If aPrincipal is null, a content principal based
-   * on aURI will be used.
+   * Reset this document to aURI, aLoadGroup, aPrincipal and
+   * aPartitionedPrincipal.  aURI must not be null.  If aPrincipal is null, a
+   * content principal based on aURI will be used.
    */
   virtual void ResetToURI(nsIURI* aURI, nsILoadGroup* aLoadGroup,
                           nsIPrincipal* aPrincipal,
-                          nsIPrincipal* aStoragePrincipal);
+                          nsIPrincipal* aPartitionedPrincipal);
 
   /**
    * Set the container (docshell) for this document. Virtual so that
    * docshell can call it.
    */
   virtual void SetContainer(nsDocShell* aContainer);
 
   /**
@@ -5041,18 +5040,19 @@ class Document : public nsINode,
 
   // Document generation. Gets incremented everytime it changes.
   int32_t mGeneration;
 
   // Cached TabSizes values for the document.
   int32_t mCachedTabSizeGeneration;
   nsTabSizes mCachedTabSizes;
 
-  // The principal to use for the storage area of this document.
-  nsCOMPtr<nsIPrincipal> mIntrinsicStoragePrincipal;
+  // This is equal to document's principal but with an isolation key. See
+  // StoragePrincipalHelper.h to know more.
+  nsCOMPtr<nsIPrincipal> mPartitionedPrincipal;
 
   // The cached storage principal for this document.
   // This is mutable so that we can keep EffectiveStoragePrincipal() const
   // which is required due to its CloneDocHelper() call site.  :-(
   mutable nsCOMPtr<nsIPrincipal> mActiveStoragePrincipal;
 
   // The principal to use for the content blocking allow list.
   nsCOMPtr<nsIPrincipal> mContentBlockingAllowListPrincipal;
--- a/dom/base/nsGlobalWindowInner.cpp
+++ b/dom/base/nsGlobalWindowInner.cpp
@@ -1094,17 +1094,17 @@ void nsGlobalWindowInner::FreeInnerObjec
 #if defined(MOZ_WIDGET_ANDROID)
   mOrientationChangeObserver = nullptr;
 #endif
 
   if (mDoc) {
     // Remember the document's principal, URI, and CSP.
     mDocumentPrincipal = mDoc->NodePrincipal();
     mDocumentStoragePrincipal = mDoc->EffectiveStoragePrincipal();
-    mDocumentIntrinsicStoragePrincipal = mDoc->IntrinsicStoragePrincipal();
+    mDocumentPartitionedPrincipal = mDoc->PartitionedPrincipal();
     mDocumentURI = mDoc->GetDocumentURI();
     mDocBaseURI = mDoc->GetDocBaseURI();
     mDocContentBlockingAllowListPrincipal =
         mDoc->GetContentBlockingAllowListPrincipal();
     mDocumentCsp = mDoc->GetCsp();
 
     while (mDoc->EventHandlingSuppressed()) {
       mDoc->UnsuppressEventHandlingAndFireEvents(false);
@@ -1322,17 +1322,17 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mCustomElements)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mSharedWorkers)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mLocalStorage)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mSessionStorage)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mApplicationCache)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mIndexedDB)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mDocumentPrincipal)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mDocumentStoragePrincipal)
-  NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mDocumentIntrinsicStoragePrincipal)
+  NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mDocumentPartitionedPrincipal)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mDocumentCsp)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mBrowserChild)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mDoc)
 
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mIdleRequestExecutor)
   for (IdleRequest* request : tmp->mIdleRequestCallbacks) {
     cb.NoteNativeChild(request, NS_CYCLE_COLLECTION_PARTICIPANT(IdleRequest));
   }
@@ -1429,17 +1429,17 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(ns
     NS_IMPL_CYCLE_COLLECTION_UNLINK(mApplicationCache)
   }
   if (tmp->mIndexedDB) {
     tmp->mIndexedDB->DisconnectFromGlobal(tmp);
     NS_IMPL_CYCLE_COLLECTION_UNLINK(mIndexedDB)
   }
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mDocumentPrincipal)
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mDocumentStoragePrincipal)
-  NS_IMPL_CYCLE_COLLECTION_UNLINK(mDocumentIntrinsicStoragePrincipal)
+  NS_IMPL_CYCLE_COLLECTION_UNLINK(mDocumentPartitionedPrincipal)
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mDocumentCsp)
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mBrowserChild)
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mDoc)
 
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mGamepads)
 
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mCacheStorage)
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mVRDisplays)
@@ -2097,34 +2097,34 @@ nsIPrincipal* nsGlobalWindowInner::GetEf
 
   if (objPrincipal) {
     return objPrincipal->GetEffectiveStoragePrincipal();
   }
 
   return nullptr;
 }
 
-nsIPrincipal* nsGlobalWindowInner::IntrinsicStoragePrincipal() {
+nsIPrincipal* nsGlobalWindowInner::PartitionedPrincipal() {
   if (mDoc) {
     // If we have a document, get the principal from the document
-    return mDoc->EffectiveStoragePrincipal();
-  }
-
-  if (mDocumentIntrinsicStoragePrincipal) {
-    return mDocumentIntrinsicStoragePrincipal;
-  }
-
-  // If we don't have a storage principal and we don't have a document we ask
-  // the parent window for the storage principal.
+    return mDoc->PartitionedPrincipal();
+  }
+
+  if (mDocumentPartitionedPrincipal) {
+    return mDocumentPartitionedPrincipal;
+  }
+
+  // If we don't have a partitioned principal and we don't have a document we
+  // ask the parent window for the partitioned principal.
 
   nsCOMPtr<nsIScriptObjectPrincipal> objPrincipal =
       do_QueryInterface(GetInProcessParentInternal());
 
   if (objPrincipal) {
-    return objPrincipal->IntrinsicStoragePrincipal();
+    return objPrincipal->PartitionedPrincipal();
   }
 
   return nullptr;
 }
 
 //*****************************************************************************
 // nsGlobalWindowInner::nsIDOMWindow
 //*****************************************************************************
@@ -4341,31 +4341,31 @@ already_AddRefed<nsICSSDeclaration> nsGl
     ErrorResult& aError) {
   FORWARD_TO_OUTER_OR_THROW(GetComputedStyleHelperOuter,
                             (aElt, aPseudoElt, aDefaultStylesOnly), aError,
                             nullptr);
 }
 
 Storage* nsGlobalWindowInner::GetSessionStorage(ErrorResult& aError) {
   nsIPrincipal* principal = GetPrincipal();
-  nsIPrincipal* storagePrincipal = IntrinsicStoragePrincipal();
+  nsIPrincipal* partitionedPrincipal = PartitionedPrincipal();
   BrowsingContext* browsingContext = GetBrowsingContext();
 
-  if (!principal || !storagePrincipal || !browsingContext ||
+  if (!principal || !partitionedPrincipal || !browsingContext ||
       !Storage::StoragePrefIsEnabled()) {
     return nullptr;
   }
 
   if (mSessionStorage) {
     MOZ_LOG(gDOMLeakPRLogInner, LogLevel::Debug,
             ("nsGlobalWindowInner %p has %p sessionStorage", this,
              mSessionStorage.get()));
     bool canAccess =
         principal->Subsumes(mSessionStorage->Principal()) &&
-        storagePrincipal->Subsumes(mSessionStorage->StoragePrincipal());
+        partitionedPrincipal->Subsumes(mSessionStorage->StoragePrincipal());
     if (!canAccess) {
       mSessionStorage = nullptr;
     }
   }
 
   if (!mSessionStorage) {
     nsString documentURI;
     if (mDoc) {
@@ -4433,19 +4433,19 @@ Storage* nsGlobalWindowInner::GetSession
     const RefPtr<SessionStorageManager> storageManager =
         browsingContext->GetSessionStorageManager();
     if (!storageManager) {
       aError.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
       return nullptr;
     }
 
     RefPtr<Storage> storage;
-    aError = storageManager->CreateStorage(this, principal, storagePrincipal,
-                                           documentURI, IsPrivateBrowsing(),
-                                           getter_AddRefs(storage));
+    aError = storageManager->CreateStorage(
+        this, principal, partitionedPrincipal, documentURI, IsPrivateBrowsing(),
+        getter_AddRefs(storage));
     if (aError.Failed()) {
       return nullptr;
     }
 
     mSessionStorage = storage;
     MOZ_ASSERT(mSessionStorage);
 
     MOZ_LOG(gDOMLeakPRLogInner, LogLevel::Debug,
@@ -5018,34 +5018,29 @@ 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);
 
     bool check = false;
 
     if (const RefPtr<SessionStorageManager> storageManager =
             GetBrowsingContext()->GetSessionStorageManager()) {
-      nsresult rv = storageManager->CheckStorage(storagePrincipal,
+      nsresult rv = storageManager->CheckStorage(PartitionedPrincipal(),
                                                  changingStorage, &check);
       if (NS_FAILED(rv)) {
         return;
       }
     }
 
     if (!check) {
       // This storage event is not coming from our storage or is coming
@@ -5062,16 +5057,21 @@ void nsGlobalWindowInner::ObserveStorage
     if (fireMozStorageChanged) {
       eventType.AssignLiteral("MozSessionStorageChanged");
     }
   }
 
   else {
     MOZ_ASSERT(!NS_strcmp(aStorageType, u"localStorage"));
 
+    nsIPrincipal* storagePrincipal = GetEffectiveStoragePrincipal();
+    if (!storagePrincipal) {
+      return;
+    }
+
     MOZ_DIAGNOSTIC_ASSERT(StorageUtils::PrincipalsEqual(aEvent->GetPrincipal(),
                                                         storagePrincipal));
 
     fireMozStorageChanged =
         mLocalStorage && mLocalStorage == aEvent->GetStorageArea();
 
     if (fireMozStorageChanged) {
       eventType.AssignLiteral("MozLocalStorageChanged");
--- a/dom/base/nsGlobalWindowInner.h
+++ b/dom/base/nsGlobalWindowInner.h
@@ -261,17 +261,17 @@ class nsGlobalWindowInner final : public
 
   virtual bool IsBlackForCC(bool aTracingNeeded = true) override;
 
   // nsIScriptObjectPrincipal
   virtual nsIPrincipal* GetPrincipal() override;
 
   virtual nsIPrincipal* GetEffectiveStoragePrincipal() override;
 
-  virtual nsIPrincipal* IntrinsicStoragePrincipal() override;
+  virtual nsIPrincipal* PartitionedPrincipal() override;
 
   // nsIDOMWindow
   NS_DECL_NSIDOMWINDOW
 
   // nsIDOMChromeWindow (only implemented on chrome windows)
   NS_DECL_NSIDOMCHROMEWINDOW
 
   void CaptureEvents();
@@ -1334,17 +1334,17 @@ class nsGlobalWindowInner final : public
   nsTObserverArray<RefPtr<mozilla::dom::SharedWorker>> mSharedWorkers;
 
   RefPtr<mozilla::dom::VisualViewport> mVisualViewport;
 
   // The document's principals and CSP are only stored if
   // FreeInnerObjects has been called.
   nsCOMPtr<nsIPrincipal> mDocumentPrincipal;
   nsCOMPtr<nsIPrincipal> mDocumentStoragePrincipal;
-  nsCOMPtr<nsIPrincipal> mDocumentIntrinsicStoragePrincipal;
+  nsCOMPtr<nsIPrincipal> mDocumentPartitionedPrincipal;
   nsCOMPtr<nsIContentSecurityPolicy> mDocumentCsp;
 
   RefPtr<mozilla::dom::DebuggerNotificationManager>
       mDebuggerNotificationManager;
 
   // mBrowserChild is only ever populated in the content process.
   nsCOMPtr<nsIBrowserChild> mBrowserChild;
 
--- a/dom/base/nsGlobalWindowOuter.cpp
+++ b/dom/base/nsGlobalWindowOuter.cpp
@@ -1583,17 +1583,17 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_
 
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mControllers)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mArguments)
 
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mLocalStorage)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mSuspendedDoc)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mDocumentPrincipal)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mDocumentStoragePrincipal)
-  NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mDocumentIntrinsicStoragePrincipal)
+  NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mDocumentPartitionedPrincipal)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mDoc)
 
   // Traverse stuff from nsPIDOMWindow
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mChromeEventHandler)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mParentTarget)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mMessageManager)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mFrameElement)
 
@@ -1615,17 +1615,17 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(ns
 
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mControllers)
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mArguments)
 
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mLocalStorage)
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mSuspendedDoc)
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mDocumentPrincipal)
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mDocumentStoragePrincipal)
-  NS_IMPL_CYCLE_COLLECTION_UNLINK(mDocumentIntrinsicStoragePrincipal)
+  NS_IMPL_CYCLE_COLLECTION_UNLINK(mDocumentPartitionedPrincipal)
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mDoc)
 
   // Unlink stuff from nsPIDOMWindow
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mChromeEventHandler)
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mParentTarget)
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mMessageManager)
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mFrameElement)
 
@@ -2039,18 +2039,18 @@ static nsresult CreateNativeGlobalForInn
 nsresult nsGlobalWindowOuter::SetNewDocument(Document* aDocument,
                                              nsISupports* aState,
                                              bool aForceReuseInnerWindow,
                                              WindowGlobalChild* aActor) {
   MOZ_ASSERT(mDocumentPrincipal == nullptr,
              "mDocumentPrincipal prematurely set!");
   MOZ_ASSERT(mDocumentStoragePrincipal == nullptr,
              "mDocumentStoragePrincipal prematurely set!");
-  MOZ_ASSERT(mDocumentIntrinsicStoragePrincipal == nullptr,
-             "mDocumentIntrinsicStoragePrincipal prematurely set!");
+  MOZ_ASSERT(mDocumentPartitionedPrincipal == nullptr,
+             "mDocumentPartitionedPrincipal prematurely set!");
   MOZ_ASSERT(aDocument);
 
   // Bail out early if we're in process of closing down the window.
   NS_ENSURE_STATE(!mCleanedUp);
 
   NS_ASSERTION(!GetCurrentInnerWindow() ||
                    GetCurrentInnerWindow()->GetExtantDoc() == mDoc,
                "Uh, mDoc doesn't match the current inner window "
@@ -2692,17 +2692,17 @@ void nsGlobalWindowOuter::DetachFromDocS
   nsGlobalWindowInner* currentInner = GetCurrentInnerWindowInternal();
 
   if (currentInner) {
     NS_ASSERTION(mDoc, "Must have doc!");
 
     // Remember the document's principal and URI.
     mDocumentPrincipal = mDoc->NodePrincipal();
     mDocumentStoragePrincipal = mDoc->EffectiveStoragePrincipal();
-    mDocumentIntrinsicStoragePrincipal = mDoc->IntrinsicStoragePrincipal();
+    mDocumentPartitionedPrincipal = mDoc->PartitionedPrincipal();
     mDocumentURI = mDoc->GetDocumentURI();
 
     // Release our document reference
     DropOuterWindowDocs();
   }
 
   ClearControllers();
 
@@ -2965,34 +2965,34 @@ nsIPrincipal* nsGlobalWindowOuter::GetEf
 
   if (objPrincipal) {
     return objPrincipal->GetEffectiveStoragePrincipal();
   }
 
   return nullptr;
 }
 
-nsIPrincipal* nsGlobalWindowOuter::IntrinsicStoragePrincipal() {
+nsIPrincipal* nsGlobalWindowOuter::PartitionedPrincipal() {
   if (mDoc) {
     // If we have a document, get the principal from the document
-    return mDoc->IntrinsicStoragePrincipal();
-  }
-
-  if (mDocumentIntrinsicStoragePrincipal) {
-    return mDocumentIntrinsicStoragePrincipal;
-  }
-
-  // If we don't have a storage principal and we don't have a document we ask
-  // the parent window for the storage principal.
+    return mDoc->PartitionedPrincipal();
+  }
+
+  if (mDocumentPartitionedPrincipal) {
+    return mDocumentPartitionedPrincipal;
+  }
+
+  // If we don't have a partitioned principal and we don't have a document we
+  // ask the parent window for the partitioned principal.
 
   nsCOMPtr<nsIScriptObjectPrincipal> objPrincipal =
       do_QueryInterface(GetInProcessParentInternal());
 
   if (objPrincipal) {
-    return objPrincipal->IntrinsicStoragePrincipal();
+    return objPrincipal->PartitionedPrincipal();
   }
 
   return nullptr;
 }
 
 //*****************************************************************************
 // nsGlobalWindowOuter::nsIDOMWindow
 //*****************************************************************************
--- a/dom/base/nsGlobalWindowOuter.h
+++ b/dom/base/nsGlobalWindowOuter.h
@@ -239,17 +239,17 @@ class nsGlobalWindowOuter final : public
 
   virtual bool IsBlackForCC(bool aTracingNeeded = true) override;
 
   // nsIScriptObjectPrincipal
   virtual nsIPrincipal* GetPrincipal() override;
 
   virtual nsIPrincipal* GetEffectiveStoragePrincipal() override;
 
-  virtual nsIPrincipal* IntrinsicStoragePrincipal() override;
+  virtual nsIPrincipal* PartitionedPrincipal() override;
 
   // nsIDOMWindow
   NS_DECL_NSIDOMWINDOW
 
   // nsIDOMChromeWindow (only implemented on chrome windows)
   NS_DECL_NSIDOMCHROMEWINDOW
 
   mozilla::dom::ChromeMessageBroadcaster* GetMessageManager();
@@ -1093,17 +1093,17 @@ class nsGlobalWindowOuter final : public
 
   RefPtr<nsDOMWindowUtils> mWindowUtils;
   nsString mStatus;
 
   RefPtr<mozilla::dom::Storage> mLocalStorage;
 
   nsCOMPtr<nsIPrincipal> mDocumentPrincipal;
   nsCOMPtr<nsIPrincipal> mDocumentStoragePrincipal;
-  nsCOMPtr<nsIPrincipal> mDocumentIntrinsicStoragePrincipal;
+  nsCOMPtr<nsIPrincipal> mDocumentPartitionedPrincipal;
 
 #ifdef DEBUG
   uint32_t mSerial;
 
   bool mSetOpenerWindowCalled;
   nsCOMPtr<nsIURI> mLastOpenedURI;
 #endif
 
--- a/dom/base/nsIScriptObjectPrincipal.h
+++ b/dom/base/nsIScriptObjectPrincipal.h
@@ -24,15 +24,15 @@ class nsIPrincipal;
 class nsIScriptObjectPrincipal : public nsISupports {
  public:
   NS_DECLARE_STATIC_IID_ACCESSOR(NS_ISCRIPTOBJECTPRINCIPAL_IID)
 
   virtual nsIPrincipal* GetPrincipal() = 0;
 
   virtual nsIPrincipal* GetEffectiveStoragePrincipal() = 0;
 
-  virtual nsIPrincipal* IntrinsicStoragePrincipal() = 0;
+  virtual nsIPrincipal* PartitionedPrincipal() = 0;
 };
 
 NS_DEFINE_STATIC_IID_ACCESSOR(nsIScriptObjectPrincipal,
                               NS_ISCRIPTOBJECTPRINCIPAL_IID)
 
 #endif  // nsIScriptObjectPrincipal_h__
--- a/dom/broadcastchannel/BroadcastChannel.cpp
+++ b/dom/broadcastchannel/BroadcastChannel.cpp
@@ -229,19 +229,17 @@ already_AddRefed<BroadcastChannel> Broad
     // object.
     if (NS_WARN_IF(!workerRef)) {
       aRv.Throw(NS_ERROR_FAILURE);
       return nullptr;
     }
 
     storageAccess = workerPrivate->StorageAccess();
     storagePrincipalInfo = workerPrivate->GetEffectiveStoragePrincipalInfo();
-
-    // TODO This is broken, it will be fixed in the following patches.
-    origin = workerPrivate->PartitionedOrigin();
+    origin = workerPrivate->StoragePrincipalOrigin();
 
     originNoSuffix = workerPrivate->GetLocationInfo().mOrigin;
 
     bc->mWorkerRef = workerRef;
 
     cjs = workerPrivate->CookieJarSettings();
   }
 
--- a/dom/html/nsHTMLDocument.cpp
+++ b/dom/html/nsHTMLDocument.cpp
@@ -157,20 +157,20 @@ void nsHTMLDocument::Reset(nsIChannel* a
 
   if (aChannel) {
     aChannel->GetLoadFlags(&mLoadFlags);
   }
 }
 
 void nsHTMLDocument::ResetToURI(nsIURI* aURI, nsILoadGroup* aLoadGroup,
                                 nsIPrincipal* aPrincipal,
-                                nsIPrincipal* aStoragePrincipal) {
+                                nsIPrincipal* aPartitionedPrincipal) {
   mLoadFlags = nsIRequest::LOAD_NORMAL;
 
-  Document::ResetToURI(aURI, aLoadGroup, aPrincipal, aStoragePrincipal);
+  Document::ResetToURI(aURI, aLoadGroup, aPrincipal, aPartitionedPrincipal);
 
   mImages = nullptr;
   mApplets = nullptr;
   mEmbeds = nullptr;
   mLinks = nullptr;
   mAnchors = nullptr;
   mScripts = nullptr;
 
--- a/dom/html/nsHTMLDocument.h
+++ b/dom/html/nsHTMLDocument.h
@@ -46,17 +46,17 @@ class nsHTMLDocument : public mozilla::d
 
   nsHTMLDocument();
   virtual nsresult Init() override;
 
   // Document
   virtual void Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup) override;
   virtual void ResetToURI(nsIURI* aURI, nsILoadGroup* aLoadGroup,
                           nsIPrincipal* aPrincipal,
-                          nsIPrincipal* aStoragePrincipal) override;
+                          nsIPrincipal* aPartitionedPrincipal) override;
 
   virtual nsresult StartDocumentLoad(const char* aCommand, nsIChannel* aChannel,
                                      nsILoadGroup* aLoadGroup,
                                      nsISupports* aContainer,
                                      nsIStreamListener** aDocListener,
                                      bool aReset = true,
                                      nsIContentSink* aSink = nullptr) override;
 
--- a/dom/interfaces/base/nsIBrowser.idl
+++ b/dom/interfaces/base/nsIBrowser.idl
@@ -72,17 +72,17 @@ interface nsIBrowser : nsISupports
    * The nsIWebProgress instance responsible for handling progress events
    * from the content process.
    *
    * Will always be non-null when isRemoteBrowser is true.
    */
   readonly attribute nsIWebProgress remoteWebProgressManager;
 
   readonly attribute nsIPrincipal contentPrincipal;
-  readonly attribute nsIPrincipal contentStoragePrincipal;
+  readonly attribute nsIPrincipal contentPartitionedPrincipal;
   readonly attribute nsIPrincipal contentBlockingAllowListPrincipal;
   readonly attribute nsIContentSecurityPolicy csp;
   readonly attribute nsIReferrerInfo referrerInfo;
 
   /**
    * Whether or not the browser is in the process of an nsIWebNavigation
    * navigation method.
    */
@@ -128,35 +128,35 @@ interface nsIBrowser : nsISupports
    * @param aCharset the character set of the document
    * @param aMayEnableCharacterEncodingMenu whether or not the content encoding
    *                                        menu may be enabled
    * @param aCharsetAutodetected whether or not the given character set was
    *                             autodetected
    * @param aDocumentURI the URI of the new document
    * @param aTitle the title of the new doucment
    * @param aContentPrincipal the security principal of the new document
-   * @param aContentStoragePrincipal the security principal for the new
-   *                                 document's storage
+   * @param aContentPartitionedPrincipal the security principal for the new
+   *                                     document's storage
    * @param aCSP the content security policy of the new document
    * @param aReferrerInfo the referrer info of the new document
    * @param aIsSynthetic whether or not the document is synthetic
    * @param aInnerWindowID the inner window ID of the document
    * @param aHasRequestContextID whether or not the the request context has a
    *                             value (true) or null should be used (false)
    * @param aRequestContextID the request context ID
    * @param aContentType the content type of the document
    */
   void updateForLocationChange(in nsIURI aLocation,
                                in AString aCharset,
                                in boolean aMayEnableCharacterEncodingMenu,
                                in boolean aCharsetAutodetected,
                                in nsIURI aDocumentURI,
                                in AString aTitle,
                                in nsIPrincipal aContentPrincipal,
-                               in nsIPrincipal aContentStoragePrincipal,
+                               in nsIPrincipal aContentPartitionedPrincipal,
                                in nsIContentSecurityPolicy aCSP,
                                in nsIReferrerInfo aReferrerInfo,
                                in boolean aIsSynthetic,
                                in uint64_t aInnerWindowID,
                                in boolean aHasRequestContextID,
                                in uint64_t aRequestContextID,
                                in AString aContentType);
 
--- a/dom/ipc/BrowserChild.cpp
+++ b/dom/ipc/BrowserChild.cpp
@@ -3642,18 +3642,18 @@ NS_IMETHODIMP BrowserChild::OnLocationCh
     document->GetCharacterSet(locationChangeData->charset());
 
     locationChangeData->mayEnableCharacterEncodingMenu() =
         docShell->GetMayEnableCharacterEncodingMenu();
     locationChangeData->charsetAutodetected() =
         docShell->GetCharsetAutodetected();
 
     locationChangeData->contentPrincipal() = document->NodePrincipal();
-    locationChangeData->contentStoragePrincipal() =
-        document->EffectiveStoragePrincipal();
+    locationChangeData->contentPartitionedPrincipal() =
+        document->PartitionedPrincipal();
     locationChangeData->csp() = document->GetCsp();
     locationChangeData->referrerInfo() = document->ReferrerInfo();
     locationChangeData->isSyntheticDocument() = document->IsSyntheticDocument();
 
     if (nsCOMPtr<nsILoadGroup> loadGroup = document->GetDocumentLoadGroup()) {
       uint64_t requestContextID = 0;
       MOZ_TRY(loadGroup->GetRequestContextID(&requestContextID));
       locationChangeData->requestContextID() = Some(requestContextID);
--- a/dom/ipc/BrowserParent.cpp
+++ b/dom/ipc/BrowserParent.cpp
@@ -2687,17 +2687,17 @@ mozilla::ipc::IPCResult BrowserParent::R
     nsCOMPtr<nsIPrincipal> contentBlockingAllowListPrincipal;
     Unused << browser->SetIsNavigating(aLocationChangeData->isNavigating());
     Unused << browser->UpdateForLocationChange(
         aLocation, aLocationChangeData->charset(),
         aLocationChangeData->mayEnableCharacterEncodingMenu(),
         aLocationChangeData->charsetAutodetected(),
         aLocationChangeData->documentURI(), aLocationChangeData->title(),
         aLocationChangeData->contentPrincipal(),
-        aLocationChangeData->contentStoragePrincipal(),
+        aLocationChangeData->contentPartitionedPrincipal(),
         aLocationChangeData->csp(), aLocationChangeData->referrerInfo(),
         aLocationChangeData->isSyntheticDocument(),
         aWebProgressData->innerDOMWindowID(),
         aLocationChangeData->requestContextID().isSome(),
         aLocationChangeData->requestContextID().valueOr(0),
         aLocationChangeData->contentType());
   }
 
--- a/dom/ipc/DOMTypes.ipdlh
+++ b/dom/ipc/DOMTypes.ipdlh
@@ -236,17 +236,17 @@ struct DocShellLoadStateInit
   bool ResultPrincipalURIIsSome;
   nsIPrincipal TriggeringPrincipal;
   nsIReferrerInfo ReferrerInfo;
   bool KeepResultPrincipalURIIfSet;
   bool LoadReplace;
   bool InheritPrincipal;
   bool PrincipalIsExplicit;
   nsIPrincipal PrincipalToInherit;
-  nsIPrincipal StoragePrincipalToInherit;
+  nsIPrincipal PartitionedPrincipalToInherit;
   bool ForceAllowDataURI;
   bool OriginalFrameSrc;
   bool IsFormSubmission;
   uint32_t LoadType;
   nsString Target;
   nsIURI BaseURI;
   uint32_t LoadFlags;
   bool FirstParty;
--- a/dom/ipc/PBrowser.ipdl
+++ b/dom/ipc/PBrowser.ipdl
@@ -142,17 +142,17 @@ struct WebProgressLocationChangeData
   bool isSyntheticDocument;
   bool mayEnableCharacterEncodingMenu;
   bool charsetAutodetected;
   nsString contentType;
   nsString title;
   nsString charset;
   nsIURI documentURI;
   nsIPrincipal contentPrincipal;
-  nsIPrincipal contentStoragePrincipal;
+  nsIPrincipal contentPartitionedPrincipal;
   nsIContentSecurityPolicy csp;
   nsIReferrerInfo referrerInfo;
   uint64_t? requestContextID;
 };
 
 /**
  * A PBrowser manages a maximal locally connected subtree of BrowsingContexts
  * in a content process.
--- a/dom/serviceworkers/ServiceWorkerPrivate.cpp
+++ b/dom/serviceworkers/ServiceWorkerPrivate.cpp
@@ -1700,19 +1700,19 @@ nsresult ServiceWorkerPrivate::SpawnWork
 
   rv = info.mBaseURI->GetHost(info.mDomain);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   info.mPrincipal = mInfo->Principal();
   info.mLoadingPrincipal = info.mPrincipal;
-  // StoragePrincipal for ServiceWorkers is equal to mPrincipal because, at the
-  // moment, ServiceWorkers are not exposed in partitioned contexts.
-  info.mStoragePrincipal = info.mPrincipal;
+  // PartitionedPrincipal for ServiceWorkers is equal to mPrincipal because, at
+  // the moment, ServiceWorkers are not exposed in partitioned contexts.
+  info.mPartitionedPrincipal = info.mPrincipal;
 
   info.mCookieJarSettings = mozilla::net::CookieJarSettings::Create();
   MOZ_ASSERT(info.mCookieJarSettings);
 
   info.mStorageAccess =
       StorageAllowedForServiceWorker(info.mPrincipal, info.mCookieJarSettings);
 
   info.mOriginAttributes = mInfo->GetOriginAttributes();
@@ -1730,17 +1730,17 @@ nsresult ServiceWorkerPrivate::SpawnWork
   // Default CSP permissions for now.  These will be overrided if necessary
   // based on the script CSP headers during load in ScriptLoader.
   info.mEvalAllowed = true;
   info.mReportCSPViolations = false;
 
   WorkerPrivate::OverrideLoadInfoLoadGroup(info, info.mPrincipal);
 
   rv = info.SetPrincipalsAndCSPOnMainThread(
-      info.mPrincipal, info.mStoragePrincipal, info.mLoadGroup, nullptr);
+      info.mPrincipal, info.mPartitionedPrincipal, info.mLoadGroup, nullptr);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   info.mAgentClusterId = reg->AgentClusterId();
 
   AutoJSAPI jsapi;
   jsapi.Init();
--- a/dom/serviceworkers/ServiceWorkerPrivateImpl.cpp
+++ b/dom/serviceworkers/ServiceWorkerPrivateImpl.cpp
@@ -64,17 +64,17 @@ ServiceWorkerPrivateImpl::RAIIActorPtrHo
   AssertIsOnMainThread();
 
   mDestructorPromiseHolder.ResolveIfExists(true, __func__);
 
   mActor->MaybeSendDelete();
 }
 
 RemoteWorkerControllerChild*
-    ServiceWorkerPrivateImpl::RAIIActorPtrHolder::operator->() const {
+ServiceWorkerPrivateImpl::RAIIActorPtrHolder::operator->() const {
   AssertIsOnMainThread();
 
   return get();
 }
 
 RemoteWorkerControllerChild* ServiceWorkerPrivateImpl::RAIIActorPtrHolder::get()
     const {
   AssertIsOnMainThread();
@@ -163,19 +163,20 @@ nsresult ServiceWorkerPrivateImpl::Initi
   mRemoteWorkerData.originalScriptURL() =
       NS_ConvertUTF8toUTF16(mOuter->mInfo->ScriptSpec());
   mRemoteWorkerData.baseScriptURL() = baseScriptURL;
   mRemoteWorkerData.resolvedScriptURL() = baseScriptURL;
   mRemoteWorkerData.name() = VoidString();
 
   mRemoteWorkerData.loadingPrincipalInfo() = principalInfo;
   mRemoteWorkerData.principalInfo() = principalInfo;
-  // storagePrincipalInfo for ServiceWorkers is equal to principalInfo because,
-  // at the moment, ServiceWorkers are not exposed in partitioned contexts.
-  mRemoteWorkerData.storagePrincipalInfo() = principalInfo;
+  // partitionedPrincipalInfo for ServiceWorkers is equal to principalInfo
+  // because, at the moment, ServiceWorkers are not exposed in partitioned
+  // contexts.
+  mRemoteWorkerData.partitionedPrincipalInfo() = principalInfo;
 
   rv = uri->GetHost(mRemoteWorkerData.domain());
   NS_ENSURE_SUCCESS(rv, rv);
   mRemoteWorkerData.isSecureContext() = true;
   mRemoteWorkerData.referrerInfo() = MakeAndAddRef<ReferrerInfo>();
   mRemoteWorkerData.storageAccess() = storageAccess;
   mRemoteWorkerData.serviceWorkerData() = std::move(serviceWorkerData);
 
--- a/dom/webidl/Document.webidl
+++ b/dom/webidl/Document.webidl
@@ -385,16 +385,23 @@ partial interface Document {
   // Wether the document was loaded using a nsXULPrototypeDocument.
   [ChromeOnly]
   readonly attribute boolean loadedFromPrototype;
 
   // The principal to use for the storage area of this document
   [ChromeOnly]
   readonly attribute Principal effectiveStoragePrincipal;
 
+  // You should probably not be using this principal getter since it performs
+  // no checks to ensure that the partitioned principal should really be used
+  // here.  It is only designed to be used in very specific circumstances, such
+  // as when inheriting the document/storage principal.
+  [ChromeOnly]
+  readonly attribute Principal partitionedPrincipal;
+
   // The principal to use for the content blocking allow list
   [ChromeOnly]
   readonly attribute Principal? contentBlockingAllowListPrincipal;
 
   // Touch bits
   // XXXbz I can't find the sane spec for this stuff, so just cribbing
   // from our xpidl for now.
   [NewObject, Func="nsGenericHTMLElement::LegacyTouchAPIEnabled"]
--- a/dom/workers/ScriptLoader.cpp
+++ b/dom/workers/ScriptLoader.cpp
@@ -1425,18 +1425,18 @@ class ScriptLoaderRunnable final : publi
       nsILoadGroup* loadGroup = mWorkerPrivate->GetLoadGroup();
       MOZ_DIAGNOSTIC_ASSERT(loadGroup);
 
       // Override the principal on the WorkerPrivate.  This is only necessary
       // in order to get a principal with exactly the correct URL.  The fetch
       // referrer logic depends on the WorkerPrivate principal having a URL
       // that matches the worker script URL.  If bug 1340694 is ever fixed
       // this can be removed.
-      // XXX: force the storagePrincipal to be equal to the response one. This
-      // is OK for now because we don't want to expose storagePrincipal
+      // XXX: force the partitionedPrincipal to be equal to the response one.
+      // This is OK for now because we don't want to expose partitionedPrincipal
       // functionality in ServiceWorkers yet.
       rv = mWorkerPrivate->SetPrincipalsAndCSPOnMainThread(
           responsePrincipal, responsePrincipal, loadGroup, nullptr);
       MOZ_DIAGNOSTIC_ASSERT(NS_SUCCEEDED(rv));
 
       rv = mWorkerPrivate->SetCSPFromHeaderValues(aCSPHeaderValue,
                                                   aCSPReportOnlyHeaderValue);
       MOZ_DIAGNOSTIC_ASSERT(NS_SUCCEEDED(rv));
--- a/dom/workers/WorkerLoadInfo.cpp
+++ b/dom/workers/WorkerLoadInfo.cpp
@@ -93,23 +93,23 @@ WorkerLoadInfoData::WorkerLoadInfoData()
       mPrincipalIsAddonOrExpandedAddon(false),
       mWatchedByDevTools(false),
       mStorageAccess(StorageAccess::eDeny),
       mFirstPartyStorageAccessGranted(false),
       mServiceWorkersTestingInWindow(false),
       mSecureContext(eNotSet) {}
 
 nsresult WorkerLoadInfo::SetPrincipalsAndCSPOnMainThread(
-    nsIPrincipal* aPrincipal, nsIPrincipal* aStoragePrincipal,
+    nsIPrincipal* aPrincipal, nsIPrincipal* aPartitionedPrincipal,
     nsILoadGroup* aLoadGroup, nsIContentSecurityPolicy* aCsp) {
   AssertIsOnMainThread();
   MOZ_ASSERT(NS_LoadGroupMatchesPrincipal(aLoadGroup, aPrincipal));
 
   mPrincipal = aPrincipal;
-  mStoragePrincipal = aStoragePrincipal;
+  mPartitionedPrincipal = aPartitionedPrincipal;
   mPrincipalIsSystem = aPrincipal->IsSystemPrincipal();
   mPrincipalIsAddonOrExpandedAddon =
       aPrincipal->GetIsAddonOrExpandedAddonPrincipal();
 
   mCSP = aCsp;
 
   if (mCSP) {
     mCSP->GetAllowsEval(&mReportCSPViolations, &mEvalAllowed);
@@ -121,79 +121,79 @@ nsresult WorkerLoadInfo::SetPrincipalsAn
   } else {
     mEvalAllowed = true;
     mReportCSPViolations = false;
   }
 
   mLoadGroup = aLoadGroup;
 
   mPrincipalInfo = MakeUnique<PrincipalInfo>();
-  mStoragePrincipalInfo = MakeUnique<PrincipalInfo>();
+  mPartitionedPrincipalInfo = MakeUnique<PrincipalInfo>();
   StoragePrincipalHelper::GetRegularPrincipalOriginAttributes(
       aLoadGroup, mOriginAttributes);
 
   nsresult rv = PrincipalToPrincipalInfo(aPrincipal, mPrincipalInfo.get());
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = nsContentUtils::GetUTFOrigin(aPrincipal, mOriginNoSuffix);
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = aPrincipal->GetOrigin(mOrigin);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  if (aPrincipal->Equals(aStoragePrincipal)) {
-    *mStoragePrincipalInfo = *mPrincipalInfo;
+  if (aPrincipal->Equals(aPartitionedPrincipal)) {
+    *mPartitionedPrincipalInfo = *mPrincipalInfo;
     mPartitionedOrigin = mOrigin;
   } else {
-    mStoragePrincipalInfo = MakeUnique<PrincipalInfo>();
-    rv = PrincipalToPrincipalInfo(aStoragePrincipal,
-                                  mStoragePrincipalInfo.get());
+    mPartitionedPrincipalInfo = MakeUnique<PrincipalInfo>();
+    rv = PrincipalToPrincipalInfo(aPartitionedPrincipal,
+                                  mPartitionedPrincipalInfo.get());
     NS_ENSURE_SUCCESS(rv, rv);
 
-    rv = aStoragePrincipal->GetOrigin(mPartitionedOrigin);
+    rv = aPartitionedPrincipal->GetOrigin(mPartitionedOrigin);
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   return NS_OK;
 }
 
 nsresult WorkerLoadInfo::GetPrincipalsAndLoadGroupFromChannel(
     nsIChannel* aChannel, nsIPrincipal** aPrincipalOut,
-    nsIPrincipal** aStoragePrincipalOut, nsILoadGroup** aLoadGroupOut) {
+    nsIPrincipal** aPartitionedPrincipalOut, nsILoadGroup** aLoadGroupOut) {
   AssertIsOnMainThread();
   MOZ_DIAGNOSTIC_ASSERT(aChannel);
   MOZ_DIAGNOSTIC_ASSERT(aPrincipalOut);
-  MOZ_DIAGNOSTIC_ASSERT(aStoragePrincipalOut);
+  MOZ_DIAGNOSTIC_ASSERT(aPartitionedPrincipalOut);
   MOZ_DIAGNOSTIC_ASSERT(aLoadGroupOut);
 
   // Initial triggering principal should be set
   NS_ENSURE_TRUE(mLoadingPrincipal, NS_ERROR_DOM_INVALID_STATE_ERR);
 
   nsIScriptSecurityManager* ssm = nsContentUtils::GetSecurityManager();
   MOZ_DIAGNOSTIC_ASSERT(ssm);
 
   nsCOMPtr<nsIPrincipal> channelPrincipal;
-  nsCOMPtr<nsIPrincipal> channelStoragePrincipal;
+  nsCOMPtr<nsIPrincipal> channelPartitionedPrincipal;
   nsresult rv = ssm->GetChannelResultPrincipals(
       aChannel, getter_AddRefs(channelPrincipal),
-      getter_AddRefs(channelStoragePrincipal));
+      getter_AddRefs(channelPartitionedPrincipal));
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Every time we call GetChannelResultPrincipal() it will return a different
   // null principal for a data URL.  We don't want to change the worker's
   // principal again, though.  Instead just keep the original null principal we
   // first got from the channel.
   //
   // Note, we don't do this by setting principalToInherit on the channel's
   // load info because we don't yet have the first null principal when we
   // create the channel.
   if (mPrincipal && mPrincipal->GetIsNullPrincipal() &&
       channelPrincipal->GetIsNullPrincipal()) {
     channelPrincipal = mPrincipal;
-    channelStoragePrincipal = mPrincipal;
+    channelPartitionedPrincipal = mPrincipal;
   }
 
   nsCOMPtr<nsILoadGroup> channelLoadGroup;
   rv = aChannel->GetLoadGroup(getter_AddRefs(channelLoadGroup));
   NS_ENSURE_SUCCESS(rv, rv);
   MOZ_ASSERT(channelLoadGroup);
 
   // If the loading principal is the system principal then the channel
@@ -216,64 +216,64 @@ nsresult WorkerLoadInfo::GetPrincipalsAn
       rv = NS_URIChainHasFlags(finalURI, nsIProtocolHandler::URI_IS_UI_RESOURCE,
                                &isResource);
       NS_ENSURE_SUCCESS(rv, rv);
 
       if (isResource) {
         // Assign the system principal to the resource:// worker only if it
         // was loaded from code using the system principal.
         channelPrincipal = mLoadingPrincipal;
-        channelStoragePrincipal = mLoadingPrincipal;
+        channelPartitionedPrincipal = mLoadingPrincipal;
       } else {
         return NS_ERROR_DOM_BAD_URI;
       }
     }
   }
 
   // The principal can change, but it should still match the original
   // load group's browser element flag.
   MOZ_ASSERT(NS_LoadGroupMatchesPrincipal(channelLoadGroup, channelPrincipal));
 
   channelPrincipal.forget(aPrincipalOut);
-  channelStoragePrincipal.forget(aStoragePrincipalOut);
+  channelPartitionedPrincipal.forget(aPartitionedPrincipalOut);
   channelLoadGroup.forget(aLoadGroupOut);
 
   return NS_OK;
 }
 
 nsresult WorkerLoadInfo::SetPrincipalsAndCSPFromChannel(nsIChannel* aChannel) {
   AssertIsOnMainThread();
 
   nsCOMPtr<nsIPrincipal> principal;
-  nsCOMPtr<nsIPrincipal> storagePrincipal;
+  nsCOMPtr<nsIPrincipal> partitionedPrincipal;
   nsCOMPtr<nsILoadGroup> loadGroup;
   nsresult rv = GetPrincipalsAndLoadGroupFromChannel(
-      aChannel, getter_AddRefs(principal), getter_AddRefs(storagePrincipal),
+      aChannel, getter_AddRefs(principal), getter_AddRefs(partitionedPrincipal),
       getter_AddRefs(loadGroup));
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Workers themselves can have their own CSP - Workers of an opaque origin
   // however inherit the CSP of the document that spawned the worker.
   nsCOMPtr<nsIContentSecurityPolicy> csp;
   if (CSP_ShouldResponseInheritCSP(aChannel)) {
     nsCOMPtr<nsILoadInfo> loadinfo = aChannel->LoadInfo();
     csp = loadinfo->GetCsp();
   }
-  return SetPrincipalsAndCSPOnMainThread(principal, storagePrincipal, loadGroup,
-                                         csp);
+  return SetPrincipalsAndCSPOnMainThread(principal, partitionedPrincipal,
+                                         loadGroup, csp);
 }
 
 bool WorkerLoadInfo::FinalChannelPrincipalIsValid(nsIChannel* aChannel) {
   AssertIsOnMainThread();
 
   nsCOMPtr<nsIPrincipal> principal;
-  nsCOMPtr<nsIPrincipal> storagePrincipal;
+  nsCOMPtr<nsIPrincipal> partitionedPrincipal;
   nsCOMPtr<nsILoadGroup> loadGroup;
   nsresult rv = GetPrincipalsAndLoadGroupFromChannel(
-      aChannel, getter_AddRefs(principal), getter_AddRefs(storagePrincipal),
+      aChannel, getter_AddRefs(principal), getter_AddRefs(partitionedPrincipal),
       getter_AddRefs(loadGroup));
   NS_ENSURE_SUCCESS(rv, false);
 
   // Verify that the channel is still a null principal.  We don't care
   // if these are the exact same null principal object, though.  From
   // the worker's perspective its the same effect.
   if (principal->GetIsNullPrincipal() && mPrincipal->GetIsNullPrincipal()) {
     return true;
@@ -288,19 +288,19 @@ bool WorkerLoadInfo::FinalChannelPrincip
   return false;
 }
 
 #ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
 bool WorkerLoadInfo::PrincipalIsValid() const {
   return mPrincipal && mPrincipalInfo &&
          mPrincipalInfo->type() != PrincipalInfo::T__None &&
          mPrincipalInfo->type() <= PrincipalInfo::T__Last &&
-         mStoragePrincipal && mStoragePrincipalInfo &&
-         mStoragePrincipalInfo->type() != PrincipalInfo::T__None &&
-         mStoragePrincipalInfo->type() <= PrincipalInfo::T__Last;
+         mPartitionedPrincipal && mPartitionedPrincipalInfo &&
+         mPartitionedPrincipalInfo->type() != PrincipalInfo::T__None &&
+         mPartitionedPrincipalInfo->type() <= PrincipalInfo::T__Last;
 }
 
 bool WorkerLoadInfo::PrincipalURIMatchesScriptURL() {
   AssertIsOnMainThread();
 
   nsAutoCString scheme;
   nsresult rv = mBaseURI->GetScheme(scheme);
   NS_ENSURE_SUCCESS(rv, false);
@@ -370,17 +370,17 @@ bool WorkerLoadInfo::ProxyReleaseMainThr
   static const uint32_t kDoomedCount = 11;
   nsTArray<nsCOMPtr<nsISupports>> doomed(kDoomedCount);
 
   SwapToISupportsArray(mWindow, doomed);
   SwapToISupportsArray(mScriptContext, doomed);
   SwapToISupportsArray(mBaseURI, doomed);
   SwapToISupportsArray(mResolvedScriptURI, doomed);
   SwapToISupportsArray(mPrincipal, doomed);
-  SwapToISupportsArray(mStoragePrincipal, doomed);
+  SwapToISupportsArray(mPartitionedPrincipal, doomed);
   SwapToISupportsArray(mLoadingPrincipal, doomed);
   SwapToISupportsArray(mChannel, doomed);
   SwapToISupportsArray(mCSP, doomed);
   SwapToISupportsArray(mLoadGroup, doomed);
   SwapToISupportsArray(mInterfaceRequestor, doomed);
   // Before adding anything here update kDoomedCount above!
 
   MOZ_ASSERT(doomed.Length() == kDoomedCount);
--- a/dom/workers/WorkerLoadInfo.h
+++ b/dom/workers/WorkerLoadInfo.h
@@ -47,17 +47,17 @@ struct WorkerLoadInfoData {
   nsCOMPtr<nsIURI> mResolvedScriptURI;
 
   // This is the principal of the global (parent worker or a window) loading
   // the worker. It can be null if we are executing a ServiceWorker, otherwise,
   // except for data: URL, it must subsumes the worker principal.
   // If we load a data: URL, mPrincipal will be a null principal.
   nsCOMPtr<nsIPrincipal> mLoadingPrincipal;
   nsCOMPtr<nsIPrincipal> mPrincipal;
-  nsCOMPtr<nsIPrincipal> mStoragePrincipal;
+  nsCOMPtr<nsIPrincipal> mPartitionedPrincipal;
 
   // Taken from the parent context.
   nsCOMPtr<nsICookieJarSettings> mCookieJarSettings;
 
   nsCOMPtr<nsIScriptContext> mScriptContext;
   nsCOMPtr<nsPIDOMWindowInner> mWindow;
   nsCOMPtr<nsIContentSecurityPolicy> mCSP;
   // Thread boundaries require us to not only store a CSP object, but also a
@@ -97,17 +97,17 @@ struct WorkerLoadInfoData {
     // called.
     nsTArray<nsWeakPtr> mBrowserChildList;
   };
 
   // Only set if we have a custom overriden load group
   RefPtr<InterfaceRequestor> mInterfaceRequestor;
 
   UniquePtr<mozilla::ipc::PrincipalInfo> mPrincipalInfo;
-  UniquePtr<mozilla::ipc::PrincipalInfo> mStoragePrincipalInfo;
+  UniquePtr<mozilla::ipc::PrincipalInfo> mPartitionedPrincipalInfo;
   nsCString mDomain;
   nsString mOriginNoSuffix;  // Derived from mPrincipal; can be used on worker
                              // thread.
   nsCString mOrigin;  // Derived from mPrincipal; can be used on worker thread.
   nsCString mPartitionedOrigin;  // Derived from mPartitionedPrincipal; can be
                                  // used on worker thread.
 
   nsString mServiceWorkerCacheName;
@@ -152,23 +152,23 @@ struct WorkerLoadInfoData {
 struct WorkerLoadInfo : WorkerLoadInfoData {
   WorkerLoadInfo();
   WorkerLoadInfo(WorkerLoadInfo&& aOther) noexcept;
   ~WorkerLoadInfo();
 
   WorkerLoadInfo& operator=(WorkerLoadInfo&& aOther) = default;
 
   nsresult SetPrincipalsAndCSPOnMainThread(nsIPrincipal* aPrincipal,
-                                           nsIPrincipal* aStoragePrincipal,
+                                           nsIPrincipal* aPartitionedPrincipal,
                                            nsILoadGroup* aLoadGroup,
                                            nsIContentSecurityPolicy* aCSP);
 
   nsresult GetPrincipalsAndLoadGroupFromChannel(
       nsIChannel* aChannel, nsIPrincipal** aPrincipalOut,
-      nsIPrincipal** aStoragePrincipalOut, nsILoadGroup** aLoadGroupOut);
+      nsIPrincipal** aPartitionedPrincipalOut, nsILoadGroup** aLoadGroupOut);
 
   nsresult SetPrincipalsAndCSPFromChannel(nsIChannel* aChannel);
 
   bool FinalChannelPrincipalIsValid(nsIChannel* aChannel);
 
 #ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
   bool PrincipalIsValid() const;
 
--- a/dom/workers/WorkerPrivate.cpp
+++ b/dom/workers/WorkerPrivate.cpp
@@ -2023,20 +2023,20 @@ void WorkerPrivate::SetBaseURI(nsIURI* a
   } else {
     mLocationInfo.mHost.Assign(mLocationInfo.mHostname);
   }
 
   nsContentUtils::GetUTFOrigin(aBaseURI, mLocationInfo.mOrigin);
 }
 
 nsresult WorkerPrivate::SetPrincipalsAndCSPOnMainThread(
-    nsIPrincipal* aPrincipal, nsIPrincipal* aStoragePrincipal,
+    nsIPrincipal* aPrincipal, nsIPrincipal* aPartitionedPrincipal,
     nsILoadGroup* aLoadGroup, nsIContentSecurityPolicy* aCsp) {
   return mLoadInfo.SetPrincipalsAndCSPOnMainThread(
-      aPrincipal, aStoragePrincipal, aLoadGroup, aCsp);
+      aPrincipal, aPartitionedPrincipal, aLoadGroup, aCsp);
 }
 
 nsresult WorkerPrivate::SetPrincipalsAndCSPFromChannel(nsIChannel* aChannel) {
   return mLoadInfo.SetPrincipalsAndCSPFromChannel(aChannel);
 }
 
 bool WorkerPrivate::FinalChannelPrincipalIsValid(nsIChannel* aChannel) {
   return mLoadInfo.FinalChannelPrincipalIsValid(aChannel);
@@ -5328,16 +5328,33 @@ void WorkerPrivate::EnsureOwnerEmbedderP
   if (GetParent()) {
     mOwnerEmbedderPolicy.emplace(GetParent()->GetEmbedderPolicy());
   } else if (GetWindow() && GetWindow()->GetWindowContext()) {
     mOwnerEmbedderPolicy.emplace(
         GetWindow()->GetWindowContext()->GetEmbedderPolicy());
   }
 }
 
+const mozilla::ipc::PrincipalInfo&
+WorkerPrivate::GetEffectiveStoragePrincipalInfo() const {
+  AssertIsOnWorkerThread();
+
+  if (mLoadInfo.mFirstPartyStorageAccessGranted) {
+    return *mLoadInfo.mPrincipalInfo;
+  }
+
+  // TODO: this is wrong and it will be fixed by the next patch.
+  return *mLoadInfo.mPartitionedPrincipalInfo;
+}
+
+const nsACString& WorkerPrivate::StoragePrincipalOrigin() const {
+  // TODO: this is wrong and it will be fixed by the next patch.
+  return mLoadInfo.mPartitionedOrigin;
+}
+
 NS_IMPL_ADDREF(WorkerPrivate::EventTarget)
 NS_IMPL_RELEASE(WorkerPrivate::EventTarget)
 
 NS_INTERFACE_MAP_BEGIN(WorkerPrivate::EventTarget)
   NS_INTERFACE_MAP_ENTRY(nsISerialEventTarget)
   NS_INTERFACE_MAP_ENTRY(nsIEventTarget)
   NS_INTERFACE_MAP_ENTRY(nsISupports)
 #ifdef DEBUG
--- a/dom/workers/WorkerPrivate.h
+++ b/dom/workers/WorkerPrivate.h
@@ -689,30 +689,27 @@ class WorkerPrivate : public RelativeTim
     mLoadInfo.mChannelInfo = aChannelInfo;
   }
 
   nsIPrincipal* GetPrincipal() const {
     AssertIsOnMainThread();
     return mLoadInfo.mPrincipal;
   }
 
-  nsIPrincipal* GetEffectiveStoragePrincipal() const {
-    AssertIsOnMainThread();
-    return mLoadInfo.mStoragePrincipal;
-  }
-
   nsIPrincipal* GetLoadingPrincipal() const {
     AssertIsOnMainThread();
     return mLoadInfo.mLoadingPrincipal;
   }
 
   const nsAString& OriginNoSuffix() const { return mLoadInfo.mOriginNoSuffix; }
 
   const nsACString& Origin() const { return mLoadInfo.mOrigin; }
 
+  const nsACString& StoragePrincipalOrigin() const;
+
   const nsACString& PartitionedOrigin() const {
     return mLoadInfo.mPartitionedOrigin;
   }
 
   nsILoadGroup* GetLoadGroup() const {
     AssertIsOnMainThread();
     return mLoadInfo.mLoadGroup;
   }
@@ -721,19 +718,17 @@ class WorkerPrivate : public RelativeTim
   bool UsesAddonOrExpandedAddonPrincipal() const {
     return mLoadInfo.mPrincipalIsAddonOrExpandedAddon;
   }
 
   const mozilla::ipc::PrincipalInfo& GetPrincipalInfo() const {
     return *mLoadInfo.mPrincipalInfo;
   }
 
-  const mozilla::ipc::PrincipalInfo& GetEffectiveStoragePrincipalInfo() const {
-    return *mLoadInfo.mStoragePrincipalInfo;
-  }
+  const mozilla::ipc::PrincipalInfo& GetEffectiveStoragePrincipalInfo() const;
 
   already_AddRefed<nsIChannel> ForgetWorkerChannel() {
     AssertIsOnMainThread();
     return mLoadInfo.mChannel.forget();
   }
 
   nsPIDOMWindowInner* GetWindow() const {
     AssertIsOnMainThread();
@@ -858,17 +853,17 @@ class WorkerPrivate : public RelativeTim
 
   void SetLowMemoryState(bool aState);
 
   void GarbageCollect(bool aShrinking);
 
   void CycleCollect(bool aDummy);
 
   nsresult SetPrincipalsAndCSPOnMainThread(nsIPrincipal* aPrincipal,
-                                           nsIPrincipal* aStoragePrincipal,
+                                           nsIPrincipal* aPartitionedPrincipal,
                                            nsILoadGroup* aLoadGroup,
                                            nsIContentSecurityPolicy* aCsp);
 
   nsresult SetPrincipalsAndCSPFromChannel(nsIChannel* aChannel);
 
   bool FinalChannelPrincipalIsValid(nsIChannel* aChannel);
 
 #ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
--- a/dom/workers/remoteworkers/RemoteWorkerChild.cpp
+++ b/dom/workers/remoteworkers/RemoteWorkerChild.cpp
@@ -320,34 +320,34 @@ nsresult RemoteWorkerChild::ExecWorkerOn
   nsCOMPtr<nsIPrincipal> principal = principalOrErr.unwrap();
 
   auto loadingPrincipalOrErr =
       PrincipalInfoToPrincipal(aData.loadingPrincipalInfo());
   if (NS_WARN_IF(loadingPrincipalOrErr.isErr())) {
     return loadingPrincipalOrErr.unwrapErr();
   }
 
-  auto storagePrincipalOrErr =
-      PrincipalInfoToPrincipal(aData.storagePrincipalInfo());
-  if (NS_WARN_IF(storagePrincipalOrErr.isErr())) {
-    return storagePrincipalOrErr.unwrapErr();
+  auto partitionedPrincipalOrErr =
+      PrincipalInfoToPrincipal(aData.partitionedPrincipalInfo());
+  if (NS_WARN_IF(partitionedPrincipalOrErr.isErr())) {
+    return partitionedPrincipalOrErr.unwrapErr();
   }
 
   WorkerLoadInfo info;
   info.mBaseURI = DeserializeURI(aData.baseScriptURL());
   info.mResolvedScriptURI = DeserializeURI(aData.resolvedScriptURL());
 
   info.mPrincipalInfo = MakeUnique<PrincipalInfo>(aData.principalInfo());
-  info.mStoragePrincipalInfo =
-      MakeUnique<PrincipalInfo>(aData.storagePrincipalInfo());
+  info.mPartitionedPrincipalInfo =
+      MakeUnique<PrincipalInfo>(aData.partitionedPrincipalInfo());
 
   info.mReferrerInfo = aData.referrerInfo();
   info.mDomain = aData.domain();
   info.mPrincipal = principal;
-  info.mStoragePrincipal = storagePrincipalOrErr.unwrap();
+  info.mPartitionedPrincipal = partitionedPrincipalOrErr.unwrap();
   info.mLoadingPrincipal = loadingPrincipalOrErr.unwrap();
   info.mStorageAccess = aData.storageAccess();
   info.mOriginAttributes =
       BasePrincipal::Cast(principal)->OriginAttributesRef();
   info.mCookieJarSettings = net::CookieJarSettings::Create();
 
   // Default CSP permissions for now.  These will be overrided if necessary
   // based on the script CSP headers during load in ScriptLoader.
@@ -378,17 +378,17 @@ nsresult RemoteWorkerChild::ExecWorkerOn
       rv = CSPToCSPInfo(info.mCSP, info.mCSPInfo.get());
       if (NS_WARN_IF(NS_FAILED(rv))) {
         return rv;
       }
     }
   }
 
   rv = info.SetPrincipalsAndCSPOnMainThread(
-      info.mPrincipal, info.mStoragePrincipal, info.mLoadGroup, info.mCSP);
+      info.mPrincipal, info.mPartitionedPrincipal, info.mLoadGroup, info.mCSP);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   nsString workerPrivateId = EmptyString();
 
   if (mIsServiceWorker) {
     ServiceWorkerData& data = aData.serviceWorkerData().get_ServiceWorkerData();
--- a/dom/workers/remoteworkers/RemoteWorkerTypes.ipdlh
+++ b/dom/workers/remoteworkers/RemoteWorkerTypes.ipdlh
@@ -44,17 +44,17 @@ struct RemoteWorkerData
   // blob URL if it takes too long to do the round trip.
   URIParams baseScriptURL;
   URIParams resolvedScriptURL;
 
   nsString name;
 
   PrincipalInfo loadingPrincipalInfo;
   PrincipalInfo principalInfo;
-  PrincipalInfo storagePrincipalInfo;
+  PrincipalInfo partitionedPrincipalInfo;
 
   nsCString domain;
 
   bool isSecureContext;
 
   IPCClientInfo? clientInfo;
 
   nsIReferrerInfo referrerInfo;
--- a/dom/workers/sharedworkers/SharedWorker.cpp
+++ b/dom/workers/sharedworkers/SharedWorker.cpp
@@ -116,53 +116,53 @@ already_AddRefed<SharedWorker> SharedWor
 
   PrincipalInfo loadingPrincipalInfo;
   aRv = PrincipalToPrincipalInfo(loadInfo.mLoadingPrincipal,
                                  &loadingPrincipalInfo);
   if (NS_WARN_IF(aRv.Failed())) {
     return nullptr;
   }
 
-  // Here, the StoragePrincipal is always equal to the SharedWorker's principal
-  // because the channel is not opened yet, and, because of this, it's not
-  // classified. We need to force the correct originAttributes.
+  // Here, the PartitionedPrincipal is always equal to the SharedWorker's
+  // principal because the channel is not opened yet, and, because of this, it's
+  // not classified. We need to force the correct originAttributes.
   if (ShouldPartitionStorage(storageAllowed)) {
     nsCOMPtr<nsIScriptObjectPrincipal> sop = do_QueryInterface(window);
     if (!sop) {
       aRv.Throw(NS_ERROR_FAILURE);
       return nullptr;
     }
 
     nsIPrincipal* windowPrincipal = sop->GetPrincipal();
     if (!windowPrincipal) {
       aRv.Throw(NS_ERROR_UNEXPECTED);
       return nullptr;
     }
 
-    nsIPrincipal* windowStoragePrincipal = sop->GetEffectiveStoragePrincipal();
-    if (!windowStoragePrincipal) {
+    nsIPrincipal* windowPartitionedPrincipal = sop->PartitionedPrincipal();
+    if (!windowPartitionedPrincipal) {
       aRv.Throw(NS_ERROR_UNEXPECTED);
       return nullptr;
     }
 
-    if (!windowPrincipal->Equals(windowStoragePrincipal)) {
-      loadInfo.mStoragePrincipal =
+    if (!windowPrincipal->Equals(windowPartitionedPrincipal)) {
+      loadInfo.mPartitionedPrincipal =
           BasePrincipal::Cast(loadInfo.mPrincipal)
               ->CloneForcingOriginAttributes(
-                  BasePrincipal::Cast(windowStoragePrincipal)
+                  BasePrincipal::Cast(windowPartitionedPrincipal)
                       ->OriginAttributesRef());
     }
   }
 
-  PrincipalInfo storagePrincipalInfo;
-  if (loadInfo.mPrincipal->Equals(loadInfo.mStoragePrincipal)) {
-    storagePrincipalInfo = principalInfo;
+  PrincipalInfo partitionedPrincipalInfo;
+  if (loadInfo.mPrincipal->Equals(loadInfo.mPartitionedPrincipal)) {
+    partitionedPrincipalInfo = principalInfo;
   } else {
-    aRv = PrincipalToPrincipalInfo(loadInfo.mStoragePrincipal,
-                                   &storagePrincipalInfo);
+    aRv = PrincipalToPrincipalInfo(loadInfo.mPartitionedPrincipal,
+                                   &partitionedPrincipalInfo);
     if (NS_WARN_IF(aRv.Failed())) {
       return nullptr;
     }
   }
 
   // We don't actually care about this MessageChannel, but we use it to 'steal'
   // its 2 connected ports.
   nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(window);
@@ -190,17 +190,17 @@ already_AddRefed<SharedWorker> SharedWor
   if (clientInfo.isSome()) {
     ipcClientInfo.emplace(clientInfo.value().ToIPC());
   }
 
   nsID agentClusterId = nsContentUtils::GenerateUUID();
 
   RemoteWorkerData remoteWorkerData(
       nsString(aScriptURL), baseURL, resolvedScriptURL, name,
-      loadingPrincipalInfo, principalInfo, storagePrincipalInfo,
+      loadingPrincipalInfo, principalInfo, partitionedPrincipalInfo,
       loadInfo.mDomain, isSecureContext, ipcClientInfo, loadInfo.mReferrerInfo,
       storageAllowed, void_t() /* OptionalServiceWorkerData */, agentClusterId);
 
   PSharedWorkerChild* pActor = actorChild->SendPSharedWorkerConstructor(
       remoteWorkerData, loadInfo.mWindowID, portIdentifier.release());
 
   RefPtr<SharedWorkerChild> actor = static_cast<SharedWorkerChild*>(pActor);
   MOZ_ASSERT(actor);
--- a/dom/workers/sharedworkers/SharedWorkerManager.cpp
+++ b/dom/workers/sharedworkers/SharedWorkerManager.cpp
@@ -17,36 +17,36 @@
 
 namespace mozilla {
 namespace dom {
 
 // static
 already_AddRefed<SharedWorkerManagerHolder> SharedWorkerManager::Create(
     SharedWorkerService* aService, nsIEventTarget* aPBackgroundEventTarget,
     const RemoteWorkerData& aData, nsIPrincipal* aLoadingPrincipal,
-    const OriginAttributes& aStoragePrincipalAttrs) {
+    const OriginAttributes& aPartitionedPrincipalAttrs) {
   MOZ_ASSERT(NS_IsMainThread());
 
   RefPtr<SharedWorkerManager> manager =
       new SharedWorkerManager(aPBackgroundEventTarget, aData, aLoadingPrincipal,
-                              aStoragePrincipalAttrs);
+                              aPartitionedPrincipalAttrs);
 
   RefPtr<SharedWorkerManagerHolder> holder =
       new SharedWorkerManagerHolder(manager, aService);
   return holder.forget();
 }
 
 SharedWorkerManager::SharedWorkerManager(
     nsIEventTarget* aPBackgroundEventTarget, const RemoteWorkerData& aData,
     nsIPrincipal* aLoadingPrincipal,
-    const OriginAttributes& aStoragePrincipalAttrs)
+    const OriginAttributes& aPartitionedPrincipalAttrs)
     : mPBackgroundEventTarget(aPBackgroundEventTarget),
       mLoadingPrincipal(aLoadingPrincipal),
       mDomain(aData.domain()),
-      mStoragePrincipalAttrs(aStoragePrincipalAttrs),
+      mPartitionedPrincipalAttrs(aPartitionedPrincipalAttrs),
       mResolvedScriptURL(DeserializeURI(aData.resolvedScriptURL())),
       mName(aData.name()),
       mIsSecureContext(aData.isSecureContext()),
       mSuspended(false),
       mFrozen(false) {
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(aLoadingPrincipal);
 }
@@ -78,30 +78,30 @@ bool SharedWorkerManager::MaybeCreateRem
   mRemoteWorkerController->AddPortIdentifier(aPortIdentifier.release());
   return true;
 }
 
 already_AddRefed<SharedWorkerManagerHolder>
 SharedWorkerManager::MatchOnMainThread(
     SharedWorkerService* aService, const nsACString& aDomain,
     nsIURI* aScriptURL, const nsAString& aName, nsIPrincipal* aLoadingPrincipal,
-    const OriginAttributes& aStoragePrincipalAttrs) {
+    const OriginAttributes& aPartitionedPrincipalAttrs) {
   MOZ_ASSERT(NS_IsMainThread());
 
   bool urlEquals;
   if (NS_FAILED(aScriptURL->Equals(mResolvedScriptURL, &urlEquals))) {
     return nullptr;
   }
 
   bool match = aDomain == mDomain && urlEquals && aName == mName &&
                // We want to be sure that the window's principal subsumes the
                // SharedWorker's loading principal and vice versa.
                mLoadingPrincipal->Subsumes(aLoadingPrincipal) &&
                aLoadingPrincipal->Subsumes(mLoadingPrincipal) &&
-               mStoragePrincipalAttrs == aStoragePrincipalAttrs;
+               mPartitionedPrincipalAttrs == aPartitionedPrincipalAttrs;
   if (!match) {
     return nullptr;
   }
 
   RefPtr<SharedWorkerManagerHolder> holder =
       new SharedWorkerManagerHolder(this, aService);
   return holder.forget();
 }
--- a/dom/workers/sharedworkers/SharedWorkerManager.h
+++ b/dom/workers/sharedworkers/SharedWorkerManager.h
@@ -65,25 +65,25 @@ class SharedWorkerManager final : public
  public:
   NS_INLINE_DECL_THREADSAFE_REFCOUNTING(SharedWorkerManager, override);
 
   // Called on main-thread thread methods
 
   static already_AddRefed<SharedWorkerManagerHolder> Create(
       SharedWorkerService* aService, nsIEventTarget* aPBackgroundEventTarget,
       const RemoteWorkerData& aData, nsIPrincipal* aLoadingPrincipal,
-      const OriginAttributes& aStoragePrincipalAttrs);
+      const OriginAttributes& aPartitionedPrincipalAttrs);
 
   // Returns a holder if this manager matches. The holder blocks the shutdown of
   // the manager.
   already_AddRefed<SharedWorkerManagerHolder> MatchOnMainThread(
       SharedWorkerService* aService, const nsACString& aDomain,
       nsIURI* aScriptURL, const nsAString& aName,
       nsIPrincipal* aLoadingPrincipal,
-      const OriginAttributes& aStoragePrincipalAttrs);
+      const OriginAttributes& aPartitionedPrincipalAttrs);
 
   // RemoteWorkerObserver
 
   void CreationFailed() override;
 
   void CreationSucceeded() override;
 
   void ErrorReceived(const ErrorValue& aValue) override;
@@ -114,25 +114,25 @@ class SharedWorkerManager final : public
   void RegisterHolder(SharedWorkerManagerHolder* aHolder);
 
   void UnregisterHolder(SharedWorkerManagerHolder* aHolder);
 
  private:
   SharedWorkerManager(nsIEventTarget* aPBackgroundEventTarget,
                       const RemoteWorkerData& aData,
                       nsIPrincipal* aLoadingPrincipal,
-                      const OriginAttributes& aStoragePrincipalAttrs);
+                      const OriginAttributes& aPartitionedPrincipalAttrs);
 
   ~SharedWorkerManager();
 
   nsCOMPtr<nsIEventTarget> mPBackgroundEventTarget;
 
   nsCOMPtr<nsIPrincipal> mLoadingPrincipal;
   const nsCString mDomain;
-  const OriginAttributes mStoragePrincipalAttrs;
+  const OriginAttributes mPartitionedPrincipalAttrs;
   const nsCOMPtr<nsIURI> mResolvedScriptURL;
   const nsString mName;
   const bool mIsSecureContext;
   bool mSuspended;
   bool mFrozen;
 
   // Raw pointers because SharedWorkerParent unregisters itself in
   // ActorDestroy().
--- a/dom/workers/sharedworkers/SharedWorkerService.cpp
+++ b/dom/workers/sharedworkers/SharedWorkerService.cpp
@@ -161,54 +161,55 @@ void SharedWorkerService::GetOrCreateWor
 void SharedWorkerService::GetOrCreateWorkerManagerOnMainThread(
     nsIEventTarget* aBackgroundEventTarget, SharedWorkerParent* aActor,
     const RemoteWorkerData& aData, uint64_t aWindowID,
     UniqueMessagePortId& aPortIdentifier) {
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(aBackgroundEventTarget);
   MOZ_ASSERT(aActor);
 
-  auto storagePrincipalOrErr =
-      PrincipalInfoToPrincipal(aData.storagePrincipalInfo());
-  if (NS_WARN_IF(storagePrincipalOrErr.isErr())) {
+  auto partitionedPrincipalOrErr =
+      PrincipalInfoToPrincipal(aData.partitionedPrincipalInfo());
+  if (NS_WARN_IF(partitionedPrincipalOrErr.isErr())) {
     ErrorPropagationOnMainThread(aBackgroundEventTarget, aActor,
-                                 storagePrincipalOrErr.unwrapErr());
+                                 partitionedPrincipalOrErr.unwrapErr());
     return;
   }
 
   auto loadingPrincipalOrErr =
       PrincipalInfoToPrincipal(aData.loadingPrincipalInfo());
   if (NS_WARN_IF(loadingPrincipalOrErr.isErr())) {
     ErrorPropagationOnMainThread(aBackgroundEventTarget, aActor,
                                  loadingPrincipalOrErr.unwrapErr());
     return;
   }
 
   RefPtr<SharedWorkerManagerHolder> managerHolder;
 
   nsCOMPtr<nsIPrincipal> loadingPrincipal = loadingPrincipalOrErr.unwrap();
-  nsCOMPtr<nsIPrincipal> storagePrincipal = storagePrincipalOrErr.unwrap();
+  nsCOMPtr<nsIPrincipal> partitionedPrincipal =
+      partitionedPrincipalOrErr.unwrap();
 
   // Let's see if there is already a SharedWorker to share.
   nsCOMPtr<nsIURI> resolvedScriptURL =
       DeserializeURI(aData.resolvedScriptURL());
   for (SharedWorkerManager* workerManager : mWorkerManagers) {
     managerHolder = workerManager->MatchOnMainThread(
         this, aData.domain(), resolvedScriptURL, aData.name(), loadingPrincipal,
-        BasePrincipal::Cast(storagePrincipal)->OriginAttributesRef());
+        BasePrincipal::Cast(partitionedPrincipal)->OriginAttributesRef());
     if (managerHolder) {
       break;
     }
   }
 
   // Let's create a new one.
   if (!managerHolder) {
     managerHolder = SharedWorkerManager::Create(
         this, aBackgroundEventTarget, aData, loadingPrincipal,
-        BasePrincipal::Cast(storagePrincipal)->OriginAttributesRef());
+        BasePrincipal::Cast(partitionedPrincipal)->OriginAttributesRef());
 
     mWorkerManagers.AppendElement(managerHolder->Manager());
   } else {
     // We are attaching the actor to an existing one.
     if (managerHolder->Manager()->IsSecureContext() !=
         aData.isSecureContext()) {
       ErrorPropagationOnMainThread(aBackgroundEventTarget, aActor,
                                    NS_ERROR_DOM_SECURITY_ERR);
--- a/dom/xml/XMLDocument.cpp
+++ b/dom/xml/XMLDocument.cpp
@@ -211,24 +211,24 @@ nsresult XMLDocument::Init() {
 }
 
 void XMLDocument::Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup) {
   Document::Reset(aChannel, aLoadGroup);
 }
 
 void XMLDocument::ResetToURI(nsIURI* aURI, nsILoadGroup* aLoadGroup,
                              nsIPrincipal* aPrincipal,
-                             nsIPrincipal* aStoragePrincipal) {
+                             nsIPrincipal* aPartitionedPrincipal) {
   if (mChannelIsPending) {
     StopDocumentLoad();
     mChannel->Cancel(NS_BINDING_ABORTED);
     mChannelIsPending = false;
   }
 
-  Document::ResetToURI(aURI, aLoadGroup, aPrincipal, aStoragePrincipal);
+  Document::ResetToURI(aURI, aLoadGroup, aPrincipal, aPartitionedPrincipal);
 }
 
 void XMLDocument::SetSuppressParserErrorElement(bool aSuppress) {
   mSuppressParserErrorElement = aSuppress;
 }
 
 bool XMLDocument::SuppressParserErrorElement() {
   return mSuppressParserErrorElement;
--- a/dom/xml/XMLDocument.h
+++ b/dom/xml/XMLDocument.h
@@ -22,17 +22,17 @@ class XMLDocument : public Document {
  public:
   explicit XMLDocument(const char* aContentType = "application/xml");
 
   NS_INLINE_DECL_REFCOUNTING_INHERITED(XMLDocument, Document)
 
   virtual void Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup) override;
   virtual void ResetToURI(nsIURI* aURI, nsILoadGroup* aLoadGroup,
                           nsIPrincipal* aPrincipal,
-                          nsIPrincipal* aStoragePrincipal) override;
+                          nsIPrincipal* aPartitionedPrincipal) override;
 
   virtual void SetSuppressParserErrorElement(bool aSuppress) override;
   virtual bool SuppressParserErrorElement() override;
 
   virtual void SetSuppressParserErrorConsoleMessages(bool aSuppress) override;
   virtual bool SuppressParserErrorConsoleMessages() override;
 
   virtual nsresult StartDocumentLoad(const char* aCommand, nsIChannel* channel,
--- a/dom/xslt/base/txURIUtils.cpp
+++ b/dom/xslt/base/txURIUtils.cpp
@@ -41,17 +41,17 @@ void URIUtils::resolveHref(const nsAStri
     dest.Append(resultHref);
   }
 }  //-- resolveHref
 
 // static
 void URIUtils::ResetWithSource(Document* aNewDoc, nsINode* aSourceNode) {
   nsCOMPtr<Document> sourceDoc = aSourceNode->OwnerDoc();
   nsIPrincipal* sourcePrincipal = sourceDoc->NodePrincipal();
-  nsIPrincipal* sourceStoragePrincipal = sourceDoc->EffectiveStoragePrincipal();
+  nsIPrincipal* sourcePartitionedPrincipal = sourceDoc->PartitionedPrincipal();
 
   // Copy the channel and loadgroup from the source document.
   nsCOMPtr<nsILoadGroup> loadGroup = sourceDoc->GetDocumentLoadGroup();
   nsCOMPtr<nsIChannel> channel = sourceDoc->GetChannel();
   if (!channel) {
     // Need to synthesize one
     nsresult rv = NS_NewChannel(
         getter_AddRefs(channel), sourceDoc->GetDocumentURI(), sourceDoc,
@@ -62,17 +62,17 @@ void URIUtils::ResetWithSource(Document*
         nsIChannel::LOAD_BYPASS_SERVICE_WORKER);
 
     if (NS_FAILED(rv)) {
       return;
     }
   }
 
   aNewDoc->Reset(channel, loadGroup);
-  aNewDoc->SetPrincipals(sourcePrincipal, sourceStoragePrincipal);
+  aNewDoc->SetPrincipals(sourcePrincipal, sourcePartitionedPrincipal);
   aNewDoc->SetBaseURI(sourceDoc->GetDocBaseURI());
 
   // Inherit the csp if there is one
   nsCOMPtr<nsIContentSecurityPolicy> csp = sourceDoc->GetCsp();
   if (csp) {
     RefPtr<nsCSPContext> cspToInherit = new nsCSPContext();
     cspToInherit->InitFromOther(static_cast<nsCSPContext*>(csp.get()));
     aNewDoc->SetCsp(cspToInherit);
--- a/image/ImageCacheKey.h
+++ b/image/ImageCacheKey.h
@@ -59,18 +59,18 @@ class ImageCacheKey final {
   void* ControlledDocument() const { return mControlledDocument; }
 
  private:
   // For ServiceWorker we need to use the document as
   // token for the key. All those exceptions are handled by this method.
   static void* GetSpecialCaseDocumentToken(dom::Document* aDocument);
 
   // For anti-tracking we need to use an isolation key. It can be the suffix of
-  // the IntrinsicStoragePrincipal (see StoragePrincipalHelper.h) or the
-  // top-level document's base domain. This is handled by this method.
+  // the PatitionedPrincipal (see StoragePrincipalHelper.h) or the top-level
+  // document's base domain. This is handled by this method.
   static nsCString GetIsolationKey(dom::Document* aDocument, nsIURI* aURI);
 
   void EnsureHash() const;
   void EnsureBlobRef() const;
 
   nsCOMPtr<nsIURI> mURI;
   Maybe<uint64_t> mBlobSerial;
   mutable nsCString mBlobRef;
--- a/js/xpconnect/src/BackstagePass.h
+++ b/js/xpconnect/src/BackstagePass.h
@@ -30,19 +30,17 @@ class BackstagePass : public nsIGlobalOb
   NS_DECL_NSICLASSINFO
 
   virtual nsIPrincipal* GetPrincipal() override { return mPrincipal; }
 
   virtual nsIPrincipal* GetEffectiveStoragePrincipal() override {
     return mPrincipal;
   }
 
-  virtual nsIPrincipal* IntrinsicStoragePrincipal() override {
-    return mPrincipal;
-  }
+  virtual nsIPrincipal* PartitionedPrincipal() override { return mPrincipal; }
 
   JSObject* GetGlobalJSObject() override;
   JSObject* GetGlobalJSObjectPreserveColor() const override;
 
   void ForgetGlobalObject() { mWrapper = nullptr; }
 
   void SetGlobalObject(JSObject* global);
 
--- a/js/xpconnect/src/SandboxPrivate.h
+++ b/js/xpconnect/src/SandboxPrivate.h
@@ -41,17 +41,17 @@ class SandboxPrivate : public nsIGlobalO
     return static_cast<SandboxPrivate*>(
         static_cast<nsIScriptObjectPrincipal*>(JS_GetPrivate(obj)));
   }
 
   nsIPrincipal* GetPrincipal() override { return mPrincipal; }
 
   nsIPrincipal* GetEffectiveStoragePrincipal() override { return mPrincipal; }
 
-  nsIPrincipal* IntrinsicStoragePrincipal() override { return mPrincipal; }
+  nsIPrincipal* PartitionedPrincipal() override { return mPrincipal; }
 
   JSObject* GetGlobalJSObject() override { return GetWrapper(); }
   JSObject* GetGlobalJSObjectPreserveColor() const override {
     return GetWrapperPreserveColor();
   }
 
   void ForgetGlobalObject(JSObject* obj) { ClearWrapper(obj); }
 
--- a/layout/build/nsContentDLF.cpp
+++ b/layout/build/nsContentDLF.cpp
@@ -221,32 +221,32 @@ nsContentDLF::CreateInstanceForDocument(
   contentViewer->LoadStart(aDocument);
   contentViewer.forget(aContentViewer);
   return NS_OK;
 }
 
 /* static */
 already_AddRefed<Document> nsContentDLF::CreateBlankDocument(
     nsILoadGroup* aLoadGroup, nsIPrincipal* aPrincipal,
-    nsIPrincipal* aStoragePrincipal, nsDocShell* aContainer) {
+    nsIPrincipal* aPartitionedPrincipal, nsDocShell* aContainer) {
   // create a new blank HTML document
   RefPtr<Document> blankDoc;
   mozilla::Unused << NS_NewHTMLDocument(getter_AddRefs(blankDoc));
 
   if (!blankDoc) {
     return nullptr;
   }
 
   // initialize
   nsCOMPtr<nsIURI> uri;
   NS_NewURI(getter_AddRefs(uri), NS_LITERAL_CSTRING("about:blank"));
   if (!uri) {
     return nullptr;
   }
-  blankDoc->ResetToURI(uri, aLoadGroup, aPrincipal, aStoragePrincipal);
+  blankDoc->ResetToURI(uri, aLoadGroup, aPrincipal, aPartitionedPrincipal);
   blankDoc->SetContainer(aContainer);
 
   // add some simple content structure
   nsNodeInfoManager* nim = blankDoc->NodeInfoManager();
 
   RefPtr<mozilla::dom::NodeInfo> htmlNodeInfo;
 
   // generate an html html element
--- a/layout/build/nsContentDLF.h
+++ b/layout/build/nsContentDLF.h
@@ -41,17 +41,17 @@ class nsContentDLF final : public nsIDoc
 
   /**
    * Create a blank document using the given loadgroup and given
    * principal.  aPrincipal is allowed to be null, in which case the
    * new document will get the about:blank content principal.
    */
   static already_AddRefed<mozilla::dom::Document> CreateBlankDocument(
       nsILoadGroup* aLoadGroup, nsIPrincipal* aPrincipal,
-      nsIPrincipal* aStoragePrincipal, nsDocShell* aContainer);
+      nsIPrincipal* aPartitionedPrincipal, nsDocShell* aContainer);
 
  private:
   static nsresult EnsureUAStyleSheet();
   static bool IsImageContentType(const char* aContentType);
 };
 
 nsresult NS_NewContentDocumentLoaderFactory(nsIDocumentLoaderFactory** aResult);
 
--- a/toolkit/components/antitracking/StoragePrincipalHelper.cpp
+++ b/toolkit/components/antitracking/StoragePrincipalHelper.cpp
@@ -12,26 +12,26 @@
 #include "mozilla/StorageAccess.h"
 #include "nsContentUtils.h"
 
 namespace mozilla {
 
 namespace {
 
 bool ChooseOriginAttributes(nsIChannel* aChannel, OriginAttributes& aAttrs,
-                            bool aForceInstrinsicStoragePrincipal) {
+                            bool aForcePartitionedPrincipal) {
   MOZ_ASSERT(aChannel);
 
   nsCOMPtr<nsILoadInfo> loadInfo = aChannel->LoadInfo();
   nsCOMPtr<nsICookieJarSettings> cjs;
   if (NS_FAILED(loadInfo->GetCookieJarSettings(getter_AddRefs(cjs)))) {
     return false;
   }
 
-  if (!aForceInstrinsicStoragePrincipal) {
+  if (!aForcePartitionedPrincipal) {
     nsCOMPtr<nsIURI> uri;
     nsresult rv = aChannel->GetURI(getter_AddRefs(uri));
     if (NS_FAILED(rv)) {
       return false;
     }
 
     uint32_t rejectedReason = 0;
     if (ContentBlocking::ShouldAllowAccessFor(aChannel, uri, &rejectedReason)) {
@@ -75,28 +75,29 @@ bool ChooseOriginAttributes(nsIChannel* 
   return true;
 }
 
 }  // namespace
 
 // static
 nsresult StoragePrincipalHelper::Create(nsIChannel* aChannel,
                                         nsIPrincipal* aPrincipal,
+                                        bool aForceIsolation,
                                         nsIPrincipal** aStoragePrincipal) {
   MOZ_ASSERT(aChannel);
   MOZ_ASSERT(aPrincipal);
   MOZ_ASSERT(aStoragePrincipal);
 
   auto scopeExit = MakeScopeExit([&] {
     nsCOMPtr<nsIPrincipal> storagePrincipal = aPrincipal;
     storagePrincipal.forget(aStoragePrincipal);
   });
 
   OriginAttributes attrs = aPrincipal->OriginAttributesRef();
-  if (!ChooseOriginAttributes(aChannel, attrs, false)) {
+  if (!ChooseOriginAttributes(aChannel, attrs, aForceIsolation)) {
     return NS_OK;
   }
 
   scopeExit.release();
 
   nsCOMPtr<nsIPrincipal> storagePrincipal =
       BasePrincipal::Cast(aPrincipal)->CloneForcingOriginAttributes(attrs);
 
@@ -278,25 +279,12 @@ bool StoragePrincipalHelper::GetOriginAt
 void StoragePrincipalHelper::GetOriginAttributesForNetworkState(
     Document* aDocument, OriginAttributes& aAttributes) {
   aAttributes = aDocument->NodePrincipal()->OriginAttributesRef();
 
   if (!StaticPrefs::privacy_partition_network_state()) {
     return;
   }
 
-  // This part is required because the intrisicStoragePrincipal is not always
-  // partitioned. This should probably change. TODO - bug 1639833.
-  nsCOMPtr<nsICookieJarSettings> cjs = aDocument->CookieJarSettings();
-  MOZ_ASSERT(cjs);
-
-  nsAutoString domain;
-  Unused << cjs->GetFirstPartyDomain(domain);
-
-  if (!domain.IsEmpty()) {
-    aAttributes.SetFirstPartyDomain(false, domain, true /* aForced */);
-    return;
-  }
-
-  aAttributes = aDocument->IntrinsicStoragePrincipal()->OriginAttributesRef();
+  aAttributes = aDocument->PartitionedPrincipal()->OriginAttributesRef();
 }
 
 }  // namespace mozilla
--- a/toolkit/components/antitracking/StoragePrincipalHelper.h
+++ b/toolkit/components/antitracking/StoragePrincipalHelper.h
@@ -54,33 +54,37 @@
  * the Partitioned Principal, while storage that should change with storage
  * access grants should choose the Storage Access Principal.
  *
  * You can obtain these nsIPrincipal objects:
  *
  * From a Document:
  * - Regular Principal: nsINode::NodePrincipal
  * - Storage Access Principal: Document::EffectiveStoragePrincipal
- * - Partitioned Principal: Document::IntrinsicStoragePrincipal
+ * - Partitioned Principal: Document::PartitionedPrincipal
  *
  * From a Global object:
  * - Regular Principal: nsIScriptObjectPrincipal::GetPrincipal
  * - Storage Access Principal:
  *     nsIScriptObjectPrincipal::GetEffectiveStoragePrincipal
- * - Partitioned Principal: nsIScriptObjectPrincipal::IntrinsicStoragePrincipal
+ * - Partitioned Principal: nsIScriptObjectPrincipal::PartitionedPrincipal
  *
  * From a Worker:
- * - Regular Principal: WorkerPrivate::GetPrincipal
- * - Storage Access Principal: WorkerPrivate::GetEffectiveStoragePrincipal
+ * - Regular Principal: WorkerPrivate::GetPrincipal (main-thread)
+ * - Regular Principal: WorkerPrivate::GetPrincipalInfo (worker thread)
+ * - Storage Access Principal: WorkerPrivate::GetEffectiveStoragePrincipalInfo
+ *                  (worker-thread)
  *
  * For a nsIChannel, the final principals must be calculated and they can be
  * obtained by calling:
  * - Regular Principal: nsIScriptSecurityManager::getChannelResultPrincipal
  * - Storage Access Principal:
  *     nsIScriptSecurityManager::getChannelResultStoragePrincipal
+ * - Partitioned and regular Principal:
+ *     nsIScriptSecurityManager::getChannelResultPrincipals
  *
  * Each use of nsIPrincipal is unique and it should be reviewed by anti-tracking
  * peers. But we can group the use of nsIPrincipal in these categories:
  *
  * - Network loading: use the Regular Principal
  * - Cache, not directly visible by content (network cache, HSTS, image cache,
  *   etc): Use the Storage Access Principal (in the future we will use the
  *   Partitioned Principal, but this part is not done yet)
@@ -209,32 +213,33 @@ namespace ipc {
 class PrincipalInfo;
 }
 
 class OriginAttributes;
 
 class StoragePrincipalHelper final {
  public:
   static nsresult Create(nsIChannel* aChannel, nsIPrincipal* aPrincipal,
+                         bool aForceIsolation,
                          nsIPrincipal** aStoragePrincipal);
 
   static nsresult PrepareEffectiveStoragePrincipalOriginAttributes(
       nsIChannel* aChannel, OriginAttributes& aOriginAttributes);
 
   static bool VerifyValidStoragePrincipalInfoForPrincipalInfo(
       const mozilla::ipc::PrincipalInfo& aStoragePrincipalInfo,
       const mozilla::ipc::PrincipalInfo& aPrincipalInfo);
 
   enum PrincipalType {
     // This is the first-party principal.
     eRegularPrincipal,
 
     // This is a dynamic principal based on the current state of the origin. If
     // the origin has the storage permission granted, effective storagePrincipal
-    // will be the regular principal, otherwise, the intrinsic storagePrincipal
+    // will be the regular principal, otherwise, the partitioned Principal
     // will be used.
     eStorageAccessPrincipal,
 
     // This is the first-party principal, plus, First-party isolation attribute
     // set.
     ePartitionedPrincipal,
   };
 
--- a/toolkit/components/sessionstore/SessionStoreUtils.cpp
+++ b/toolkit/components/sessionstore/SessionStoreUtils.cpp
@@ -1092,17 +1092,17 @@ static void ReadAllEntriesFromStorage(ns
     return;
   }
 
   nsCOMPtr<nsIPrincipal> principal = doc->NodePrincipal();
   if (!principal) {
     return;
   }
 
-  nsCOMPtr<nsIPrincipal> storagePrincipal = doc->IntrinsicStoragePrincipal();
+  nsCOMPtr<nsIPrincipal> storagePrincipal = doc->EffectiveStoragePrincipal();
   if (!storagePrincipal) {
     return;
   }
 
   nsAutoCString origin;
   nsresult rv = storagePrincipal->GetOrigin(origin);
   if (NS_FAILED(rv) || aOrigins.Contains(origin)) {
     // Don't read a host twice.
--- a/toolkit/content/browser-child.js
+++ b/toolkit/content/browser-child.js
@@ -30,25 +30,25 @@ sendAsyncMessage("Content:BrowserChildRe
 // with a particular principal that doesn't involve the message manager. We can't
 // do this with JS Window Actors for now because JS Window Actors are tied to the
 // document principals themselves, so forcing the load with a new principal is
 // self-destructive in that case.
 addMessageListener("BrowserElement:CreateAboutBlank", message => {
   if (!content.document || content.document.documentURI != "about:blank") {
     throw new Error("Can't create a content viewer unless on about:blank");
   }
-  let { principal, storagePrincipal } = message.data;
+  let { principal, partitionedPrincipal } = message.data;
   principal = BrowserUtils.principalWithMatchingOA(
     principal,
     content.document.nodePrincipal
   );
-  storagePrincipal = BrowserUtils.principalWithMatchingOA(
-    storagePrincipal,
-    content.document.effectiveStoragePrincipal
+  partitionedPrincipal = BrowserUtils.principalWithMatchingOA(
+    partitionedPrincipal,
+    content.document.partitionedPrincipal
   );
-  docShell.createAboutBlankContentViewer(principal, storagePrincipal);
+  docShell.createAboutBlankContentViewer(principal, partitionedPrincipal);
 });
 
 // We may not get any responses to Browser:Init if the browser element
 // is torn down too quickly.
 var outerWindowID = docShell.outerWindowID;
 var browsingContextId = docShell.browsingContext.id;
 sendAsyncMessage("Browser:Init", { outerWindowID, browsingContextId });
--- a/toolkit/content/widgets/browser-custom-element.js
+++ b/toolkit/content/widgets/browser-custom-element.js
@@ -260,17 +260,17 @@
       this._characterSet = "";
 
       this._mayEnableCharacterEncodingMenu = null;
 
       this._charsetAutodetected = false;
 
       this._contentPrincipal = null;
 
-      this._contentStoragePrincipal = null;
+      this._contentPartitionedPrincipal = null;
 
       this._csp = null;
 
       this._referrerInfo = null;
 
       this._contentRequestContextID = null;
 
       this._rdmFullZoom = 1.0;
@@ -699,20 +699,20 @@
     }
 
     get contentPrincipal() {
       return this.isRemoteBrowser
         ? this._contentPrincipal
         : this.contentDocument.nodePrincipal;
     }
 
-    get contentStoragePrincipal() {
+    get contentPartitionedPrincipal() {
       return this.isRemoteBrowser
-        ? this._contentStoragePrincipal
-        : this.contentDocument.effectiveStoragePrincipal;
+        ? this._contentPartitionedPrincipal
+        : this.contentDocument.partitionedPrincipal;
     }
 
     get contentBlockingAllowListPrincipal() {
       if (!this.isRemoteBrowser) {
         return this.contentDocument.contentBlockingAllowListPrincipal;
       }
 
       return this.browsingContext.currentWindowGlobal
@@ -1274,17 +1274,17 @@
     updateForLocationChange(
       aLocation,
       aCharset,
       aMayEnableCharacterEncodingMenu,
       aCharsetAutodetected,
       aDocumentURI,
       aTitle,
       aContentPrincipal,
-      aContentStoragePrincipal,
+      aContentPartitionedPrincipal,
       aCSP,
       aReferrerInfo,
       aIsSynthetic,
       aInnerWindowID,
       aHaveRequestContextID,
       aRequestContextID,
       aContentType
     ) {
@@ -1297,17 +1297,17 @@
 
         if (aContentType != null) {
           this._documentContentType = aContentType;
         }
 
         this._remoteWebNavigation._currentURI = aLocation;
         this._documentURI = aDocumentURI;
         this._contentPrincipal = aContentPrincipal;
-        this._contentStoragePrincipal = aContentStoragePrincipal;
+        this._contentPartitionedPrincipal = aContentPartitionedPrincipal;
         this._csp = aCSP;
         this._referrerInfo = aReferrerInfo;
         this._isSyntheticDocument = aIsSynthetic;
         this._innerWindowID = aInnerWindowID;
         this._contentRequestContextID = aHaveRequestContextID
           ? aRequestContextID
           : null;
       }
@@ -1328,17 +1328,17 @@
       } catch (ex) {
         // This can throw if the browser has started to go away.
         if (ex.result != Cr.NS_ERROR_NOT_INITIALIZED) {
           throw ex;
         }
       }
     }
 
-    createAboutBlankContentViewer(aPrincipal, aStoragePrincipal) {
+    createAboutBlankContentViewer(aPrincipal, aPartitionedPrincipal) {
       if (this.isRemoteBrowser) {
         // Ensure that the content process has the permissions which are
         // needed to create a document with the given principal.
         let permissionPrincipal = BrowserUtils.principalWithMatchingOA(
           aPrincipal,
           this.contentPrincipal
         );
         this.frameLoader.remoteTab.transmitPermissionsForPrincipal(
@@ -1354,29 +1354,32 @@
         //
         // 2. JS Window Actors are tied to the principals for the frames they're running
         //    in - switching principals is therefore self-destructive and unexpected.
         //
         // So we'll continue to use the message manager until we come up with a better
         // solution.
         this.messageManager.sendAsyncMessage(
           "BrowserElement:CreateAboutBlank",
-          { principal: aPrincipal, storagePrincipal: aStoragePrincipal }
+          { principal: aPrincipal, partitionedPrincipal: aPartitionedPrincipal }
         );
         return;
       }
       let principal = BrowserUtils.principalWithMatchingOA(
         aPrincipal,
         this.contentPrincipal
       );
-      let storagePrincipal = BrowserUtils.principalWithMatchingOA(
-        aStoragePrincipal,
-        this.contentStoragePrincipal
+      let partitionedPrincipal = BrowserUtils.principalWithMatchingOA(
+        aPartitionedPrincipal,
+        this.contentPartitionedPrincipal
       );
-      this.docShell.createAboutBlankContentViewer(principal, storagePrincipal);
+      this.docShell.createAboutBlankContentViewer(
+        principal,
+        partitionedPrincipal
+      );
     }
 
     stopScroll() {
       if (this._autoScrollBrowsingContext) {
         window.removeEventListener("mousemove", this, true);
         window.removeEventListener("mousedown", this, true);
         window.removeEventListener("mouseup", this, true);
         window.removeEventListener("DOMMouseScroll", this, true);
@@ -1694,17 +1697,17 @@
             "_remoteFinder",
             "_securityUI",
             "_documentURI",
             "_documentContentType",
             "_characterSet",
             "_mayEnableCharacterEncodingMenu",
             "_charsetAutodetected",
             "_contentPrincipal",
-            "_contentStoragePrincipal",
+            "_contentPartitionedPrincipal",
             "_isSyntheticDocument",
             "_innerWindowID",
           ]
         );
       }
 
       var ourFieldValues = {};
       var otherFieldValues = {};
--- a/toolkit/modules/sessionstore/SessionHistory.jsm
+++ b/toolkit/modules/sessionstore/SessionHistory.jsm
@@ -265,19 +265,19 @@ var SessionHistoryInternal = {
 
     // Collect triggeringPrincipal data for the current history entry.
     if (shEntry.principalToInherit) {
       entry.principalToInherit_base64 = E10SUtils.serializePrincipal(
         shEntry.principalToInherit
       );
     }
 
-    if (shEntry.storagePrincipalToInherit) {
-      entry.storagePrincipalToInherit_base64 = E10SUtils.serializePrincipal(
-        shEntry.storagePrincipalToInherit
+    if (shEntry.partitionedPrincipalToInherit) {
+      entry.partitionedPrincipalToInherit_base64 = E10SUtils.serializePrincipal(
+        shEntry.partitionedPrincipalToInherit
       );
     }
 
     if (shEntry.triggeringPrincipal) {
       entry.triggeringPrincipal_base64 = E10SUtils.serializePrincipal(
         shEntry.triggeringPrincipal
       );
     }
@@ -546,21 +546,21 @@ var SessionHistoryInternal = {
         // We must always have a triggering principal for a load to work.
         // A null principal won't always work however is safe to use.
         debug(
           "Couldn't deserialize the triggeringPrincipal, falling back to NullPrincipal"
         );
         return Services.scriptSecurityManager.createNullPrincipal({});
       }
     );
-    // As both storagePrincipal and principalToInherit are both not required to load
+    // As both partitionedPrincipal and principalToInherit are both not required to load
     // it's ok to keep these undefined when we don't have a previously defined principal.
-    if (entry.storagePrincipalToInherit_base64) {
-      shEntry.storagePrincipalToInherit = E10SUtils.deserializePrincipal(
-        entry.storagePrincipalToInherit_base64
+    if (entry.partitionedPrincipalToInherit_base64) {
+      shEntry.partitionedPrincipalToInherit = E10SUtils.deserializePrincipal(
+        entry.partitionedPrincipalToInherit_base64
       );
     }
     if (entry.principalToInherit_base64) {
       shEntry.principalToInherit = E10SUtils.deserializePrincipal(
         entry.principalToInherit_base64
       );
     }
     if (entry.csp) {