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..15623be01a21dd152fa8cc1fd280ffffa40ce09d 100644 |
--- a/content/browser/frame_host/navigation_request.cc |
+++ b/content/browser/frame_host/navigation_request.cc |
@@ -229,7 +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 |
alexmos
2016/11/07 22:51:46
nit: need { for else
arthursonzogni
2016/11/08 12:21:30
Done.
|
+ is_srcdoc_ = false; |
restore_type_ = entry->restore_type(); |
is_view_source_ = entry->IsViewSourceMode(); |
@@ -239,6 +241,7 @@ NavigationRequest::NavigationRequest( |
// SiteInstance as the initiating renderer. |
source_site_instance_ = |
frame_tree_node->current_frame_host()->GetSiteInstance(); |
+ is_srcdoc_ = false; |
} |
// Update the load flags with cache information. |
@@ -285,6 +288,13 @@ void NavigationRequest::BeginNavigation() { |
// it immediately. |
state_ = RESPONSE_STARTED; |
+ // Iframes with the srcdoc attribute have the "about::srcdoc" URL inside the |
+ // renderer and the about::blank URL inside the browser. The conversion is |
+ // 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 +309,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 |
} |