class WebkitRemote::Client::StackTrace

The call stack that represents the context of an assertion or error.

Attributes

description[R]

@return [String] label of the trace; for async traces, might be the name of

a function that initiated the async call
frames[R]

@return [Array<Symbol, Object>] Ruby-friendly stack trace

parent[R]

@return [WebkitRemote::Client::StackTrace] stack trace for a parent async

call; may be null

Public Class Methods

new(raw_stack_trace) click to toggle source

Parses a StackTrace object returned by a RPC request.

@param [Array<String, Object>] raw_stack_trace the raw StackTrace object

in the Runtime domain returned by an RPC request
# File lib/webkit_remote/client/runtime.rb, line 511
def initialize(raw_stack_trace)
  @description = raw_stack_trace['description']
  @frames = raw_stack_trace['callFrames'].map do |raw_frame|
    frame = {}
    if raw_frame['columnNumber']
      frame[:column] = raw_frame['columnNumber'].to_i
    end
    if raw_frame['lineNumber']
      frame[:line] = raw_frame['lineNumber'].to_i
    end
    if raw_frame['functionName']
      frame[:function] = raw_frame['functionName']
    end
    if raw_frame['url']
      frame[:url] = raw_frame['url']
    end
    frame
  end

  parent_trace = raw_stack_trace['parent']
  if parent_trace
    @parent = StackTrace.new parent_trace
  else
    @parent = nil
  end
end
parse(raw_stack_trace) click to toggle source

Parses a StackTrace object returned by a RPC request.

@param [Array<String, Object>] raw_stack_trace the raw StackTrace object

in the Runtime domain returned by an RPC request

@return [WebkitRemote::Client::StackTrace]

# File lib/webkit_remote/client/runtime.rb, line 554
def self.parse(raw_stack_trace)
  return nil unless raw_stack_trace

  StackTrace.new raw_stack_trace
end