OS: Android
What steps will reproduce the problem?
(1) Setup a WIFI hotspot from an Android device. Make sure that this device is not connected to WIFI and other data network.
(2) In another Android device, navigate to a page, say google.com, and download it.
(3) Go to Downloads home, open the downloaded page. The offline copy should be loaded. You should see an Offline chip shown up in the omnibar.
(4) Connect to the hotspot. Reload current page.
What is the expected result?
The page should be reloaded with the Offline chip shown.
What happens instead?
The page is reloaded without the Offline chip. Note that we do load the offline page but the Offline chip is not shown (this can be verified by trying to select the input box. If a MHTML page is being loaded, the input box is disabled).
When we reload current page in step 4, a net error page is hit because we connect to a hotspot without the network activity. OfflinePageTabHelper::TryLoadingOfflinePageOnNetError detects that it is the net error code we want to handle and there is an offline page for it. So we reload current page with extra header to force loading the offline version. Then some risk condition happens in this navigation and causes DidStopLoading event to be sent before DidFinishNavigation. DidStopLoading causes RenderFrameHostImpl::OnDidStopLoading to clear navigation_request_. Then RenderFrameHostImpl::TakeNavigationHandleForCommit ends up with creating a new NavigationHandle.
As a result, we observe the following sequence of navigation events:
1) DidStartNavigation
2) DidStopLoading
3) DidFinishNavigation (NavigationHandle::HasCommitted returns false)
4) DidStartNavigation
5) DidFinishNavigation (NavigationHandle::HasCommitted returns true)
Comment 1 by jianli@chromium.org
, Apr 27 2018