When frame is swapped, CefHostMsg_FrameAttached is dispatched to old frame host

Issue #2710 duplicate
Masako Toda created an issue

This is about --site-per-process option.

  1. Add this function (I think it’s necessary…):
bool CefContentClient::CanSendWhileSwappedOut(const IPC::Message* message) {
  switch (message->type()) {
  case CefHostMsg_Request::ID:
  case CefHostMsg_Response::ID:
  case CefHostMsg_ResponseAck::ID:
  case CefHostMsg_DidFinishLoad::ID:
  case CefHostMsg_FrameAttached::ID:
    return true;
  default:
    break;
  }
  return false;
}
  1. Run cefclient with --site-per-process option and load a page that contains iframe (iframe’s src has to be different domain from the main page.)
  2. Notice CefHostMsg_FrameAttached is delivered to CefFrameHostImpl::OnMessageReceived for the iframe.
  3. Notice CefHostMsg_FrameAttached is again delivered to CefFrameHostImpl::OnMessageReceived. Note that the instance of CefFrameHostImpl in step 2 and step 3 is same one.
  4. Notice CefHostMsg_DidFinishLoad is delivered to CefFrameHostImpl::OnMessageReceived. Note that the instance of CefFrameHostImpl here is different one from step 2 and step 3. And therefore is_attached_ is false.

When 2nd CefHostMsg_FrameAttached arrives at CefBrowserHostImpl::OnMessageReceived, render_frame_host is still speculative and GetFrameForHost returns CefFrameHostImpl for the old frame. "speculative" flag is cleared when CefBrowserHostImpl::RenderFrameHostChanged is called. (I guess that's when "swapping" completes.)

Comments (2)

  1. Log in to comment