Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(622)

Unified Diff: content/renderer/render_frame_impl.cc

Issue 2316003002: Notify the renderer if a history navigation has no subframe items. (Closed)
Patch Set: Fix indent. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/render_frame_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_frame_impl.cc
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
index 83214dd34566f49df10aae8d5c47b837aec7a542..2052b7ceee32f761b7e7f2f58cf504ac2a438c3d 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -1043,6 +1043,7 @@ RenderFrameImpl::RenderFrameImpl(const CreateParams& params)
render_view_(params.render_view->AsWeakPtr()),
routing_id_(params.routing_id),
proxy_routing_id_(MSG_ROUTING_NONE),
+ browser_has_subtree_history_items_(false),
#if defined(ENABLE_PLUGINS)
plugin_power_saver_helper_(nullptr),
plugin_find_handler_(nullptr),
@@ -1165,6 +1166,11 @@ void RenderFrameImpl::Initialize() {
RenderFrameImpl* parent_frame = RenderFrameImpl::FromWebFrame(
frame_->parent());
if (parent_frame) {
+ // Inherit knowledge of whether we need to consult the browser process for
+ // a history item on the first navigation. This is inherited by further
+ // subframes and cleared at didStopLoading.
+ browser_has_subtree_history_items_ =
+ parent_frame->browser_has_subtree_history_items_;
is_using_lofi_ = parent_frame->IsUsingLoFi();
effective_connection_type_ = parent_frame->getEffectiveConnectionType();
}
@@ -4820,6 +4826,12 @@ void RenderFrameImpl::didStartLoading(bool to_different_document) {
void RenderFrameImpl::didStopLoading() {
TRACE_EVENT1("navigation,rail", "RenderFrameImpl::didStopLoading",
"id", routing_id_);
+
+ // Any subframes created after this point won't be considered part of the
+ // current history navigation (if this was one), so we don't need to track
+ // this state anymore.
+ browser_has_subtree_history_items_ = false;
+
render_view_->FrameDidStopLoading(frame_);
Send(new FrameHostMsg_DidStopLoading(routing_id_));
}
@@ -4964,10 +4976,12 @@ WebNavigationPolicy RenderFrameImpl::decidePolicyForNavigation(
}
// In OOPIF-enabled modes, back/forward navigations in newly created subframes
- // should be sent to the browser in case there is a matching
- // FrameNavigationEntry. If none is found, fall back to the default url.
+ // should be sent to the browser if there is a chance there is a matching
+ // FrameNavigationEntry. If none is found (or if the browser has indicated it
+ // has no subtree history items), fall back to loading the default url.
if (SiteIsolationPolicy::UseSubframeNavigationEntries() &&
- info.isHistoryNavigationInNewChildFrame && is_content_initiated) {
+ info.isHistoryNavigationInNewChildFrame && is_content_initiated &&
+ browser_has_subtree_history_items_) {
// Don't do this if |info| also says it is a client redirect, in which case
// JavaScript on the page is trying to interrupt the history navigation.
if (!info.isClientRedirect) {
@@ -5571,6 +5585,11 @@ void RenderFrameImpl::NavigateInternal(
: blink::WebFrameLoadType::BackForward;
should_load_request = true;
+ // Remember whether we should consult the browser process for any
+ // subframes created during this history navigation.
+ browser_has_subtree_history_items_ =
+ request_params.has_subtree_history_items;
+
if (history_load_type == blink::WebHistorySameDocumentLoad) {
// If this is marked as a same document load but we haven't committed
// anything, treat it as a new load. The browser shouldn't let this
« no previous file with comments | « content/renderer/render_frame_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698