SendProcessMessage is broken in site isolation.

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

SendProcessMessage is broken in site isolation.

Postby crayze » Wed Sep 30, 2020 7:28 am

I bellive I found serious bug in CEF: OnProcessMessageReceived() is not called in renderer process spawned for domain origin other than main frame (site isolation feature).
Attached code reproduces the problem: number of responses is smaller than sends.
I checked this on: '79.0.3945.130-win64' and '85.0.4183.102-win64' versions and both are the same.
SendProcessMessage() -> OnProcessMessageReceived() is quite important feature, so I can't update my application until it is broken.
Attachments
main.cpp
(7.83 KiB) Downloaded 317 times
crayze
Techie
 
Posts: 12
Joined: Wed Jun 07, 2017 9:21 am

Re: SendProcessMessage is broken in site isolation.

Postby Czarek » Wed Sep 30, 2020 9:14 am

The website can destroy frames at any time, so it's not a good test.
Maintainer of the CEF Python, PHP Desktop and CEF C API projects. My LinkedIn.
User avatar
Czarek
Virtuoso
 
Posts: 1927
Joined: Sun Nov 06, 2011 2:12 am

Re: SendProcessMessage is broken in site isolation.

Postby crayze » Wed Sep 30, 2020 10:30 am

Czarek wrote:The website can destroy frames at any time, so it's not a good test.

You are right- in my real app after send all messages I startup timer which check frames existance [by CefFrame::IsValid] for pending messages, to support possibility that response is lost by frame dead. I just didn't want add too much complexity to my example. I could add this to 'main.cpp' if you need.

But the bug exists and currently I know that in this method:
Code: Select all
// frame_host_impl.cc:
void CefFrameHostImpl::Send(IPC::Message* message) {
  if (!CEF_CURRENTLY_ON_UIT()) {
    CEF_POST_TASK(CEF_UIT,
                  base::BindOnce(base::IgnoreResult(&CefFrameHostImpl::Send),
                                 this, message));
    return;
  }

  if (!render_frame_host_) {
    // Either we're a placeholder frame without a renderer representation, or
    // we've been detached.
    delete message;
    return;
  }

  if (!is_attached_) {
    // Queue messages until we're notified by the renderer that it's ready to
    // handle them.
    queued_messages_.push(base::WrapUnique(message));
    return;
  }

  message->set_routing_id(render_frame_host_->GetRoutingID());
  render_frame_host_->Send(message);
}


for CefFrame from other domain origin 'is_attached_' is 'false', so SendProcessMessage do only push into 'queued_messages_', so it is never send to renderer process. It seems that there is a problem with 'CefFrameHostImpl::is_attached_' variable with frames that works in extra separated renderer process. Mechanism that should set 'is_attached_' to true is broken. Tomorrow I will continue my investigation.
crayze
Techie
 
Posts: 12
Joined: Wed Jun 07, 2017 9:21 am

Re: SendProcessMessage is broken in site isolation.

Postby Czarek » Wed Sep 30, 2020 12:23 pm

Maybe related. I know there is a bug in CEF that causes dead frames to float around until app quits. In my code I can detect such frames by calling CefFrame::GetBrowser and if it returns NULL then it's dead. I've reported this in: https://bitbucket.org/chromiumembedded/ ... ing-called
Maintainer of the CEF Python, PHP Desktop and CEF C API projects. My LinkedIn.
User avatar
Czarek
Virtuoso
 
Posts: 1927
Joined: Sun Nov 06, 2011 2:12 am

Re: SendProcessMessage is broken in site isolation.

Postby crayze » Wed Oct 07, 2020 5:59 am

crayze
Techie
 
Posts: 12
Joined: Wed Jun 07, 2017 9:21 am


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 60 guests