Class: WebkitRemote::Event::NetworkRequest
- Inherits:
-
WebkitRemote::Event
- Object
- WebkitRemote::Event
- WebkitRemote::Event::NetworkRequest
- Defined in:
- lib/webkit_remote/client/network_events.rb
Overview
Emitted right before a network request.
Instance Attribute Summary collapse
-
#document_url ⇒ String
readonly
The URL of the document that caused this network request.
-
#initiator ⇒ WebkitRemote::Client::NetworkRequestInitiator
readonly
Cause for this network request.
-
#loader_id ⇒ String
readonly
Used to correlate events.
-
#redirect_response ⇒ WebkitRemote::Client::NetworkResponse
readonly
The HTTP redirect that caused this request; can be nil.
-
#request ⇒ WebkitRemote::Client::NetworkRequest
readonly
Information about this network request.
-
#resource ⇒ WebkitRemote::Client::NetworkResource
readonly
Information about the resource fetched by this network operation.
-
#timestamp ⇒ Number
readonly
The event timestamp.
Attributes inherited from WebkitRemote::Event
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(rpc_event, client) ⇒ NetworkRequest
constructor
A new instance of NetworkRequest.
Methods inherited from WebkitRemote::Event
can_receive?, class_for, for, #matches?, register, register_class
Constructor Details
#initialize(rpc_event, client) ⇒ NetworkRequest
Returns a new instance of NetworkRequest.
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 |
# 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 |
Instance Attribute Details
#document_url ⇒ String (readonly)
Returns the URL of the document that caused this network request.
120 121 122 |
# File 'lib/webkit_remote/client/network_events.rb', line 120 def document_url @document_url end |
#initiator ⇒ WebkitRemote::Client::NetworkRequestInitiator (readonly)
Returns cause for this network request.
124 125 126 |
# File 'lib/webkit_remote/client/network_events.rb', line 124 def initiator @initiator end |
#loader_id ⇒ String (readonly)
Returns used to correlate events.
131 132 133 |
# File 'lib/webkit_remote/client/network_events.rb', line 131 def loader_id @loader_id end |
#redirect_response ⇒ WebkitRemote::Client::NetworkResponse (readonly)
Returns the HTTP redirect that caused this request; can be nil.
128 129 130 |
# File 'lib/webkit_remote/client/network_events.rb', line 128 def redirect_response @redirect_response end |
#request ⇒ WebkitRemote::Client::NetworkRequest (readonly)
Returns information about this network request.
117 118 119 |
# File 'lib/webkit_remote/client/network_events.rb', line 117 def request @request end |
#resource ⇒ WebkitRemote::Client::NetworkResource (readonly)
Returns information about the resource fetched by this network operation.
113 114 115 |
# File 'lib/webkit_remote/client/network_events.rb', line 113 def resource @resource end |
#timestamp ⇒ Number (readonly)
Returns the event timestamp.
134 135 136 |
# File 'lib/webkit_remote/client/network_events.rb', line 134 def @timestamp end |
Class Method Details
.can_reach?(client) ⇒ Boolean
164 165 166 |
# File 'lib/webkit_remote/client/network_events.rb', line 164 def self.can_reach?(client) client.network_events end |