forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Postpone calling RenderFrameObserver::DidCommitProvisionalLoad
This change postpones calling RenderFrameObserver::DidCommitProvisionalLoad until after RenderFrameImpl is done updating its own state and performing its own work. This avoids running arbitrary other code from within the middle of those state updates. In particular, this ensures that observers that wish to execute script from within DidCommitProvisionalLoad do not do so until after we have setup the new BrowserInterfaceBrokerProxy and finished other critical steps associated with committing a navigation in the renderer. See ChromeRenderFrameObserver, which uses this signal to inject scripts for WebUI pages. (We might decide that is non-ideal for other reasons and design a better injection point, but that can be done in a subsequent CL.) Injected script can call into local storage, which is a synchronous operation. That operation requires a synchronous check of the ContentSettingsManager to determine if the script can access local storage. That interface is acquired through the BrowserInterfaceBrokerProxy. Hence, there is opportunity for a dead-lock if the BrowserInterfaceBrokerProxy has not already been set-up (meaning, not already had its receiver handle sent to the browser process) by the time script tries to access local storage. In practice, this has not been an issue, but in another change I am making, the ContentSettingsManager will be lazily acquired causing this potential dead-lock to more easily occur and to definitely occur in some of our WebUI browser tests. As part of this change, the page_load_metrics/ module had to be revised to not flush existing metrics from DidCommitProvisionalLoad. Doing so could attribute metrics from the previous page to the newly committed page including especially the navigation_start time which is used as a key to identify page loads by the metrics system. That in turn could cause subsequent metrics on the newly loaded page to simply be dropped. Fortunately, tests helped root out this issue. The PageTimingMetricsSender grows a SendLatest method that can be used to trigger when metrics should be flushed rather than having that be a side-effect of the destructor running. SendLatest is now called from ReadyToCommitNavigation to send any accumulated metrics for the previous page before the new load commits. This may result in dropping some metrics data between the calls to ReadyToCommitNavigation and DidCommitProvisionalLoad, but that is probably reasonable. Also, a comment from dgozman indicates that ReadyToCommitNavigation is something we want to get rid of but MetricsRenderFrameObserver already implements this method so whatever substitute there will be in the future for this method can hopefully account for both this new use case as well as the existing use case. Files w/ implementations potentially impacted: chrome/renderer/chrome_render_frame_observer.cc chrome/renderer/content_settings_agent_impl.cc chrome/renderer/content_settings_agent_impl_browsertest.cc chrome/renderer/net/net_error_helper.cc chrome/renderer/safe_browsing/phishing_classifier_delegate.cc chrome/renderer/searchbox/searchbox.cc components/autofill/content/renderer/autofill_agent.cc components/autofill/content/renderer/form_tracker.cc components/autofill/content/renderer/password_autofill_agent.cc components/autofill/content/renderer/password_generation_agent.cc components/data_reduction_proxy/content/renderer/content_previews_render_frame_observer.cc components/page_load_metrics/renderer/metrics_render_frame_observer.cc content/renderer/accessibility/render_accessibility_impl.cc content/renderer/media/audio/audio_renderer_sink_cache_impl.cc content/renderer/pepper/plugin_power_saver_helper.cc extensions/renderer/extension_frame_helper.cc Change-Id: Ia6627b2db06ea51e769ed6c8889e37e554fcc1d1 Bug: 1023519 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1898769 Reviewed-by: Bryan McQuade <bmcquade@chromium.org> Reviewed-by: John Abd-El-Malek <jam@chromium.org> Commit-Queue: Darin Fisher <darin@chromium.org> Cr-Commit-Position: refs/heads/master@{#715460}
- Loading branch information
Darin Fisher
authored and
Commit Bot
committed
Nov 14, 2019
1 parent
01f7c68
commit 2d2b194
Showing
6 changed files
with
80 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters