mobileFX WebKitX CEF3 ActiveX 4.x
WebKitXCEF3Lib ActiveX Control / WebKitXCEF3 Object / DebuggerEnable Method
In This Topic
    DebuggerEnable Method
    In This Topic
    Description

    Enables the Debug domain.

    Syntax
    Visual Basic
    Public Sub DebuggerEnable( _
       ByVal Debugger As WEBKITX_DEBUGGER _
    ) 
    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.
    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 Editor_OnCreate(ByVal Settings As WebKitXCEF3Lib.ISettings, CommandLineSwitches As String)
        
        On Error Resume Next
          
        With Settings
            
            .app_path = FS.GetAbsolutePathName(App.Path)
            .accept_language_list = "es-CL,en-GB"
            .persist_session_cookies = 0
            .persist_user_preferences = 0
            .show_context_menu = False
            .asynchronous_com_events = True
            
            If InStr(CommandLine, "--debug-editor") > 0 Then
                .remote_debugging_port = 9222
            End If
                
        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 Editor_OnEvent(ByVal EventType As String, ByVal EventSelector As String, ByVal TargetSelector As String, ByVal TargetPath As String, ByVal EventData As String, ByVal Async As Boolean, PreventDefault As Boolean, CancelBubble As Boolean)
    
        On Error Resume Next
           
        Select Case EventType
        
        Case "mousedown"
        
            HTML_X = EventValue(EventData, "x")
            HTML_Y = EventValue(EventData, "y")
        
            If InStr(EventData, """which"": 3,") > 0 And InStr(EventData, """shiftKey"": true,") > 0 Then
                ContextMenuTimer.Enabled = False
                ContextMenuTimer.Enabled = True
            End If
            
        Case "click"
                
            Select Case TargetSelector
                    
            Case "#x-w2ui-designer-action-play":
                
                If Debugger.PageLoaded Then
                            
                    ' When continuing, unpause both client and server
                    
                    If Debugger.ClientPaused Then
                        Debugger.WebKitX.DebuggerContinue DEBUGGER_CHROMIUM
                    End If
                    
                    If Debugger.ServerPaused Then
                        Debugger.WebKitX.DebuggerContinue DEBUGGER_NODEJS
                    End If
                    
                End If
                    
            Case "#x-w2ui-designer-action-step-in":
                
                If Not Debugger Is Nothing Then
                    
                    If Debugger.ClientPaused And SelectedDebugger = DEBUGGER_CHROMIUM Then
                        
                        Debugger.WebKitX.DebuggerStepIn DEBUGGER_CHROMIUM
                    
                    ElseIf Debugger.ServerPaused And SelectedDebugger = DEBUGGER_NODEJS Then
                        
                        Debugger.WebKitX.DebuggerStepIn DEBUGGER_NODEJS
                        
                    End If
                    
                End If
                
            Case "#x-w2ui-designer-action-step-out":
                
                If Not Debugger Is Nothing Then
                
                    If Debugger.ClientPaused And SelectedDebugger = DEBUGGER_CHROMIUM Then
                        
                        Debugger.WebKitX.DebuggerStepOut DEBUGGER_CHROMIUM
                    
                    ElseIf Debugger.ServerPaused And SelectedDebugger = DEBUGGER_NODEJS Then
                        
                        Debugger.WebKitX.DebuggerStepOut DEBUGGER_NODEJS
                        
                    End If
                    
                End If
                
            Case "#x-w2ui-designer-action-step-over":
                
                If Not Debugger Is Nothing Then
                
                    If Debugger.ClientPaused And SelectedDebugger = DEBUGGER_CHROMIUM Then
                        
                        Debugger.WebKitX.DebuggerStepOver DEBUGGER_CHROMIUM
                    
                    ElseIf Debugger.ServerPaused And SelectedDebugger = DEBUGGER_NODEJS Then
                        
                        Debugger.WebKitX.DebuggerStepOver DEBUGGER_NODEJS
                        
                    End If
                
                End If
                
            Case "#x-w2ui-designer-action-stop":
                
                Debugger.Hide
                Debugger.PageLoaded = False
                Debugger.WebKitX.Open "about:blank"
                Debugger.WebKitX.StopNodeJS
                Debugger.WebKitX.DebuggerContinue DEBUGGER_CHROMIUM
                PrintStatus "Ready."
                
            End Select
            
        End Select
        
    End Sub
    See Also