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

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

Issue 2901833002: Create NavigationHandle after beforeunload with PlzNavigate. (Closed)
Patch Set: small fix from jam Created 3 years, 7 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/browser/frame_host/navigation_request.h ('k') | content/browser/frame_host/navigator.h » ('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 ad1b6c07ee7f249c954f06ab208aaa5b312c7fea..8fb708f2d979f82b1ae947abe1b814282b1ce947 100644
--- a/content/browser/frame_host/navigation_request.cc
+++ b/content/browser/frame_host/navigation_request.cc
@@ -257,6 +257,7 @@ std::unique_ptr<NavigationRequest> NavigationRequest::CreateBrowserInitiated(
// static
std::unique_ptr<NavigationRequest> NavigationRequest::CreateRendererInitiated(
FrameTreeNode* frame_tree_node,
+ NavigationEntryImpl* entry,
const CommonNavigationParams& common_params,
const BeginNavigationParams& begin_params,
int current_history_list_offset,
@@ -297,7 +298,7 @@ std::unique_ptr<NavigationRequest> NavigationRequest::CreateRendererInitiated(
frame_tree_node, common_params, begin_params, request_params,
false, // browser_initiated
false, // may_transfer
- nullptr, nullptr));
+ nullptr, entry));
return navigation_request;
}
@@ -356,9 +357,12 @@ NavigationRequest::NavigationRequest(
// Add necessary headers that may not be present in the BeginNavigationParams.
std::string user_agent_override;
- if (entry && entry->GetIsOverridingUserAgent()) {
- user_agent_override =
- frame_tree_node_->navigator()->GetDelegate()->GetUserAgentOverride();
+ if (entry) {
+ nav_entry_id_ = entry->GetUniqueID();
+ if (entry->GetIsOverridingUserAgent()) {
+ user_agent_override =
+ frame_tree_node_->navigator()->GetDelegate()->GetUserAgentOverride();
+ }
}
net::HttpRequestHeaders headers;
@@ -380,6 +384,19 @@ void NavigationRequest::BeginNavigation() {
TRACE_EVENT_ASYNC_STEP_INTO0("navigation", "NavigationRequest", this,
"BeginNavigation");
state_ = STARTED;
+ CreateNavigationHandle();
+
+ if (nav_entry_id_) {
+ NavigationEntryImpl* nav_entry =
+ static_cast<NavigationControllerImpl*>(
+ frame_tree_node_->navigator()->GetController())
+ ->GetEntryWithUniqueID(nav_entry_id_);
+ if (nav_entry) {
+ navigation_handle_->set_base_url_for_data_url(
+ nav_entry->GetBaseURLForDataURL());
+ }
+ }
+
RenderFrameDevToolsAgentHost::OnBeforeNavigation(navigation_handle_.get());
if (ShouldMakeNetworkRequestForURL(common_params_.url) &&
@@ -427,7 +444,7 @@ void NavigationRequest::SetWaitingForRendererResponse() {
state_ = WAITING_FOR_RENDERER_RESPONSE;
}
-void NavigationRequest::CreateNavigationHandle(int pending_nav_entry_id) {
+void NavigationRequest::CreateNavigationHandle() {
DCHECK_EQ(frame_tree_node_->navigation_request(), this);
FrameTreeNode* frame_tree_node = frame_tree_node_;
@@ -442,7 +459,7 @@ void NavigationRequest::CreateNavigationHandle(int pending_nav_entry_id) {
FrameMsg_Navigate_Type::IsSameDocument(
common_params_.navigation_type),
common_params_.navigation_start,
- pending_nav_entry_id,
+ nav_entry_id_,
false, // started_in_context_menu
common_params_.should_check_main_world_csp,
begin_params_.is_form_submission);
@@ -633,8 +650,11 @@ void NavigationRequest::OnRequestFailed(bool has_stale_copy_in_cache,
// renderer, however do not discard the pending entry so that the URL bar
// shows them correctly.
if (!IsRendererDebugURL(common_params_.url)) {
+ int expected_pending_entry_id =
+ navigation_handle_.get() ? navigation_handle_->pending_nav_entry_id()
+ : nav_entry_id_;
frame_tree_node_->navigator()->DiscardPendingEntryIfNeeded(
- navigation_handle_.get());
+ expected_pending_entry_id);
}
// If the request was canceled by the user do not show an error page.
« no previous file with comments | « content/browser/frame_host/navigation_request.h ('k') | content/browser/frame_host/navigator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698