request custom scheme from app cache returns ERR_UNKNOWN_URL

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.

request custom scheme from app cache returns ERR_UNKNOWN_URL

Postby Streamlet » Tue Oct 29, 2019 10:29 pm

my web page is like this:

<html>
...
<img src="custom_scheme://xxx.png" />
...
</html>

console log:
Document was loaded from Application Cache with manifest https://.../xxx.manifest
custom_scheme://xxx.png:1 GET custom_scheme://xxx.png net::ERR_UNKNOWN_URL_SCHEME
...


As I debugged the code:
If using appcache, the browser process will send ipc message to the utility process.
And then in the utility process, SubresourceLoader will at last call URLRequestJobFactory::IsHandledProtocol to find the ProtocolHandler.
So far as I known, we only registered our ProtocolHandler in the browser process, thus the utility process doesn't known how to process "custom_scheme", so it causes ERR_UNKNOWN_URL_SCHEME.
Am I Right?

Since I cannot push the web developers not to use app cache, is there a way to disable app cache in the browser? Or is there a way to fix it, that means let the browser process custem schemes correctly even if it uses app cache?

releted issue:
https://bitbucket.org/chromiumembedded/ ... ndlers-are
(I am not sure whether the "cache" metioned in the issue means HTML5 Application Cache or the ordinary browser cache.)
Streamlet
Mentor
 
Posts: 61
Joined: Tue Aug 27, 2019 6:47 am

Re: request custom scheme from app cache returns ERR_UNKNOWN

Postby amaitland » Tue Oct 29, 2019 10:46 pm

You need to register your custom scheme in all processes, this includes the Network Service (--type=utility)

OnRegisterCustomSchemes
public virtual void OnRegisterCustomSchemes( CefRawPtr< CefSchemeRegistrar > registrar );
Provides an opportunity to register custom schemes. Do not keep a reference to the |registrar| object. This method is called on the main thread for each process and the registered schemes should be the same across all processes.


apidocs3/projects/(default)/CefApp.html#OnRegisterCustomSchemes(CefRawPtr%3CCefSchemeRegistrar%3E)
Maintainer of the CefSharp project.
amaitland
Virtuoso
 
Posts: 1292
Joined: Wed Jan 14, 2015 2:35 am

Re: request custom scheme from app cache returns ERR_UNKNOWN

Postby Streamlet » Tue Oct 29, 2019 11:50 pm

amaitland wrote:You need to register your custom scheme in all processes, this includes the Network Service (--type=utility)

OnRegisterCustomSchemes
public virtual void OnRegisterCustomSchemes( CefRawPtr< CefSchemeRegistrar > registrar );
Provides an opportunity to register custom schemes. Do not keep a reference to the |registrar| object. This method is called on the main thread for each process and the registered schemes should be the same across all processes.


apidocs3/projects/(default)/CefApp.html#OnRegisterCustomSchemes(CefRawPtr%3CCefSchemeRegistrar%3E)



I'm sure I has registered the chemes with OnRegisterCustomSchemes.
(But not call RegisterSchemeHandlerFactory for utility process.)
Streamlet
Mentor
 
Posts: 61
Joined: Tue Aug 27, 2019 6:47 am

Re: request custom scheme from app cache returns ERR_UNKNOWN

Postby amaitland » Wed Oct 30, 2019 2:13 am

You only need to register the scheme, the factory is only required in the browser process.

Add some logging and confirm the scheme has been registered with the same options in all processes.
Maintainer of the CefSharp project.
amaitland
Virtuoso
 
Posts: 1292
Joined: Wed Jan 14, 2015 2:35 am

Re: request custom scheme from app cache returns ERR_UNKNOWN

Postby Streamlet » Thu Oct 31, 2019 8:34 pm

@magreenblatt, any comment?
Streamlet
Mentor
 
Posts: 61
Joined: Tue Aug 27, 2019 6:47 am

Re: request custom scheme from app cache returns ERR_UNKNOWN

Postby Streamlet » Thu Nov 07, 2019 2:54 am

Update:

set CefBrowserSettings.application_cache = STATE_DISABLED works!
Streamlet
Mentor
 
Posts: 61
Joined: Tue Aug 27, 2019 6:47 am


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 88 guests