| 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 5d59ba4efb20d98dee6b7f252aa3806e3fb9cdda..e3f51bf4946a1b2cc9437a0e973f4b77a78e5325 100644
|
| --- a/chrome/browser/page_load_metrics/metrics_web_contents_observer.cc
|
| +++ b/chrome/browser/page_load_metrics/metrics_web_contents_observer.cc
|
| @@ -525,6 +525,33 @@
|
| content::RenderFrameHost* render_frame_host,
|
| const PageLoadTiming& timing,
|
| const PageLoadMetadata& metadata) {
|
| + // We may receive notifications from frames that have been navigated away
|
| + // from. We simply ignore them.
|
| + if (!render_frame_host->GetRenderViewHost() ||
|
| + render_frame_host->GetRenderViewHost()->GetMainFrame() !=
|
| + web_contents()->GetMainFrame()) {
|
| + RecordInternalError(ERR_IPC_FROM_WRONG_FRAME);
|
| + return;
|
| + }
|
| +
|
| + // While timings arriving for the wrong frame are expected, we do not expect
|
| + // any of the errors below. Thus, we track occurrences of all errors below,
|
| + // rather than returning early after encountering an error.
|
| +
|
| + bool error = false;
|
| + if (!committed_load_) {
|
| + RecordInternalError(ERR_IPC_WITH_NO_RELEVANT_LOAD);
|
| + error = true;
|
| + }
|
| +
|
| + if (!web_contents()->GetLastCommittedURL().SchemeIsHTTPOrHTTPS()) {
|
| + RecordInternalError(ERR_IPC_FROM_BAD_URL_SCHEME);
|
| + error = true;
|
| + }
|
| +
|
| + if (error)
|
| + return;
|
| +
|
| if (render_frame_host->GetParent() != nullptr) {
|
| // Child frames may send PageLoadMetadata updates, but not PageLoadTiming
|
| // updates.
|
| @@ -534,31 +561,6 @@
|
| return;
|
| }
|
|
|
| - // We may receive notifications from frames that have been navigated away
|
| - // from. We simply ignore them.
|
| - if (render_frame_host != web_contents()->GetMainFrame()) {
|
| - RecordInternalError(ERR_IPC_FROM_WRONG_FRAME);
|
| - return;
|
| - }
|
| -
|
| - // While timings arriving for the wrong frame are expected, we do not expect
|
| - // any of the errors below. Thus, we track occurrences of all errors below,
|
| - // rather than returning early after encountering an error.
|
| -
|
| - bool error = false;
|
| - if (!committed_load_) {
|
| - RecordInternalError(ERR_IPC_WITH_NO_RELEVANT_LOAD);
|
| - error = true;
|
| - }
|
| -
|
| - if (!web_contents()->GetLastCommittedURL().SchemeIsHTTPOrHTTPS()) {
|
| - RecordInternalError(ERR_IPC_FROM_BAD_URL_SCHEME);
|
| - error = true;
|
| - }
|
| -
|
| - if (error)
|
| - 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).
|
|
|