Hi All,I need an identifier that consistently points to the same frame in both the browser and renderer process. Prior to [1] (which deleted WebContentsObserver::DidCommitProvisionLoad) I could use the frame routing ID retrieved via RenderFrameHost::GetRoutingID() and RenderFrame::GetRoutingID(). I can no longer use the frame routing ID with DidStartNavigation because, for the main frame, the NavigationHandle state is INITIAL when DidStartNavigation is called and NavigationHandle::GetRenderFrameHost() can't be called at that time (according to DCHECK).
On Fri, Mar 3, 2017 at 5:25 PM, Marshall Greenblatt <magree...@gmail.com> wrote:Hi All,I need an identifier that consistently points to the same frame in both the browser and renderer process. Prior to [1] (which deleted WebContentsObserver::DidCommitProvisionLoad) I could use the frame routing ID retrieved via RenderFrameHost::GetRoutingID() and RenderFrame::GetRoutingID(). I can no longer use the frame routing ID with DidStartNavigation because, for the main frame, the NavigationHandle state is INITIAL when DidStartNavigation is called and NavigationHandle::GetRenderFrameHost() can't be called at that time (according to DCHECK).I've been able to work around the lack of RFH in DidStartNavigation by using ReadyToCommitNavigation instead. However, there is still a problem retrieving the RFH in DidFinishNavigation if the navigation is aborted (net_error_code == ERR_ABORTED). In that case DidFinishNavigation will be called with state == WILL_SEND_REQUEST.From what I can see NavigationHandle does not expose a method for determining if state is >= WILL_PROCESS_RESPONSE (necessary to pass the CHECK in GetRenderFrameHost). How should my code determine if it's safe to call GetRenderFrameHost? I see some other code using (HasCommitted() && !IsErrorPage()), but that appears to miss the (WILL_PROCESS_RESPONSE, DEFERRING_RESPONSE, READY_TO_COMMIT) states where the RFH should also be valid.