Class: WebkitRemote::Client::StackTrace
- Inherits:
-
Object
- Object
- WebkitRemote::Client::StackTrace
- Defined in:
- lib/webkit_remote/client/runtime.rb
Overview
The call stack that represents the context of an assertion or error.
Instance Attribute Summary collapse
-
#description ⇒ String
readonly
Label of the trace; for async traces, might be the name of a function that initiated the async call.
-
#frames ⇒ Array<Symbol, Object>
readonly
Ruby-friendly stack trace.
-
#parent ⇒ WebkitRemote::Client::StackTrace
readonly
Stack trace for a parent async call; may be null.
Class Method Summary collapse
-
.parse(raw_stack_trace) ⇒ WebkitRemote::Client::StackTrace
Parses a StackTrace object returned by a RPC request.
Instance Method Summary collapse
-
#initialize(raw_stack_trace) ⇒ StackTrace
constructor
Parses a StackTrace object returned by a RPC request.
Constructor Details
#initialize(raw_stack_trace) ⇒ StackTrace
Parses a StackTrace object returned by a RPC request.
511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 |
# 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 |
Instance Attribute Details
#description ⇒ String (readonly)
Returns label of the trace; for async traces, might be the name of a function that initiated the async call.
540 541 542 |
# File 'lib/webkit_remote/client/runtime.rb', line 540 def description @description end |
#frames ⇒ Array<Symbol, Object> (readonly)
Returns Ruby-friendly stack trace.
543 544 545 |
# File 'lib/webkit_remote/client/runtime.rb', line 543 def frames @frames end |
#parent ⇒ WebkitRemote::Client::StackTrace (readonly)
Returns stack trace for a parent async call; may be null.
547 548 549 |
# File 'lib/webkit_remote/client/runtime.rb', line 547 def parent @parent end |
Class Method Details
.parse(raw_stack_trace) ⇒ WebkitRemote::Client::StackTrace
Parses a StackTrace object returned by a RPC request.
554 555 556 557 558 |
# 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 |