Fix ExecuteJavaScript failure with null CefRenderProcessHandler (see issue #2421)
When CefApp::GetRenderProcessHandler returned null CefRenderFrameObserver::DidCreateScriptContext was returning early (not calling CefFrameImpl::OnContextCreated) and consequently queued actions such as JavaScript were never executed.
This commit is contained in:
parent
b4ab321a79
commit
cfdec92624
|
@ -126,20 +126,20 @@ void CefRenderFrameObserver::DidCreateScriptContext(
|
||||||
CefRefPtr<CefApp> application = CefAppManager::Get()->GetApplication();
|
CefRefPtr<CefApp> application = CefAppManager::Get()->GetApplication();
|
||||||
if (application)
|
if (application)
|
||||||
handler = application->GetRenderProcessHandler();
|
handler = application->GetRenderProcessHandler();
|
||||||
if (!handler)
|
|
||||||
return;
|
|
||||||
|
|
||||||
CefRefPtr<CefFrameImpl> framePtr = browserPtr->GetWebFrameImpl(frame);
|
CefRefPtr<CefFrameImpl> framePtr = browserPtr->GetWebFrameImpl(frame);
|
||||||
|
|
||||||
v8::Isolate* isolate = blink::MainThreadIsolate();
|
if (handler) {
|
||||||
v8::HandleScope handle_scope(isolate);
|
v8::Isolate* isolate = blink::MainThreadIsolate();
|
||||||
v8::Context::Scope scope(context);
|
v8::HandleScope handle_scope(isolate);
|
||||||
v8::MicrotasksScope microtasks_scope(isolate,
|
v8::Context::Scope scope(context);
|
||||||
v8::MicrotasksScope::kRunMicrotasks);
|
v8::MicrotasksScope microtasks_scope(isolate,
|
||||||
|
v8::MicrotasksScope::kRunMicrotasks);
|
||||||
|
|
||||||
CefRefPtr<CefV8Context> contextPtr(new CefV8ContextImpl(isolate, context));
|
CefRefPtr<CefV8Context> contextPtr(new CefV8ContextImpl(isolate, context));
|
||||||
|
|
||||||
handler->OnContextCreated(browserPtr.get(), framePtr.get(), contextPtr);
|
handler->OnContextCreated(browserPtr.get(), framePtr.get(), contextPtr);
|
||||||
|
}
|
||||||
|
|
||||||
// Do this last, in case the client callback modified the window object.
|
// Do this last, in case the client callback modified the window object.
|
||||||
framePtr->OnContextCreated();
|
framePtr->OnContextCreated();
|
||||||
|
|
Loading…
Reference in New Issue