mobileFX WebKitX CEF3 ActiveX 4.x
WebKitXCEF3Lib ActiveX Control / WebKitXCEF3 Object / DebuggerEvaluate Method

String, the JavaScript expression to evaluate.

Call Frame ID is obtained by event OnDebuggerBreakPointHit.

Boolean, in silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides setPauseOnException state.

Boolean, whether the result is expected to be a JSON object that should be sent by value.

Boolean, whether preview should be generated for the result.

In This Topic
    DebuggerEvaluate Method
    In This Topic
    Description

    Evaluates an expression against a Call Frame of a paused Debugger and returns its JSON representation.

    Syntax
    Visual Basic
    Public Function DebuggerEvaluate( _
       ByVal Debugger As WEBKITX_DEBUGGER, _
       ByVal Expression As String, _
       ByVal CallFrameID As String, _
       ByVal Silent As Boolean, _
       ByVal ReturnByValue As Boolean, _
       ByVal GeneratePreview As Boolean _
    ) As String
    Parameters
    Debugger
    ValueDescription
    DEBUGGER_CHROMIUM

    Defines use of Chromium Debugger for WebKitX debugger commands and events.

    DEBUGGER_NODEJSDefines use of node.js Debugger for WebKitX debugger commands and events.
    Expression

    String, the JavaScript expression to evaluate.

    CallFrameID

    Call Frame ID is obtained by event OnDebuggerBreakPointHit.

    Silent

    Boolean, in silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides setPauseOnException state.

    ReturnByValue

    Boolean, whether the result is expected to be a JSON object that should be sent by value.

    GeneratePreview

    Boolean, whether preview should be generated for the result.

    Return Type

    Object wrapper for the evaluation result.

    Remarks

    This is intended for IDE developers with prior experience with Inspector Protocol. WebKitX offers debugging capabilities for both Chromium and Node.js. For more information please refer to these guides:

    https://nodejs.org/en/docs/guides/debugging-getting-started/

    https://chromedevtools.github.io/devtools-protocol/1-2/

    Example
    Private Sub WebKitX_OnCreate(ByVal Settings As WebKitXCEF3Lib.ISettings, CommandLineSwitches As String)
        
        On Error Resume Next
        
        With Settings
            
            .app_path = App.Path
            .accept_language_list = "es-CL,en-GB"
            .remote_debugging_port = 9999
            .persist_session_cookies = 0
            .persist_user_preferences = 0
            
            .nodejs_auto_start = False
            .nodejs_debug_port = 9998
            .nodejs_debugger_protocol = "inspector"
            .nodejs_executable = App.Path + "\etc\config\server\node.exe"
            .nodejs_modules_path = App.Path + "\etc\config\server\node_modules"
            .nodejs_command_line_arguments = " --stack-trace-limit=25 --interactive --report-compact --insecure-http-parser "
            .nodejs_terminate_on_debug_end = True
            
        End With
        
        CommandLineSwitches = CommandLineSwitches + " --no-proxy-server --disable-cache --disable-gpu-program-cache --disable-gpu-shader-disk-cache"
        CommandLineSwitches = CommandLineSwitches + " --disable-background-networking --disable-background-timer-throttling --disable-backgrounding-occluded-windows"
        CommandLineSwitches = CommandLineSwitches + " --disable-breakpad --disable-client-side-phishing-detection --disable-default-apps --disable-dev-shm-usage "
        CommandLineSwitches = CommandLineSwitches + " --disable-renderer-backgrounding --disable-sync --metrics-recording-only --no-first-run --no-default-browser-check"
        
    End Sub
    
    Private Sub DebugBridge_OnEval(ByVal DebuggerHost As Long, ByVal Expression As String, ByVal CallFrameID As String, ByVal Silent As Boolean, ByVal ReturnByValue As Boolean, ByVal GeneratePreview As Boolean, Result As String)
        
        On Error Resume Next
        
        If DebuggerHost = DEBUGGER_CHROMIUM And ClientDebuggerReady = False Then Exit Sub
        If DebuggerHost = DEBUGGER_NODEJS And ServerDebuggerReady = False Then Exit Sub
        
        Result = WebKitX.DebuggerEvaluate(DebuggerHost, Expression, CallFrameID, Silent, ReturnByValue, GeneratePreview)
        
    End Sub
    Option Explicit
    
    Public Event OnEval(ByVal DebuggerHost As Long, ByVal Expression As String, ByVal CallFrameID As String, ByVal Silent As Boolean, ByVal ReturnByValue As Boolean, ByVal GeneratePreview As Boolean, ByRef Result As String)
    Public Event OnProperties(ByVal DebuggerHost As Long, ByVal ObjectID As String, ByRef Result As String)
    Public Event OnGetCode(ByVal DebuggerHost As Long, ByVal ScriptID As Long, ByRef Result As String)
    
    Public Function Eval(ByVal DebuggerHost As Long, ByVal Expression As String, ByVal CallFrameID As String, ByVal Silent As Boolean, ByVal ReturnByValue As Boolean, ByVal GeneratePreview As Boolean) As String
        On Error Resume Next
        Dim Result As String
        RaiseEvent OnEval(DebuggerHost, Expression, CallFrameID, Silent, ReturnByValue, GeneratePreview, Result)
        Eval = Result
        Err.Clear
    End Function
    
    Public Function Properties(ByVal DebuggerHost As Long, ByVal ObjectID As String) As String
        On Error Resume Next
        Dim Result As String
        RaiseEvent OnProperties(DebuggerHost, ObjectID, Result)
        Properties = Result
        Err.Clear
    End Function
    
    Public Function GetCode(ByVal DebuggerHost As Long, ByVal ScriptID As Long) As String
        On Error Resume Next
        Dim Result As String
        RaiseEvent OnGetCode(DebuggerHost, ScriptID, Result)
        GetCode = Result
        Err.Clear
    End Function
    See Also