Re: JS ArrayBuffer and others
Posted: Wed Oct 30, 2019 3:25 pm
Read the JavaScript integration Wiki page to know the details about "working with contexts" :
https://bitbucket.org/chromiumembedded/ ... h-contexts
The JSWindowBindingWithArrayBuffer demo uses the OnContextCreated event to create the ArrayBuffer but the tests in the official CEF project use the GlobalCEFApp.OnProcessMessageReceived event and call frame.GetV8Context.Enter and frame.GetV8Context.Exit to create the ArrayBuffer.
Notice that the GlobalCEFApp.OnProcessMessageReceived event is executed in the TID_RENDERER thread that belongs to the renderer process.
V8 functions can only be used on the main thread (TID_RENDERER) in the renderer process.
The JSEval demo uses the same event and context calls to evaluate some JavaScript :
https://github.com/salvadordf/CEF4Delph ... l.pas#L510
https://bitbucket.org/chromiumembedded/ ... h-contexts
The JSWindowBindingWithArrayBuffer demo uses the OnContextCreated event to create the ArrayBuffer but the tests in the official CEF project use the GlobalCEFApp.OnProcessMessageReceived event and call frame.GetV8Context.Enter and frame.GetV8Context.Exit to create the ArrayBuffer.
Notice that the GlobalCEFApp.OnProcessMessageReceived event is executed in the TID_RENDERER thread that belongs to the renderer process.
V8 functions can only be used on the main thread (TID_RENDERER) in the renderer process.
The JSEval demo uses the same event and context calls to evaluate some JavaScript :
https://github.com/salvadordf/CEF4Delph ... l.pas#L510