class WebkitRemote::Event::NetworkRequest

Emitted right before a network request.

Attributes

document_url[R]

@return [String] the URL of the document that caused this network request

initiator[R]

@return [WebkitRemote::Client::NetworkRequestInitiator] cause for this

network request
loader_id[R]

@return [String] used to correlate events

redirect_response[R]

@return [WebkitRemote::Client::NetworkResponse] the HTTP redirect that

caused this request; can be nil
request[R]

@return [WebkitRemote::Client::NetworkRequest] information about this

network request
resource[R]

@return [WebkitRemote::Client::NetworkResource] information about the

resource fetched by this network operation
timestamp[R]

@return [Number] the event timestamp

Public Class Methods

can_reach?(client) click to toggle source

@private Use Event#can_receive instead of calling this directly.

# File lib/webkit_remote/client/network_events.rb, line 164
def self.can_reach?(client)
  client.network_events
end
new(rpc_event, client) click to toggle source

@private Use Event#for instead of calling this constructor directly.

Calls superclass method WebkitRemote::Event::new
# File lib/webkit_remote/client/network_events.rb, line 137
def initialize(rpc_event, client)
  super
  @document_url = raw_data['documentURL']
  if raw_data['initiator']
    @initiator = WebkitRemote::Client::NetworkRequestInitiator.new(
        raw_data['initiator'])
  end
  @loader_id = raw_data['loaderId']
  if raw_data['request']
    @request = WebkitRemote::Client::NetworkRequest.new(
        raw_data['request'])
  end
  if raw_data['redirectResponse']
    @redirect_response = WebkitRemote::Client::NetworkResponse.new(
        raw_data['redirectResponse'])
  end
  @timestamp = raw_data['timestamp']

  @resource = client.network_resource raw_data['requestId']
  @resource.set_document_url @document_url
  @resource.set_initiator @initiator
  @resource.set_request @request
  # TODO(pwnall): consider tracking redirects
  @resource.add_event self
end