Index: chrome/browser/page_load_metrics/metrics_web_contents_observer.cc |
diff --git a/chrome/browser/page_load_metrics/metrics_web_contents_observer.cc b/chrome/browser/page_load_metrics/metrics_web_contents_observer.cc |
index ba63fd9f6e830ed1cfb9d68dbd1a4b91c6e8bf65..8117d1f70fe688612b0366e99f57da94c304630b 100644 |
--- a/chrome/browser/page_load_metrics/metrics_web_contents_observer.cc |
+++ b/chrome/browser/page_load_metrics/metrics_web_contents_observer.cc |
@@ -510,9 +510,14 @@ void MetricsWebContentsObserver::OnTimingUpdated( |
content::RenderFrameHost* render_frame_host, |
const PageLoadTiming& timing, |
const PageLoadMetadata& metadata) { |
+ content::RenderFrameHost* root_render_frame_host = render_frame_host; |
Charlie Harrison
2017/03/08 21:47:17
I would probably prefer GetRenderViewHost()->GetMa
Bryan McQuade
2017/03/09 03:06:11
ah, absolutely, thanks! didn't know about that.
|
+ while (root_render_frame_host->GetParent() != nullptr) { |
+ root_render_frame_host = root_render_frame_host->GetParent(); |
+ } |
+ |
// We may receive notifications from frames that have been navigated away |
// from. We simply ignore them. |
- if (render_frame_host != web_contents()->GetMainFrame()) { |
+ if (root_render_frame_host != web_contents()->GetMainFrame()) { |
RecordInternalError(ERR_IPC_FROM_WRONG_FRAME); |
return; |
} |
@@ -535,6 +540,15 @@ void MetricsWebContentsObserver::OnTimingUpdated( |
if (error) |
return; |
+ if (render_frame_host->GetParent() != nullptr) { |
+ // Child frames may send PageLoadMetadata updates, but not PageLoadTiming |
+ // updates. |
+ if (!timing.IsEmpty()) |
+ RecordInternalError(ERR_TIMING_IPC_FROM_SUBFRAME); |
+ committed_load_->UpdateChildMetadata(metadata); |
+ return; |
+ } |
+ |
if (!committed_load_->UpdateTiming(timing, metadata)) { |
// If the page load tracker cannot update its timing, something is wrong |
// with the IPC (it's from another load, or it's invalid in some other way). |