Tungsten v0.1.0 Tungsten.CDP.Debugger View Source
Debugger domain exposes JavaScript debugging capabilities. It allows setting and removing breakpoints, stepping through execution, exploring stack traces, etc.
Link to this section Summary
Link to this section Types
cdp_break_location_type()
View Source
cdp_break_location_type() :: %{
:script_id => Tungsten.CDP.Runtime.cdp_script_id_type(),
:line_number => integer(),
optional(:column_number) => integer(),
optional(:type) => :return | :call | :debugger_statement
}
cdp_break_location_type() :: %{
:script_id => Tungsten.CDP.Runtime.cdp_script_id_type(),
:line_number => integer(),
optional(:column_number) => integer(),
optional(:type) => :return | :call | :debugger_statement
}
This type has no documentation
cdp_breakpoint_id_type()
View Source
cdp_breakpoint_id_type() :: String.t()
cdp_breakpoint_id_type() :: String.t()
Breakpoint identifier.
cdp_call_frame_id_type()
View Source
cdp_call_frame_id_type() :: String.t()
cdp_call_frame_id_type() :: String.t()
Call frame identifier.
cdp_call_frame_type()
View Source
cdp_call_frame_type() :: %{
:call_frame_id => cdp_call_frame_id_type(),
:function_name => String.t(),
optional(:function_location) => cdp_location_type(),
:location => cdp_location_type(),
:url => String.t(),
:scope_chain => [cdp_scope_type()],
:this => Tungsten.CDP.Runtime.cdp_remote_object_type(),
optional(:return_value) => Tungsten.CDP.Runtime.cdp_remote_object_type()
}
cdp_call_frame_type() :: %{
:call_frame_id => cdp_call_frame_id_type(),
:function_name => String.t(),
optional(:function_location) => cdp_location_type(),
:location => cdp_location_type(),
:url => String.t(),
:scope_chain => [cdp_scope_type()],
:this => Tungsten.CDP.Runtime.cdp_remote_object_type(),
optional(:return_value) => Tungsten.CDP.Runtime.cdp_remote_object_type()
}
JavaScript call frame. Array of call frames form the call stack.
cdp_location_type()
View Source
cdp_location_type() :: %{
:script_id => Tungsten.CDP.Runtime.cdp_script_id_type(),
:line_number => integer(),
optional(:column_number) => integer()
}
cdp_location_type() :: %{
:script_id => Tungsten.CDP.Runtime.cdp_script_id_type(),
:line_number => integer(),
optional(:column_number) => integer()
}
Location in the source code.
cdp_scope_type()
View Source
cdp_scope_type() :: %{
:type =>
:module
| :eval
| :script
| :block
| :catch
| :closure
| :with
| :local
| :global,
:object => Tungsten.CDP.Runtime.cdp_remote_object_type(),
optional(:name) => String.t(),
optional(:start_location) => cdp_location_type(),
optional(:end_location) => cdp_location_type()
}
cdp_scope_type() :: %{
:type =>
:module
| :eval
| :script
| :block
| :catch
| :closure
| :with
| :local
| :global,
:object => Tungsten.CDP.Runtime.cdp_remote_object_type(),
optional(:name) => String.t(),
optional(:start_location) => cdp_location_type(),
optional(:end_location) => cdp_location_type()
}
Scope description.
cdp_script_position_type() View Source
Location in the source code.
cdp_search_match_type() View Source
Search match for resource.
Link to this section Functions
continue_to_location(session, parameters, options \\ [])
View Source
continue_to_location(
GenServer.server(),
%{
:location => cdp_location_type(),
optional(:target_call_frames) => :current | :any
},
Tungsten.Connection.exec_options()
) :: {:ok, map()} | {:error, term()}
continue_to_location( GenServer.server(), %{ :location => cdp_location_type(), optional(:target_call_frames) => :current | :any }, Tungsten.Connection.exec_options() ) :: {:ok, map()} | {:error, term()}
Continues execution until specific location is reached.
disable(session, parameters \\ %{}, options \\ [])
View Source
disable(GenServer.server(), map(), Tungsten.Connection.exec_options()) ::
{:ok, map()} | {:error, term()}
disable(GenServer.server(), map(), Tungsten.Connection.exec_options()) :: {:ok, map()} | {:error, term()}
Disables debugger for given page.
enable(session, parameters \\ %{}, options \\ [])
View Source
enable(
GenServer.server(),
%{optional(:max_scripts_cache_size) => integer() | float()},
Tungsten.Connection.exec_options()
) ::
{:ok, %{debugger_id: Tungsten.CDP.Runtime.cdp_unique_debugger_id_type()}}
| {:error, term()}
enable( GenServer.server(), %{optional(:max_scripts_cache_size) => integer() | float()}, Tungsten.Connection.exec_options() ) :: {:ok, %{debugger_id: Tungsten.CDP.Runtime.cdp_unique_debugger_id_type()}} | {:error, term()}
Enables debugger for the given page. Clients should not assume that the debugging has been enabled until the result for this command is received.
evaluate_on_call_frame(session, parameters, options \\ [])
View Source
evaluate_on_call_frame(
GenServer.server(),
%{
:call_frame_id => cdp_call_frame_id_type(),
:expression => String.t(),
optional(:object_group) => String.t(),
optional(:include_command_line_api) => boolean(),
optional(:silent) => boolean(),
optional(:return_by_value) => boolean(),
optional(:generate_preview) => boolean(),
optional(:throw_on_side_effect) => boolean(),
optional(:timeout) => Tungsten.CDP.Runtime.cdp_time_delta_type()
},
Tungsten.Connection.exec_options()
) ::
{:ok,
%{
:result => Tungsten.CDP.Runtime.cdp_remote_object_type(),
optional(:exception_details) =>
Tungsten.CDP.Runtime.cdp_exception_details_type()
}}
| {:error, term()}
evaluate_on_call_frame( GenServer.server(), %{ :call_frame_id => cdp_call_frame_id_type(), :expression => String.t(), optional(:object_group) => String.t(), optional(:include_command_line_api) => boolean(), optional(:silent) => boolean(), optional(:return_by_value) => boolean(), optional(:generate_preview) => boolean(), optional(:throw_on_side_effect) => boolean(), optional(:timeout) => Tungsten.CDP.Runtime.cdp_time_delta_type() }, Tungsten.Connection.exec_options() ) :: {:ok, %{ :result => Tungsten.CDP.Runtime.cdp_remote_object_type(), optional(:exception_details) => Tungsten.CDP.Runtime.cdp_exception_details_type() }} | {:error, term()}
Evaluates expression on a given call frame.
get_possible_breakpoints(session, parameters, options \\ [])
View Source
get_possible_breakpoints(
GenServer.server(),
%{
:start => cdp_location_type(),
optional(:end) => cdp_location_type(),
optional(:restrict_to_function) => boolean()
},
Tungsten.Connection.exec_options()
) :: {:ok, %{locations: [cdp_break_location_type()]}} | {:error, term()}
get_possible_breakpoints( GenServer.server(), %{ :start => cdp_location_type(), optional(:end) => cdp_location_type(), optional(:restrict_to_function) => boolean() }, Tungsten.Connection.exec_options() ) :: {:ok, %{locations: [cdp_break_location_type()]}} | {:error, term()}
Debugger.getPossibleBreakpoints
Returns possible locations for breakpoint. scriptId in start and end range locations should be the same.
get_script_source(session, parameters, options \\ [])
View Source
get_script_source(
GenServer.server(),
%{script_id: Tungsten.CDP.Runtime.cdp_script_id_type()},
Tungsten.Connection.exec_options()
) :: {:ok, %{script_source: String.t()}} | {:error, term()}
get_script_source( GenServer.server(), %{script_id: Tungsten.CDP.Runtime.cdp_script_id_type()}, Tungsten.Connection.exec_options() ) :: {:ok, %{script_source: String.t()}} | {:error, term()}
Returns source for the script with given id.
get_stack_trace(session, parameters, options \\ [])
View Source
get_stack_trace(
GenServer.server(),
%{stack_trace_id: Tungsten.CDP.Runtime.cdp_stack_trace_id_type()},
Tungsten.Connection.exec_options()
) ::
{:ok, %{stack_trace: Tungsten.CDP.Runtime.cdp_stack_trace_type()}}
| {:error, term()}
get_stack_trace( GenServer.server(), %{stack_trace_id: Tungsten.CDP.Runtime.cdp_stack_trace_id_type()}, Tungsten.Connection.exec_options() ) :: {:ok, %{stack_trace: Tungsten.CDP.Runtime.cdp_stack_trace_type()}} | {:error, term()}
Returns stack trace with given stackTraceId.
pause(session, parameters \\ %{}, options \\ [])
View Source
pause(GenServer.server(), map(), Tungsten.Connection.exec_options()) ::
{:ok, map()} | {:error, term()}
pause(GenServer.server(), map(), Tungsten.Connection.exec_options()) :: {:ok, map()} | {:error, term()}
Stops on the next JavaScript statement.
pause_on_async_call(session, parameters, options \\ [])
View Source
pause_on_async_call(
GenServer.server(),
%{parent_stack_trace_id: Tungsten.CDP.Runtime.cdp_stack_trace_id_type()},
Tungsten.Connection.exec_options()
) :: {:ok, map()} | {:error, term()}
pause_on_async_call( GenServer.server(), %{parent_stack_trace_id: Tungsten.CDP.Runtime.cdp_stack_trace_id_type()}, Tungsten.Connection.exec_options() ) :: {:ok, map()} | {:error, term()}
This command has no documentation
remove_breakpoint(session, parameters, options \\ [])
View Source
remove_breakpoint(
GenServer.server(),
%{breakpoint_id: cdp_breakpoint_id_type()},
Tungsten.Connection.exec_options()
) :: {:ok, map()} | {:error, term()}
remove_breakpoint( GenServer.server(), %{breakpoint_id: cdp_breakpoint_id_type()}, Tungsten.Connection.exec_options() ) :: {:ok, map()} | {:error, term()}
Removes JavaScript breakpoint.
restart_frame(session, parameters, options \\ [])
View Source
restart_frame(
GenServer.server(),
%{call_frame_id: cdp_call_frame_id_type()},
Tungsten.Connection.exec_options()
) ::
{:ok,
%{
:call_frames => [cdp_call_frame_type()],
optional(:async_stack_trace) =>
Tungsten.CDP.Runtime.cdp_stack_trace_type(),
optional(:async_stack_trace_id) =>
Tungsten.CDP.Runtime.cdp_stack_trace_id_type()
}}
| {:error, term()}
restart_frame( GenServer.server(), %{call_frame_id: cdp_call_frame_id_type()}, Tungsten.Connection.exec_options() ) :: {:ok, %{ :call_frames => [cdp_call_frame_type()], optional(:async_stack_trace) => Tungsten.CDP.Runtime.cdp_stack_trace_type(), optional(:async_stack_trace_id) => Tungsten.CDP.Runtime.cdp_stack_trace_id_type() }} | {:error, term()}
Restarts particular call frame from the beginning.
resume(session, parameters \\ %{}, options \\ [])
View Source
resume(GenServer.server(), map(), Tungsten.Connection.exec_options()) ::
{:ok, map()} | {:error, term()}
resume(GenServer.server(), map(), Tungsten.Connection.exec_options()) :: {:ok, map()} | {:error, term()}
Resumes JavaScript execution.
search_in_content(session, parameters, options \\ [])
View Source
search_in_content(
GenServer.server(),
%{
:script_id => Tungsten.CDP.Runtime.cdp_script_id_type(),
:query => String.t(),
optional(:case_sensitive) => boolean(),
optional(:is_regex) => boolean()
},
Tungsten.Connection.exec_options()
) :: {:ok, %{result: [cdp_search_match_type()]}} | {:error, term()}
search_in_content( GenServer.server(), %{ :script_id => Tungsten.CDP.Runtime.cdp_script_id_type(), :query => String.t(), optional(:case_sensitive) => boolean(), optional(:is_regex) => boolean() }, Tungsten.Connection.exec_options() ) :: {:ok, %{result: [cdp_search_match_type()]}} | {:error, term()}
Searches for given string in script content.
set_async_call_stack_depth(session, parameters, options \\ [])
View Source
set_async_call_stack_depth(
GenServer.server(),
%{max_depth: integer()},
Tungsten.Connection.exec_options()
) :: {:ok, map()} | {:error, term()}
set_async_call_stack_depth( GenServer.server(), %{max_depth: integer()}, Tungsten.Connection.exec_options() ) :: {:ok, map()} | {:error, term()}
Debugger.setAsyncCallStackDepth
Enables or disables async call stacks tracking.
set_blackbox_patterns(session, parameters, options \\ [])
View Source
set_blackbox_patterns(
GenServer.server(),
%{patterns: [String.t()]},
Tungsten.Connection.exec_options()
) :: {:ok, map()} | {:error, term()}
set_blackbox_patterns( GenServer.server(), %{patterns: [String.t()]}, Tungsten.Connection.exec_options() ) :: {:ok, map()} | {:error, term()}
Replace previous blackbox patterns with passed ones. Forces backend to skip stepping/pausing in scripts with url matching one of the patterns. VM will try to leave blackboxed script by performing 'step in' several times, finally resorting to 'step out' if unsuccessful.
set_blackboxed_ranges(session, parameters, options \\ [])
View Source
set_blackboxed_ranges(
GenServer.server(),
%{
script_id: Tungsten.CDP.Runtime.cdp_script_id_type(),
positions: [cdp_script_position_type()]
},
Tungsten.Connection.exec_options()
) :: {:ok, map()} | {:error, term()}
set_blackboxed_ranges( GenServer.server(), %{ script_id: Tungsten.CDP.Runtime.cdp_script_id_type(), positions: [cdp_script_position_type()] }, Tungsten.Connection.exec_options() ) :: {:ok, map()} | {:error, term()}
Makes backend skip steps in the script in blackboxed ranges. VM will try leave blacklisted scripts by performing 'step in' several times, finally resorting to 'step out' if unsuccessful. Positions array contains positions where blackbox state is changed. First interval isn't blackboxed. Array should be sorted.
set_breakpoint(session, parameters, options \\ [])
View Source
set_breakpoint(
GenServer.server(),
%{:location => cdp_location_type(), optional(:condition) => String.t()},
Tungsten.Connection.exec_options()
) ::
{:ok,
%{
breakpoint_id: cdp_breakpoint_id_type(),
actual_location: cdp_location_type()
}}
| {:error, term()}
set_breakpoint( GenServer.server(), %{:location => cdp_location_type(), optional(:condition) => String.t()}, Tungsten.Connection.exec_options() ) :: {:ok, %{ breakpoint_id: cdp_breakpoint_id_type(), actual_location: cdp_location_type() }} | {:error, term()}
Sets JavaScript breakpoint at a given location.
set_breakpoint_by_url(session, parameters, options \\ [])
View Source
set_breakpoint_by_url(
GenServer.server(),
%{
:line_number => integer(),
optional(:url) => String.t(),
optional(:url_regex) => String.t(),
optional(:script_hash) => String.t(),
optional(:column_number) => integer(),
optional(:condition) => String.t()
},
Tungsten.Connection.exec_options()
) ::
{:ok,
%{breakpoint_id: cdp_breakpoint_id_type(), locations: [cdp_location_type()]}}
| {:error, term()}
set_breakpoint_by_url( GenServer.server(), %{ :line_number => integer(), optional(:url) => String.t(), optional(:url_regex) => String.t(), optional(:script_hash) => String.t(), optional(:column_number) => integer(), optional(:condition) => String.t() }, Tungsten.Connection.exec_options() ) :: {:ok, %{breakpoint_id: cdp_breakpoint_id_type(), locations: [cdp_location_type()]}} | {:error, term()}
Sets JavaScript breakpoint at given location specified either by URL or URL regex. Once this
command is issued, all existing parsed scripts will have breakpoints resolved and returned in
locations property. Further matching script parsing will result in subsequent
breakpointResolved events issued. This logical breakpoint will survive page reloads.
set_breakpoint_on_function_call(session, parameters, options \\ [])
View Source
set_breakpoint_on_function_call(
GenServer.server(),
%{
:object_id => Tungsten.CDP.Runtime.cdp_remote_object_id_type(),
optional(:condition) => String.t()
},
Tungsten.Connection.exec_options()
) :: {:ok, %{breakpoint_id: cdp_breakpoint_id_type()}} | {:error, term()}
set_breakpoint_on_function_call( GenServer.server(), %{ :object_id => Tungsten.CDP.Runtime.cdp_remote_object_id_type(), optional(:condition) => String.t() }, Tungsten.Connection.exec_options() ) :: {:ok, %{breakpoint_id: cdp_breakpoint_id_type()}} | {:error, term()}
Debugger.setBreakpointOnFunctionCall
Sets JavaScript breakpoint before each call to the given function. If another function was created from the same source as a given one, calling it will also trigger the breakpoint.
set_breakpoints_active(session, parameters, options \\ [])
View Source
set_breakpoints_active(
GenServer.server(),
%{active: boolean()},
Tungsten.Connection.exec_options()
) :: {:ok, map()} | {:error, term()}
set_breakpoints_active( GenServer.server(), %{active: boolean()}, Tungsten.Connection.exec_options() ) :: {:ok, map()} | {:error, term()}
Activates / deactivates all breakpoints on the page.
set_pause_on_exceptions(session, parameters, options \\ [])
View Source
set_pause_on_exceptions(
GenServer.server(),
%{state: :all | :uncaught | :none},
Tungsten.Connection.exec_options()
) :: {:ok, map()} | {:error, term()}
set_pause_on_exceptions( GenServer.server(), %{state: :all | :uncaught | :none}, Tungsten.Connection.exec_options() ) :: {:ok, map()} | {:error, term()}
Defines pause on exceptions state. Can be set to stop on all exceptions, uncaught exceptions or
no exceptions. Initial pause on exceptions state is none.
set_return_value(session, parameters, options \\ [])
View Source
set_return_value(
GenServer.server(),
%{new_value: Tungsten.CDP.Runtime.cdp_call_argument_type()},
Tungsten.Connection.exec_options()
) :: {:ok, map()} | {:error, term()}
set_return_value( GenServer.server(), %{new_value: Tungsten.CDP.Runtime.cdp_call_argument_type()}, Tungsten.Connection.exec_options() ) :: {:ok, map()} | {:error, term()}
Changes return value in top frame. Available only at return break position.
set_script_source(session, parameters, options \\ [])
View Source
set_script_source(
GenServer.server(),
%{
:script_id => Tungsten.CDP.Runtime.cdp_script_id_type(),
:script_source => String.t(),
optional(:dry_run) => boolean()
},
Tungsten.Connection.exec_options()
) ::
{:ok,
%{
optional(:call_frames) => [cdp_call_frame_type()],
optional(:stack_changed) => boolean(),
optional(:async_stack_trace) =>
Tungsten.CDP.Runtime.cdp_stack_trace_type(),
optional(:async_stack_trace_id) =>
Tungsten.CDP.Runtime.cdp_stack_trace_id_type(),
optional(:exception_details) =>
Tungsten.CDP.Runtime.cdp_exception_details_type()
}}
| {:error, term()}
set_script_source( GenServer.server(), %{ :script_id => Tungsten.CDP.Runtime.cdp_script_id_type(), :script_source => String.t(), optional(:dry_run) => boolean() }, Tungsten.Connection.exec_options() ) :: {:ok, %{ optional(:call_frames) => [cdp_call_frame_type()], optional(:stack_changed) => boolean(), optional(:async_stack_trace) => Tungsten.CDP.Runtime.cdp_stack_trace_type(), optional(:async_stack_trace_id) => Tungsten.CDP.Runtime.cdp_stack_trace_id_type(), optional(:exception_details) => Tungsten.CDP.Runtime.cdp_exception_details_type() }} | {:error, term()}
Edits JavaScript source live.
set_skip_all_pauses(session, parameters, options \\ [])
View Source
set_skip_all_pauses(
GenServer.server(),
%{skip: boolean()},
Tungsten.Connection.exec_options()
) :: {:ok, map()} | {:error, term()}
set_skip_all_pauses( GenServer.server(), %{skip: boolean()}, Tungsten.Connection.exec_options() ) :: {:ok, map()} | {:error, term()}
Makes page not interrupt on any pauses (breakpoint, exception, dom exception etc).
set_variable_value(session, parameters, options \\ [])
View Source
set_variable_value(
GenServer.server(),
%{
scope_number: integer(),
variable_name: String.t(),
new_value: Tungsten.CDP.Runtime.cdp_call_argument_type(),
call_frame_id: cdp_call_frame_id_type()
},
Tungsten.Connection.exec_options()
) :: {:ok, map()} | {:error, term()}
set_variable_value( GenServer.server(), %{ scope_number: integer(), variable_name: String.t(), new_value: Tungsten.CDP.Runtime.cdp_call_argument_type(), call_frame_id: cdp_call_frame_id_type() }, Tungsten.Connection.exec_options() ) :: {:ok, map()} | {:error, term()}
Changes value of variable in a callframe. Object-based scopes are not supported and must be mutated manually.
step_into(session, parameters \\ %{}, options \\ [])
View Source
step_into(
GenServer.server(),
%{optional(:break_on_async_call) => boolean()},
Tungsten.Connection.exec_options()
) :: {:ok, map()} | {:error, term()}
step_into( GenServer.server(), %{optional(:break_on_async_call) => boolean()}, Tungsten.Connection.exec_options() ) :: {:ok, map()} | {:error, term()}
Steps into the function call.
step_out(session, parameters \\ %{}, options \\ [])
View Source
step_out(GenServer.server(), map(), Tungsten.Connection.exec_options()) ::
{:ok, map()} | {:error, term()}
step_out(GenServer.server(), map(), Tungsten.Connection.exec_options()) :: {:ok, map()} | {:error, term()}
Steps out of the function call.
step_over(session, parameters \\ %{}, options \\ [])
View Source
step_over(GenServer.server(), map(), Tungsten.Connection.exec_options()) ::
{:ok, map()} | {:error, term()}
step_over(GenServer.server(), map(), Tungsten.Connection.exec_options()) :: {:ok, map()} | {:error, term()}
Steps over the statement.