From b9e2ecab97a8a7f3cce06951ab92a3eaef559206 Mon Sep 17 00:00:00 2001 From: "darin@chromium.org" Date: Fri, 2 Oct 2009 20:14:29 +0000 Subject: Do not discount a MANUAL_SUBFRAME load just because it involved some redirects. R=brettw BUG=21353 TEST=none Review URL: http://codereview.chromium.org/246073 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27887 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/session_history_uitest.cc | 22 +++++++++++++++++----- .../browser/tab_contents/navigation_controller.cc | 4 ---- .../data/session_history/location_redirect.html | 5 +++++ .../session_history/location_redirect_frame1.html | 5 +++++ .../session_history/location_redirect_frame2.html | 3 +++ 5 files changed, 30 insertions(+), 9 deletions(-) create mode 100644 chrome/test/data/session_history/location_redirect.html create mode 100644 chrome/test/data/session_history/location_redirect_frame1.html create mode 100644 chrome/test/data/session_history/location_redirect_frame2.html (limited to 'chrome') diff --git a/chrome/browser/session_history_uitest.cc b/chrome/browser/session_history_uitest.cc index 8d76583..473dc8b 100644 --- a/chrome/browser/session_history_uitest.cc +++ b/chrome/browser/session_history_uitest.cc @@ -23,10 +23,6 @@ const wchar_t kDocRoot[] = L"chrome/test/data"; class SessionHistoryTest : public UITest { protected: SessionHistoryTest() : UITest() { - FilePath path(test_data_directory_); - path = path.AppendASCII("session_history"); - - url_prefix_ = UTF8ToWide(net::FilePathToFileURL(path).spec()); } virtual void SetUp() { @@ -98,7 +94,6 @@ class SessionHistoryTest : public UITest { } protected: - wstring url_prefix_; scoped_refptr window_; scoped_refptr tab_; }; @@ -518,4 +513,21 @@ TEST_F(SessionHistoryTest, HistorySearchXSS) { EXPECT_EQ(L"History", GetTabTitle()); } +TEST_F(SessionHistoryTest, LocationChangeInSubframe) { + scoped_refptr server = + HTTPTestServer::CreateServer(kDocRoot, NULL); + ASSERT_TRUE(server.get()); + + ASSERT_TRUE(tab_->NavigateToURL(server->TestServerPage( + "files/session_history/location_redirect.html"))); + EXPECT_EQ(L"Default Title", GetTabTitle()); + + ASSERT_TRUE(tab_->NavigateToURL(GURL( + "javascript:void(frames[0].navigate())"))); + EXPECT_EQ(L"foo", GetTabTitle()); + + ASSERT_TRUE(tab_->GoBack()); + EXPECT_EQ(L"Default Title", GetTabTitle()); +} + } // namespace diff --git a/chrome/browser/tab_contents/navigation_controller.cc b/chrome/browser/tab_contents/navigation_controller.cc index fddf3de..a1fa599 100644 --- a/chrome/browser/tab_contents/navigation_controller.cc +++ b/chrome/browser/tab_contents/navigation_controller.cc @@ -711,10 +711,6 @@ void NavigationController::RendererDidNavigateNewSubframe( // This is not user-initiated. Ignore. return; } - if (IsRedirect(params)) { - // This is redirect. Ignore. - return; - } // Manual subframe navigations just get the current entry cloned so the user // can go back or forward to it. The actual subframe information will be diff --git a/chrome/test/data/session_history/location_redirect.html b/chrome/test/data/session_history/location_redirect.html new file mode 100644 index 0000000..07f0f2a --- /dev/null +++ b/chrome/test/data/session_history/location_redirect.html @@ -0,0 +1,5 @@ +Default Title + + diff --git a/chrome/test/data/session_history/location_redirect_frame1.html b/chrome/test/data/session_history/location_redirect_frame1.html new file mode 100644 index 0000000..3b9c05e --- /dev/null +++ b/chrome/test/data/session_history/location_redirect_frame1.html @@ -0,0 +1,5 @@ + diff --git a/chrome/test/data/session_history/location_redirect_frame2.html b/chrome/test/data/session_history/location_redirect_frame2.html new file mode 100644 index 0000000..21e040e --- /dev/null +++ b/chrome/test/data/session_history/location_redirect_frame2.html @@ -0,0 +1,3 @@ + -- cgit v1.1