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

Unified Diff: content/renderer/render_frame_impl.cc

Issue 1422333009: OOPIF: History navigations for new child frames. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Improve comment. Created 5 years 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') | testing/buildbot/chromium.fyi.json » ('j') | 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 9a7edf5b7662435b67377035481f2beda4b444d5..0db8f24e912c0fabcddef7f30b37c8e696090b5a 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -2599,16 +2599,14 @@ void RenderFrameImpl::loadURLExternally(const blink::WebURLRequest& request,
request.url(), referrer,
suggested_name));
} else {
- OpenURL(request.url(), referrer, policy, should_replace_current_entry);
+ OpenURL(request.url(), referrer, policy, should_replace_current_entry,
+ false);
}
}
-blink::WebHistoryItem RenderFrameImpl::historyItemForNewChildFrame(
- blink::WebFrame* frame) {
- DCHECK(!frame_ || frame_ == frame);
-
- // TODO(creis): In OOPIF enabled modes, send an IPC to the browser process
- // telling it to navigate the new frame. See https://crbug.com/502317.
+blink::WebHistoryItem RenderFrameImpl::historyItemForNewChildFrame() {
+ // OOPIF enabled modes will punt this navigation to the browser in
+ // decidePolicyForNavigation.
if (SiteIsolationPolicy::UseSubframeNavigationEntries())
return WebHistoryItem();
@@ -4509,7 +4507,7 @@ WebNavigationPolicy RenderFrameImpl::decidePolicyForNavigation(
// fixing http://crbug.com/101395.
if (frame_->parent() == NULL) {
OpenURL(info.urlRequest.url(), referrer, info.defaultPolicy,
- info.replacesCurrentHistoryItem);
+ info.replacesCurrentHistoryItem, false);
return blink::WebNavigationPolicyIgnore; // Suppress the load here.
}
@@ -4532,10 +4530,22 @@ WebNavigationPolicy RenderFrameImpl::decidePolicyForNavigation(
if (is_content_initiated && IsTopLevelNavigation(frame_) &&
render_view_->renderer_preferences_
.browser_handles_all_top_level_requests) {
- OpenURL(url, referrer, info.defaultPolicy, info.replacesCurrentHistoryItem);
+ OpenURL(url, referrer, info.defaultPolicy, info.replacesCurrentHistoryItem,
+ false);
return blink::WebNavigationPolicyIgnore; // Suppress the load here.
}
+ // 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.
+ if (SiteIsolationPolicy::UseSubframeNavigationEntries() &&
+ info.isHistoryNavigationInNewChildFrame && is_content_initiated) {
+ OpenURL(url, referrer, info.defaultPolicy, info.replacesCurrentHistoryItem,
+ true);
+ // Suppress the load in Blink but mark the frame as loading.
+ return blink::WebNavigationPolicyHandledByClient;
+ }
+
// Use the frame's original request's URL rather than the document's URL for
// subsequent checks. For a popup, the document's URL may become the opener
// window's URL if the opener has called document.write().
@@ -4595,7 +4605,7 @@ WebNavigationPolicy RenderFrameImpl::decidePolicyForNavigation(
if (should_fork) {
OpenURL(url, send_referrer ? referrer : Referrer(), info.defaultPolicy,
- info.replacesCurrentHistoryItem);
+ info.replacesCurrentHistoryItem, false);
return blink::WebNavigationPolicyIgnore; // Suppress the load here.
}
}
@@ -4635,7 +4645,7 @@ WebNavigationPolicy RenderFrameImpl::decidePolicyForNavigation(
if (is_fork) {
// Open the URL via the browser, not via WebKit.
OpenURL(url, Referrer(), info.defaultPolicy,
- info.replacesCurrentHistoryItem);
+ info.replacesCurrentHistoryItem, false);
return blink::WebNavigationPolicyIgnore;
}
@@ -4695,7 +4705,8 @@ void RenderFrameImpl::OnGetSerializedHtmlWithLocalLinks(
void RenderFrameImpl::OpenURL(const GURL& url,
const Referrer& referrer,
WebNavigationPolicy policy,
- bool should_replace_current_entry) {
+ bool should_replace_current_entry,
+ bool is_history_navigation_in_new_child) {
FrameHostMsg_OpenURL_Params params;
params.url = url;
params.referrer = referrer;
@@ -4724,6 +4735,12 @@ void RenderFrameImpl::OpenURL(const GURL& url,
WebUserGestureIndicator::consumeUserGesture();
}
+ if (is_history_navigation_in_new_child) {
+ DCHECK(SiteIsolationPolicy::UseSubframeNavigationEntries());
+ params.is_history_navigation_in_new_child = true;
+ params.frame_unique_name = frame_->uniqueName().utf8();
+ }
+
Send(new FrameHostMsg_OpenURL(routing_id_, params));
}
@@ -4856,6 +4873,8 @@ void RenderFrameImpl::NavigateInternal(
: blink::WebHistoryDifferentDocumentLoad;
// Navigate the frame directly.
+ // TODO(creis): Use InitialHistoryLoad rather than BackForward for a
+ // history navigation in a newly created subframe.
WebURLRequest request =
frame_->requestFromHistoryItem(history_item, cache_policy);
frame_->load(request, blink::WebFrameLoadType::BackForward,
« no previous file with comments | « content/renderer/render_frame_impl.h ('k') | testing/buildbot/chromium.fyi.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698