cef crashing when registering extension for calling dot net
Posted: Fri Feb 23, 2018 7:37 am
We have been using cefglue version 2623 and using the below extension to pass data from javascript to dot net. Now we are upgrading cefglue to version 3202 but the extension below results in error during initialization of browser. If I comment the RegisterExtension line then there is no crash.
[0223/161321.161:FATAL:V8Initializer.cpp(80)]
Is something changed between these versions which I am missing?
Code below
[0223/161321.161:FATAL:V8Initializer.cpp(80)]
Is something changed between these versions which I am missing?
Code below
- Code: Select all
internal sealed class RenderProcessHandler : CefRenderProcessHandler
{
MyCustomCefV8Handler myCefV8Handler = new MyCustomCefV8Handler();
protected override void OnWebKitInitialized()
{
var nativeFunction = @"gmApi = function(jsonArg) {
native function MyNativeFunction(jsonArg);
return MyNativeFunction(jsonArg);
};
";
CefRuntime.RegisterExtension("MessageEvent", nativeFunction, myCefV8Handler);
base.OnWebKitInitialized();
}
}
internal class MyCustomCefV8Handler : CefV8Handler
{
protected override bool Execute(string name, CefV8Value obj, CefV8Value[] arguments, out CefV8Value returnValue, out string exception)
{
returnValue = CefV8Value.CreateString("");
ReceiveJsFunctionCall(arguments, ref returnValue);
exception = null;
return true;
}
}