diff options
author | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-13 22:22:01 +0000 |
---|---|---|
committer | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-13 22:22:01 +0000 |
commit | 070c49c0f0578ccda58ccc4d3528f9458b5a2879 (patch) | |
tree | 58ff235ee5d107b988c29ce649945c2cc779a2f8 | |
parent | bdf411b661a997857619a520c2812e98ba8006a1 (diff) | |
download | chromium_src-070c49c0f0578ccda58ccc4d3528f9458b5a2879.zip chromium_src-070c49c0f0578ccda58ccc4d3528f9458b5a2879.tar.gz chromium_src-070c49c0f0578ccda58ccc4d3528f9458b5a2879.tar.bz2 |
ChromeFrame back forward navigations at times would mess up the navigation history if the back and the current page both
were rendered in ChromeFrame. This was because the back operation would incorrectly navigate twice. Once via IE history
navigation and the other navigation would originate within the renderer and would execute as a new navigation in IE.
Fix is to not report backforward navigations as top level navigations to the external host.
Fixes bug http://code.google.com/p/chromium/issues/detail?id=44403
Bug=44403
Test=Covered by ChromeFrame test
Review URL: http://codereview.chromium.org/2982003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@52235 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/renderer/render_view.cc | 6 | ||||
-rw-r--r-- | chrome_frame/test/data/action.html | 10 | ||||
-rw-r--r-- | chrome_frame/test/data/form-get.html | 33 | ||||
-rw-r--r-- | chrome_frame/test/navigation_test.cc | 47 |
4 files changed, 93 insertions, 3 deletions
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc index 7030f80..c539120 100644 --- a/chrome/renderer/render_view.cc +++ b/chrome/renderer/render_view.cc @@ -5237,13 +5237,15 @@ bool RenderView::IsNonLocalTopLevelNavigation( if (last_top_level_navigation_page_id_ != page_id_ && // Not interested in reloads. type != WebKit::WebNavigationTypeReload && - type != WebKit::WebNavigationTypeFormSubmitted) { + type != WebKit::WebNavigationTypeFormSubmitted && + type != WebKit::WebNavigationTypeBackForward) { return true; } } // Not interested in reloads. if (type != WebKit::WebNavigationTypeReload && - type != WebKit::WebNavigationTypeFormSubmitted) { + type != WebKit::WebNavigationTypeFormSubmitted && + type != WebKit::WebNavigationTypeBackForward) { // The opener relationship between the new window and the parent allows the // new window to script the parent and vice versa. This is not allowed if // the origins of the two domains are different. This can be treated as a diff --git a/chrome_frame/test/data/action.html b/chrome_frame/test/data/action.html new file mode 100644 index 0000000..75023ae --- /dev/null +++ b/chrome_frame/test/data/action.html @@ -0,0 +1,10 @@ +<html> + <head> + <title> Form action </title> + </head> + <body> + <br /> + FORM SUBMITTED! + <br /> + </body> +</html> diff --git a/chrome_frame/test/data/form-get.html b/chrome_frame/test/data/form-get.html new file mode 100644 index 0000000..91768ea --- /dev/null +++ b/chrome_frame/test/data/form-get.html @@ -0,0 +1,33 @@ +<html> + <head> + <title> ChromeFrame form submit test(GET method) </title> + <script type="text/javascript"> + function submitForm() { + var submit = document.getElementById("submit_button"); + submit.click(); + } + </script> + </head> + <body onkeypress="submitForm();"> + <br /> + <form name="login" method="get" action="action.html"> + <table width="90%" border="0" align="center" cellpadding="4" + cellspacing="0" class="form-text"> + <tr> + <td>field 1</td> + <td><input type="text" name="field1" value="a"></td> + </tr> + <tr> + <td>field 2</td> + <td><input type="text" name="field2" value="b"></td> + </tr> + </table> + <br /> + <p style="margin-left: 28px"> + <input id="submit_button" name="submit" type="submit" value="Submit"> + + </p> + </form> + <br /> + </body> +</html> diff --git a/chrome_frame/test/navigation_test.cc b/chrome_frame/test/navigation_test.cc index 6258350..50da567 100644 --- a/chrome_frame/test/navigation_test.cc +++ b/chrome_frame/test/navigation_test.cc @@ -632,4 +632,49 @@ TEST_F(NavigationTest, DISABLED_DownloadInNewWindow) { LaunchIEAndNavigate(kDownloadFromNewWin); } -} // namespace chrome_frame_test
\ No newline at end of file +TEST_P(FullTabNavigationTest, FLAKY_FormPostBackForward) { + bool in_cf = GetParam().invokes_cf(); + // Navigate to the form-get.html page: + // - First set focus to chrome renderer window + // - Send over a character to the window. + // - This should initiate a form post which eventually navigates to the + // action.html page. + // Navigate backwards from the action.html page and then navigate forward + // from the form-get.html page. + + std::wstring kFormPostUrl = + GetTestUrl(L"form-get.html"); + + std::wstring kFormPostActionUrl = + GetTestUrl(L"action.html?field1=a&field2=b&submit=Submit"); + + server_mock_.ExpectAndServeAnyRequests(GetParam()); + InSequence expect_in_sequence_for_scope; + + ie_mock_.ExpectNavigation(in_cf, kFormPostUrl); + EXPECT_CALL(ie_mock_, OnLoad(in_cf, StrEq(kFormPostUrl))) + .WillOnce(testing::DoAll( + SetFocusToRenderer(&ie_mock_), + DelaySendChar(&loop_, 500, 'C', simulate_input::NONE))); + + ie_mock_.ExpectNavigation(in_cf, kFormPostActionUrl); + EXPECT_CALL(ie_mock_, OnLoad(in_cf, StrEq(kFormPostActionUrl))) + .WillOnce(testing::DoAll( + VerifyAddressBarUrl(&ie_mock_), + DelayGoBack(&ie_mock_, &loop_, 0))); + + ie_mock_.ExpectNavigation(in_cf, kFormPostUrl); + EXPECT_CALL(ie_mock_, OnLoad(in_cf, StrEq(kFormPostUrl))) + .WillOnce(testing::DoAll( + VerifyAddressBarUrl(&ie_mock_), + DelayGoForward(&ie_mock_, &loop_, 0))); + + ie_mock_.ExpectNavigation(in_cf, kFormPostActionUrl); + EXPECT_CALL(ie_mock_, OnLoad(in_cf, StrEq(kFormPostActionUrl))) + .WillOnce(CloseBrowserMock(&ie_mock_)); + + LaunchIEAndNavigate(kFormPostUrl); +} + +} // namespace chrome_frame_test + |