summaryrefslogtreecommitdiffstats
path: root/docshell
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-12-14 12:50:01 +0100
committerwolfbeast <mcwerewolf@gmail.com>2018-12-14 12:50:01 +0100
commitfea96b4527a2db6cd97c9053d647478b347d3853 (patch)
treeeeb73acd7f8295dbab17ec993392bce3161be9db /docshell
parent2e69b03ddd11de777e6d52a995ff0d1675eb58d2 (diff)
downloadUXP-fea96b4527a2db6cd97c9053d647478b347d3853.tar
UXP-fea96b4527a2db6cd97c9053d647478b347d3853.tar.gz
UXP-fea96b4527a2db6cd97c9053d647478b347d3853.tar.lz
UXP-fea96b4527a2db6cd97c9053d647478b347d3853.tar.xz
UXP-fea96b4527a2db6cd97c9053d647478b347d3853.zip
Do not report resource-timing subdocument loads triggered by that subdocument.
Diffstat (limited to 'docshell')
-rw-r--r--docshell/base/nsDocShell.cpp28
-rw-r--r--docshell/base/nsDocShell.h1
-rw-r--r--docshell/base/nsDocShellLoadInfo.cpp17
-rw-r--r--docshell/base/nsDocShellLoadInfo.h4
-rw-r--r--docshell/base/nsIDocShell.idl5
-rw-r--r--docshell/base/nsIDocShellLoadInfo.idl6
6 files changed, 57 insertions, 4 deletions
diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp
index ae307431d..e6fa5a200 100644
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -1263,6 +1263,7 @@ nsDocShell::LoadURI(nsIURI* aURI,
nsCOMPtr<nsIURI> referrer;
nsCOMPtr<nsIURI> originalURI;
bool loadReplace = false;
+ bool isFromProcessingFrameAttributes = false;
nsCOMPtr<nsIInputStream> postStream;
nsCOMPtr<nsIInputStream> headersStream;
nsCOMPtr<nsIPrincipal> triggeringPrincipal;
@@ -1292,6 +1293,7 @@ nsDocShell::LoadURI(nsIURI* aURI,
aLoadInfo->GetReferrer(getter_AddRefs(referrer));
aLoadInfo->GetOriginalURI(getter_AddRefs(originalURI));
aLoadInfo->GetLoadReplace(&loadReplace);
+ aLoadInfo->GetIsFromProcessingFrameAttributes(&isFromProcessingFrameAttributes);
nsDocShellInfoLoadType lt = nsIDocShellLoadInfo::loadNormal;
aLoadInfo->GetLoadType(&lt);
// Get the appropriate loadType from nsIDocShellLoadInfo type
@@ -1571,6 +1573,7 @@ nsDocShell::LoadURI(nsIURI* aURI,
return InternalLoad(aURI,
originalURI,
loadReplace,
+ isFromProcessingFrameAttributes,
referrer,
referrerPolicy,
triggeringPrincipal,
@@ -5340,8 +5343,8 @@ nsDocShell::LoadErrorPage(nsIURI* aURI, const char16_t* aURL,
rv = NS_NewURI(getter_AddRefs(errorPageURI), errorPageUrl);
NS_ENSURE_SUCCESS(rv, rv);
- return InternalLoad(errorPageURI, nullptr, false, nullptr,
- mozilla::net::RP_Default,
+ return InternalLoad(errorPageURI, nullptr, false, false,
+ nullptr, mozilla::net::RP_Default,
nsContentUtils::GetSystemPrincipal(), nullptr,
INTERNAL_LOAD_FLAGS_NONE, EmptyString(),
nullptr, NullString(), nullptr, nullptr, LOAD_ERROR_PAGE,
@@ -5427,6 +5430,7 @@ nsDocShell::Reload(uint32_t aReloadFlags)
rv = InternalLoad(currentURI,
originalURI,
loadReplace,
+ false, // Is from processing frame attributes
referrerURI,
referrerPolicy,
triggeringPrincipal,
@@ -9578,6 +9582,7 @@ class InternalLoadEvent : public Runnable
public:
InternalLoadEvent(nsDocShell* aDocShell, nsIURI* aURI,
nsIURI* aOriginalURI, bool aLoadReplace,
+ bool aIsFromProcessingFrameAttributes,
nsIURI* aReferrer, uint32_t aReferrerPolicy,
nsIPrincipal* aTriggeringPrincipal,
nsIPrincipal* aPrincipalToInherit, uint32_t aFlags,
@@ -9591,6 +9596,7 @@ public:
, mURI(aURI)
, mOriginalURI(aOriginalURI)
, mLoadReplace(aLoadReplace)
+ , mIsFromProcessingFrameAttributes(aIsFromProcessingFrameAttributes)
, mReferrer(aReferrer)
, mReferrerPolicy(aReferrerPolicy)
, mTriggeringPrincipal(aTriggeringPrincipal)
@@ -9615,6 +9621,7 @@ public:
{
return mDocShell->InternalLoad(mURI, mOriginalURI,
mLoadReplace,
+ mIsFromProcessingFrameAttributes,
mReferrer,
mReferrerPolicy,
mTriggeringPrincipal, mPrincipalToInherit,
@@ -9635,6 +9642,7 @@ private:
nsCOMPtr<nsIURI> mURI;
nsCOMPtr<nsIURI> mOriginalURI;
bool mLoadReplace;
+ bool mIsFromProcessingFrameAttributes;
nsCOMPtr<nsIURI> mReferrer;
uint32_t mReferrerPolicy;
nsCOMPtr<nsIPrincipal> mTriggeringPrincipal;
@@ -9703,6 +9711,7 @@ NS_IMETHODIMP
nsDocShell::InternalLoad(nsIURI* aURI,
nsIURI* aOriginalURI,
bool aLoadReplace,
+ bool aIsFromProcessingFrameAttributes,
nsIURI* aReferrer,
uint32_t aReferrerPolicy,
nsIPrincipal* aTriggeringPrincipal,
@@ -10005,6 +10014,7 @@ nsDocShell::InternalLoad(nsIURI* aURI,
INTERNAL_LOAD_FLAGS_DONT_SEND_REFERRER));
loadInfo->SetOriginalURI(aOriginalURI);
loadInfo->SetLoadReplace(aLoadReplace);
+ loadInfo->SetIsFromProcessingFrameAttributes(aIsFromProcessingFrameAttributes);
loadInfo->SetTriggeringPrincipal(aTriggeringPrincipal);
loadInfo->SetInheritPrincipal(
aFlags & INTERNAL_LOAD_FLAGS_INHERIT_PRINCIPAL);
@@ -10053,6 +10063,7 @@ nsDocShell::InternalLoad(nsIURI* aURI,
rv = targetDocShell->InternalLoad(aURI,
aOriginalURI,
aLoadReplace,
+ aIsFromProcessingFrameAttributes,
aReferrer,
aReferrerPolicy,
aTriggeringPrincipal,
@@ -10135,6 +10146,7 @@ nsDocShell::InternalLoad(nsIURI* aURI,
// Do this asynchronously
nsCOMPtr<nsIRunnable> ev =
new InternalLoadEvent(this, aURI, aOriginalURI, aLoadReplace,
+ aIsFromProcessingFrameAttributes,
aReferrer, aReferrerPolicy,
aTriggeringPrincipal, principalToInherit,
aFlags, aTypeHint, aPostData, aHeadersData,
@@ -10661,7 +10673,8 @@ nsDocShell::InternalLoad(nsIURI* aURI,
nsINetworkPredictor::PREDICT_LOAD, this, nullptr);
nsCOMPtr<nsIRequest> req;
- rv = DoURILoad(aURI, aOriginalURI, aLoadReplace, loadFromExternal,
+ rv = DoURILoad(aURI, aOriginalURI, aLoadReplace,
+ aIsFromProcessingFrameAttributes, loadFromExternal,
(aFlags & INTERNAL_LOAD_FLAGS_FORCE_ALLOW_DATA_URI),
aReferrer,
!(aFlags & INTERNAL_LOAD_FLAGS_DONT_SEND_REFERRER),
@@ -10743,6 +10756,7 @@ nsresult
nsDocShell::DoURILoad(nsIURI* aURI,
nsIURI* aOriginalURI,
bool aLoadReplace,
+ bool aIsFromProcessingFrameAttributes,
bool aLoadFromExternal,
bool aForceAllowDataURI,
nsIURI* aReferrerURI,
@@ -10903,7 +10917,7 @@ nsDocShell::DoURILoad(nsIURI* aURI,
securityFlags |= nsILoadInfo::SEC_SANDBOXED;
}
- nsCOMPtr<nsILoadInfo> loadInfo =
+ RefPtr<LoadInfo> loadInfo =
(aContentPolicyType == nsIContentPolicy::TYPE_DOCUMENT) ?
new LoadInfo(loadingWindow, aTriggeringPrincipal, topLevelLoadingContext,
securityFlags) :
@@ -10929,6 +10943,10 @@ nsDocShell::DoURILoad(nsIURI* aURI,
return rv;
}
+ if (aIsFromProcessingFrameAttributes) {
+ loadInfo->SetIsFromProcessingFrameAttributes();
+ }
+
if (!isSrcdoc) {
rv = NS_NewChannelInternal(getter_AddRefs(channel),
aURI,
@@ -12581,6 +12599,7 @@ nsDocShell::LoadHistoryEntry(nsISHEntry* aEntry, uint32_t aLoadType)
rv = InternalLoad(uri,
originalURI,
loadReplace,
+ false, // Is from processing frame attributes
referrerURI,
referrerPolicy,
triggeringPrincipal,
@@ -14084,6 +14103,7 @@ nsDocShell::OnLinkClickSync(nsIContent* aContent,
nsresult rv = InternalLoad(clonedURI, // New URI
nullptr, // Original URI
false, // LoadReplace
+ false, // From frame attributes
referer, // Referer URI
refererPolicy, // Referer policy
triggeringPrincipal,
diff --git a/docshell/base/nsDocShell.h b/docshell/base/nsDocShell.h
index f510a15b0..8de3995fc 100644
--- a/docshell/base/nsDocShell.h
+++ b/docshell/base/nsDocShell.h
@@ -371,6 +371,7 @@ protected:
nsresult DoURILoad(nsIURI* aURI,
nsIURI* aOriginalURI,
bool aLoadReplace,
+ bool aIsFromProcessingFrameAttributes,
bool aLoadFromExternal,
bool aForceAllowDataURI,
nsIURI* aReferrer,
diff --git a/docshell/base/nsDocShellLoadInfo.cpp b/docshell/base/nsDocShellLoadInfo.cpp
index b00e8e360..b1a990267 100644
--- a/docshell/base/nsDocShellLoadInfo.cpp
+++ b/docshell/base/nsDocShellLoadInfo.cpp
@@ -20,6 +20,7 @@ nsDocShellLoadInfo::nsDocShellLoadInfo()
, mReferrerPolicy(mozilla::net::RP_Default)
, mLoadType(nsIDocShellLoadInfo::loadNormal)
, mIsSrcdocLoad(false)
+ , mIsFromProcessingFrameAttributes(false)
{
}
@@ -310,3 +311,19 @@ nsDocShellLoadInfo::SetBaseURI(nsIURI* aBaseURI)
mBaseURI = aBaseURI;
return NS_OK;
}
+
+NS_IMETHODIMP
+nsDocShellLoadInfo::GetIsFromProcessingFrameAttributes(bool* aIsFromProcessingFrameAttributes)
+{
+ NS_ENSURE_ARG_POINTER(aIsFromProcessingFrameAttributes);
+
+ *aIsFromProcessingFrameAttributes = mIsFromProcessingFrameAttributes;
+ return NS_OK;
+}
+
+NS_IMETHODIMP
+nsDocShellLoadInfo::SetIsFromProcessingFrameAttributes(bool aIsFromProcessingFrameAttributes)
+{
+ mIsFromProcessingFrameAttributes = aIsFromProcessingFrameAttributes;
+ return NS_OK;
+}
diff --git a/docshell/base/nsDocShellLoadInfo.h b/docshell/base/nsDocShellLoadInfo.h
index f3ddcca1e..09479683b 100644
--- a/docshell/base/nsDocShellLoadInfo.h
+++ b/docshell/base/nsDocShellLoadInfo.h
@@ -49,6 +49,10 @@ protected:
nsString mSrcdocData;
nsCOMPtr<nsIDocShell> mSourceDocShell;
nsCOMPtr<nsIURI> mBaseURI;
+
+ // This will be true if this load is triggered by attribute changes.
+ // See nsILoadInfo.isFromProcessingFrameAttributes
+ bool mIsFromProcessingFrameAttributes;
};
#endif /* nsDocShellLoadInfo_h__ */
diff --git a/docshell/base/nsIDocShell.idl b/docshell/base/nsIDocShell.idl
index e34e6adfd..d205e5b0c 100644
--- a/docshell/base/nsIDocShell.idl
+++ b/docshell/base/nsIDocShell.idl
@@ -133,6 +133,10 @@ interface nsIDocShell : nsIDocShellTreeItem
* @param aLoadReplace - If set LOAD_REPLACE flag will be set on the
* channel. aOriginalURI is null, this argument is
* ignored.
+ * @param aIsFromProcessingFrameAttributes
+ * - If this is a load triggered by changing frame
+ * attributes.
+ * See nsILoadInfo.isFromProcessingFrameAttributes
* @param aReferrer - Referring URI
* @param aReferrerPolicy - Referrer policy
* @param aTriggeringPrincipal - A non-null principal that initiated that load.
@@ -178,6 +182,7 @@ interface nsIDocShell : nsIDocShellTreeItem
[noscript]void internalLoad(in nsIURI aURI,
in nsIURI aOriginalURI,
in boolean aLoadReplace,
+ in boolean aIsFromProcessingFrameAttributes,
in nsIURI aReferrer,
in unsigned long aReferrerPolicy,
in nsIPrincipal aTriggeringPrincipal,
diff --git a/docshell/base/nsIDocShellLoadInfo.idl b/docshell/base/nsIDocShellLoadInfo.idl
index 8804f63a3..2f52ef0aa 100644
--- a/docshell/base/nsIDocShellLoadInfo.idl
+++ b/docshell/base/nsIDocShellLoadInfo.idl
@@ -128,4 +128,10 @@ interface nsIDocShellLoadInfo : nsISupports
* URI as this information isn't embedded in the load's URI.
*/
attribute nsIURI baseURI;
+
+ /**
+ * This will be true if this load is triggered by attribute changes.
+ * See nsILoadInfo.isFromProcessingFrameAttributes
+ */
+ attribute boolean isFromProcessingFrameAttributes;
};