[tbb-commits] [tor-browser/tor-browser-78.8.0esr-10.0-1] Bug 1542194: Set original frame src load. r=mattwoodrow, a=RyanVM

sysrqb at torproject.org sysrqb at torproject.org
Wed Feb 17 03:51:18 UTC 2021


commit fa30ece0dcdd38d07935bd360650ae5e015d3765
Author: Christoph Kerschbaumer <ckerschb at christophkerschbaumer.com>
Date:   Mon Feb 15 13:57:44 2021 +0100

    Bug 1542194: Set original frame src load. r=mattwoodrow, a=RyanVM
---
 docshell/base/nsDocShell.cpp         |  7 +++++++
 ipc/glue/BackgroundUtils.cpp         |  2 ++
 netwerk/base/LoadInfo.cpp            |  4 ++--
 netwerk/base/LoadInfo.h              | 14 +++++++-------
 netwerk/ipc/NeckoChannelParams.ipdlh |  1 +
 5 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp
index fcdbe4918064..43fb261a9f8a 100644
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -9636,6 +9636,13 @@ nsresult nsDocShell::DoURILoad(nsDocShellLoadState* aLoadState,
     loadInfo->SetHasValidUserGestureActivation(true);
   }
 
+  // if this is an iframe load then store if it's the inital frame src load
+  if (nsContentUtils::InternalContentPolicyTypeToExternal(contentPolicyType) ==
+      nsIContentPolicy::TYPE_SUBDOCUMENT) {
+    loadInfo->SetOriginalFrameSrcLoad(
+        aLoadState->HasLoadFlags(INTERNAL_LOAD_FLAGS_ORIGINAL_FRAME_SRC));
+  }
+
   /* Get the cache Key from SH */
   uint32_t cacheKey = 0;
   if (mLSHE) {
diff --git a/ipc/glue/BackgroundUtils.cpp b/ipc/glue/BackgroundUtils.cpp
index 1fd0b585f357..ecacef83c500 100644
--- a/ipc/glue/BackgroundUtils.cpp
+++ b/ipc/glue/BackgroundUtils.cpp
@@ -522,6 +522,7 @@ nsresult LoadInfoToLoadInfoArgs(nsILoadInfo* aLoadInfo,
       aLoadInfo->GetAllowInsecureRedirectToDataURI(),
       aLoadInfo->GetBypassCORSChecks(),
       aLoadInfo->GetSkipContentPolicyCheckForWebRequest(),
+      aLoadInfo->GetOriginalFrameSrcLoad(),
       aLoadInfo->GetForceInheritPrincipalDropped(),
       aLoadInfo->GetInnerWindowID(), aLoadInfo->GetOuterWindowID(),
       aLoadInfo->GetParentOuterWindowID(), aLoadInfo->GetTopOuterWindowID(),
@@ -748,6 +749,7 @@ nsresult LoadInfoArgsToLoadInfo(
       loadInfoArgs.allowInsecureRedirectToDataURI(),
       loadInfoArgs.bypassCORSChecks(),
       loadInfoArgs.skipContentPolicyCheckForWebRequest(),
+      loadInfoArgs.originalFrameSrcLoad(),
       loadInfoArgs.forceInheritPrincipalDropped(), loadInfoArgs.innerWindowID(),
       loadInfoArgs.outerWindowID(), loadInfoArgs.parentOuterWindowID(),
       loadInfoArgs.topOuterWindowID(), loadInfoArgs.frameOuterWindowID(),
diff --git a/netwerk/base/LoadInfo.cpp b/netwerk/base/LoadInfo.cpp
index 17468a7d3d0b..3a3d3acd25cb 100644
--- a/netwerk/base/LoadInfo.cpp
+++ b/netwerk/base/LoadInfo.cpp
@@ -826,7 +826,7 @@ LoadInfo::LoadInfo(
     bool aBrowserUpgradeInsecureRequests,
     bool aBrowserWouldUpgradeInsecureRequests, bool aForceAllowDataURI,
     bool aAllowInsecureRedirectToDataURI, bool aBypassCORSChecks,
-    bool aSkipContentPolicyCheckForWebRequest,
+    bool aSkipContentPolicyCheckForWebRequest, bool aOriginalFrameSrcLoad,
     bool aForceInheritPrincipalDropped, uint64_t aInnerWindowID,
     uint64_t aOuterWindowID, uint64_t aParentOuterWindowID,
     uint64_t aTopOuterWindowID, uint64_t aFrameOuterWindowID,
@@ -876,7 +876,7 @@ LoadInfo::LoadInfo(
       mBypassCORSChecks(aBypassCORSChecks),
       mSkipContentPolicyCheckForWebRequest(
           aSkipContentPolicyCheckForWebRequest),
-      mOriginalFrameSrcLoad(false),
+      mOriginalFrameSrcLoad(aOriginalFrameSrcLoad),
       mForceInheritPrincipalDropped(aForceInheritPrincipalDropped),
       mInnerWindowID(aInnerWindowID),
       mOuterWindowID(aOuterWindowID),
diff --git a/netwerk/base/LoadInfo.h b/netwerk/base/LoadInfo.h
index caf5e7debee8..60b9adbf08e4 100644
--- a/netwerk/base/LoadInfo.h
+++ b/netwerk/base/LoadInfo.h
@@ -152,13 +152,13 @@ class LoadInfo final : public nsILoadInfo {
            bool aBrowserWouldUpgradeInsecureRequests, bool aForceAllowDataURI,
            bool aAllowInsecureRedirectToDataURI, bool aBypassCORSChecks,
            bool aSkipContentPolicyCheckForWebRequest,
-           bool aForceInheritPrincipalDropped, uint64_t aInnerWindowID,
-           uint64_t aOuterWindowID, uint64_t aParentOuterWindowID,
-           uint64_t aTopOuterWindowID, uint64_t aFrameOuterWindowID,
-           uint64_t aBrowsingContextID, uint64_t aFrameBrowsingContextID,
-           bool aInitialSecurityCheckDone, bool aIsThirdPartyRequest,
-           bool aIsThirdPartyContextToTopWindow, bool aIsFormSubmission,
-           bool aSendCSPViolationEvents,
+           bool aOriginalFrameSrcLoad, bool aForceInheritPrincipalDropped,
+           uint64_t aInnerWindowID, uint64_t aOuterWindowID,
+           uint64_t aParentOuterWindowID, uint64_t aTopOuterWindowID,
+           uint64_t aFrameOuterWindowID, uint64_t aBrowsingContextID,
+           uint64_t aFrameBrowsingContextID, bool aInitialSecurityCheckDone,
+           bool aIsThirdPartyRequest, bool aIsThirdPartyContextToTopWindow,
+           bool aIsFormSubmission, bool aSendCSPViolationEvents,
            const OriginAttributes& aOriginAttributes,
            RedirectHistoryArray& aRedirectChainIncludingInternalRedirects,
            RedirectHistoryArray& aRedirectChain,
diff --git a/netwerk/ipc/NeckoChannelParams.ipdlh b/netwerk/ipc/NeckoChannelParams.ipdlh
index 69b9af45b0a5..7f4fe332f5a1 100644
--- a/netwerk/ipc/NeckoChannelParams.ipdlh
+++ b/netwerk/ipc/NeckoChannelParams.ipdlh
@@ -93,6 +93,7 @@ struct LoadInfoArgs
   bool                        allowInsecureRedirectToDataURI;
   bool                        bypassCORSChecks;
   bool                        skipContentPolicyCheckForWebRequest;
+  bool                        originalFrameSrcLoad;
   bool                        forceInheritPrincipalDropped;
   uint64_t                    innerWindowID;
   uint64_t                    outerWindowID;





More information about the tbb-commits mailing list