|
|
Description[PageLoadMetrics] Reenable AdsMetrics and handle case where navigation aborts
It turns out that a frame can abort and continue to load resources even if it
has no previous navigation. This happens if a doc.write overwrites the frame
navigation while the navigation is still provisional.
This CL now labels all finished frame navigations (regardless of success) and
removes an incorrect dcheck.
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_site_isolation
BUG=708570
Review-Url: https://codereview.chromium.org/2861433005
Cr-Commit-Position: refs/heads/master@{#470701}
Committed: https://chromium.googlesource.com/chromium/src/+/6f3a10ddea2ee602ff61267ce3ed6a60c8e6ff71
Patch Set 1 : Enables feature and adds test which shows failure #Patch Set 2 : Fix #
Total comments: 20
Patch Set 3 : Address comments from PS2 #
Total comments: 1
Patch Set 4 : UnsafeFindFrameByFrameTreeNodeId #Patch Set 5 : Rebase #Patch Set 6 : Label all frames, remove resource dcheck #
Total comments: 4
Patch Set 7 : Address comments from PS6 #Messages
Total messages: 80 (68 generated)
Patchset #1 (id:1) has been deleted
The CQ bit was checked by jkarlin@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
Patchset #2 (id:40001) has been deleted
The CQ bit was checked by jkarlin@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: linux_chromium_chromeos_ozone_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_...)
Patchset #2 (id:60001) has been deleted
Patchset #2 (id:80001) has been deleted
The CQ bit was checked by jkarlin@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
Description was changed from ========== [PageLoadMetrics] Fix dchecks in ads observer It turns out that a frame can abort and continue to load resources even if it has no previous navigation. This happens if a doc.write overwrites the frame navigation while the navigation is still provisional. This CL replaces the dchecks with UMA (to see how often this happens) and early returns. BUG=708570 ========== to ========== [PageLoadMetrics] Handle case where navigation aborts It turns out that a frame can abort and continue to load resources even if it has no previous navigation. This happens if a doc.write overwrites the frame navigation while the navigation is still provisional. This CL replaces the dchecks with UMA (to see how often this happens) and early returns. BUG=708570 ==========
jkarlin@chromium.org changed reviewers: + bmcquade@chromium.org, csharrison@chromium.org
Charles, Bryan: PTAL! Thanks!
Looks good! https://codereview.chromium.org/2861433005/diff/100001/chrome/browser/page_lo... File chrome/browser/page_load_metrics/observers/ads_page_load_metrics_observer.cc (right): https://codereview.chromium.org/2861433005/diff/100001/chrome/browser/page_lo... chrome/browser/page_load_metrics/observers/ads_page_load_metrics_observer.cc:22: const base::Feature kAdsFeature{"AdsMetrics", base::FEATURE_ENABLED_BY_DEFAULT}; Please mention in the description that this CL re-enables the feature. https://codereview.chromium.org/2861433005/diff/100001/chrome/browser/page_lo... chrome/browser/page_load_metrics/observers/ads_page_load_metrics_observer.cc:78: navigation_handle->GetNetErrorCode() != net::ERR_ABORTED) { #include net errors https://codereview.chromium.org/2861433005/diff/100001/chrome/browser/page_lo... chrome/browser/page_load_metrics/observers/ads_page_load_metrics_observer.cc:79: // We're not interested in tracking this navigation. In case we've seen a IMO pulling this whole comment above the if statement is clearer and makes the if statement easier to parse. https://codereview.chromium.org/2861433005/diff/100001/chrome/browser/page_lo... chrome/browser/page_load_metrics/observers/ads_page_load_metrics_observer.cc:86: // navigation). I imagine this is not the only way the navigation can be aborted, is it? https://codereview.chromium.org/2861433005/diff/100001/chrome/browser/page_lo... chrome/browser/page_load_metrics/observers/ads_page_load_metrics_observer.cc:92: // NavigationHandle->GetRenderFrameHost doesn't like being called for Slightly awkward wording. It's helpful to differentiate between the FTN the navigation is happening in, and the RFH. The canonical RFH associated with a navigation is the one it commits in. "Doesn't like" peppers over this distinction as arbitrary. https://codereview.chromium.org/2861433005/diff/100001/chrome/browser/page_lo... File chrome/browser/page_load_metrics/observers/ads_page_load_metrics_observer_browsertest.cc (right): https://codereview.chromium.org/2861433005/diff/100001/chrome/browser/page_lo... chrome/browser/page_load_metrics/observers/ads_page_load_metrics_observer_browsertest.cc:16: ASSERT_TRUE(embedded_test_server()->Start()); #include gtest https://codereview.chromium.org/2861433005/diff/100001/chrome/browser/page_lo... chrome/browser/page_load_metrics/observers/ads_page_load_metrics_observer_browsertest.cc:21: DISALLOW_COPY_AND_ASSIGN(AdsPageLoadMetricsObserverBrowserTest); #include base/macros https://codereview.chromium.org/2861433005/diff/100001/chrome/browser/page_lo... chrome/browser/page_load_metrics/observers/ads_page_load_metrics_observer_browsertest.cc:26: // Test that a subframe that aborts (due to doc.write) doesn't cause a crash optional: I prefer comments above test names. https://codereview.chromium.org/2861433005/diff/100001/chrome/browser/page_lo... chrome/browser/page_load_metrics/observers/ads_page_load_metrics_observer_browsertest.cc:28: ui_test_utils::NavigateToURL( #include gurl https://codereview.chromium.org/2861433005/diff/100001/chrome/test/data/ads_o... File chrome/test/data/ads_observer/docwrite_provisional_frame.html (right): https://codereview.chromium.org/2861433005/diff/100001/chrome/test/data/ads_o... chrome/test/data/ads_observer/docwrite_provisional_frame.html:11: doc.write('<html>Rewritten. <img src=pixel.png><img src=pixel2.png><img src=pixel3.png></html>'); Can you confirm that the images are successfully loaded? I know it makes the test more complicated but I am only vaguely sure that this even works. My suggestion is to use document.write to write something like: <img src="pixel.png" onload="postMessage('loaded');" Then in the parent use a message listener + domAutomationController to send a signal to the test harness.
LGTM, thanks for addressing this case!
Description was changed from ========== [PageLoadMetrics] Handle case where navigation aborts It turns out that a frame can abort and continue to load resources even if it has no previous navigation. This happens if a doc.write overwrites the frame navigation while the navigation is still provisional. This CL replaces the dchecks with UMA (to see how often this happens) and early returns. BUG=708570 ========== to ========== [PageLoadMetrics] Reenable AdsMetrics and handle case where navigation aborts It turns out that a frame can abort and continue to load resources even if it has no previous navigation. This happens if a doc.write overwrites the frame navigation while the navigation is still provisional. This CL replaces the dchecks with UMA (to see how often this happens) and early returns. BUG=708570 ==========
The CQ bit was checked by jkarlin@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: linux_chromium_tsan_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_...) mac_chromium_rel_ng on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_rel_...)
The CQ bit was checked by jkarlin@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: linux_chromium_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_...)
The CQ bit was checked by jkarlin@chromium.org to run a CQ dry run
csharrison@ PTAL https://codereview.chromium.org/2861433005/diff/100001/chrome/browser/page_lo... File chrome/browser/page_load_metrics/observers/ads_page_load_metrics_observer.cc (right): https://codereview.chromium.org/2861433005/diff/100001/chrome/browser/page_lo... chrome/browser/page_load_metrics/observers/ads_page_load_metrics_observer.cc:22: const base::Feature kAdsFeature{"AdsMetrics", base::FEATURE_ENABLED_BY_DEFAULT}; On 2017/05/04 20:21:14, Charlie Harrison wrote: > Please mention in the description that this CL re-enables the feature. Done. https://codereview.chromium.org/2861433005/diff/100001/chrome/browser/page_lo... chrome/browser/page_load_metrics/observers/ads_page_load_metrics_observer.cc:78: navigation_handle->GetNetErrorCode() != net::ERR_ABORTED) { On 2017/05/04 20:21:14, Charlie Harrison wrote: > #include net errors Done. https://codereview.chromium.org/2861433005/diff/100001/chrome/browser/page_lo... chrome/browser/page_load_metrics/observers/ads_page_load_metrics_observer.cc:79: // We're not interested in tracking this navigation. In case we've seen a On 2017/05/04 20:21:14, Charlie Harrison wrote: > IMO pulling this whole comment above the if statement is clearer and makes the > if statement easier to parse. Done. https://codereview.chromium.org/2861433005/diff/100001/chrome/browser/page_lo... chrome/browser/page_load_metrics/observers/ads_page_load_metrics_observer.cc:86: // navigation). On 2017/05/04 20:21:14, Charlie Harrison wrote: > I imagine this is not the only way the navigation can be aborted, is it? Done. https://codereview.chromium.org/2861433005/diff/100001/chrome/browser/page_lo... chrome/browser/page_load_metrics/observers/ads_page_load_metrics_observer.cc:92: // NavigationHandle->GetRenderFrameHost doesn't like being called for On 2017/05/04 20:21:14, Charlie Harrison wrote: > Slightly awkward wording. It's helpful to differentiate between the FTN the > navigation is happening in, and the RFH. The canonical RFH associated with a > navigation is the one it commits in. "Doesn't like" peppers over this > distinction as arbitrary. Done. https://codereview.chromium.org/2861433005/diff/100001/chrome/browser/page_lo... File chrome/browser/page_load_metrics/observers/ads_page_load_metrics_observer_browsertest.cc (right): https://codereview.chromium.org/2861433005/diff/100001/chrome/browser/page_lo... chrome/browser/page_load_metrics/observers/ads_page_load_metrics_observer_browsertest.cc:16: ASSERT_TRUE(embedded_test_server()->Start()); On 2017/05/04 20:21:14, Charlie Harrison wrote: > #include gtest Done. https://codereview.chromium.org/2861433005/diff/100001/chrome/browser/page_lo... chrome/browser/page_load_metrics/observers/ads_page_load_metrics_observer_browsertest.cc:21: DISALLOW_COPY_AND_ASSIGN(AdsPageLoadMetricsObserverBrowserTest); On 2017/05/04 20:21:14, Charlie Harrison wrote: > #include base/macros Done. https://codereview.chromium.org/2861433005/diff/100001/chrome/browser/page_lo... chrome/browser/page_load_metrics/observers/ads_page_load_metrics_observer_browsertest.cc:26: // Test that a subframe that aborts (due to doc.write) doesn't cause a crash On 2017/05/04 20:21:14, Charlie Harrison wrote: > optional: I prefer comments above test names. Done. https://codereview.chromium.org/2861433005/diff/100001/chrome/browser/page_lo... chrome/browser/page_load_metrics/observers/ads_page_load_metrics_observer_browsertest.cc:28: ui_test_utils::NavigateToURL( On 2017/05/04 20:21:14, Charlie Harrison wrote: > #include gurl Done. https://codereview.chromium.org/2861433005/diff/100001/chrome/test/data/ads_o... File chrome/test/data/ads_observer/docwrite_provisional_frame.html (right): https://codereview.chromium.org/2861433005/diff/100001/chrome/test/data/ads_o... chrome/test/data/ads_observer/docwrite_provisional_frame.html:11: doc.write('<html>Rewritten. <img src=pixel.png><img src=pixel2.png><img src=pixel3.png></html>'); On 2017/05/04 20:21:14, Charlie Harrison wrote: > Can you confirm that the images are successfully loaded? I know it makes the > test more complicated but I am only vaguely sure that this even works. > > My suggestion is to use document.write to write something like: > <img src="pixel.png" onload="postMessage('loaded');" > > Then in the parent use a message listener + domAutomationController to send a > signal to the test harness. Sure. Done.
Dry run: CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
Patchset #3 (id:120001) has been deleted
Patchset #3 (id:140001) has been deleted
The CQ bit was checked by jkarlin@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
LGTM thanks https://codereview.chromium.org/2861433005/diff/160001/chrome/browser/page_lo... File chrome/browser/page_load_metrics/observers/ads_page_load_metrics_observer_browsertest.cc (right): https://codereview.chromium.org/2861433005/diff/160001/chrome/browser/page_lo... chrome/browser/page_load_metrics/observers/ads_page_load_metrics_observer_browsertest.cc:34: content::DOMMessageQueue msg_queue; Cool, didn't know about that one.
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: linux_chromium_chromeos_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_...)
The CQ bit was checked by jkarlin@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: linux_chromium_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_...)
Patchset #6 (id:220001) has been deleted
The CQ bit was checked by jkarlin@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: win_clang on master.tryserver.chromium.win (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.win/builders/win_clang/builds/...)
The CQ bit was checked by jkarlin@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
Patchset #6 (id:240001) has been deleted
The CQ bit was checked by jkarlin@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was checked by jkarlin@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was checked by jkarlin@chromium.org to run a CQ dry run
Patchset #6 (id:260001) has been deleted
Patchset #6 (id:280001) has been deleted
Dry run: CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was checked by jkarlin@chromium.org to run a CQ dry run
Patchset #6 (id:300001) has been deleted
Dry run: CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
Description was changed from ========== [PageLoadMetrics] Reenable AdsMetrics and handle case where navigation aborts It turns out that a frame can abort and continue to load resources even if it has no previous navigation. This happens if a doc.write overwrites the frame navigation while the navigation is still provisional. This CL replaces the dchecks with UMA (to see how often this happens) and early returns. BUG=708570 ========== to ========== [PageLoadMetrics] Reenable AdsMetrics and handle case where navigation aborts It turns out that a frame can abort and continue to load resources even if it has no previous navigation. This happens if a doc.write overwrites the frame navigation while the navigation is still provisional. This CL replaces the dchecks with UMA (to see how often this happens) and early returns. CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_site_isolation BUG=708570 ==========
bmcquade@ and csharrison@ I made a few changes, PTAL. I'm now labeling frames (as an ad or not) after any navigation finishes regardless of navigation success.
Description was changed from ========== [PageLoadMetrics] Reenable AdsMetrics and handle case where navigation aborts It turns out that a frame can abort and continue to load resources even if it has no previous navigation. This happens if a doc.write overwrites the frame navigation while the navigation is still provisional. This CL replaces the dchecks with UMA (to see how often this happens) and early returns. CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_site_isolation BUG=708570 ========== to ========== [PageLoadMetrics] Reenable AdsMetrics and handle case where navigation aborts It turns out that a frame can abort and continue to load resources even if it has no previous navigation. This happens if a doc.write overwrites the frame navigation while the navigation is still provisional. This CL now labels all finished frame navigations (regardless of success) and removes an incorrect dcheck. CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_site_isolation BUG=708570 ==========
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: win_chromium_x64_rel_ng on master.tryserver.chromium.win (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.win/builders/win_chromium_x64_...)
lgtm
LGTM % nits https://codereview.chromium.org/2861433005/diff/320001/chrome/browser/page_lo... File chrome/browser/page_load_metrics/observers/ads_page_load_metrics_observer.cc (right): https://codereview.chromium.org/2861433005/diff/320001/chrome/browser/page_lo... chrome/browser/page_load_metrics/observers/ads_page_load_metrics_observer.cc:35: navigation_handle->GetWebContents()->UnsafeFindFrameByFrameTreeNodeId( Can you comment why the "Unsafe" is necessary? https://codereview.chromium.org/2861433005/diff/320001/chrome/browser/page_lo... chrome/browser/page_load_metrics/observers/ads_page_load_metrics_observer.cc:89: // labels all of a page's frames, even those that fail to navigate. s/navigate/commit
The CQ bit was checked by jkarlin@chromium.org to run a CQ dry run
Thanks! https://codereview.chromium.org/2861433005/diff/320001/chrome/browser/page_lo... File chrome/browser/page_load_metrics/observers/ads_page_load_metrics_observer.cc (right): https://codereview.chromium.org/2861433005/diff/320001/chrome/browser/page_lo... chrome/browser/page_load_metrics/observers/ads_page_load_metrics_observer.cc:35: navigation_handle->GetWebContents()->UnsafeFindFrameByFrameTreeNodeId( On 2017/05/10 16:47:21, Charlie Harrison wrote: > Can you comment why the "Unsafe" is necessary? I commented on way it's safe to use in this case. It doesn't seem worth looking up the pid if it's not necessary to do so. https://codereview.chromium.org/2861433005/diff/320001/chrome/browser/page_lo... chrome/browser/page_load_metrics/observers/ads_page_load_metrics_observer.cc:89: // labels all of a page's frames, even those that fail to navigate. On 2017/05/10 16:47:21, Charlie Harrison wrote: > s/navigate/commit Done.
Dry run: CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: win_chromium_x64_rel_ng on master.tryserver.chromium.win (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.win/builders/win_chromium_x64_...) win_clang on master.tryserver.chromium.win (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.win/builders/win_clang/builds/...)
The CQ bit was checked by jkarlin@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from bmcquade@chromium.org, csharrison@chromium.org Link to the patchset: https://codereview.chromium.org/2861433005/#ps340001 (title: "Address comments from PS6")
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
CQ is committing da patch. Bot data: {"patchset_id": 340001, "attempt_start_ts": 1494441947864070, "parent_rev": "2525d998c7c50bce5ca17fb934c2aeb8e27e1db0", "commit_rev": "6f3a10ddea2ee602ff61267ce3ed6a60c8e6ff71"}
Message was sent while issue was closed.
Description was changed from ========== [PageLoadMetrics] Reenable AdsMetrics and handle case where navigation aborts It turns out that a frame can abort and continue to load resources even if it has no previous navigation. This happens if a doc.write overwrites the frame navigation while the navigation is still provisional. This CL now labels all finished frame navigations (regardless of success) and removes an incorrect dcheck. CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_site_isolation BUG=708570 ========== to ========== [PageLoadMetrics] Reenable AdsMetrics and handle case where navigation aborts It turns out that a frame can abort and continue to load resources even if it has no previous navigation. This happens if a doc.write overwrites the frame navigation while the navigation is still provisional. This CL now labels all finished frame navigations (regardless of success) and removes an incorrect dcheck. CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_site_isolation BUG=708570 Review-Url: https://codereview.chromium.org/2861433005 Cr-Commit-Position: refs/heads/master@{#470701} Committed: https://chromium.googlesource.com/chromium/src/+/6f3a10ddea2ee602ff61267ce3ed... ==========
Message was sent while issue was closed.
Committed patchset #7 (id:340001) as https://chromium.googlesource.com/chromium/src/+/6f3a10ddea2ee602ff61267ce3ed...
Message was sent while issue was closed.
A revert of this CL (patchset #7 id:340001) has been created in https://codereview.chromium.org/2876823003/ by thakis@chromium.org. The reason for reverting is: Test is flaky, see https://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium.... |