Cleanup old navigation code in RenderFrameImpl
This CL cleans up the old navigation code from RenderFrameImpl. In
particular, it removes the StartNavigationParams and the
FrameMsg_Navigate IPC, which are no longer used.
Bug: 789577
Change-Id: I3c4e7a1ed8b735095f05234acaabbbe028c45156
Reviewed-on: https://chromium-review.googlesource.com/842543
Commit-Queue: Camille Lamy <[email protected]>
Commit-Queue: John Abd-El-Malek <[email protected]>
Reviewed-by: Ken Buchanan <[email protected]>
Reviewed-by: John Abd-El-Malek <[email protected]>
Cr-Commit-Position: refs/heads/master@{#526017}
diff --git a/content/renderer/loader/request_extra_data.cc b/content/renderer/loader/request_extra_data.cc
index 4202a41b..a18495c 100644
--- a/content/renderer/loader/request_extra_data.cc
+++ b/content/renderer/loader/request_extra_data.cc
@@ -20,8 +20,6 @@
allow_download_(true),
transition_type_(ui::PAGE_TRANSITION_LINK),
should_replace_current_entry_(false),
- transferred_request_child_id_(-1),
- transferred_request_request_id_(-1),
service_worker_provider_id_(kInvalidServiceWorkerProviderId),
originated_from_service_worker_(false),
initiated_in_secure_context_(false),
@@ -41,8 +39,6 @@
request->allow_download = allow_download_;
request->transition_type = transition_type_;
request->should_replace_current_entry = should_replace_current_entry_;
- request->transferred_request_child_id = transferred_request_child_id_;
- request->transferred_request_request_id = transferred_request_request_id_;
request->service_worker_provider_id = service_worker_provider_id_;
request->originated_from_service_worker = originated_from_service_worker_;
diff --git a/content/renderer/loader/request_extra_data.h b/content/renderer/loader/request_extra_data.h
index d2b78f4..bf0273860 100644
--- a/content/renderer/loader/request_extra_data.h
+++ b/content/renderer/loader/request_extra_data.h
@@ -56,14 +56,6 @@
bool should_replace_current_entry) {
should_replace_current_entry_ = should_replace_current_entry;
}
- void set_transferred_request_child_id(
- int transferred_request_child_id) {
- transferred_request_child_id_ = transferred_request_child_id;
- }
- void set_transferred_request_request_id(
- int transferred_request_request_id) {
- transferred_request_request_id_ = transferred_request_request_id;
- }
int service_worker_provider_id() const {
return service_worker_provider_id_;
}
@@ -127,7 +119,6 @@
block_mixed_plugin_content_ = block_mixed_plugin_content;
}
- // PlzNavigate
// Indicates whether a navigation was initiated by the browser or renderer.
bool navigation_initiated_by_renderer() const {
return navigation_initiated_by_renderer_;
@@ -154,8 +145,6 @@
bool allow_download_;
ui::PageTransition transition_type_;
bool should_replace_current_entry_;
- int transferred_request_child_id_;
- int transferred_request_request_id_;
int service_worker_provider_id_;
bool originated_from_service_worker_;
blink::WebString custom_user_agent_;
diff --git a/content/renderer/navigation_state_impl.cc b/content/renderer/navigation_state_impl.cc
index 659c27c..bd7fa791 100644
--- a/content/renderer/navigation_state_impl.cc
+++ b/content/renderer/navigation_state_impl.cc
@@ -11,15 +11,12 @@
NavigationStateImpl* NavigationStateImpl::CreateBrowserInitiated(
const CommonNavigationParams& common_params,
- const StartNavigationParams& start_params,
const RequestNavigationParams& request_params) {
- return new NavigationStateImpl(common_params, start_params, request_params,
- false);
+ return new NavigationStateImpl(common_params, request_params, false);
}
NavigationStateImpl* NavigationStateImpl::CreateContentInitiated() {
return new NavigationStateImpl(CommonNavigationParams(),
- StartNavigationParams(),
RequestNavigationParams(), true);
}
@@ -37,14 +34,12 @@
NavigationStateImpl::NavigationStateImpl(
const CommonNavigationParams& common_params,
- const StartNavigationParams& start_params,
const RequestNavigationParams& request_params,
bool is_content_initiated)
: request_committed_(false),
was_within_same_document_(false),
is_content_initiated_(is_content_initiated),
common_params_(common_params),
- start_params_(start_params),
request_params_(request_params) {}
} // namespace content
diff --git a/content/renderer/navigation_state_impl.h b/content/renderer/navigation_state_impl.h
index 87aad584..66461e2c 100644
--- a/content/renderer/navigation_state_impl.h
+++ b/content/renderer/navigation_state_impl.h
@@ -19,7 +19,6 @@
static NavigationStateImpl* CreateBrowserInitiated(
const CommonNavigationParams& common_params,
- const StartNavigationParams& start_params,
const RequestNavigationParams& request_params);
static NavigationStateImpl* CreateContentInitiated();
@@ -30,7 +29,6 @@
bool IsContentInitiated() override;
const CommonNavigationParams& common_params() const { return common_params_; }
- const StartNavigationParams& start_params() const { return start_params_; }
const RequestNavigationParams& request_params() const {
return request_params_;
}
@@ -46,7 +44,6 @@
private:
NavigationStateImpl(const CommonNavigationParams& common_params,
- const StartNavigationParams& start_params,
const RequestNavigationParams& request_params,
bool is_content_initiated);
@@ -57,7 +54,6 @@
const bool is_content_initiated_;
CommonNavigationParams common_params_;
- const StartNavigationParams start_params_;
// Note: if IsContentInitiated() is false, whether this navigation should
// replace the current entry in the back/forward history list is determined by
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
index 1ea6e43..9069bc75 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -65,7 +65,6 @@
#include "content/public/common/appcache_info.h"
#include "content/public/common/bind_interface_helpers.h"
#include "content/public/common/bindings_policy.h"
-#include "content/public/common/browser_side_navigation_policy.h"
#include "content/public/common/content_constants.h"
#include "content/public/common/content_features.h"
#include "content/public/common/content_switches.h"
@@ -402,18 +401,15 @@
std::unique_ptr<StreamOverrideParameters> stream_override,
bool is_view_source_mode_enabled,
bool is_same_document_navigation) {
- // PlzNavigate: use the original navigation url to construct the
- // WebURLRequest. The WebURLloaderImpl will replay the redirects afterwards
- // and will eventually commit the final url.
- const GURL navigation_url = IsBrowserSideNavigationEnabled() &&
- !request_params.original_url.is_empty()
+ // Use the original navigation url to construct the WebURLRequest. The
+ // WebURLloaderImpl will replay the redirects afterwards and will eventually
+ // commit the final url.
+ const GURL navigation_url = !request_params.original_url.is_empty()
? request_params.original_url
: common_params.url;
- const std::string navigation_method =
- IsBrowserSideNavigationEnabled() &&
- !request_params.original_method.empty()
- ? request_params.original_method
- : common_params.method;
+ const std::string navigation_method = !request_params.original_method.empty()
+ ? request_params.original_method
+ : common_params.method;
WebURLRequest request(navigation_url);
request.SetHTTPMethod(WebString::FromUTF8(navigation_method));
@@ -476,7 +472,6 @@
return std::min(browser_navigation_start, renderer_navigation_start);
}
-// PlzNavigate
CommonNavigationParams MakeCommonNavigationParams(
const blink::WebFrameClient::NavigationPolicyInfo& info,
int load_flags) {
@@ -1713,7 +1708,6 @@
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(RenderFrameImpl, msg)
- IPC_MESSAGE_HANDLER(FrameMsg_Navigate, OnNavigate)
IPC_MESSAGE_HANDLER(FrameMsg_BeforeUnload, OnBeforeUnload)
IPC_MESSAGE_HANDLER(FrameMsg_SwapOut, OnSwapOut)
IPC_MESSAGE_HANDLER(FrameMsg_SwapIn, OnSwapIn)
@@ -1836,20 +1830,6 @@
associated_interfaces_.BindRequest(interface_name, std::move(handle));
}
-void RenderFrameImpl::OnNavigate(
- const CommonNavigationParams& common_params,
- const StartNavigationParams& start_params,
- const RequestNavigationParams& request_params) {
- DCHECK(!IsBrowserSideNavigationEnabled());
- TRACE_EVENT2("navigation,rail", "RenderFrameImpl::OnNavigate", "id",
- routing_id_, "url", common_params.url.possibly_invalid_spec());
- NavigateInternal(common_params, start_params, request_params,
- std::unique_ptr<StreamOverrideParameters>(),
- /*subresource_loader_factories=*/base::nullopt,
- /* non-plznavigate navigations are not traced */
- base::UnguessableToken::Create());
-}
-
void RenderFrameImpl::BindEngagement(
blink::mojom::EngagementClientAssociatedRequest request) {
engagement_binding_.Bind(std::move(request));
@@ -2667,8 +2647,7 @@
// page load is regarded as the same browser initiated request.
if (!navigation_state->IsContentInitiated()) {
pending_navigation_params_.reset(new NavigationParams(
- navigation_state->common_params(), navigation_state->start_params(),
- navigation_state->request_params()));
+ navigation_state->common_params(), navigation_state->request_params()));
}
// Load an error page.
@@ -3065,7 +3044,6 @@
mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints,
base::Optional<URLLoaderFactoryBundle> subresource_loader_factories,
const base::UnguessableToken& devtools_navigation_token) {
- CHECK(IsBrowserSideNavigationEnabled());
// If this was a renderer-initiated navigation (nav_entry_id == 0) from this
// frame, but it was aborted, then ignore it.
if (!browser_side_navigation_pending_ &&
@@ -3076,29 +3054,17 @@
return;
}
- // This will override the url requested by the WebURLLoader, as well as
- // provide it with the response to the request.
- std::unique_ptr<StreamOverrideParameters> stream_override(
- new StreamOverrideParameters());
- stream_override->stream_url = body_url;
- stream_override->url_loader_client_endpoints =
- std::move(url_loader_client_endpoints);
- stream_override->response = head;
- stream_override->redirects = request_params.redirects;
- stream_override->redirect_responses = request_params.redirect_response;
- stream_override->redirect_infos = request_params.redirect_infos;
-
- // Used to notify the browser that it can release its |stream_handle_| when
- // the |stream_override| object isn't used anymore.
- // TODO(clamy): Remove this when we switch to Mojo streams.
- stream_override->on_delete = base::BindOnce(
- [](base::WeakPtr<RenderFrameImpl> weak_self, const GURL& url) {
- if (RenderFrameImpl* self = weak_self.get()) {
- self->Send(
- new FrameHostMsg_StreamHandleConsumed(self->routing_id_, url));
- }
- },
- weak_factory_.GetWeakPtr());
+ // First, check if this is a Debug URL. If so, handle it and stop the
+ // navigation right away.
+ base::WeakPtr<RenderFrameImpl> weak_this = weak_factory_.GetWeakPtr();
+ if (MaybeHandleDebugURL(common_params.url)) {
+ // The browser expects the frame to be loading the requested URL. Inform it
+ // that the load stopped if needed, while leaving the debug URL visible in
+ // the address bar.
+ if (weak_this && frame_ && !frame_->IsLoading())
+ Send(new FrameHostMsg_DidStopLoading(routing_id_));
+ return;
+ }
// If the request was initiated in the context of a user gesture then make
// sure that the navigation also executes in the context of a user gesture.
@@ -3109,13 +3075,219 @@
browser_side_navigation_pending_ = false;
browser_side_navigation_pending_url_ = GURL();
- NavigateInternal(common_params, StartNavigationParams(), request_params,
- std::move(stream_override),
- std::move(subresource_loader_factories),
+ // Clear pending navigations which weren't sent to the browser because we
+ // did not get a didStartProvisionalLoad() notification for them.
+ pending_navigation_info_.reset(nullptr);
+
+ // Lower bound for browser initiated navigation start time.
+ base::TimeTicks renderer_navigation_start = base::TimeTicks::Now();
+
+ bool is_reload =
+ FrameMsg_Navigate_Type::IsReload(common_params.navigation_type);
+ bool is_history_navigation = request_params.page_state.IsValid();
+ auto cache_mode = blink::mojom::FetchCacheMode::kDefault;
+ RenderFrameImpl::PrepareRenderViewForNavigation(common_params.url,
+ request_params);
+
+ GetContentClient()->SetActiveURL(
+ common_params.url, frame_->Top()->GetSecurityOrigin().ToString().Utf8());
+
+ // If this frame is navigating cross-process, it may naively assume that this
+ // is the first navigation in the frame, but this may not actually be the
+ // case. Inform the frame's state machine if this frame has already committed
+ // other loads.
+ if (request_params.has_committed_real_load)
+ frame_->SetCommittedFirstRealLoad();
+
+ // TODO(clamy): This may not be needed now that PlzNavigate has shipped.
+ if (is_reload && current_history_item_.IsNull()) {
+ // We cannot reload if we do not have any history state. This happens, for
+ // example, when recovering from a crash.
+ is_reload = false;
+ cache_mode = blink::mojom::FetchCacheMode::kValidateCache;
+ }
+
+ // If the navigation is for "view source", the WebLocalFrame needs to be put
+ // in a special mode.
+ if (request_params.is_view_source)
+ frame_->EnableViewSourceMode(true);
+
+ pending_navigation_params_.reset(
+ new NavigationParams(common_params, request_params));
+
+ // Sanitize navigation start and store in |pending_navigation_params_|.
+ // It will be picked up in UpdateNavigationState.
+ pending_navigation_params_->common_params.navigation_start =
+ SanitizeNavigationTiming(common_params.navigation_start,
+ renderer_navigation_start);
+
+ // Create parameters for a standard navigation, indicating whether it should
+ // replace the current NavigationEntry.
+ blink::WebFrameLoadType load_type =
+ common_params.should_replace_current_entry
+ ? blink::WebFrameLoadType::kReplaceCurrentItem
+ : blink::WebFrameLoadType::kStandard;
+ blink::WebHistoryLoadType history_load_type =
+ blink::kWebHistoryDifferentDocumentLoad;
+ bool should_load_request = false;
+ WebHistoryItem item_for_history_navigation;
+ bool is_same_document =
+ FrameMsg_Navigate_Type::IsSameDocument(common_params.navigation_type);
+
+ // Sanity check that the browser always sends us new loader factories on
+ // cross-document navigations with the Network Service enabled.
+ DCHECK(is_same_document ||
+ common_params.url.SchemeIs(url::kJavaScriptScheme) ||
+ !base::FeatureList::IsEnabled(features::kNetworkService) ||
+ subresource_loader_factories.has_value());
+
+ if (subresource_loader_factories)
+ subresource_loader_factories_ = std::move(subresource_loader_factories);
+
+ // If the Network Service is enabled, by this point the frame should always
+ // have subresource loader factories, even if they're from a previous (but
+ // same-document) commit.
+ DCHECK(!base::FeatureList::IsEnabled(features::kNetworkService) ||
+ subresource_loader_factories_.has_value());
+
+ // Used to determine whether this frame is actually loading a request as part
+ // of a history navigation.
+ bool has_history_navigation_in_frame = false;
+
+ // If we are reloading, then use the history state of the current frame.
+ // Otherwise, if we have history state, then we need to navigate to it, which
+ // corresponds to a back/forward navigation event. Update the parameters
+ // depending on the navigation type.
+ if (is_reload) {
+ load_type = ReloadFrameLoadTypeFor(common_params.navigation_type);
+ should_load_request = true;
+ } else if (is_history_navigation) {
+ // We must know the nav entry ID of the page we are navigating back to,
+ // which should be the case because history navigations are routed via the
+ // browser.
+ DCHECK_NE(0, request_params.nav_entry_id);
+ std::unique_ptr<HistoryEntry> entry =
+ PageStateToHistoryEntry(request_params.page_state);
+ if (entry) {
+ // The browser process sends a single WebHistoryItem for this frame.
+ // TODO(creis): Change PageState to FrameState. In the meantime, we
+ // store the relevant frame's WebHistoryItem in the root of the
+ // PageState.
+ item_for_history_navigation = entry->root();
+ switch (common_params.navigation_type) {
+ case FrameMsg_Navigate_Type::RELOAD:
+ case FrameMsg_Navigate_Type::RELOAD_BYPASSING_CACHE:
+ case FrameMsg_Navigate_Type::RELOAD_ORIGINAL_REQUEST_URL:
+ case FrameMsg_Navigate_Type::RESTORE:
+ case FrameMsg_Navigate_Type::RESTORE_WITH_POST:
+ case FrameMsg_Navigate_Type::HISTORY_DIFFERENT_DOCUMENT:
+ history_load_type = blink::kWebHistoryDifferentDocumentLoad;
+ break;
+ case FrameMsg_Navigate_Type::HISTORY_SAME_DOCUMENT:
+ history_load_type = blink::kWebHistorySameDocumentLoad;
+ break;
+ default:
+ NOTREACHED();
+ history_load_type = blink::kWebHistoryDifferentDocumentLoad;
+ }
+ load_type = request_params.is_history_navigation_in_new_child
+ ? blink::WebFrameLoadType::kInitialHistoryLoad
+ : blink::WebFrameLoadType::kBackForward;
+ should_load_request = true;
+
+ // Keep track of which subframes the browser process has history items
+ // for during a history navigation.
+ history_subframe_unique_names_ = request_params.subframe_unique_names;
+
+ if (history_load_type == blink::kWebHistorySameDocumentLoad) {
+ // If this is marked as a same document load but we haven't committed
+ // anything, treat it as a new load. The browser shouldn't let this
+ // happen.
+ if (current_history_item_.IsNull()) {
+ history_load_type = blink::kWebHistoryDifferentDocumentLoad;
+ NOTREACHED();
+ } else {
+ // Additionally, if the |current_history_item_|'s document
+ // sequence number doesn't match the one sent from the browser, it
+ // is possible that this renderer has committed a different
+ // document. In such case, don't use WebHistorySameDocumentLoad.
+ if (current_history_item_.DocumentSequenceNumber() !=
+ item_for_history_navigation.DocumentSequenceNumber()) {
+ history_load_type = blink::kWebHistoryDifferentDocumentLoad;
+ }
+ }
+ }
+
+ // If this navigation is to a history item for a new child frame, we may
+ // want to ignore it in some cases. If a Javascript navigation (i.e.,
+ // client redirect) interrupted it and has either been scheduled,
+ // started loading, or has committed, we should ignore the history item.
+ bool interrupted_by_client_redirect =
+ frame_->IsNavigationScheduledWithin(0) ||
+ frame_->GetProvisionalDocumentLoader() ||
+ !current_history_item_.IsNull();
+ if (request_params.is_history_navigation_in_new_child &&
+ interrupted_by_client_redirect) {
+ should_load_request = false;
+ has_history_navigation_in_frame = false;
+ }
+ }
+ } else {
+ // Navigate to the given URL.
+ should_load_request = true;
+ }
+
+ if (should_load_request) {
+ // Check if the navigation being committed originated as a client redirect.
+ bool is_client_redirect =
+ !!(common_params.transition & ui::PAGE_TRANSITION_CLIENT_REDIRECT);
+
+ // Perform a navigation for loadDataWithBaseURL if needed (for main frames).
+ // Note: the base URL might be invalid, so also check the data URL string.
+ bool should_load_data_url = !common_params.base_url_for_data_url.is_empty();
+#if defined(OS_ANDROID)
+ should_load_data_url |= !request_params.data_url_as_string.empty();
+#endif
+ if (is_main_frame_ && should_load_data_url) {
+ LoadDataURL(common_params, request_params, frame_, load_type,
+ item_for_history_navigation, history_load_type,
+ is_client_redirect);
+ } else {
+ WebURLRequest request = CreateURLRequestForCommit(
+ common_params, request_params, std::move(url_loader_client_endpoints),
+ head, body_url, is_same_document);
+
+ // Load the request.
+ frame_->Load(request, load_type, item_for_history_navigation,
+ history_load_type, is_client_redirect,
devtools_navigation_token);
- // Don't add code after this since NavigateInternal may have destroyed this
- // RenderFrameImpl.
+ // The load of the URL can result in this frame being removed. Use a
+ // WeakPtr as an easy way to detect whether this has occured. If so, this
+ // method should return immediately and not touch any part of the object,
+ // otherwise it will result in a use-after-free bug.
+ if (!weak_this)
+ return;
+ }
+ } else {
+ // The browser expects the frame to be loading this navigation. Inform it
+ // that the load stopped if needed.
+ // Note: in the case of history navigations, |should_load_request| will be
+ // false, and the frame may not have been set in a loading state. Do not
+ // send a stop message if a history navigation is loading in this frame
+ // nonetheless. This behavior will go away with subframe navigation
+ // entries.
+ if (frame_ && !frame_->IsLoading() && !has_history_navigation_in_frame)
+ Send(new FrameHostMsg_DidStopLoading(routing_id_));
+ }
+
+ // In case LoadRequest failed before DidCreateDocumentLoader was called.
+ pending_navigation_params_.reset();
+
+ // Reset the source location now that the commit checks have been processed.
+ frame_->GetDocumentLoader()->ResetSourceLocation();
+ if (frame_->GetProvisionalDocumentLoader())
+ frame_->GetProvisionalDocumentLoader()->ResetSourceLocation();
}
void RenderFrameImpl::CommitFailedNavigation(
@@ -3125,7 +3297,6 @@
int error_code,
const base::Optional<std::string>& error_page_content,
base::Optional<URLLoaderFactoryBundle> subresource_loader_factories) {
- DCHECK(IsBrowserSideNavigationEnabled());
bool is_reload =
FrameMsg_Navigate_Type::IsReload(common_params.navigation_type);
RenderFrameImpl::PrepareRenderViewForNavigation(common_params.url,
@@ -3144,8 +3315,8 @@
if (request_params.has_committed_real_load)
frame_->SetCommittedFirstRealLoad();
- pending_navigation_params_.reset(new NavigationParams(
- common_params, StartNavigationParams(), request_params));
+ pending_navigation_params_.reset(
+ new NavigationParams(common_params, request_params));
// Send the provisional load failure.
WebURLError error(
@@ -3792,14 +3963,6 @@
blink::WebDocumentLoader* document_loader) {
bool content_initiated = !pending_navigation_params_.get();
- // Make sure any previous redirect URLs end up in our new data source.
- if (pending_navigation_params_.get() && !IsBrowserSideNavigationEnabled()) {
- for (const auto& i :
- pending_navigation_params_->request_params.redirects) {
- document_loader->AppendRedirect(i);
- }
- }
-
DocumentState* document_state =
DocumentState::FromDocumentLoader(document_loader);
if (!document_state) {
@@ -3840,10 +4003,9 @@
document_loader->SetNavigationStartTime(
ConvertToBlinkTime(navigation_state->common_params().navigation_start));
- // PlzNavigate: if an actual navigation took place, inform the document
- // loader of what happened in the browser.
- if (IsBrowserSideNavigationEnabled() &&
- !navigation_state->request_params()
+ // If an actual navigation took place, inform the document loader of what
+ // happened in the browser.
+ if (!navigation_state->request_params()
.navigation_timing.fetch_start.is_null()) {
// Set timing of several events that happened during navigation.
// They will be used in blink for the Navigation Timing API.
@@ -3859,10 +4021,8 @@
!navigation_state->request_params().redirects.empty());
}
- // PlzNavigate: update the source location before processing the navigation
- // commit.
- if (IsBrowserSideNavigationEnabled() &&
- navigation_state->common_params().source_location.has_value()) {
+ // Update the source location before processing the navigation commit.
+ if (navigation_state->common_params().source_location.has_value()) {
blink::WebSourceLocation source_location;
source_location.url = WebString::FromLatin1(
navigation_state->common_params().source_location->url);
@@ -3899,10 +4059,8 @@
"RenderFrameImpl::didStartProvisionalLoad", "id", routing_id_,
"url", document_loader->GetRequest().Url().GetString().Utf8());
- // PlzNavigate:
// If we have a pending navigation to be sent to the browser send it here.
if (pending_navigation_info_.get()) {
- DCHECK(IsBrowserSideNavigationEnabled());
NavigationPolicyInfo info(request);
info.navigation_type = pending_navigation_info_->navigation_type;
info.default_policy = pending_navigation_info_->policy;
@@ -4670,7 +4828,7 @@
// user agent on its own. Similarly, it may indicate that we should set an
// X-Requested-With header. This must be done here to avoid breaking CORS
// checks.
- // PlzNavigate: there may also be a stream url associated with the request.
+ // There may also be a stream url associated with the request.
WebString custom_user_agent;
WebString requested_with;
std::unique_ptr<StreamOverrideParameters> stream_override;
@@ -4736,11 +4894,6 @@
bool is_navigational_request =
request.GetFrameType() != network::mojom::RequestContextFrameType::kNone;
if (is_navigational_request) {
- extra_data->set_transferred_request_child_id(
- navigation_state->start_params().transferred_request_child_id);
- extra_data->set_transferred_request_request_id(
- navigation_state->start_params().transferred_request_request_id);
-
// For navigation requests, we should copy the flag which indicates if this
// was a navigation initiated by the renderer to the new RequestExtraData
// instance.
@@ -4785,28 +4938,6 @@
request.SetHasUserGesture(
WebUserGestureIndicator::IsProcessingUserGesture(frame_));
- // StartNavigationParams should only apply to navigational requests (and not
- // to subresource requests). For example - Content-Type header provided via
- // OpenURLParams::extra_headers should only be applied to the original POST
- // navigation request (and not to subresource requests).
- if (is_navigational_request &&
- !navigation_state->start_params().extra_headers.empty()) {
- for (net::HttpUtil::HeadersIterator i(
- navigation_state->start_params().extra_headers.begin(),
- navigation_state->start_params().extra_headers.end(), "\n");
- i.GetNext();) {
- if (base::LowerCaseEqualsASCII(i.name(), "referer")) {
- WebString referrer = WebSecurityPolicy::GenerateReferrerHeader(
- blink::kWebReferrerPolicyDefault, request.Url(),
- WebString::FromUTF8(i.values()));
- request.SetHTTPReferrer(referrer, blink::kWebReferrerPolicyDefault);
- } else {
- request.SetHTTPHeaderField(WebString::FromUTF8(i.name()),
- WebString::FromUTF8(i.values()));
- }
- }
- }
-
if (!render_view_->renderer_preferences_.enable_referrers)
request.SetHTTPReferrer(WebString(), blink::kWebReferrerPolicyDefault);
}
@@ -5516,9 +5647,10 @@
"id", routing_id_);
render_view_->FrameDidStartLoading(frame_);
- // PlzNavigate: the browser is responsible for knowing the start of all
- // non-synchronous navigations.
- if (!IsBrowserSideNavigationEnabled() || !to_different_document)
+ // The browser is responsible for knowing the start of all non-synchronous
+ // navigations.
+ // TODO(clamy): Remove this IPC.
+ if (!to_different_document)
Send(new FrameHostMsg_DidStartLoading(routing_id_, to_different_document));
}
@@ -5581,7 +5713,6 @@
render_accessibility()->AccessibilityFocusedNodeChanged(node);
}
-// PlzNavigate
void RenderFrameImpl::OnReportContentSecurityPolicyViolation(
const content::CSPViolationParams& violation_params) {
frame_->ReportContentSecurityPolicyViolation(
@@ -5606,22 +5737,20 @@
// context and they're trying to navigate to a different context.
const GURL& url = info.url_request.Url();
- // With PlzNavigate, the redirect list is available for the first url. So
- // maintain the old behavior of not classifying the first URL in the chain as
- // a redirect.
+ // The redirect list is available for the first url. We maintain the old
+ // behavior of not classifying the first URL in the chain as a redirect.
bool is_redirect =
info.extra_data ||
(pending_navigation_params_ &&
!pending_navigation_params_->request_params.redirects.empty() &&
- (!IsBrowserSideNavigationEnabled() ||
- url != pending_navigation_params_->request_params.redirects[0]));
+ url != pending_navigation_params_->request_params.redirects[0]);
#ifdef OS_ANDROID
bool render_view_was_created_by_renderer =
render_view_->was_created_by_renderer_;
// The handlenavigation API is deprecated and will be removed once
// crbug.com/325351 is resolved.
- if ((!IsBrowserSideNavigationEnabled() || !IsURLHandledByNetworkStack(url)) &&
+ if (!IsURLHandledByNetworkStack(url) &&
GetContentClient()->renderer()->HandleNavigation(
this, is_content_initiated, render_view_was_created_by_renderer,
frame_, info.url_request, info.navigation_type, info.default_policy,
@@ -5778,9 +5907,8 @@
// There is no need to execute the BeforeUnload event during a redirect,
// since it was already executed at the start of the navigation.
!is_redirect &&
- // PlzNavigate: this should not be executed when commiting the navigation.
- (!IsBrowserSideNavigationEnabled() ||
- info.url_request.CheckForBrowserSideNavigation()) &&
+ // This should not be executed when commiting the navigation.
+ info.url_request.CheckForBrowserSideNavigation() &&
// No need to dispatch beforeunload if the frame has not committed a
// navigation and contains an empty initial document.
(has_accessed_initial_document_ || !current_history_item_.IsNull());
@@ -5812,10 +5940,9 @@
(info.archive_status == NavigationPolicyInfo::ArchiveStatus::Present) &&
!url.SchemeIs(url::kDataScheme);
- // PlzNavigate: if the navigation is not synchronous, send it to the browser.
- // This includes navigations with no request being sent to the network stack.
- if (IsBrowserSideNavigationEnabled() &&
- info.url_request.CheckForBrowserSideNavigation() &&
+ // If the navigation is not synchronous, send it to the browser. This
+ // includes navigations with no request being sent to the network stack.
+ if (info.url_request.CheckForBrowserSideNavigation() &&
IsURLHandledByNetworkStack(url) && !use_archive) {
if (info.default_policy == blink::kWebNavigationPolicyCurrentTab) {
// The BeginNavigation() call happens in didStartProvisionalLoad(). We
@@ -6242,113 +6369,45 @@
Send(new FrameHostMsg_OpenURL(routing_id_, params));
}
-void RenderFrameImpl::NavigateInternal(
+WebURLRequest RenderFrameImpl::CreateURLRequestForCommit(
const CommonNavigationParams& common_params,
- const StartNavigationParams& start_params,
const RequestNavigationParams& request_params,
- std::unique_ptr<StreamOverrideParameters> stream_params,
- base::Optional<URLLoaderFactoryBundle> subresource_loader_factories,
- const base::UnguessableToken& devtools_navigation_token) {
- bool browser_side_navigation = IsBrowserSideNavigationEnabled();
+ mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints,
+ const ResourceResponseHead& head,
+ const GURL& body_url,
+ bool is_same_document_navigation) {
+ // This will override the url requested by the WebURLLoader, as well as
+ // provide it with the response to the request.
+ std::unique_ptr<StreamOverrideParameters> stream_override(
+ new StreamOverrideParameters());
+ stream_override->stream_url = body_url;
+ stream_override->url_loader_client_endpoints =
+ std::move(url_loader_client_endpoints);
+ stream_override->response = head;
+ stream_override->redirects = request_params.redirects;
+ stream_override->redirect_responses = request_params.redirect_response;
+ stream_override->redirect_infos = request_params.redirect_infos;
- // First, check if this is a Debug URL. If so, handle it and stop the
- // navigation right away.
- base::WeakPtr<RenderFrameImpl> weak_this = weak_factory_.GetWeakPtr();
- if (MaybeHandleDebugURL(common_params.url)) {
- // The browser expects the frame to be loading the requested URL. Inform it
- // that the load stopped if needed, while leaving the debug URL visible in
- // the address bar.
- if (weak_this && frame_ && !frame_->IsLoading())
- Send(new FrameHostMsg_DidStopLoading(routing_id_));
- return;
- }
-
- // PlzNavigate
- // Clear pending navigations which weren't sent to the browser because we
- // did not get a didStartProvisionalLoad() notification for them.
- pending_navigation_info_.reset(nullptr);
-
- // Lower bound for browser initiated navigation start time.
- base::TimeTicks renderer_navigation_start = base::TimeTicks::Now();
- bool is_reload =
- FrameMsg_Navigate_Type::IsReload(common_params.navigation_type);
- bool is_history_navigation = request_params.page_state.IsValid();
- auto cache_mode = blink::mojom::FetchCacheMode::kDefault;
- RenderFrameImpl::PrepareRenderViewForNavigation(
- common_params.url, request_params);
-
- GetContentClient()->SetActiveURL(
- common_params.url, frame_->Top()->GetSecurityOrigin().ToString().Utf8());
-
- // If this frame is navigating cross-process, it may naively assume that this
- // is the first navigation in the frame, but this may not actually be the
- // case. Inform the frame's state machine if this frame has already committed
- // other loads.
- if (request_params.has_committed_real_load)
- frame_->SetCommittedFirstRealLoad();
-
- if (is_reload && current_history_item_.IsNull()) {
- // We cannot reload if we do not have any history state. This happens, for
- // example, when recovering from a crash.
- is_reload = false;
- cache_mode = blink::mojom::FetchCacheMode::kValidateCache;
- }
-
- // If the navigation is for "view source", the WebLocalFrame needs to be put
- // in a special mode.
- if (request_params.is_view_source)
- frame_->EnableViewSourceMode(true);
-
- pending_navigation_params_.reset(
- new NavigationParams(common_params, start_params, request_params));
-
- // Sanitize navigation start and store in |pending_navigation_params_|.
- // It will be picked up in UpdateNavigationState.
- pending_navigation_params_->common_params.navigation_start =
- SanitizeNavigationTiming(common_params.navigation_start,
- renderer_navigation_start);
-
- // Create parameters for a standard navigation, indicating whether it should
- // replace the current NavigationEntry.
- blink::WebFrameLoadType load_type =
- common_params.should_replace_current_entry
- ? blink::WebFrameLoadType::kReplaceCurrentItem
- : blink::WebFrameLoadType::kStandard;
- blink::WebHistoryLoadType history_load_type =
- blink::kWebHistoryDifferentDocumentLoad;
- bool should_load_request = false;
- WebHistoryItem item_for_history_navigation;
-
- // Enforce same-document navigation from the browser only if
- // browser-side-navigation is enabled.
- bool is_same_document =
- IsBrowserSideNavigationEnabled() &&
- FrameMsg_Navigate_Type::IsSameDocument(common_params.navigation_type);
-
- // Sanity check that the browser always sends us new loader factories on
- // cross-document navigations with the Network Service enabled.
- DCHECK(is_same_document ||
- common_params.url.SchemeIs(url::kJavaScriptScheme) ||
- !base::FeatureList::IsEnabled(features::kNetworkService) ||
- subresource_loader_factories.has_value());
-
- if (subresource_loader_factories)
- subresource_loader_factories_ = std::move(subresource_loader_factories);
-
- // If the Network Service is enabled, by this point the frame should always
- // have subresource loader factories, even if they're from a previous (but
- // same-document) commit.
- DCHECK(!base::FeatureList::IsEnabled(features::kNetworkService) ||
- subresource_loader_factories_.has_value());
+ // Used to notify the browser that it can release its |stream_handle_| when
+ // the |stream_override| object isn't used anymore.
+ // TODO(clamy): Remove this when we switch to Mojo streams.
+ stream_override->on_delete = base::BindOnce(
+ [](base::WeakPtr<RenderFrameImpl> weak_self, const GURL& url) {
+ if (RenderFrameImpl* self = weak_self.get()) {
+ self->Send(
+ new FrameHostMsg_StreamHandleConsumed(self->routing_id_, url));
+ }
+ },
+ weak_factory_.GetWeakPtr());
WebURLRequest request = CreateURLRequestForNavigation(
- common_params, request_params, std::move(stream_params),
- frame_->IsViewSourceModeEnabled(), is_same_document);
+ common_params, request_params, std::move(stream_override),
+ frame_->IsViewSourceModeEnabled(), is_same_document_navigation);
request.SetFrameType(IsTopLevelNavigation(frame_)
? network::mojom::RequestContextFrameType::kTopLevel
: network::mojom::RequestContextFrameType::kNested);
- if (IsBrowserSideNavigationEnabled() && common_params.post_data) {
+ if (common_params.post_data) {
request.SetHTTPBody(GetWebHTTPBodyForRequestBody(*common_params.post_data));
if (!request_params.post_content_type.empty()) {
request.AddHTTPHeaderField(
@@ -6357,193 +6416,18 @@
}
}
- // Used to determine whether this frame is actually loading a request as part
- // of a history navigation.
- bool has_history_navigation_in_frame = false;
-
#if defined(OS_ANDROID)
request.SetHasUserGesture(common_params.has_user_gesture);
#endif
- if (browser_side_navigation) {
- // PlzNavigate: Make sure that Blink's loader will not try to use browser
- // side navigation for this request (since it already went to the browser).
- request.SetCheckForBrowserSideNavigation(false);
+ // Make sure that Blink's loader will not try to use browser side navigation
+ // for this request (since it already went to the browser).
+ request.SetCheckForBrowserSideNavigation(false);
- request.SetNavigationStartTime(
- ConvertToBlinkTime(common_params.navigation_start));
- }
+ request.SetNavigationStartTime(
+ ConvertToBlinkTime(common_params.navigation_start));
- // If we are reloading, then use the history state of the current frame.
- // Otherwise, if we have history state, then we need to navigate to it, which
- // corresponds to a back/forward navigation event. Update the parameters
- // depending on the navigation type.
- if (is_reload) {
- load_type = ReloadFrameLoadTypeFor(common_params.navigation_type);
-
- if (!browser_side_navigation) {
- const GURL override_url =
- (common_params.navigation_type ==
- FrameMsg_Navigate_Type::RELOAD_ORIGINAL_REQUEST_URL)
- ? common_params.url
- : GURL();
- request = frame_->RequestForReload(load_type, override_url);
- }
- should_load_request = true;
- } else if (is_history_navigation) {
- // We must know the nav entry ID of the page we are navigating back to,
- // which should be the case because history navigations are routed via the
- // browser.
- DCHECK_NE(0, request_params.nav_entry_id);
- std::unique_ptr<HistoryEntry> entry =
- PageStateToHistoryEntry(request_params.page_state);
- if (entry) {
- // The browser process sends a single WebHistoryItem for this frame.
- // TODO(creis): Change PageState to FrameState. In the meantime, we
- // store the relevant frame's WebHistoryItem in the root of the
- // PageState.
- item_for_history_navigation = entry->root();
- switch (common_params.navigation_type) {
- case FrameMsg_Navigate_Type::RELOAD:
- case FrameMsg_Navigate_Type::RELOAD_BYPASSING_CACHE:
- case FrameMsg_Navigate_Type::RELOAD_ORIGINAL_REQUEST_URL:
- case FrameMsg_Navigate_Type::RESTORE:
- case FrameMsg_Navigate_Type::RESTORE_WITH_POST:
- case FrameMsg_Navigate_Type::HISTORY_DIFFERENT_DOCUMENT:
- history_load_type = blink::kWebHistoryDifferentDocumentLoad;
- break;
- case FrameMsg_Navigate_Type::HISTORY_SAME_DOCUMENT:
- history_load_type = blink::kWebHistorySameDocumentLoad;
- break;
- default:
- NOTREACHED();
- history_load_type = blink::kWebHistoryDifferentDocumentLoad;
- }
- load_type = request_params.is_history_navigation_in_new_child
- ? blink::WebFrameLoadType::kInitialHistoryLoad
- : blink::WebFrameLoadType::kBackForward;
- should_load_request = true;
-
- // Keep track of which subframes the browser process has history items
- // for during a history navigation.
- history_subframe_unique_names_ = request_params.subframe_unique_names;
-
- if (history_load_type == blink::kWebHistorySameDocumentLoad) {
- // If this is marked as a same document load but we haven't committed
- // anything, treat it as a new load. The browser shouldn't let this
- // happen.
- if (current_history_item_.IsNull()) {
- history_load_type = blink::kWebHistoryDifferentDocumentLoad;
- NOTREACHED();
- } else {
- // Additionally, if the |current_history_item_|'s document
- // sequence number doesn't match the one sent from the browser, it
- // is possible that this renderer has committed a different
- // document. In such case, don't use WebHistorySameDocumentLoad.
- if (current_history_item_.DocumentSequenceNumber() !=
- item_for_history_navigation.DocumentSequenceNumber()) {
- history_load_type = blink::kWebHistoryDifferentDocumentLoad;
- }
- }
- }
-
- // If this navigation is to a history item for a new child frame, we may
- // want to ignore it in some cases. If a Javascript navigation (i.e.,
- // client redirect) interrupted it and has either been scheduled,
- // started loading, or has committed, we should ignore the history item.
- bool interrupted_by_client_redirect =
- frame_->IsNavigationScheduledWithin(0) ||
- frame_->GetProvisionalDocumentLoader() ||
- !current_history_item_.IsNull();
- if (request_params.is_history_navigation_in_new_child &&
- interrupted_by_client_redirect) {
- should_load_request = false;
- has_history_navigation_in_frame = false;
- }
-
- // Generate the request for the load from the HistoryItem.
- // PlzNavigate: use the data sent by the browser for the url and the
- // HTTP state. The restoration of user state such as scroll position
- // will be done based on the history item during the load.
- if (!browser_side_navigation && should_load_request) {
- request = frame_->RequestFromHistoryItem(item_for_history_navigation,
- cache_mode);
- }
- }
- } else {
- // Navigate to the given URL.
- if (!start_params.extra_headers.empty() && !browser_side_navigation) {
- for (net::HttpUtil::HeadersIterator i(start_params.extra_headers.begin(),
- start_params.extra_headers.end(),
- "\n");
- i.GetNext();) {
- request.AddHTTPHeaderField(WebString::FromUTF8(i.name()),
- WebString::FromUTF8(i.values()));
- }
- }
-
- if (common_params.method == "POST" && !browser_side_navigation &&
- common_params.post_data) {
- request.SetHTTPBody(
- GetWebHTTPBodyForRequestBody(*common_params.post_data));
- }
-
- should_load_request = true;
- }
-
- if (should_load_request) {
- // PlzNavigate: check if the navigation being committed originated as a
- // client redirect.
- bool is_client_redirect =
- browser_side_navigation
- ? !!(common_params.transition & ui::PAGE_TRANSITION_CLIENT_REDIRECT)
- : false;
-
- // Perform a navigation for loadDataWithBaseURL if needed (for main frames).
- // Note: the base URL might be invalid, so also check the data URL string.
- bool should_load_data_url = !common_params.base_url_for_data_url.is_empty();
-#if defined(OS_ANDROID)
- should_load_data_url |= !request_params.data_url_as_string.empty();
-#endif
- if (is_main_frame_ && should_load_data_url) {
- LoadDataURL(common_params, request_params, frame_, load_type,
- item_for_history_navigation, history_load_type,
- is_client_redirect);
- } else {
- // Load the request.
- frame_->Load(request, load_type, item_for_history_navigation,
- history_load_type, is_client_redirect,
- devtools_navigation_token);
-
- // The load of the URL can result in this frame being removed. Use a
- // WeakPtr as an easy way to detect whether this has occured. If so, this
- // method should return immediately and not touch any part of the object,
- // otherwise it will result in a use-after-free bug.
- if (!weak_this)
- return;
- }
- } else {
- // The browser expects the frame to be loading this navigation. Inform it
- // that the load stopped if needed.
- // Note: in the case of history navigations, |should_load_request| will be
- // false, and the frame may not have been set in a loading state. Do not
- // send a stop message if a history navigation is loading in this frame
- // nonetheless. This behavior will go away with subframe navigation
- // entries.
- if (frame_ && !frame_->IsLoading() && !has_history_navigation_in_frame)
- Send(new FrameHostMsg_DidStopLoading(routing_id_));
- }
-
- // In case LoadRequest failed before DidCreateDocumentLoader was called.
- pending_navigation_params_.reset();
-
- // PlzNavigate: reset the source location now that the commit checks have been
- // processed.
- if (IsBrowserSideNavigationEnabled()) {
- frame_->GetDocumentLoader()->ResetSourceLocation();
- if (frame_->GetProvisionalDocumentLoader())
- frame_->GetProvisionalDocumentLoader()->ResetSourceLocation();
- }
+ return request;
}
URLLoaderFactoryBundle& RenderFrameImpl::GetSubresourceLoaderFactories() {
@@ -6699,7 +6583,6 @@
}
void RenderFrameImpl::BeginNavigation(const NavigationPolicyInfo& info) {
- CHECK(IsBrowserSideNavigationEnabled());
browser_side_navigation_pending_ = true;
browser_side_navigation_pending_url_ = info.url_request.Url();
@@ -6936,7 +6819,6 @@
if (IsBrowserInitiated(pending_navigation_params_.get())) {
return NavigationStateImpl::CreateBrowserInitiated(
pending_navigation_params_->common_params,
- pending_navigation_params_->start_params,
pending_navigation_params_->request_params);
}
return NavigationStateImpl::CreateContentInitiated();
diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h
index ab19f4f7..e587bb93 100644
--- a/content/renderer/render_frame_impl.h
+++ b/content/renderer/render_frame_impl.h
@@ -175,8 +175,6 @@
struct RequestNavigationParams;
struct ResourceResponseHead;
struct ScreenInfo;
-struct StartNavigationParams;
-struct StreamOverrideParameters;
class CONTENT_EXPORT RenderFrameImpl
: public RenderFrame,
@@ -967,9 +965,6 @@
//
// The documentation for these functions should be in
// content/common/*_messages.h for the message that the function is handling.
- void OnNavigate(const CommonNavigationParams& common_params,
- const StartNavigationParams& start_params,
- const RequestNavigationParams& request_params);
void OnBeforeUnload(bool is_reload);
void OnSwapIn();
void OnSwapOut(int proxy_routing_id,
@@ -1092,21 +1087,14 @@
bool send_referrer,
bool is_history_navigation_in_new_child);
- // Performs a navigation in the frame. This provides a unified function for
- // the current code path and the browser-side navigation path (in
- // development). Currently used by OnNavigate, with all *NavigationParams
- // provided by the browser. |stream_params| should be null.
- // PlzNavigate: used by CommitNavigation, with |common_params| and
- // |request_params| received by the browser. |stream_params| should be non
- // null and created from the information provided by the browser.
- // |start_params| is not used.
- void NavigateInternal(
+ // Creates a WebURLRequest to use fo the commit of a navigation.
+ blink::WebURLRequest CreateURLRequestForCommit(
const CommonNavigationParams& common_params,
- const StartNavigationParams& start_params,
const RequestNavigationParams& request_params,
- std::unique_ptr<StreamOverrideParameters> stream_params,
- base::Optional<URLLoaderFactoryBundle> subresource_loader_factories,
- const base::UnguessableToken& devtools_navigation_token);
+ mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints,
+ const ResourceResponseHead& head,
+ const GURL& body_url,
+ bool is_same_document_navigation);
// Returns a URLLoaderFactoryBundle which can be used to request subresources
// for this frame. Only valid to call when the Network Service is enabled.
@@ -1139,7 +1127,7 @@
base::string16* result);
// Loads the appropriate error page for the specified failure into the frame.
- // |entry| is only used by PlzNavigate when navigating to a history item.
+ // |entry| is only when navigating to a history item.
void LoadNavigationErrorPage(
const blink::WebURLRequest& failed_request,
const blink::WebURLError& error,
@@ -1175,7 +1163,6 @@
const GURL& url,
const RequestNavigationParams& request_params);
- // PlzNavigate
// Sends a FrameHostMsg_BeginNavigation to the browser
void BeginNavigation(const NavigationPolicyInfo& info);
@@ -1540,7 +1527,6 @@
// See BindingsPolicy for details.
int enabled_bindings_ = 0;
- // PlzNavigate:
// Contains information about a pending navigation to be sent to the browser.
// We save information about the navigation in decidePolicyForNavigation().
// The navigation is sent to the browser in didStartProvisionalLoad().
@@ -1559,9 +1545,9 @@
explicit PendingNavigationInfo(const NavigationPolicyInfo& info);
};
- // PlzNavigate: Contains information about a pending navigation to be sent to
- // the browser. This state is allocated in decidePolicyForNavigation() and
- // is used and released in didStartProvisionalLoad().
+ // Contains information about a pending navigation to be sent to the browser.
+ // This state is allocated in decidePolicyForNavigation() and is used and
+ // released in didStartProvisionalLoad().
std::unique_ptr<PendingNavigationInfo> pending_navigation_info_;
service_manager::BindSourceInfo browser_info_;
diff --git a/content/renderer/render_frame_impl_browsertest.cc b/content/renderer/render_frame_impl_browsertest.cc
index 10d237324..316a83d 100644
--- a/content/renderer/render_frame_impl_browsertest.cc
+++ b/content/renderer/render_frame_impl_browsertest.cc
@@ -406,10 +406,7 @@
common_params.url = GURL("data:text/html,min_zoomlimit_test");
common_params.navigation_type = FrameMsg_Navigate_Type::DIFFERENT_DOCUMENT;
GetMainRenderFrame()->SetHostZoomLevel(common_params.url, kMinZoomLevel);
- GetMainRenderFrame()->NavigateInternal(
- common_params, StartNavigationParams(), RequestNavigationParams(),
- std::unique_ptr<StreamOverrideParameters>(), URLLoaderFactoryBundle(),
- base::UnguessableToken::Create());
+ GetMainRenderFrame()->Navigate(common_params, RequestNavigationParams());
base::RunLoop().RunUntilIdle();
EXPECT_DOUBLE_EQ(kMinZoomLevel, view_->GetWebView()->ZoomLevel());
@@ -418,10 +415,7 @@
ZoomFactorToZoomLevel(1.0));
common_params.url = GURL("data:text/html,max_zoomlimit_test");
GetMainRenderFrame()->SetHostZoomLevel(common_params.url, kMaxZoomLevel);
- GetMainRenderFrame()->NavigateInternal(
- common_params, StartNavigationParams(), RequestNavigationParams(),
- std::unique_ptr<StreamOverrideParameters>(), URLLoaderFactoryBundle(),
- base::UnguessableToken::Create());
+ GetMainRenderFrame()->Navigate(common_params, RequestNavigationParams());
base::RunLoop().RunUntilIdle();
EXPECT_DOUBLE_EQ(kMaxZoomLevel, view_->GetWebView()->ZoomLevel());
}
diff --git a/content/renderer/render_view_browsertest.cc b/content/renderer/render_view_browsertest.cc
index b1def01..b9cf940 100644
--- a/content/renderer/render_view_browsertest.cc
+++ b/content/renderer/render_view_browsertest.cc
@@ -246,7 +246,6 @@
void GoToOffsetWithParams(int offset,
const PageState& state,
const CommonNavigationParams common_params,
- const StartNavigationParams start_params,
RequestNavigationParams request_params) {
EXPECT_TRUE(common_params.transition & ui::PAGE_TRANSITION_FORWARD_BACK);
int pending_offset = offset + view()->history_list_offset_;
@@ -256,7 +255,7 @@
request_params.pending_history_list_offset = pending_offset;
request_params.current_history_list_offset = view()->history_list_offset_;
request_params.current_history_list_length = view()->history_list_length_;
- frame()->Navigate(common_params, start_params, request_params);
+ frame()->Navigate(common_params, request_params);
// The load actually happens asynchronously, so we pump messages to process
// the pending continuation.
@@ -514,7 +513,6 @@
TEST_F(RenderViewImplTest, OnNavigationHttpPost) {
// An http url will trigger a resource load so cannot be used here.
CommonNavigationParams common_params;
- StartNavigationParams start_params;
RequestNavigationParams request_params;
common_params.url = GURL("data:text/html,<div>Page</div>");
common_params.navigation_type = FrameMsg_Navigate_Type::DIFFERENT_DOCUMENT;
@@ -528,7 +526,7 @@
post_data->AppendBytes(raw_data, length);
common_params.post_data = post_data;
- frame()->Navigate(common_params, start_params, request_params);
+ frame()->Navigate(common_params, request_params);
base::RunLoop().RunUntilIdle();
auto last_commit_params = frame()->TakeLastCommitParams();
@@ -570,8 +568,7 @@
"data:text/html,<html><head><title>Data page</title></head></html>";
render_thread_->sink().ClearMessages();
- frame()->Navigate(common_params, StartNavigationParams(),
- request_params);
+ frame()->Navigate(common_params, request_params);
const IPC::Message* frame_title_msg = nullptr;
do {
base::RunLoop().RunUntilIdle();
@@ -807,13 +804,12 @@
// Navigate to other page, which triggers the swap in.
CommonNavigationParams common_params;
- StartNavigationParams start_params;
RequestNavigationParams request_params;
common_params.url = GURL("data:text/html,<div>Page</div>");
common_params.navigation_type = FrameMsg_Navigate_Type::DIFFERENT_DOCUMENT;
common_params.transition = ui::PAGE_TRANSITION_TYPED;
- provisional_frame->Navigate(common_params, start_params, request_params);
+ provisional_frame->Navigate(common_params, request_params);
EXPECT_EQ(device_scale, view()->GetDeviceScaleFactor());
EXPECT_EQ(device_scale, view()->webview()->ZoomFactorForDeviceScaleFactor());
@@ -953,7 +949,7 @@
request_params_C.pending_history_list_offset = 2;
request_params_C.nav_entry_id = 3;
request_params_C.page_state = state_C;
- frame()->Navigate(common_params_C, StartNavigationParams(), request_params_C);
+ frame()->Navigate(common_params_C, request_params_C);
base::RunLoop().RunUntilIdle();
render_thread_->sink().ClearMessages();
@@ -972,7 +968,7 @@
request_params_B.pending_history_list_offset = 1;
request_params_B.nav_entry_id = 2;
request_params_B.page_state = state_B;
- frame()->Navigate(common_params_B, StartNavigationParams(), request_params_B);
+ frame()->Navigate(common_params_B, request_params_B);
// Back to page A and commit.
CommonNavigationParams common_params;
@@ -985,7 +981,7 @@
request_params.pending_history_list_offset = 0;
request_params.nav_entry_id = 1;
request_params.page_state = state_A;
- frame()->Navigate(common_params, StartNavigationParams(), request_params);
+ frame()->Navigate(common_params, request_params);
base::RunLoop().RunUntilIdle();
// Now ensure that the UpdateState message we receive is consistent
@@ -1311,8 +1307,7 @@
CommonNavigationParams common_params;
common_params.navigation_type = FrameMsg_Navigate_Type::DIFFERENT_DOCUMENT;
common_params.url = GURL("data:text/html,test data");
- frame()->Navigate(common_params, StartNavigationParams(),
- RequestNavigationParams());
+ frame()->Navigate(common_params, RequestNavigationParams());
// An error occurred.
view()->GetMainRenderFrame()->DidFailProvisionalLoad(
@@ -1331,8 +1326,7 @@
CommonNavigationParams common_params;
common_params.navigation_type = FrameMsg_Navigate_Type::DIFFERENT_DOCUMENT;
common_params.url = GURL("data:text/html,test data");
- frame()->Navigate(common_params, StartNavigationParams(),
- RequestNavigationParams());
+ frame()->Navigate(common_params, RequestNavigationParams());
// A cancellation occurred.
view()->GetMainRenderFrame()->DidFailProvisionalLoad(
@@ -1703,7 +1697,7 @@
TestRenderFrame* subframe =
static_cast<TestRenderFrame*>(RenderFrameImpl::FromWebFrame(
frame()->GetWebFrame()->FindFrameByName("frame")));
- subframe->Navigate(common_params, StartNavigationParams(), request_params);
+ subframe->Navigate(common_params, request_params);
FrameLoadWaiter(subframe).Wait();
// Copy the document content to std::wstring and compare with the
@@ -1812,8 +1806,7 @@
common_params.navigation_type = FrameMsg_Navigate_Type::DIFFERENT_DOCUMENT;
common_params.url = GURL("data:text/html,test data");
TestRenderFrame* main_frame = static_cast<TestRenderFrame*>(frame());
- main_frame->Navigate(common_params, StartNavigationParams(),
- RequestNavigationParams());
+ main_frame->Navigate(common_params, RequestNavigationParams());
// An error occurred.
main_frame->DidFailProvisionalLoad(error, blink::kWebStandardCommit);
@@ -1840,8 +1833,7 @@
common_params.navigation_type = FrameMsg_Navigate_Type::DIFFERENT_DOCUMENT;
common_params.url = GURL("data:text/html,test data");
TestRenderFrame* main_frame = static_cast<TestRenderFrame*>(frame());
- main_frame->Navigate(common_params, StartNavigationParams(),
- RequestNavigationParams());
+ main_frame->Navigate(common_params, RequestNavigationParams());
// An error occurred.
main_frame->DidFailProvisionalLoad(error, blink::kWebStandardCommit);
@@ -1872,8 +1864,7 @@
common_params.navigation_type = FrameMsg_Navigate_Type::DIFFERENT_DOCUMENT;
common_params.url = GURL("data:text/html,test data");
TestRenderFrame* main_frame = static_cast<TestRenderFrame*>(frame());
- main_frame->Navigate(common_params, StartNavigationParams(),
- RequestNavigationParams());
+ main_frame->Navigate(common_params, RequestNavigationParams());
// Emulate a 4xx/5xx main resource response with an empty body.
main_frame->DidReceiveResponse(response);
@@ -2026,8 +2017,7 @@
TEST_F(RenderViewImplTest, BrowserNavigationStart) {
auto common_params = MakeCommonNavigationParams(-TimeDelta::FromSeconds(1));
- frame()->Navigate(common_params, StartNavigationParams(),
- RequestNavigationParams());
+ frame()->Navigate(common_params, RequestNavigationParams());
FrameHostMsg_DidStartProvisionalLoad::Param nav_params =
ProcessAndReadIPC<FrameHostMsg_DidStartProvisionalLoad>();
EXPECT_EQ(common_params.navigation_start, std::get<2>(nav_params));
@@ -2043,8 +2033,7 @@
auto late_common_params = MakeCommonNavigationParams(TimeDelta::FromDays(42));
late_common_params.method = "POST";
- frame()->Navigate(late_common_params, StartNavigationParams(),
- RequestNavigationParams());
+ frame()->Navigate(late_common_params, RequestNavigationParams());
base::RunLoop().RunUntilIdle();
base::Time after_navigation =
base::Time::Now() + base::TimeDelta::FromDays(1);
@@ -2064,8 +2053,7 @@
ExecuteJavaScriptForTests("document.title = 'Hi!';");
auto common_params = MakeCommonNavigationParams(-TimeDelta::FromSeconds(1));
- frame()->Navigate(common_params, StartNavigationParams(),
- RequestNavigationParams());
+ frame()->Navigate(common_params, RequestNavigationParams());
FrameHostMsg_DidStartProvisionalLoad::Param nav_params =
ProcessAndReadIPC<FrameHostMsg_DidStartProvisionalLoad>();
@@ -2090,8 +2078,7 @@
// The browser navigation_start should not be used because beforeunload will
// be fired during Navigate.
- frame()->Navigate(common_params, StartNavigationParams(),
- RequestNavigationParams());
+ frame()->Navigate(common_params, RequestNavigationParams());
FrameHostMsg_DidStartProvisionalLoad::Param host_nav_params =
ProcessAndReadIPC<FrameHostMsg_DidStartProvisionalLoad>();
@@ -2124,7 +2111,7 @@
common_params_back.navigation_type =
FrameMsg_Navigate_Type::HISTORY_DIFFERENT_DOCUMENT;
GoToOffsetWithParams(-1, back_state, common_params_back,
- StartNavigationParams(), RequestNavigationParams());
+ RequestNavigationParams());
FrameHostMsg_DidStartProvisionalLoad::Param host_nav_params =
ProcessAndReadIPC<FrameHostMsg_DidStartProvisionalLoad>();
if (!IsBrowserSideNavigationEnabled()) {
@@ -2147,7 +2134,7 @@
common_params_forward.navigation_type =
FrameMsg_Navigate_Type::HISTORY_DIFFERENT_DOCUMENT;
GoToOffsetWithParams(1, forward_state, common_params_forward,
- StartNavigationParams(), RequestNavigationParams());
+ RequestNavigationParams());
FrameHostMsg_DidStartProvisionalLoad::Param host_nav_params2 =
ProcessAndReadIPC<FrameHostMsg_DidStartProvisionalLoad>();
if (!IsBrowserSideNavigationEnabled()) {
@@ -2172,7 +2159,7 @@
request_params.pending_history_list_offset = 1;
request_params.current_history_list_offset = 0;
request_params.current_history_list_length = 1;
- frame()->Navigate(common_params, StartNavigationParams(), request_params);
+ frame()->Navigate(common_params, request_params);
FrameHostMsg_DidStartProvisionalLoad::Param host_nav_params =
ProcessAndReadIPC<FrameHostMsg_DidStartProvisionalLoad>();
@@ -2225,8 +2212,7 @@
request_params.current_history_list_length = 2;
request_params.current_history_list_offset = 1;
request_params.pending_history_list_offset = 2;
- frame()->Navigate(CommonNavigationParams(), StartNavigationParams(),
- request_params);
+ frame()->Navigate(CommonNavigationParams(), request_params);
// The history list in RenderView should have been updated.
EXPECT_EQ(1, view()->HistoryBackListCount());