diff options
-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 + |