Do not report resource-timing subdocument loads triggered by that subdocument.

This commit is contained in:
wolfbeast 2018-12-14 12:50:01 +01:00 committed by Roy Tam
commit 27d88fc505
13 changed files with 108 additions and 12 deletions

View file

@ -3676,14 +3676,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<nsPIDOMWindowInner> innerWindow = loadingDocument->GetInnerWindow();
if (!innerWindow) {
return nullptr;