Bug 1408990 - Only add the entry to the performance object if the loading document's principal is the same as the triggering principal. r=bz, r=dragana, a=lizzard DEVEDITION_57_0b13_RELEASE FENNEC_57_0b13_BUILD1 FENNEC_57_0b13_RELEASE FIREFOX_57_0b13_BUILD1 FIREFOX_57_0b13_RELEASE
authorValentin Gosu <valentin.gosu@gmail.com>
Sat, 28 Oct 2017 00:15:01 +0200
changeset 435242 aa8f74f0ad60ab35955e539ac8e1164fe00a7fd1
parent 435241 ca0924347f3b4c1fc5310a200a1b6de202a61831
child 435243 75a4db331abc0c89e1333d54f810597dc3bb66ac
push id1567
push userjlorenzo@mozilla.com
push dateThu, 02 Nov 2017 12:36:05 +0000
treeherdermozilla-release@e512c14a0406 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz, dragana, lizzard
bugs1408990
milestone57.0
Bug 1408990 - Only add the entry to the performance object if the loading document's principal is the same as the triggering principal. r=bz, r=dragana, a=lizzard MozReview-Commit-ID: 7o8XKHioP1p
netwerk/protocol/http/HttpBaseChannel.cpp
--- a/netwerk/protocol/http/HttpBaseChannel.cpp
+++ b/netwerk/protocol/http/HttpBaseChannel.cpp
@@ -4083,16 +4083,24 @@ HttpBaseChannel::GetPerformance()
     return nullptr;
   }
 
   nsCOMPtr<nsIDocument> loadingDocument = do_QueryInterface(domDocument);
   if (!loadingDocument) {
     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;
+  }
+
   nsCOMPtr<nsPIDOMWindowInner> innerWindow = loadingDocument->GetInnerWindow();
   if (!innerWindow) {
     return nullptr;
   }
 
   mozilla::dom::Performance* docPerformance = innerWindow->GetPerformance();
   if (!docPerformance) {
     return nullptr;