#534: M1487964
This commit is contained in:
parent
6db6f6ac23
commit
8126d332a5
|
@ -1275,6 +1275,7 @@ nsDocShell::LoadURI(nsIURI* aURI,
|
|||
nsCOMPtr<nsIURI> referrer;
|
||||
nsCOMPtr<nsIURI> originalURI;
|
||||
bool loadReplace = false;
|
||||
bool isFromProcessingFrameAttributes = false;
|
||||
nsCOMPtr<nsIInputStream> postStream;
|
||||
nsCOMPtr<nsIInputStream> headersStream;
|
||||
nsCOMPtr<nsISupports> owner;
|
||||
|
@ -1303,6 +1304,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(<);
|
||||
// Get the appropriate loadType from nsIDocShellLoadInfo type
|
||||
|
@ -1558,6 +1560,7 @@ nsDocShell::LoadURI(nsIURI* aURI,
|
|||
return InternalLoad(aURI,
|
||||
originalURI,
|
||||
loadReplace,
|
||||
isFromProcessingFrameAttributes,
|
||||
referrer,
|
||||
referrerPolicy,
|
||||
owner,
|
||||
|
@ -5252,7 +5255,7 @@ 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,
|
||||
return InternalLoad(errorPageURI, nullptr, false, false, nullptr,
|
||||
mozilla::net::RP_Default,
|
||||
nullptr, INTERNAL_LOAD_FLAGS_INHERIT_OWNER, nullptr,
|
||||
nullptr, NullString(), nullptr, nullptr, LOAD_ERROR_PAGE,
|
||||
|
@ -5334,6 +5337,7 @@ nsDocShell::Reload(uint32_t aReloadFlags)
|
|||
rv = InternalLoad(currentURI,
|
||||
originalURI,
|
||||
loadReplace,
|
||||
false, // IsFromProcessingFrameAttributes
|
||||
referrerURI,
|
||||
referrerPolicy,
|
||||
principal,
|
||||
|
@ -9412,6 +9416,7 @@ class InternalLoadEvent : public nsRunnable
|
|||
public:
|
||||
InternalLoadEvent(nsDocShell* aDocShell, nsIURI* aURI,
|
||||
nsIURI* aOriginalURI, bool aLoadReplace,
|
||||
bool aIsFromProcessingFrameAttributes,
|
||||
nsIURI* aReferrer, uint32_t aReferrerPolicy,
|
||||
nsISupports* aOwner, uint32_t aFlags,
|
||||
const char* aTypeHint, nsIInputStream* aPostData,
|
||||
|
@ -9424,6 +9429,7 @@ public:
|
|||
, mURI(aURI)
|
||||
, mOriginalURI(aOriginalURI)
|
||||
, mLoadReplace(aLoadReplace)
|
||||
, mIsFromProcessingFrameAttributes(aIsFromProcessingFrameAttributes)
|
||||
, mReferrer(aReferrer)
|
||||
, mReferrerPolicy(aReferrerPolicy)
|
||||
, mOwner(aOwner)
|
||||
|
@ -9447,6 +9453,7 @@ public:
|
|||
{
|
||||
return mDocShell->InternalLoad(mURI, mOriginalURI,
|
||||
mLoadReplace,
|
||||
mIsFromProcessingFrameAttributes,
|
||||
mReferrer,
|
||||
mReferrerPolicy,
|
||||
mOwner, mFlags,
|
||||
|
@ -9467,6 +9474,7 @@ private:
|
|||
nsCOMPtr<nsIURI> mURI;
|
||||
nsCOMPtr<nsIURI> mOriginalURI;
|
||||
bool mLoadReplace;
|
||||
bool mIsFromProcessingFrameAttributes;
|
||||
nsCOMPtr<nsIURI> mReferrer;
|
||||
uint32_t mReferrerPolicy;
|
||||
nsCOMPtr<nsISupports> mOwner;
|
||||
|
@ -9513,6 +9521,7 @@ NS_IMETHODIMP
|
|||
nsDocShell::InternalLoad(nsIURI* aURI,
|
||||
nsIURI* aOriginalURI,
|
||||
bool aLoadReplace,
|
||||
bool aIsFromProcessingFrameAttributes,
|
||||
nsIURI* aReferrer,
|
||||
uint32_t aReferrerPolicy,
|
||||
nsISupports* aOwner,
|
||||
|
@ -9782,6 +9791,7 @@ nsDocShell::InternalLoad(nsIURI* aURI,
|
|||
INTERNAL_LOAD_FLAGS_DONT_SEND_REFERRER));
|
||||
loadInfo->SetOriginalURI(aOriginalURI);
|
||||
loadInfo->SetLoadReplace(aLoadReplace);
|
||||
loadInfo->SetIsFromProcessingFrameAttributes(aIsFromProcessingFrameAttributes);
|
||||
loadInfo->SetOwner(loadingPrincipal); // SetTriggeringPrincipal
|
||||
loadInfo->SetInheritOwner( /* SetInheritPrincipal _INHERIT_PRINCIPAL */
|
||||
!!(aFlags & INTERNAL_LOAD_FLAGS_INHERIT_OWNER));
|
||||
|
@ -9831,6 +9841,7 @@ nsDocShell::InternalLoad(nsIURI* aURI,
|
|||
rv = targetDocShell->InternalLoad(aURI,
|
||||
aOriginalURI,
|
||||
aLoadReplace,
|
||||
aIsFromProcessingFrameAttributes,
|
||||
aReferrer,
|
||||
aReferrerPolicy,
|
||||
owner,
|
||||
|
@ -9912,6 +9923,7 @@ nsDocShell::InternalLoad(nsIURI* aURI,
|
|||
// Do this asynchronously
|
||||
nsCOMPtr<nsIRunnable> ev =
|
||||
new InternalLoadEvent(this, aURI, aOriginalURI, aLoadReplace,
|
||||
aIsFromProcessingFrameAttributes,
|
||||
aReferrer, aReferrerPolicy, aOwner, aFlags,
|
||||
aTypeHint, aPostData, aHeadersData,
|
||||
aLoadType, aSHEntry, aFirstParty, aSrcdoc,
|
||||
|
@ -10392,7 +10404,9 @@ nsDocShell::InternalLoad(nsIURI* aURI,
|
|||
nsINetworkPredictor::PREDICT_LOAD, this, nullptr);
|
||||
|
||||
nsCOMPtr<nsIRequest> req;
|
||||
rv = DoURILoad(aURI, aOriginalURI, aLoadReplace, aReferrer,
|
||||
rv = DoURILoad(aURI, aOriginalURI, aLoadReplace,
|
||||
aIsFromProcessingFrameAttributes,
|
||||
aReferrer,
|
||||
!(aFlags & INTERNAL_LOAD_FLAGS_DONT_SEND_REFERRER),
|
||||
aReferrerPolicy,
|
||||
owner, aTypeHint, aFileName, aPostData, aHeadersData,
|
||||
|
@ -10471,6 +10485,7 @@ nsresult
|
|||
nsDocShell::DoURILoad(nsIURI* aURI,
|
||||
nsIURI* aOriginalURI,
|
||||
bool aLoadReplace,
|
||||
bool aIsFromProcessingFrameAttributes,
|
||||
nsIURI* aReferrerURI,
|
||||
bool aSendReferrer,
|
||||
uint32_t aReferrerPolicy,
|
||||
|
@ -10620,6 +10635,14 @@ nsDocShell::DoURILoad(nsIURI* aURI,
|
|||
securityFlags |= nsILoadInfo::SEC_SANDBOXED;
|
||||
}
|
||||
|
||||
#if(0)
|
||||
// XXX: bug 1487964 has this code, but we have no nsILoadInfo set up yet.
|
||||
// Do we need it?
|
||||
if (aIsFromProcessingFrameAttributes) {
|
||||
loadInfo->SetIsFromProcessingFrameAttributes();
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!isSrcdoc) {
|
||||
rv = NS_NewChannelInternal(getter_AddRefs(channel),
|
||||
aURI,
|
||||
|
@ -12184,6 +12207,7 @@ nsDocShell::LoadHistoryEntry(nsISHEntry* aEntry, uint32_t aLoadType)
|
|||
rv = InternalLoad(uri,
|
||||
originalURI,
|
||||
loadReplace,
|
||||
false, // IsFromProcessingFrameAttributes
|
||||
referrerURI,
|
||||
referrerPolicy,
|
||||
owner,
|
||||
|
@ -13646,6 +13670,7 @@ nsDocShell::OnLinkClickSync(nsIContent* aContent,
|
|||
nsresult rv = InternalLoad(clonedURI, // New URI
|
||||
nullptr, // Original URI
|
||||
false, // LoadReplace
|
||||
false, // IsFromProcessingFrameAttributes
|
||||
referer, // Referer URI
|
||||
refererPolicy, // Referer policy
|
||||
aContent->NodePrincipal(), // Owner is our node's
|
||||
|
|
|
@ -353,6 +353,7 @@ protected:
|
|||
nsresult DoURILoad(nsIURI* aURI,
|
||||
nsIURI* aOriginalURI,
|
||||
bool aLoadReplace,
|
||||
bool aIsFromProcessingFrameAttributes,
|
||||
nsIURI* aReferrer,
|
||||
bool aSendReferrer,
|
||||
uint32_t aReferrerPolicy,
|
||||
|
|
|
@ -19,6 +19,7 @@ nsDocShellLoadInfo::nsDocShellLoadInfo()
|
|||
, mReferrerPolicy(mozilla::net::RP_Default)
|
||||
, mLoadType(nsIDocShellLoadInfo::loadNormal)
|
||||
, mIsSrcdocLoad(false)
|
||||
, mIsFromProcessingFrameAttributes(false)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -298,3 +299,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;
|
||||
}
|
||||
|
|
|
@ -48,6 +48,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__ */
|
||||
|
|
|
@ -126,6 +126,9 @@ 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 aOwner - Owner (security principal)
|
||||
|
@ -154,6 +157,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 nsISupports aOwner,
|
||||
|
|
|
@ -120,4 +120,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;
|
||||
};
|
||||
|
|
|
@ -427,6 +427,8 @@ nsFrameLoader::ReallyStartLoadingInternal()
|
|||
nsIWebNavigation::LOAD_FLAGS_DISALLOW_INHERIT_OWNER;
|
||||
}
|
||||
|
||||
loadInfo->SetIsFromProcessingFrameAttributes(true);
|
||||
|
||||
// Kick off the load...
|
||||
bool tmpState = mNeedsAsyncDestroy;
|
||||
mNeedsAsyncDestroy = true;
|
||||
|
|
|
@ -255,7 +255,9 @@ LoadInfoToLoadInfoArgs(nsILoadInfo *aLoadInfo,
|
|||
redirectChain,
|
||||
aLoadInfo->CorsUnsafeHeaders(),
|
||||
aLoadInfo->GetForcePreflight(),
|
||||
aLoadInfo->GetIsPreflight());
|
||||
aLoadInfo->GetIsPreflight(),
|
||||
aLoadInfo->GetIsFromProcessingFrameAttributes()
|
||||
);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -296,7 +298,7 @@ LoadInfoArgsToLoadInfo(const OptionalLoadInfoArgs& aOptionalLoadInfoArgs,
|
|||
redirectChain.AppendElement(redirectedPrincipal.forget());
|
||||
}
|
||||
|
||||
nsCOMPtr<nsILoadInfo> loadInfo =
|
||||
RefPtr<mozilla::LoadInfo> loadInfo =
|
||||
new mozilla::LoadInfo(requestingPrincipal,
|
||||
triggeringPrincipal,
|
||||
loadInfoArgs.securityFlags(),
|
||||
|
@ -316,6 +318,10 @@ LoadInfoArgsToLoadInfo(const OptionalLoadInfoArgs& aOptionalLoadInfoArgs,
|
|||
loadInfoArgs.forcePreflight(),
|
||||
loadInfoArgs.isPreflight());
|
||||
|
||||
if (loadInfoArgs.isFromProcessingFrameAttributes()) {
|
||||
loadInfo->SetIsFromProcessingFrameAttributes();
|
||||
}
|
||||
|
||||
loadInfo.forget(outLoadInfo);
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -43,6 +43,7 @@ LoadInfo::LoadInfo(nsIPrincipal* aLoadingPrincipal,
|
|||
, mIsThirdPartyContext(false)
|
||||
, mForcePreflight(false)
|
||||
, mIsPreflight(false)
|
||||
, mIsFromProcessingFrameAttributes(false)
|
||||
{
|
||||
MOZ_ASSERT(mLoadingPrincipal);
|
||||
MOZ_ASSERT(mTriggeringPrincipal);
|
||||
|
@ -134,6 +135,7 @@ LoadInfo::LoadInfo(const LoadInfo& rhs)
|
|||
, mCorsUnsafeHeaders(rhs.mCorsUnsafeHeaders)
|
||||
, mForcePreflight(rhs.mForcePreflight)
|
||||
, mIsPreflight(rhs.mIsPreflight)
|
||||
, mIsFromProcessingFrameAttributes(rhs.mIsFromProcessingFrameAttributes)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -171,6 +173,7 @@ LoadInfo::LoadInfo(nsIPrincipal* aLoadingPrincipal,
|
|||
, mCorsUnsafeHeaders(aCorsUnsafeHeaders)
|
||||
, mForcePreflight(aForcePreflight)
|
||||
, mIsPreflight(aIsPreflight)
|
||||
, mIsFromProcessingFrameAttributes(false)
|
||||
{
|
||||
MOZ_ASSERT(mLoadingPrincipal);
|
||||
MOZ_ASSERT(mTriggeringPrincipal);
|
||||
|
@ -587,4 +590,18 @@ LoadInfo::MaybeIncreaseTainting(uint32_t aTainting)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
LoadInfo::SetIsFromProcessingFrameAttributes()
|
||||
{
|
||||
mIsFromProcessingFrameAttributes = true;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
LoadInfo::GetIsFromProcessingFrameAttributes(bool *aIsFromProcessingFrameAttributes)
|
||||
{
|
||||
MOZ_ASSERT(aIsFromProcessingFrameAttributes);
|
||||
*aIsFromProcessingFrameAttributes = mIsFromProcessingFrameAttributes;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -68,6 +68,8 @@ public:
|
|||
|
||||
void SetIsPreflight();
|
||||
|
||||
void SetIsFromProcessingFrameAttributes();
|
||||
|
||||
private:
|
||||
// private constructor that is only allowed to be called from within
|
||||
// HttpChannelParent and FTPChannelParent declared as friends undeneath.
|
||||
|
@ -128,6 +130,11 @@ private:
|
|||
nsTArray<nsCString> mCorsUnsafeHeaders;
|
||||
bool mForcePreflight;
|
||||
bool mIsPreflight;
|
||||
|
||||
// Is true if this load was triggered by processing the attributes of the
|
||||
// browsing context container.
|
||||
// See nsILoadInfo.isFromProcessingFrameAttributes
|
||||
bool mIsFromProcessingFrameAttributes;
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -528,4 +528,11 @@ interface nsILoadInfo : nsISupports
|
|||
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(MaybeIncreaseTainting(tainting)));
|
||||
}
|
||||
%}
|
||||
|
||||
/**
|
||||
* This attribute will be true if this is a load triggered by
|
||||
* https://html.spec.whatwg.org/multipage/iframe-embed-object.html#process-the-iframe-attributes
|
||||
* or https://html.spec.whatwg.org/multipage/obsolete.html#process-the-frame-attributes
|
||||
*/
|
||||
[infallible] readonly attribute boolean isFromProcessingFrameAttributes;
|
||||
};
|
||||
|
|
|
@ -45,6 +45,7 @@ struct LoadInfoArgs
|
|||
nsCString[] corsUnsafeHeaders;
|
||||
bool forcePreflight;
|
||||
bool isPreflight;
|
||||
bool isFromProcessingFrameAttributes;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -3072,14 +3072,17 @@ HttpBaseChannel::GetPerformance()
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
// We only add to the document's performance object if it has the same
|
||||
// principal as the one triggering the load. This is to prevent navigations
|
||||
// triggered _by_ the iframe from showing up in the parent document's
|
||||
// performance entries if they have different origins.
|
||||
if (!mLoadInfo->TriggeringPrincipal()->Equals(loadingDocument->NodePrincipal())) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (mLoadInfo->GetExternalContentPolicyType() == nsIContentPolicy::TYPE_SUBDOCUMENT &&
|
||||
!mLoadInfo->GetIsFromProcessingFrameAttributes()) {
|
||||
// We only report loads caused by processing the attributes of the
|
||||
// browsing context container.
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsPIDOMWindow> innerWindow = loadingDocument->GetInnerWindow();
|
||||
if (!innerWindow) {
|
||||
return nullptr;
|
||||
|
|
Loading…
Reference in New Issue