mirror of
https://github.com/cefsharp/CefSharp.git
synced 2026-12-04 10:22:55 +00:00
CefAppUnmanagedWrapper::OnContextCreated - Send OnContextCreated message after Objects created
Message is now sent once the CefSharp.BindObjectAsync and helper functions are created and Legacy objects are bound. It should now be reliable to call CefSharp.BindObjectAsync in OnContextCreated
This commit is contained in:
@@ -61,18 +61,6 @@ namespace CefSharp
|
||||
|
||||
void CefAppUnmanagedWrapper::OnContextCreated(CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame, CefRefPtr<CefV8Context> context)
|
||||
{
|
||||
//Send a message to the browser processing signaling that OnContextCreated has been called
|
||||
//only param is the FrameId. Currently an IPC message is only sent for the main frame - will see
|
||||
//how viable this solution is and if it's worth expanding to sub/child frames.
|
||||
if (frame->IsMain())
|
||||
{
|
||||
auto contextCreatedMessage = CefProcessMessage::Create(kOnContextCreatedRequest);
|
||||
|
||||
SetInt64(contextCreatedMessage->GetArgumentList(), 0, frame->GetIdentifier());
|
||||
|
||||
browser->SendProcessMessage(CefProcessId::PID_BROWSER, contextCreatedMessage);
|
||||
}
|
||||
|
||||
if (_legacyBindingEnabled)
|
||||
{
|
||||
if (_javascriptObjects->Count > 0)
|
||||
@@ -112,6 +100,18 @@ namespace CefSharp
|
||||
cefSharpObjCamelCase->SetValue(kDeleteBoundObjectCamelCase, unBindObjFunction, CefV8Value::PropertyAttribute::V8_PROPERTY_ATTRIBUTE_NONE);
|
||||
cefSharpObjCamelCase->SetValue(kRemoveObjectFromCacheCamelCase, removeObjectFromCacheFunction, CefV8Value::PropertyAttribute::V8_PROPERTY_ATTRIBUTE_NONE);
|
||||
cefSharpObjCamelCase->SetValue(kIsObjectCachedCamelCase, isObjectCachedFunction, CefV8Value::PropertyAttribute::V8_PROPERTY_ATTRIBUTE_NONE);
|
||||
|
||||
//Send a message to the browser processing signaling that OnContextCreated has been called
|
||||
//only param is the FrameId. Currently an IPC message is only sent for the main frame - will see
|
||||
//how viable this solution is and if it's worth expanding to sub/child frames.
|
||||
if (frame->IsMain())
|
||||
{
|
||||
auto contextCreatedMessage = CefProcessMessage::Create(kOnContextCreatedRequest);
|
||||
|
||||
SetInt64(contextCreatedMessage->GetArgumentList(), 0, frame->GetIdentifier());
|
||||
|
||||
browser->SendProcessMessage(CefProcessId::PID_BROWSER, contextCreatedMessage);
|
||||
}
|
||||
};
|
||||
|
||||
void CefAppUnmanagedWrapper::OnContextReleased(CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame, CefRefPtr<CefV8Context> context)
|
||||
|
||||
Reference in New Issue
Block a user