Browser-Independent Requests fails in render process

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.

Browser-Independent Requests fails in render process

Postby tiplip » Sun Jun 27, 2021 12:33 am

Hi

I am on latest cef3

The Browser-Independent Requests says
CefURLRequest can be used in both the browser and render processes

but in fact, the example code will fail in render process,
Code: Select all
CefRefPtr<CefURLRequest> url_request = CefURLRequest::Create(request, client.get(), nullptr);

url_request will be null in render processes.

I am testing it with cef3 4389

this code only support browser process

for render process, is there any introduction or sample for the request?

thanks
tiplip
Mentor
 
Posts: 76
Joined: Thu Mar 26, 2015 3:09 am

Re: Browser-Independent Requests fails in render process

Postby magreenblatt » Sun Jun 27, 2021 9:27 am

That documentation is out of date. See header documentation here and here.
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

Re: Browser-Independent Requests fails in render process

Postby tiplip » Mon Jun 28, 2021 2:38 am

magreenblatt wrote:That documentation is out of date. See header documentation here and here.


thanks, won't render process support the feature any more?

the code only supports browser process, not render process
it will return nullptr in render process
you can find code
Code: Select all
// static
CefRefPtr<CefURLRequest> CefURLRequest::Create(
    CefRefPtr<CefRequest> request,
    CefRefPtr<CefURLRequestClient> client,
    CefRefPtr<CefRequestContext> request_context) {
  if (!request.get() || !client.get()) {
    NOTREACHED() << "called with invalid parameters";
    return nullptr;
  }

  if (!CefTaskRunnerImpl::GetCurrentTaskRunner()) {
    NOTREACHED() << "called on invalid thread";
    return nullptr;
  }

  auto content_client = CefAppManager::Get()->GetContentClient();
  if (content_client->browser()) {
    // In the browser process.
    CefRefPtr<CefBrowserURLRequest> impl =
        new CefBrowserURLRequest(nullptr, request, client, request_context);
    if (impl->Start())
      return impl.get();
    return nullptr;
  } else {
    NOTREACHED() << "called in unsupported process";
    return nullptr;
  }
}
tiplip
Mentor
 
Posts: 76
Joined: Thu Mar 26, 2015 3:09 am

Re: Browser-Independent Requests fails in render process

Postby magreenblatt » Mon Jun 28, 2021 11:20 am

Only CefFrame::CreateURLRequest is supported in the renderer process. Read the links that I provided above for more details.
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

Re: Browser-Independent Requests fails in render process

Postby tiplip » Mon Jun 28, 2021 6:39 pm

thanks for your answer
I understant, that is, render process can not perform Browser-Independent Requests any more.
tiplip
Mentor
 
Posts: 76
Joined: Thu Mar 26, 2015 3:09 am


Return to Support Forum

Who is online

Users browsing this forum: Google [Bot] and 36 guests