OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/frame_host/navigation_controller_impl.h" | 5 #include "content/browser/frame_host/navigation_controller_impl.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 6031 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6042 TestNavigationObserver observer(web_contents); | 6042 TestNavigationObserver observer(web_contents); |
6043 std::string script = "history.replaceState({}, '', '/server-redirect?" + | 6043 std::string script = "history.replaceState({}, '', '/server-redirect?" + |
6044 redirect_dest_url.spec() + "')"; | 6044 redirect_dest_url.spec() + "')"; |
6045 EXPECT_TRUE(ExecuteScript(root, script)); | 6045 EXPECT_TRUE(ExecuteScript(root, script)); |
6046 observer.Wait(); | 6046 observer.Wait(); |
6047 } | 6047 } |
6048 | 6048 |
6049 // Simulate the user hitting Enter in the omnibox without changing the URL. | 6049 // Simulate the user hitting Enter in the omnibox without changing the URL. |
6050 { | 6050 { |
6051 TestNavigationObserver observer(web_contents); | 6051 TestNavigationObserver observer(web_contents); |
6052 web_contents->GetController().LoadURL(web_contents->GetLastCommittedURL(), | 6052 web_contents->GetController().LoadURL( |
6053 Referrer(), ui::PAGE_TRANSITION_LINK, | 6053 web_contents->GetLastCommittedURL(), Referrer(), |
6054 std::string()); | 6054 ui::PAGE_TRANSITION_RELOAD, std::string()); |
clamy
2016/10/05 12:47:04
Are we sure that in the case described above we wo
nasko
2016/10/05 22:07:09
You are correct. Selecting the current URL in the
| |
6055 observer.Wait(); | 6055 observer.Wait(); |
6056 } | 6056 } |
6057 | 6057 |
6058 EXPECT_EQ(2, web_contents->GetController().GetEntryCount()); | |
6059 | |
6058 // Prior to fixing the issue, the above omnibox navigation (which is | 6060 // Prior to fixing the issue, the above omnibox navigation (which is |
6059 // classified as SAME_PAGE) was leaving the FrameNavigationEntry with the | 6061 // classified as SAME_PAGE) was leaving the FrameNavigationEntry with the |
6060 // same document sequence number as the previous entry but updates the URL. | 6062 // same document sequence number as the previous entry but updates the URL. |
6061 // Doing a back session history navigation now will cause the browser to | 6063 // Doing a back session history navigation now will cause the browser to |
6062 // consider it as in-page because of this matching document sequence number | 6064 // consider it as in-page because of this matching document sequence number |
6063 // and lead to a mismatch of origin and URL in the renderer process. | 6065 // and lead to a mismatch of origin and URL in the renderer process. |
6064 { | 6066 { |
6065 TestNavigationObserver observer(web_contents); | 6067 TestNavigationObserver observer(web_contents); |
6066 web_contents->GetController().GoBack(); | 6068 web_contents->GetController().GoBack(); |
6067 observer.Wait(); | 6069 observer.Wait(); |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6446 histogram.ExpectTotalCount(kReloadToReloadMetricName, 4); | 6448 histogram.ExpectTotalCount(kReloadToReloadMetricName, 4); |
6447 histogram.ExpectTotalCount(kReloadMainResourceToReloadMetricName, 3); | 6449 histogram.ExpectTotalCount(kReloadMainResourceToReloadMetricName, 3); |
6448 | 6450 |
6449 controller.ReloadToRefreshContent(false); | 6451 controller.ReloadToRefreshContent(false); |
6450 EXPECT_TRUE(WaitForLoadStop(shell()->web_contents())); | 6452 EXPECT_TRUE(WaitForLoadStop(shell()->web_contents())); |
6451 histogram.ExpectTotalCount(kReloadToReloadMetricName, 4); | 6453 histogram.ExpectTotalCount(kReloadToReloadMetricName, 4); |
6452 histogram.ExpectTotalCount(kReloadMainResourceToReloadMetricName, 3); | 6454 histogram.ExpectTotalCount(kReloadMainResourceToReloadMetricName, 3); |
6453 } | 6455 } |
6454 | 6456 |
6455 } // namespace content | 6457 } // namespace content |
OLD | NEW |