Ensure that all code paths which call FrameTreeNode::ResetNavigationRequest set NavigationHandle::GetNetErrorCode().

The places were

1) NavigationRequest::OnRequestRedirected (redirected URL fails FilterURL check)
The non-PlzNavigate code was setting this in ResourceLoader::OnReceivedRedirect. Added NavigationHandleImplBrowserTest.ErrorCodeOnRedirect to test this.

2) NavigationRequest::OnResponseStarted (cross-process commit cancelled by embedder)
Neither PlzNavigate or old code path were setting this. Added this check to existing test CrossSiteTransferTest.NoLeakOnCrossSiteCancel. Fixed PlzNavigate in the above method, and non-Navigate in RenderFrameHostManager::OnCrossSiteResponse.

3) NavigatorImpl::CancelNavigation (navigation aborted case, i.e. beforeunload cancels it)
This codepath is only hit for PlzNavigate, since non-PlzNavigate doesn't create a NavigationHandle until after beforeunload succeeds. Added test in NavigationHandleImplBrowserTest.ErrorCodeOnAbortedNavigation.

4) RenderFrameHostImpl::DispatchBeforeUnload
This is a PlzNavigate-only code path. Added checks to existing test BrowserSideNavigationBrowserTest.UnloadDuringNavigation.

5) RenderFrameHostManager::CancelPendingIfNecessary
Fixed in the above method for PlzNavigate, and in RenderFrameHostImpl::DispatchBeforeUnload for old code path. Added checks to existing test SitePerProcessBrowserTest.RenderViewHostKeepsSwappedOutStateIfPendingRFHDies.

6) RenderFrameHostImpl::FailedNavigation is only called by NavigationRequest::OnRequestFailed which already sets the error code. I've audited all code path leading to this to check that they set an error code, and added a DCHECK to confirm.

7) NavigatorImpl::OnBeginNavigation
This looks like dead code, I've sent https://codereview.chromium.org/2890613002/ to remove it.

BUG=705119
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_site_isolation

Review-Url: https://codereview.chromium.org/2889703002
Cr-Commit-Position: refs/heads/master@{#473017}
11 files changed