Commit 192c03da authored by Dmitry Gozman's avatar Dmitry Gozman Committed by Commit Bot

Stop calling DecidePolicyForNavigation when committing

We had enough time with CHECK to ensure this is not needed.

A couple of tests which did browser-initiated navigation do
not dump the policy anymore.

reload-policy-delegate was doing browser-initiated reload,
and does not test anything meaningful for a while. I changed it
to check performance.navigation.type which is pretty similar
is also available for browser-initiated navigation.

Bug: 789577
Change-Id: If89041e4ae9b509e82d724f171a1faa731099965
Reviewed-on: https://chromium-review.googlesource.com/1119380Reviewed-by: default avatarCamille Lamy <clamy@chromium.org>
Commit-Queue: Dmitry Gozman <dgozman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#572383}
parent 97f9353c
Default policy for navigation to 'notify-done.html' is 'new background tab'
Default policy for navigation to 'notify-done.html' is 'current tab'
Tests that hitting ctrl-click on a link results in a new background tab.
link
Default policy for navigation to 'notify-done.html' is 'new background tab'
Default policy for navigation to 'notify-done.html' is 'current tab'
Tests that ctrl-clicking on a submit button results in a new background tab.
Default policy for navigation to 'notify-done.html' is 'new foreground tab'
Default policy for navigation to 'notify-done.html' is 'current tab'
Tests that synthesizing ctrl-click on a submit button does not result in a new background tab.
Default policy for navigation to 'notify-done.html' is 'new foreground tab'
Default policy for navigation to 'notify-done.html' is 'current tab'
Tests that synthesizing ctrl-click does not result in a new background tab.
link
Default policy for navigation to 'done.html' is 'new background tab'
Default policy for navigation to 'done.html' is 'current tab'
This test opens a new window by middle-clicking on a link with target=_blank. It passes, if the WebViewClient::createView method was invoked with the parameter "done.html".
link
Test to make sure that reloads get reload navigation type.
navigation type is 1, expected (reload) is 1
<html>
<head>
<script type="text/javascript">
function startTest()
{
let value = localStorage['reload-policy-delegate'];
if (!value) {
localStorage['reload-policy-delegate'] = 1;
testRunner.dumpAsText();
testRunner.queueReload();
} else {
document.querySelector('span').textContent =
`navigation type is ${window.performance.navigation.type},
expected (reload) is ${window.PerformanceNavigation.TYPE_RELOAD}`;
}
}
</script>
</head>
<body onload="startTest()">
<p>Test to make sure that reloads get reload navigation type.</p>
<span></span>
</body>
</html>
Policy delegate: attempt to load reload-policy-delegate.html with navigation type 'reload'
Test to make sure that reloads get reload policy.
<html>
<head>
<script type="text/javascript">
function startTest()
{
testRunner.dumpAsText();
testRunner.setCustomPolicyDelegate(true, true);
testRunner.queueReload();
}
</script>
</head>
<body onload="startTest()">
<p>Test to make sure that reloads get reload policy.</p>
</body>
</html>
Policy delegate: attempt to load http://127.0.0.1:8000/history/back-to-post.html with navigation type 'form submitted'
Policy delegate: attempt to load http://127.0.0.1:8000/history/back-to-post.html with navigation type 'form submitted'
Policy delegate: attempt to load http://127.0.0.1:8000/history/back-to-post.html with navigation type 'form resubmitted'
Test for rdar://problem/6791439 Getting an error page instead of login page navigating back in gmail.
PASS
......
......@@ -1360,6 +1360,11 @@ NavigationPolicy FrameLoader::ShouldContinueForNavigationPolicy(
return kNavigationPolicyIgnore;
}
if (!check_with_client) {
DCHECK_EQ(kNavigationPolicyCurrentTab, policy);
return policy;
}
bool replaces_current_history_item =
frame_load_type == WebFrameLoadType::kReplaceCurrentItem;
policy = Client()->DecidePolicyForNavigation(
......@@ -1367,8 +1372,6 @@ NavigationPolicy FrameLoader::ShouldContinueForNavigationPolicy(
replaces_current_history_item, is_client_redirect, triggering_event_info,
form, should_check_main_world_content_security_policy,
std::move(blob_url_token));
if (!check_with_client)
CHECK_EQ(kNavigationPolicyCurrentTab, policy);
DCHECK(policy == kNavigationPolicyCurrentTab ||
policy == kNavigationPolicyIgnore ||
policy == kNavigationPolicyHandledByClient ||
......
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