X Tutup
Skip to content

Commit cb35b21

Browse files
committed
Added safety check whether in V8 context when executing V8 function.
1 parent 863a820 commit cb35b21

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

cefpython/cef3/subprocess/v8function_handler.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@ bool V8FunctionHandler::Execute(const CefString& functionName,
1111
const CefV8ValueList& v8Arguments,
1212
CefRefPtr<CefV8Value>& returnValue,
1313
CefString& exception) {
14+
if (!CefV8Context::InContext()) {
15+
// CefV8Context::GetCurrentContext may not be called when
16+
// not in a V8 context.
17+
DebugLog("Renderer: V8FunctionHandler::Execute() FAILED:"\
18+
" not inside a V8 context");
19+
return false;
20+
}
1421
CefRefPtr<CefV8Context> context = CefV8Context::GetCurrentContext();
1522
CefRefPtr<CefBrowser> browser = context.get()->GetBrowser();
1623
CefRefPtr<CefFrame> frame = context.get()->GetFrame();

0 commit comments

Comments
 (0)
X Tutup