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

Unified Diff: content/browser/frame_host/navigation_request.cc

Issue 2482873002: Add is_srcdoc to FrameNavigationEntry and restore about::srcdoc URL. (Closed)
Patch Set: Addressed comments. Created 4 years, 1 month 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
Index: content/browser/frame_host/navigation_request.cc
diff --git a/content/browser/frame_host/navigation_request.cc b/content/browser/frame_host/navigation_request.cc
index 8feb8e20b4703844c6e6de8b98378b9c01a30f04..54206cd043fd33502c4af1e2fee1a49dd2ccb474 100644
--- a/content/browser/frame_host/navigation_request.cc
+++ b/content/browser/frame_host/navigation_request.cc
@@ -229,6 +229,9 @@ NavigationRequest::NavigationRequest(
if (frame_entry) {
source_site_instance_ = frame_entry->source_site_instance();
dest_site_instance_ = frame_entry->site_instance();
+ is_srcdoc_ = frame_entry->is_srcdoc();
+ } else {
+ is_srcdoc_ = false;
}
restore_type_ = entry->restore_type();
@@ -239,6 +242,7 @@ NavigationRequest::NavigationRequest(
// SiteInstance as the initiating renderer.
source_site_instance_ =
frame_tree_node->current_frame_host()->GetSiteInstance();
+ is_srcdoc_ = false;
nasko 2016/11/09 01:41:01 Why not initialize is_srcdoc_ in the initializer l
arthursonzogni 2016/11/09 09:23:13 You are right.
}
// Update the load flags with cache information.
@@ -285,6 +289,13 @@ void NavigationRequest::BeginNavigation() {
// it immediately.
state_ = RESPONSE_STARTED;
+ // Iframes with the srcdoc attribute have the "about::srcdoc" URL inside the
nasko 2016/11/09 01:41:01 nit: Only one colon in "about:srcdoc".
arthursonzogni 2016/11/09 09:23:13 Done.
+ // renderer and the about::blank URL inside the browser. The conversion is
nasko 2016/11/09 01:41:01 Ditto for about:blank.
arthursonzogni 2016/11/09 09:23:13 Done.
+ // made in RenderFrameHostImpl::OnDidCommitProvisionalLoad. The initial url
+ // must be restored here when the navigation is committed into the renderer.
+ if (is_srcdoc_)
+ common_params_.url = GURL(content::kAboutSrcDocURL);
+
// Select an appropriate RenderFrameHost.
RenderFrameHostImpl* render_frame_host =
frame_tree_node_->render_manager()->GetFrameHostForNavigation(*this);
@@ -299,11 +310,11 @@ void NavigationRequest::BeginNavigation() {
void NavigationRequest::CreateNavigationHandle(int pending_nav_entry_id) {
// TODO(nasko): Update the NavigationHandle creation to ensure that the
- // proper values are specified for is_same_page and is_srcdoc.
+ // proper values is specified for is_same_page.
navigation_handle_ = NavigationHandleImpl::Create(
common_params_.url, frame_tree_node_, !browser_initiated_,
- false, // is_same_page
- false, // is_srcdoc
+ false, // is_same_page
+ is_srcdoc_, // is_srcdoc
common_params_.navigation_start, pending_nav_entry_id,
false); // started_in_context_menu
}

Powered by Google App Engine
This is Rietveld 408576698