Commit 7ed98321 authored by Hitoshi Yoshida's avatar Hitoshi Yoshida Committed by Chromium LUCI CQ

BFcache: Call OnReactivated in ReadyToCommitNavigation

In web tests, TestRunner checks if a test can finish successfully
using the main window's main frame, and it is searched from a list
of main frames.
Internally, JavaScript code which tries to finish tests is invoked
from CommitNavigation. But when we use back/forward navigation with
BFcache, we update the list of main frames through OnFrameReactivated
in OnFinishNavigation, that is called after CommitNavigation.

This order makes frames' state inconsistent and tests fail with
timeout.

This CL moves the call of OnFrameReactivated into
ReadyToCommitNavigation, which is called before CommitNavigation,
and makes frames' state in the renderer consistent.


Bug: 1150297
Cq-Include-Trybots: luci.chromium.try:linux-bfcache-rel
Change-Id: Ib87a2d1c604e0013d3d93d5d679583e196d44eb9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2581621
Commit-Queue: Hitoshi Yoshida <peria@chromium.org>
Auto-Submit: Hitoshi Yoshida <peria@chromium.org>
Reviewed-by: default avatarRakina Zata Amni <rakina@chromium.org>
Reviewed-by: default avatarFergal Daly <fergal@chromium.org>
Reviewed-by: default avatardanakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/master@{#844463}
parent 99ab1a0a
...@@ -1091,7 +1091,7 @@ void WebTestControlHost::RenderViewDeleted(RenderViewHost* render_view_host) { ...@@ -1091,7 +1091,7 @@ void WebTestControlHost::RenderViewDeleted(RenderViewHost* render_view_host) {
main_window_render_view_hosts_.erase(render_view_host); main_window_render_view_hosts_.erase(render_view_host);
} }
void WebTestControlHost::DidFinishNavigation( void WebTestControlHost::ReadyToCommitNavigation(
NavigationHandle* navigation_handle) { NavigationHandle* navigation_handle) {
NavigationRequest* request = NavigationRequest::From(navigation_handle); NavigationRequest* request = NavigationRequest::From(navigation_handle);
RenderFrameHostImpl* rfh = request->rfh_restored_from_back_forward_cache(); RenderFrameHostImpl* rfh = request->rfh_restored_from_back_forward_cache();
......
...@@ -162,7 +162,7 @@ class WebTestControlHost : public WebContentsObserver, ...@@ -162,7 +162,7 @@ class WebTestControlHost : public WebContentsObserver,
void RenderViewHostChanged(RenderViewHost* old_host, void RenderViewHostChanged(RenderViewHost* old_host,
RenderViewHost* new_host) override; RenderViewHost* new_host) override;
void RenderViewDeleted(RenderViewHost* render_view_host) override; void RenderViewDeleted(RenderViewHost* render_view_host) override;
void DidFinishNavigation(NavigationHandle* navigation_handle) override; void ReadyToCommitNavigation(NavigationHandle* navigation_handle) override;
// RenderProcessHostObserver implementation. // RenderProcessHostObserver implementation.
void RenderProcessHostDestroyed( void RenderProcessHostDestroyed(
......
...@@ -13,9 +13,6 @@ crbug.com/1132180 http/tests/navigation/back-to-dynamic-iframe.html [ Skip ] ...@@ -13,9 +13,6 @@ crbug.com/1132180 http/tests/navigation/back-to-dynamic-iframe.html [ Skip ]
crbug.com/1132180 http/tests/navigation/forward-to-fragment-fires-onload.html [ Skip ] crbug.com/1132180 http/tests/navigation/forward-to-fragment-fires-onload.html [ Skip ]
# TODO(peria): Make these tests work with same-site back-forward cache. # TODO(peria): Make these tests work with same-site back-forward cache.
crbug.com/1150297 http/tests/navigation/back-during-child-frame-reload.html [ Timeout ]
crbug.com/1150297 http/tests/navigation/post-frames-goback1.html [ Timeout ]
crbug.com/1150297 http/tests/navigation/postredirect-frames-goback1.html [ Timeout ]
crbug.com/1155125 http/tests/history/replacestate-post-to-get-2.html [ Timeout ] crbug.com/1155125 http/tests/history/replacestate-post-to-get-2.html [ Timeout ]
# TODO(peria): Make these tests work with same-site browsing instance swap. # TODO(peria): Make these tests work with same-site browsing instance swap.
......
<script> <script>
function onload() { onpageshow = () => {
debugger; debugger;
if (!localStorage['state']) { if (!localStorage['state']) {
localStorage['state'] = 'one'; localStorage['state'] = 'one';
...@@ -29,7 +29,7 @@ function onload() { ...@@ -29,7 +29,7 @@ function onload() {
} }
} }
</script> </script>
<body onload="onload()"> <body>
<p> <p>
Navigation initiated by history.back() should overwrite child frame reload, Navigation initiated by history.back() should overwrite child frame reload,
which was started eralier and did not finish yet. which was started eralier and did not finish yet.
......
...@@ -9,7 +9,7 @@ if (window.testRunner) { ...@@ -9,7 +9,7 @@ if (window.testRunner) {
testRunner.dumpBackForwardList(); testRunner.dumpBackForwardList();
} }
onload = function() onpageshow = function()
{ {
if (sessionStorage.didNav) { if (sessionStorage.didNav) {
delete sessionStorage.didNav; delete sessionStorage.didNav;
...@@ -38,4 +38,4 @@ onload = function() ...@@ -38,4 +38,4 @@ onload = function()
<iframe name="target-frame" src="about:blank"></iframe> <iframe name="target-frame" src="about:blank"></iframe>
</body> </body>
</html> </html>
\ No newline at end of file
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