Class: WebkitRemote::Client::NetworkRequestInitiator

Inherits:
Object
  • Object
show all
Defined in:
lib/webkit_remote/client/network_events.rb

Overview

Wraps information about the reason behind a network request.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw_initiator) ⇒ NetworkRequestInitiator

Returns a new instance of NetworkRequestInitiator.



511
512
513
514
515
516
517
518
519
520
521
# File 'lib/webkit_remote/client/network_events.rb', line 511

def initialize(raw_initiator)
  if raw_initiator['lineNumber']
    @line = raw_initiator['lineNumber'].to_i
  else
    @line = nil
  end

  @stack_trace = WebkitRemote::Client::StackTrace.parse raw_initiator['stack']
  @type = (raw_initiator['type'] || 'other').to_sym
  @url = raw_initiator['url']
end

Instance Attribute Details

#lineNumber (readonly)

Returns number of the line that references the requested resource.

Returns:

  • (Number)

    number of the line that references the requested resource



504
505
506
# File 'lib/webkit_remote/client/network_events.rb', line 504

def line
  @line
end

#stack_traceWebkitRemote::Client::StackTrace (readonly)

Returns JavaScript trace, set only for :script initiators.

Returns:



508
509
510
# File 'lib/webkit_remote/client/network_events.rb', line 508

def stack_trace
  @stack_trace
end

#typeSymbol (readonly)

Returns reason behind the request; documented values are :parser, :script and :other.

Returns:

  • (Symbol)

    reason behind the request; documented values are :parser, :script and :other



498
499
500
# File 'lib/webkit_remote/client/network_events.rb', line 498

def type
  @type
end

#urlString (readonly)

Returns URL of the document that references the requested resource.

Returns:

  • (String)

    URL of the document that references the requested resource



501
502
503
# File 'lib/webkit_remote/client/network_events.rb', line 501

def url
  @url
end