ifener / javachromiumembedded

Automatically exported from code.google.com/p/javachromiumembedded
0 stars 0 forks source link

Render process crashes if you try to access localStorage (via JavaScript) on a custom scheme (e.g. client://) #123

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Check out latest JCEF r105
2. Apply attached patch "2014-09-30_example_scheme_handler_bug.patch
3. Compile and start MainFrame detailed example 
3. Open "Bookmarks->Test local storage"

What is the expected output? What do you see instead?
Expected: You might see the local storage example from the CEF CefClient 
example. It reads a value from localStorage and sets a new one by clicking a 
button.

Instead of that the render process crashes.

What version of the product are you using? On what operating system?
JCEF Version = 3.1916.1839.105
CEF Version = 3.1916.1839
Chromium Version = 35.0.1916.138
Java:  7u65
OS: Independent

Please provide any additional information below.
This issue only occurs if you're using a custom scheme, like "client://".
The reason for that is that the render process (as well as all others expect 
the main process) doesn't know anything from your custom schemes.

The solution for this issue: Tell the render process to register your custom 
schemes by implementing the method CefApp::OnRegisterCustomSchemes() within 
jcef_helper.app.

Please see attached patch file "2014-09-30_fixed_scheme_handler_bug.patch" for 
a working solution.

Some notes:
(1) Passing the scheme name and its params (isLocal, etc.) to the 
render-process by using CefBrowserProcessHandler::OnRenderProcessThreadCreated 
on the  browser process side and 
CefRenderProcessHandler::OnRenderThreadCreated(CefRefPtr<CefListValue> 
extra_info) won't work because the methods are invoked AFTER 
OnRegisterCustomSchemes() has been called.
(2) For that reason you can't use OnProcessMessageReceived() as well.
(3) Therefore this solution creates a temporary file, assigns the values 
(scheme name and params) to it on the browser side and reads them on the render 
side. The file will be deleted if you call CefShutdown().

Regards,
Kai

Original issue reported on code.google.com by k...@censhare.de on 30 Sep 2014 at 7:23

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks, added in revision 107 with minor changes:
- Use function local static instead of class member static for tempFiles in 
client_app.cpp (this initializes the std::set when used instead of potentially 
on application startup).
- Include system headers first.
- Rename util_unix.cpp to util_posix.cpp for consistency.
- Minor formatting and documentation fixes.

Original comment by magreenb...@gmail.com on 24 Oct 2014 at 4:45