Class: WebkitRemote::Event::NetworkFailure

Inherits:
WebkitRemote::Event show all
Defined in:
lib/webkit_remote/client/network_events.rb

Overview

Emitted when a resource fails to load.

Instance Attribute Summary collapse

Attributes inherited from WebkitRemote::Event

#domain, #name, #raw_data

Instance Method Summary collapse

Methods inherited from WebkitRemote::Event

can_reach?, can_receive?, class_for, for, #matches?, register, register_class

Constructor Details

#initialize(rpc_event, client) ⇒ NetworkFailure

Returns a new instance of NetworkFailure.



56
57
58
59
60
61
62
63
64
65
66
# File 'lib/webkit_remote/client/network_events.rb', line 56

def initialize(rpc_event, client)
  super
  @canceled = !!raw_data['canceled']
  @error = raw_data['errorText']
  @timestamp = raw_data['timestamp']

  @resource = client.network_resource raw_data['requestId']
  @resource.set_canceled @canceled
  @resource.set_error @error
  @resource.add_event self
end

Instance Attribute Details

#canceledBoolean (readonly)

For example, CORS violations cause requests to be canceled.

Returns:

  • (Boolean)

    true if the request was canceled



53
54
55
# File 'lib/webkit_remote/client/network_events.rb', line 53

def canceled
  @canceled
end

#errorString (readonly)

Returns the error message.

Returns:

  • (String)

    the error message



48
49
50
# File 'lib/webkit_remote/client/network_events.rb', line 48

def error
  @error
end

#resourceWebkitRemote::Client::NetworkResource (readonly)

Returns information about the resource fetched by this network operation.

Returns:



42
43
44
# File 'lib/webkit_remote/client/network_events.rb', line 42

def resource
  @resource
end

#timestampNumber (readonly)

Returns the event timestamp.

Returns:

  • (Number)

    the event timestamp



45
46
47
# File 'lib/webkit_remote/client/network_events.rb', line 45

def timestamp
  @timestamp
end