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

Unified Diff: content/browser/web_contents/web_contents_impl.cc

Issue 22622003: Ensure that renderer-initiated pending entries can be replaced when a new navigation is started. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix merge conflicts. Created 7 years, 4 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/web_contents/navigation_controller_impl_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/web_contents/web_contents_impl.cc
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 66e110ef1f33c5170e3f0ce455afa2723f3063e8..22327c2d551d85d7e54d66e7600a04713512be3c 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -2133,24 +2133,31 @@ void WebContentsImpl::DidStartProvisionalLoadForFrame(
render_view_host->GetProcess();
RenderViewHost::FilterURL(render_process_host, false, &validated_url);
- if (is_main_frame)
+ if (is_main_frame) {
DidChangeLoadProgress(0);
- // Create a pending entry for this provisional load (if none exists) using the
- // current SiteInstance, and ensure the address bar updates accordingly.
- // We don't know the referrer or extra headers at this point, but the referrer
- // will be set properly upon commit.
- if (is_main_frame && !controller_.GetPendingEntry()) {
- NavigationEntryImpl* entry = NavigationEntryImpl::FromNavigationEntry(
- controller_.CreateNavigationEntry(validated_url,
- content::Referrer(),
- content::PAGE_TRANSITION_LINK,
- true /* is_renderer_initiated */,
- std::string(), GetBrowserContext()));
- entry->set_site_instance(
- static_cast<SiteInstanceImpl*>(GetSiteInstance()));
- controller_.SetPendingEntry(entry);
- NotifyNavigationStateChanged(content::INVALIDATE_TYPE_URL);
+ // If there is no browser-initiated pending entry for this navigation and it
+ // is not for the error URL, create a pending entry using the current
+ // SiteInstance, and ensure the address bar updates accordingly. We don't
+ // know the referrer or extra headers at this point, but the referrer will
+ // be set properly upon commit.
+ NavigationEntry* pending_entry = controller_.GetPendingEntry();
+ bool has_browser_initiated_pending_entry = pending_entry &&
+ !NavigationEntryImpl::FromNavigationEntry(pending_entry)->
+ is_renderer_initiated();
+ if (!has_browser_initiated_pending_entry && !is_error_page) {
+ NavigationEntryImpl* entry = NavigationEntryImpl::FromNavigationEntry(
+ controller_.CreateNavigationEntry(validated_url,
+ content::Referrer(),
+ content::PAGE_TRANSITION_LINK,
+ true /* is_renderer_initiated */,
+ std::string(),
+ GetBrowserContext()));
+ entry->set_site_instance(
+ static_cast<SiteInstanceImpl*>(GetSiteInstance()));
+ controller_.SetPendingEntry(entry);
+ NotifyNavigationStateChanged(content::INVALIDATE_TYPE_URL);
+ }
}
// Notify observers about the start of the provisional load.
« no previous file with comments | « content/browser/web_contents/navigation_controller_impl_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698