Commit d80835ac authored by Rakina Zata Amni's avatar Rakina Zata Amni Committed by Chromium LUCI CQ

Fix browser expectation of "method" and "post_id" on same-document navigations

Currently we use NavigationRequest's CommitNavigationParams' method in
VerifyThatBrowserAndRendererCalculatedDidCommitParamsMatch, but that
might differ than what the renderer returns on history same-document
navigations due to the history API resetting methods to "GET".

For POST ID, we use the last committed entry's POST ID on same-document
navigations, but that will only work for main frame cases. We need to
track the post ID directly in the RenderFrameHostImpl to cover cases
with subframe navigations.

This CL fixes the calculated values, and adds additional logging.

Bug: 1155414
Change-Id: I81358e641b7b3aaeda7fbcec58c92cef97ba9d27
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2576878
Commit-Queue: Rakina Zata Amni <rakina@chromium.org>
Reviewed-by: default avatarMatt Falkenhagen <falken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#835129}
parent 4ef9d510
...@@ -344,9 +344,13 @@ class CONTENT_EXPORT NavigationControllerImpl : public NavigationController { ...@@ -344,9 +344,13 @@ class CONTENT_EXPORT NavigationControllerImpl : public NavigationController {
FRIEND_TEST_ALL_PREFIXES(NavigationControllerBrowserTest, FRIEND_TEST_ALL_PREFIXES(NavigationControllerBrowserTest,
PostThenReplaceStateThenReload); PostThenReplaceStateThenReload);
FRIEND_TEST_ALL_PREFIXES(NavigationControllerBrowserTest, FRIEND_TEST_ALL_PREFIXES(NavigationControllerBrowserTest,
PostThenPushStateThenReload); PostThenPushStateThenReloadThenHistory);
FRIEND_TEST_ALL_PREFIXES(NavigationControllerBrowserTest, FRIEND_TEST_ALL_PREFIXES(NavigationControllerBrowserTest,
PostThenFragmentNavigationThenReload); PostThenFragmentNavigationThenReloadThenHistory);
FRIEND_TEST_ALL_PREFIXES(
NavigationControllerBrowserTest,
PostThenBrowserInitiatedFragmentNavigationThenReload);
FRIEND_TEST_ALL_PREFIXES(NavigationControllerBrowserTest, PostSubframe);
// Defines possible actions that are returned by // Defines possible actions that are returned by
// DetermineActionForHistoryNavigation(). // DetermineActionForHistoryNavigation().
......
...@@ -578,12 +578,15 @@ class CONTENT_EXPORT RenderFrameHostImpl ...@@ -578,12 +578,15 @@ class CONTENT_EXPORT RenderFrameHostImpl
// cases, use GetLastCommittedURL instead. // cases, use GetLastCommittedURL instead.
const GURL& last_successful_url() { return last_successful_url_; } const GURL& last_successful_url() { return last_successful_url_; }
// Return the http method of the last committed navigation. // Returns the http method of the last committed navigation.
const std::string& last_http_method() { return last_http_method_; } const std::string& last_http_method() { return last_http_method_; }
// Return the http status code of the last committed navigation. // Returns the http status code of the last committed navigation.
int last_http_status_code() { return last_http_status_code_; } int last_http_status_code() { return last_http_status_code_; }
// Returns the POST ID of the last committed navigation.
int64_t last_post_id() { return last_post_id_; }
// Returns true if |dest_url_info| should be considered the same site as the // Returns true if |dest_url_info| should be considered the same site as the
// current contents of this frame. This is the primary entry point for // current contents of this frame. This is the primary entry point for
// determining if a navigation to |dest_url_info| should stay in this // determining if a navigation to |dest_url_info| should stay in this
...@@ -2523,7 +2526,7 @@ class CONTENT_EXPORT RenderFrameHostImpl ...@@ -2523,7 +2526,7 @@ class CONTENT_EXPORT RenderFrameHostImpl
void VerifyThatBrowserAndRendererCalculatedDidCommitParamsMatch( void VerifyThatBrowserAndRendererCalculatedDidCommitParamsMatch(
NavigationRequest* navigation_request, NavigationRequest* navigation_request,
const mojom::DidCommitProvisionalLoadParams& params, const mojom::DidCommitProvisionalLoadParams& params,
bool is_same_document_navigation); mojom::DidCommitSameDocumentNavigationParamsPtr same_document_params);
// Evicts the document from the BackForwardCache if it is in the cache, // Evicts the document from the BackForwardCache if it is in the cache,
// and ineligible for caching. // and ineligible for caching.
...@@ -2657,6 +2660,9 @@ class CONTENT_EXPORT RenderFrameHostImpl ...@@ -2657,6 +2660,9 @@ class CONTENT_EXPORT RenderFrameHostImpl
// The http status code of the last committed navigation. // The http status code of the last committed navigation.
int last_http_status_code_ = 0; int last_http_status_code_ = 0;
// The POST ID of the last committed navigation.
int64_t last_post_id_ = 0;
// Local root subframes directly own their RenderWidgetHost. // Local root subframes directly own their RenderWidgetHost.
// Please see comments about the GetLocalRenderWidgetHost() function. // Please see comments about the GetLocalRenderWidgetHost() function.
// TODO(kenrb): Later this will also be used on the top-level frame, when // TODO(kenrb): Later this will also be used on the top-level frame, when
......
...@@ -2,6 +2,6 @@ ...@@ -2,6 +2,6 @@
<head></head> <head></head>
<body> <body>
<p>This page has an iframe.</p> <p>This page has an iframe.</p>
<p><iframe id="frame" src="simple_page.html"></iframe> <p><iframe id="frame" name="simple_iframe" src="simple_page_1.html"></iframe>
</body> </body>
</html> </html>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment