summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authorprimiano@chromium.org <primiano@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-31 12:52:26 +0000
committerprimiano@chromium.org <primiano@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-31 12:52:26 +0000
commitc3b3d9590cbef573fafbffe7e33a43af28036812 (patch)
tree022aefde417a82064aa0694fa2b7449a00bd97fc /content
parentdf1225e6c41e906e5484e3bfadf3ae60bc684580 (diff)
downloadchromium_src-c3b3d9590cbef573fafbffe7e33a43af28036812.zip
chromium_src-c3b3d9590cbef573fafbffe7e33a43af28036812.tar.gz
chromium_src-c3b3d9590cbef573fafbffe7e33a43af28036812.tar.bz2
Revert to default title upon page reload (and the new page does not have a <title> tag)
BUG=96041 TEST= Review URL: http://codereview.chromium.org/9288060 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@119891 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/browser/tab_contents/navigation_controller_impl.cc7
-rw-r--r--content/browser/tab_contents/navigation_controller_impl_unittest.cc6
2 files changed, 12 insertions, 1 deletions
diff --git a/content/browser/tab_contents/navigation_controller_impl.cc b/content/browser/tab_contents/navigation_controller_impl.cc
index 05dbda2..7a1ef2f 100644
--- a/content/browser/tab_contents/navigation_controller_impl.cc
+++ b/content/browser/tab_contents/navigation_controller_impl.cc
@@ -267,6 +267,13 @@ void NavigationControllerImpl::ReloadInternal(bool check_for_repost,
DiscardNonCommittedEntriesInternal();
pending_entry_index_ = current_index;
+
+ // The title of the page being reloaded might have been removed in the
+ // meanwhile, so we need to revert to the default title upon reload and
+ // invalidate the previously cached title (SetTitle will do both).
+ // See Chromium issue 96041.
+ entries_[pending_entry_index_]->SetTitle(string16());
+
entries_[pending_entry_index_]->SetTransitionType(
content::PAGE_TRANSITION_RELOAD);
NavigateToPendingEntry(reload_type);
diff --git a/content/browser/tab_contents/navigation_controller_impl_unittest.cc b/content/browser/tab_contents/navigation_controller_impl_unittest.cc
index c99e5a5..564f47d 100644
--- a/content/browser/tab_contents/navigation_controller_impl_unittest.cc
+++ b/content/browser/tab_contents/navigation_controller_impl_unittest.cc
@@ -559,7 +559,7 @@ TEST_F(NavigationControllerTest, Reload) {
rvh()->SendNavigate(0, url1);
EXPECT_TRUE(notifications.Check1AndReset(
content::NOTIFICATION_NAV_ENTRY_COMMITTED));
-
+ controller.GetActiveEntry()->SetTitle(ASCIIToUTF16("Title"));
controller.Reload(true);
EXPECT_EQ(0U, notifications.size());
@@ -571,6 +571,10 @@ TEST_F(NavigationControllerTest, Reload) {
EXPECT_TRUE(controller.GetPendingEntry());
EXPECT_FALSE(controller.CanGoBack());
EXPECT_FALSE(controller.CanGoForward());
+ // Make sure the title has been cleared (will be redrawn just after reload).
+ // Avoids a stale cached title when the new page being reloaded has no title.
+ // See http://crbug.com/96041.
+ EXPECT_TRUE(controller.GetActiveEntry()->GetTitle().empty());
rvh()->SendNavigate(0, url1);
EXPECT_TRUE(notifications.Check1AndReset(