Revert 195553 "Allow showing pending URL for new tab navigations..."
Caused spike in renderer crashes.
> Allow showing pending URL for new tab navigations, but only if safe.
>
> We revert to showing the opener's URL if it modifies the content of the
> initial blank page before the pending URL commits, to prevent URL spoofs.
>
> Implications:
> - All renderer-initiated navigations now have pending NavigationEntries.
> - GetURL and GetTitle use the visible entry, not active entry.
> - The renderer notifies the browser if DOM mutations occur before first load.
>
> [Second attempt, after http://crrev.com/191277 was reverted.]
>
> BUG=9682
> TEST=Open a slow link in a new tab. Destination URL should be visible and reloadable.
>
> Review URL: https://chromiumcodereview.appspot.com/13846007
[email protected]
Review URL: https://codereview.chromium.org/13966012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@195970 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index b78842f..5c099ee 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -714,7 +714,7 @@
const GURL& WebContentsImpl::GetURL() const {
// We may not have a navigation entry yet
- NavigationEntry* entry = controller_.GetVisibleEntry();
+ NavigationEntry* entry = controller_.GetActiveEntry();
return entry ? entry->GetVirtualURL() : GURL::EmptyGURL();
}
@@ -860,7 +860,7 @@
render_manager_.pending_web_ui() : render_manager_.web_ui();
if (our_web_ui) {
// Don't override the title in view source mode.
- entry = controller_.GetVisibleEntry();
+ entry = controller_.GetActiveEntry();
if (!(entry && entry->IsViewSourceMode())) {
// Give the Web UI the chance to override our title.
const string16& title = our_web_ui->GetOverriddenTitle();
@@ -874,13 +874,6 @@
// keep the old page's title until the new load has committed and we get a new
// title.
entry = controller_.GetLastCommittedEntry();
-
- // We make an exception for initial navigations, because we can have a
- // committed entry for an initial navigation when doing a history navigation
- // in a new tab, such as Ctrl+Back.
- if (entry && controller_.IsInitialNavigation())
- entry = controller_.GetVisibleEntry();
-
if (entry) {
return entry->GetTitleForDisplay(accept_languages);
}
@@ -1983,23 +1976,6 @@
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);
- }
-
// Notify observers about the start of the provisional load.
FOR_EACH_OBSERVER(WebContentsObserver, observers_,
DidStartProvisionalLoadForFrame(frame_id, parent_frame_id,
@@ -2935,11 +2911,6 @@
render_manager_.DidDisownOpener(rvh);
}
-void WebContentsImpl::DidAccessInitialDocument() {
- // Update the URL display.
- NotifyNavigationStateChanged(content::INVALIDATE_TYPE_URL);
-}
-
void WebContentsImpl::DocumentAvailableInMainFrame(
RenderViewHost* render_view_host) {
FOR_EACH_OBSERVER(WebContentsObserver, observers_,