Handle External Protocol in cef3_2785 introduced issue

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.

Handle External Protocol in cef3_2785 introduced issue

Postby zhouyangjulia » Fri Aug 12, 2016 4:44 pm

Hi,

We were using cef3_2454 and I am working on upgrading it to cef3_2785. I found out there's some changes for CefResourceDispatcherHostDelegate::HandleExternalProtocol().
In cef3_2785, cef added a check if the method is called from cef_ui_thread. If not, it will use CEF_POST_TASK to make the method calling from CEF UI thread. But it's using base::IgnoreResult for the callback value, and return false instead.
So when HandleExternalProtocol() is not called from CEF UI thread, it will always return false.
We are using the return result to determine if we want to CancelAndIgnore the current navigation.
Currently, we are override OnHandleExternalProtocol() to launch external protocol externally, and cancel the navigation from the original frame. The change kind of broke our behavior. Now there is an additional navigation in the frame, when user is clicking an link, which is to an external url, and display error 302 for unknown scheme.

Questions:
1. I have tried remove the part of checking CEF_CURRENT_ON_UIT(), and that works for us. But I wonder if it's safe to remove it.
2. Does CEF_POST_TASK(CEF_UIT, base::Bind() only accept void functions? Is there any ways to remove base::IgnoreResult and still use the callback return value to determine if we want to cancel and ignore the navigation? I have a quick check in the CEF forum, and found out it might only accept void result function? http://www.magpcss.org/ceforum/viewtopi ... =6&t=14249
Attachments
Capture.PNG
Capture.PNG (280.74 KiB) Viewed 4016 times
zhouyangjulia
Techie
 
Posts: 20
Joined: Thu Nov 19, 2015 2:07 pm

Re: Handle External Protocol in cef3_2785 introduced issue

Postby magreenblatt » Mon Aug 15, 2016 4:53 am

Correct, functions with return values cannot be bound. In any case it would be necessary to block the calling thread waiting for a response if you wanted to propagate a return value.

The HandleExternalProtocol logic needs to be executed on the UI thread because WebContentsGetter can only be used on the UI thread.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Handle External Protocol in cef3_2785 introduced issue

Postby zhouyangjulia » Mon Aug 15, 2016 12:55 pm

magreenblatt wrote:Correct, functions with return values cannot be bound. In any case it would be necessary to block the calling thread waiting for a response if you wanted to propagate a return value.

The HandleExternalProtocol logic needs to be executed on the UI thread because WebContentsGetter can only be used on the UI thread.


How to block the calling thread waiting for a response for the return value?
Do I need to block the cef ui thread here?
Not sure how to do that...Does it need any patch to cef in order to make it work?
zhouyangjulia
Techie
 
Posts: 20
Joined: Thu Nov 19, 2015 2:07 pm

Re: Handle External Protocol in cef3_2785 introduced issue

Postby magreenblatt » Mon Aug 15, 2016 1:39 pm

Don't block the thread. You will need to find some other way to get the state that you need.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm


Return to Support Forum

Who is online

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