FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
cefpython/src/handlers/v8function_handler.pyx at cefpython66 · danielpine/cefpython · GitHub
danielpine
cefpython
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
cefpython
/
src
/
handlers
/
v8function_handler.pyx
Copy path
More file actions
More file actions
Latest commit
History
History
History
51 lines (49 loc) · 2.09 KB
Breadcrumbs
cefpython
/
src
/
handlers
/
v8function_handler.pyx
Copy path
File metadata and controls
51 lines (49 loc) · 2.09 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#
Copyright (c) 2012 CEF Python, see the Authors file.
#
All rights reserved. Licensed under BSD 3-clause license.
#
Project website: https://github.com/cztomczak/cefpython
include
"
../cefpython.pyx
"
include
"
../browser.pyx
"
include
"
../frame.pyx
"
cdef public
void
V8FunctionHandler_Execute(
CefRefPtr[CefBrowser] cefBrowser,
int64 frameId,
CefString
&
cefFuncName,
CefRefPtr[CefListValue] cefFuncArgs
)
except
*
with
gil:
cdef PyBrowser pyBrowser
cdef CefRefPtr[CefFrame] cefFrame
cdef PyFrame pyFrame
#
may be None
cdef py_string funcName
cdef
object
func
cdef
list
funcArgs
cdef
object
returnValue
cdef py_string errorMessage
try
:
pyBrowser
=
GetPyBrowser(cefBrowser,
"
V8FunctionHandler_Execute
"
)
cefFrame
=
cefBrowser.get().GetFrame(frameId)
if
cefFrame.get():
pyFrame
=
GetPyFrame(cefFrame)
else
:
pyFrame
=
None
funcName
=
CefToPyString(cefFuncName)
Debug(
"
V8FunctionHandler_Execute(): funcName=
%s
"
%
funcName)
jsBindings
=
pyBrowser.GetJavascriptBindings()
func
=
jsBindings.GetFunctionOrMethod(funcName)
if
not
func:
#
The Renderer process already checks whether function
#
name is valid before calling V8FunctionHandler_Execute(),
#
but it is possible for the javascript bindings to change
#
during execution, so it's possible for the Browser/Renderer
#
bindings to be out of sync due to delay in process messaging.
errorMessage
=
"
V8FunctionHandler_Execute() FAILED:
"
\
"
python function not found:
%s
"
%
funcName
NonCriticalError(errorMessage)
#
Raise a javascript exception in that frame if it still exists
if
pyFrame:
pyFrame.ExecuteJavascript(
"
throw '
%s
';
"
%
errorMessage)
return
funcArgs
=
CefListValueToPyList(cefBrowser, cefFuncArgs)
func(
*
funcArgs)
except
:
(exc_type, exc_value, exc_trace)
=
sys.exc_info()
sys.excepthook(exc_type, exc_value, exc_trace)
Back
|
FazBrowse Home
|
New Git URL