
chromiumembedded - issue #1570
CefV8Context becomes NULL when executing a callback function once Chromedriver is plugged
Steps used to reproduce the problem are similar to what is described there: https://code.google.com/p/chromiumembedded/wiki/GeneralUsage#Custom_Implementation
What steps will reproduce the problem? 1. Register a javascript function using a callback in one of its parameters. 2. Connect through Chromedriver configured with remote debug port to the window. 3. Execute this function using a custom V8Handler to store the callback and context for a later use. 4. The render process sends an asynchronous IPC message to the browser process requesting that work be performed. 5. Upon completion of the work the browser process sends an asynchronous IPC message back to the render process with the result. 6. The render process receives the IPC message and try to executes the callback function with the result.
What is the expected output? What do you see instead? We expect callback execution, instead stored context and function are NULL, so it crashes.
What version of the product are you using? On what operating system? CEF3 branch 2171, Windows 8 64bits
Please provide any additional information below. Without connecting through Chromedriver the whole process execute normally.
In attachment, please find patch to apply on cefsimple and the index.html used to highlight the issue.
- callback.diff 8.77KB
- index.html 323
Comment #1
Posted on Mar 6, 2015 by Quick HorseRelated forum post: http://magpcss.org/ceforum/viewtopic.php?f=6&t=12712
In the forum post you say:
context is not null when executing CefV8Handler::Execute() for storing current context and callback function, but is null when using it after inter-processes communications, resulting in a crash when using Chromedriver while using callback functions.
Can you verify that V8Handler::Execute is called and that |context| and |function| are assigned values? Do you have multiple browsers in |browser_list_|?
You're not clearing the |context| and |function| values anywhere so they're likely either (a) not being assigned to begin with or (b) the calls to V8Handler::Execute and V8Handler::executeCallback are occurring in different renderer processes.
Comment #2
Posted on Mar 6, 2015 by Helpful RhinoComment deleted
Comment #3
Posted on Mar 6, 2015 by Helpful RhinoI added logs to the patch to show function and context ptr value. Here is what is shown with my new logs:
V8Handler::Execute() : GetCurrentContext() is : not null Storing function: not null Storing context: not null
V8Handler::executeCallback() : Stored context: context is null Stored function: function is null
So V8Handler::Execute is called and |context| and |function| are both assigned values.
Running with the same logs but without connecting chromedriver, the output is:
V8Handler::Execute() : GetCurrentContext() is : not null Storing function: not null Storing context: not null
V8Handler::executeCallback() : Stored context: context is not null Stored function: function is not null
|browser_list_| is left untouched from cefsimple, so when requiring a browser I use the first one from the list, expecting to get the main and only one.
Comment #4
Posted on Mar 6, 2015 by Quick Horse@#3: Is there anything else occurring between call to V8Handler::Execute() and V8Handler::executeCallback() (navigation, etc)? Can you print the current thread ID as part of the output from those functions?
Comment #5
Posted on Mar 6, 2015 by Helpful RhinoThread ID when executing both V8Handler::Execute() and V8Handler::executeCallback() is TID_RENDERER, chromedriver connected and not connected.
I'm not sure about what you are asking, but the only thing I'm doing is pressing the button (only element in my webpage), executing my function with a callback in its parameters, which trigger the usual IPC process.
But I can check if any other function are called in between, if that's why you are asking ?
Comment #6
Posted on Mar 6, 2015 by Quick Horse@#5: I'd like to verify that the renderer process is not changing between calls. Please include the output of base::PlatformThread::CurrentId() (from include/base/cef_platform_thread.h) in your print statements.
Comment #7
Posted on Mar 10, 2015 by Helpful RhinoComment deleted
Comment #8
Posted on Mar 10, 2015 by Helpful RhinoComment deleted
Comment #9
Posted on Mar 10, 2015 by Helpful Rhino@#6: Sorry for the delay. Printing this id show:
V8Handler::Execute(): TID_RENDERER; current id: 3836 Storing function: not null Storing context: not null
V8Handler::executeCallback(): TID_RENDERER; current id: 3836 Stored function: function is null Stored context: context is null
Furthermore, the problem occur after plugging and then executing anything with Chromedriver (just plug in does not result in this issue).
First execution with Chromedriver (such as printing currentUrl with getDriver().getCurrentUrl() or anything else) flicker the webview, as if it was refreshed or reloaded, but it is not.
Comment #10
Posted on Mar 14, 2015 by Quick HorseCEF is transitioning from Google Code to Bitbucket project hosting. If you would like to continue receiving notifications on this issue please add yourself as a Watcher at the new location: https://bitbucket.org/chromiumembedded/cef/issue/1570
Status: New
Labels:
Type-Defect
Priority-Medium