summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authorpfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-25 11:24:00 +0000
committerpfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-25 11:24:00 +0000
commit0f38dc4551ef947f74259b3e7c92b984bf554c60 (patch)
treedd0bd5def0622f1e89bd07e32053a1a44dc86a37 /content
parenta36a00c43da41700edcc4e50da238a0b937f7421 (diff)
downloadchromium_src-0f38dc4551ef947f74259b3e7c92b984bf554c60.zip
chromium_src-0f38dc4551ef947f74259b3e7c92b984bf554c60.tar.gz
chromium_src-0f38dc4551ef947f74259b3e7c92b984bf554c60.tar.bz2
Duplicate tab does not work for POST pages.
BUG=17261 TEST= Review URL: http://codereview.chromium.org/6549009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@76042 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/browser/renderer_host/test_render_view_host.cc3
-rw-r--r--content/browser/tab_contents/navigation_controller.cc6
-rw-r--r--content/browser/tab_contents/navigation_controller_unittest.cc16
-rw-r--r--content/browser/tab_contents/render_view_host_manager_unittest.cc2
4 files changed, 25 insertions, 2 deletions
diff --git a/content/browser/renderer_host/test_render_view_host.cc b/content/browser/renderer_host/test_render_view_host.cc
index 918ddbd..eb66962 100644
--- a/content/browser/renderer_host/test_render_view_host.cc
+++ b/content/browser/renderer_host/test_render_view_host.cc
@@ -13,6 +13,7 @@
#include "content/browser/tab_contents/navigation_controller.h"
#include "content/browser/tab_contents/test_tab_contents.h"
#include "ui/gfx/rect.h"
+#include "webkit/glue/webkit_glue.h"
#include "webkit/glue/webpreferences.h"
#include "webkit/glue/password_form.h"
@@ -35,6 +36,7 @@ void InitNavigateParams(ViewHostMsg_FrameNavigate_Params* params,
params->gesture = NavigationGestureUser;
params->was_within_same_page = false;
params->is_post = false;
+ params->content_state = webkit_glue::CreateHistoryStateForURL(GURL(url));
}
TestRenderViewHost::TestRenderViewHost(SiteInstance* instance,
@@ -99,6 +101,7 @@ void TestRenderViewHost::SendNavigateWithTransition(
params.http_status_code = 0;
params.socket_address.set_host("2001:db8::1");
params.socket_address.set_port(80);
+ params.content_state = webkit_glue::CreateHistoryStateForURL(GURL(url));
ViewHostMsg_FrameNavigate msg(1, params);
OnMsgNavigate(msg);
diff --git a/content/browser/tab_contents/navigation_controller.cc b/content/browser/tab_contents/navigation_controller.cc
index ba3ef2a..7601d23 100644
--- a/content/browser/tab_contents/navigation_controller.cc
+++ b/content/browser/tab_contents/navigation_controller.cc
@@ -562,7 +562,9 @@ bool NavigationController::RendererDidNavigate(
// All committed entries should have nonempty content state so WebKit doesn't
// get confused when we go back to them (see the function for details).
- SetContentStateIfEmpty(GetActiveEntry());
+ DCHECK(!params.content_state.empty());
+ NavigationEntry* active_entry = GetActiveEntry();
+ active_entry->set_content_state(params.content_state);
// WebKit doesn't set the "auto" transition on meta refreshes properly (bug
// 1051891) so we manually set it for redirects which we normally treat as
@@ -580,7 +582,7 @@ bool NavigationController::RendererDidNavigate(
params.gesture == NavigationGestureAuto;
// Now prep the rest of the details for the notification and broadcast.
- details->entry = GetActiveEntry();
+ details->entry = active_entry;
details->is_main_frame = PageTransition::IsMainFrame(params.transition);
details->serialized_security_info = params.security_info;
details->is_content_filtered = params.is_content_filtered;
diff --git a/content/browser/tab_contents/navigation_controller_unittest.cc b/content/browser/tab_contents/navigation_controller_unittest.cc
index 0d3b0c1..2ab4517 100644
--- a/content/browser/tab_contents/navigation_controller_unittest.cc
+++ b/content/browser/tab_contents/navigation_controller_unittest.cc
@@ -747,6 +747,7 @@ TEST_F(NavigationControllerTest, Redirect) {
params.should_update_history = false;
params.gesture = NavigationGestureAuto;
params.is_post = false;
+ params.content_state = webkit_glue::CreateHistoryStateForURL(GURL(url2));
NavigationController::LoadCommittedDetails details;
@@ -802,6 +803,7 @@ TEST_F(NavigationControllerTest, PostThenRedirect) {
params.should_update_history = false;
params.gesture = NavigationGestureAuto;
params.is_post = false;
+ params.content_state = webkit_glue::CreateHistoryStateForURL(GURL(url2));
NavigationController::LoadCommittedDetails details;
@@ -847,6 +849,7 @@ TEST_F(NavigationControllerTest, ImmediateRedirect) {
params.should_update_history = false;
params.gesture = NavigationGestureAuto;
params.is_post = false;
+ params.content_state = webkit_glue::CreateHistoryStateForURL(GURL(url2));
NavigationController::LoadCommittedDetails details;
@@ -886,6 +889,7 @@ TEST_F(NavigationControllerTest, NewSubframe) {
params.should_update_history = false;
params.gesture = NavigationGestureUser;
params.is_post = false;
+ params.content_state = webkit_glue::CreateHistoryStateForURL(GURL(url2));
NavigationController::LoadCommittedDetails details;
EXPECT_TRUE(controller().RendererDidNavigate(params, 0, &details));
@@ -921,6 +925,7 @@ TEST_F(NavigationControllerTest, SubframeOnEmptyPage) {
params.should_update_history = false;
params.gesture = NavigationGestureAuto;
params.is_post = false;
+ params.content_state = webkit_glue::CreateHistoryStateForURL(GURL(url));
NavigationController::LoadCommittedDetails details;
EXPECT_FALSE(controller().RendererDidNavigate(params, 0, &details));
@@ -946,6 +951,7 @@ TEST_F(NavigationControllerTest, AutoSubframe) {
params.should_update_history = false;
params.gesture = NavigationGestureUser;
params.is_post = false;
+ params.content_state = webkit_glue::CreateHistoryStateForURL(GURL(url2));
// Navigating should do nothing.
NavigationController::LoadCommittedDetails details;
@@ -976,6 +982,7 @@ TEST_F(NavigationControllerTest, BackSubframe) {
params.should_update_history = false;
params.gesture = NavigationGestureUser;
params.is_post = false;
+ params.content_state = webkit_glue::CreateHistoryStateForURL(GURL(url2));
// This should generate a new entry.
NavigationController::LoadCommittedDetails details;
@@ -1059,6 +1066,7 @@ TEST_F(NavigationControllerTest, InPage) {
params.should_update_history = false;
params.gesture = NavigationGestureUser;
params.is_post = false;
+ params.content_state = webkit_glue::CreateHistoryStateForURL(GURL(url2));
// This should generate a new entry.
NavigationController::LoadCommittedDetails details;
@@ -1139,6 +1147,7 @@ TEST_F(NavigationControllerTest, InPage_Replace) {
params.should_update_history = false;
params.gesture = NavigationGestureUser;
params.is_post = false;
+ params.content_state = webkit_glue::CreateHistoryStateForURL(GURL(url2));
// This should NOT generate a new entry.
NavigationController::LoadCommittedDetails details;
@@ -1189,6 +1198,7 @@ TEST_F(NavigationControllerTest, ClientRedirectAfterInPageNavigation) {
params.should_update_history = true;
params.gesture = NavigationGestureUnknown;
params.is_post = false;
+ params.content_state = webkit_glue::CreateHistoryStateForURL(GURL(url));
// This should NOT generate a new entry.
NavigationController::LoadCommittedDetails details;
@@ -1213,6 +1223,7 @@ TEST_F(NavigationControllerTest, ClientRedirectAfterInPageNavigation) {
params.should_update_history = true;
params.gesture = NavigationGestureUnknown;
params.is_post = false;
+ params.content_state = webkit_glue::CreateHistoryStateForURL(GURL(url));
// This SHOULD generate a new entry.
NavigationController::LoadCommittedDetails details;
@@ -1346,6 +1357,7 @@ TEST_F(NavigationControllerTest, RestoreNavigate) {
params.should_update_history = false;
params.gesture = NavigationGestureUser;
params.is_post = false;
+ params.content_state = webkit_glue::CreateHistoryStateForURL(GURL(url));
NavigationController::LoadCommittedDetails details;
our_controller.RendererDidNavigate(params, 0, &details);
@@ -1610,6 +1622,7 @@ TEST_F(NavigationControllerTest, SameSubframe) {
params.should_update_history = false;
params.gesture = NavigationGestureAuto;
params.is_post = false;
+ params.content_state = webkit_glue::CreateHistoryStateForURL(GURL(subframe));
NavigationController::LoadCommittedDetails details;
EXPECT_FALSE(controller().RendererDidNavigate(params, 0, &details));
@@ -1635,6 +1648,8 @@ TEST_F(NavigationControllerTest, ViewSourceRedirect) {
params.should_update_history = false;
params.gesture = NavigationGestureAuto;
params.is_post = false;
+ params.content_state =
+ webkit_glue::CreateHistoryStateForURL(GURL(result_url));
NavigationController::LoadCommittedDetails details;
controller().RendererDidNavigate(params, 0, &details);
@@ -1698,6 +1713,7 @@ TEST_F(NavigationControllerTest, SubframeWhilePending) {
params.should_update_history = false;
params.gesture = NavigationGestureAuto;
params.is_post = false;
+ params.content_state = webkit_glue::CreateHistoryStateForURL(GURL(url1_sub));
NavigationController::LoadCommittedDetails details;
// This should return false meaning that nothing was actually updated.
diff --git a/content/browser/tab_contents/render_view_host_manager_unittest.cc b/content/browser/tab_contents/render_view_host_manager_unittest.cc
index fc13f1b..5c519a0 100644
--- a/content/browser/tab_contents/render_view_host_manager_unittest.cc
+++ b/content/browser/tab_contents/render_view_host_manager_unittest.cc
@@ -20,6 +20,7 @@
#include "content/browser/tab_contents/test_tab_contents.h"
#include "ipc/ipc_message.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "webkit/glue/webkit_glue.h"
class RenderViewHostManagerTest : public RenderViewHostTestHarness {
public:
@@ -331,6 +332,7 @@ TEST_F(RenderViewHostManagerTest, PageDoesBackAndReload) {
params.gesture = NavigationGestureAuto;
params.was_within_same_page = false;
params.is_post = false;
+ params.content_state = webkit_glue::CreateHistoryStateForURL(GURL(url2));
contents()->TestDidNavigate(evil_rvh, params);
// That should have cancelled the pending RVH, and the evil RVH should be the