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

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 (@nasko) 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
« no previous file with comments | « content/browser/frame_host/navigation_request.h ('k') | content/browser/frame_host/navigator_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..42f2abd2be80a2374219d27b78746ff89fe9f0d8 100644
--- a/content/browser/frame_host/navigation_request.cc
+++ b/content/browser/frame_host/navigation_request.cc
@@ -218,6 +218,7 @@ NavigationRequest::NavigationRequest(
begin_params_(begin_params),
request_params_(request_params),
browser_initiated_(browser_initiated),
+ is_srcdoc_(false),
state_(NOT_STARTED),
restore_type_(RestoreType::NONE),
is_view_source_(false),
@@ -229,6 +230,7 @@ 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();
}
restore_type_ = entry->restore_type();
@@ -285,6 +287,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 +308,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
}
« no previous file with comments | « content/browser/frame_host/navigation_request.h ('k') | content/browser/frame_host/navigator_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698