Module: WebkitRemote::Client::Network
- Included in:
- WebkitRemote::Client
- Defined in:
- lib/webkit_remote/client/network.rb
Overview
API for the Network domain.
Instance Attribute Summary collapse
-
#disable_cache ⇒ Boolean
True if the browser’s network cache is disabled, so every resource load generates an HTTP request.
- #http_headers ⇒ Hash<String, String>
-
#network_events ⇒ Boolean
True if the debugger generates Network.* events.
-
#network_resources ⇒ Array<WebkitRemote::Client::NetworkResource>
readonly
This is only populated when Network events are received.
-
#user_agent ⇒ String
Replaces the brower’s built-in User-Agent string.
Instance Method Summary collapse
-
#can_clear_cookies? ⇒ Boolean
Checks if the debugger can clear the browser’s cookies.
-
#can_clear_network_cache? ⇒ Boolean
Checks if the debugger can clear the browser’s cache.
-
#clear_cookies ⇒ WebkitRemote::Client
Removes all the cookies in the debugged browser.
-
#clear_network ⇒ WebkitRemote::Client
Removes the cached network request information.
-
#clear_network_cache ⇒ WebkitRemote::Client
Removes all the cached data in the debugged browser.
- #initialize_network ⇒ Object
-
#network_resource(remote_id) ⇒ WebkitRemote::Client::NetworkResource
Looks up network resources by IDs assigned by the WebKit remote debugger.
Instance Attribute Details
#disable_cache ⇒ Boolean
Returns true if the browser’s network cache is disabled, so every resource load generates an HTTP request.
105 106 107 |
# File 'lib/webkit_remote/client/network.rb', line 105 def disable_cache @disable_cache end |
#http_headers ⇒ Hash<String, String>
111 112 113 |
# File 'lib/webkit_remote/client/network.rb', line 111 def http_headers @http_headers end |
#network_events ⇒ Boolean
Returns true if the debugger generates Network.* events.
95 96 97 |
# File 'lib/webkit_remote/client/network.rb', line 95 def network_events @network_events end |
#network_resources ⇒ Array<WebkitRemote::Client::NetworkResource> (readonly)
This is only populated when Network events are received.
101 102 103 |
# File 'lib/webkit_remote/client/network.rb', line 101 def network_resources @network_resources end |
#user_agent ⇒ String
Returns replaces the brower’s built-in User-Agent string.
108 109 110 |
# File 'lib/webkit_remote/client/network.rb', line 108 def user_agent @user_agent end |
Instance Method Details
#can_clear_cookies? ⇒ Boolean
Checks if the debugger can clear the browser’s cookies.
64 65 66 67 |
# File 'lib/webkit_remote/client/network.rb', line 64 def response = @rpc.call 'Network.canClearBrowserCookies' !!response['result'] end |
#can_clear_network_cache? ⇒ Boolean
Checks if the debugger can clear the browser’s cache.
81 82 83 84 |
# File 'lib/webkit_remote/client/network.rb', line 81 def can_clear_network_cache? response = @rpc.call 'Network.canClearBrowserCache' !!response['result'] end |
#clear_cookies ⇒ WebkitRemote::Client
Removes all the cookies in the debugged browser.
72 73 74 75 |
# File 'lib/webkit_remote/client/network.rb', line 72 def @rpc.call 'Network.clearBrowserCookies' self end |
#clear_network ⇒ WebkitRemote::Client
Removes the cached network request information.
134 135 136 137 138 |
# File 'lib/webkit_remote/client/network.rb', line 134 def clear_network @network_resource_hash.clear @network_resources.clear self end |
#clear_network_cache ⇒ WebkitRemote::Client
Removes all the cached data in the debugged browser.
89 90 91 92 |
# File 'lib/webkit_remote/client/network.rb', line 89 def clear_network_cache @rpc.call 'Network.clearBrowserCache' self end |
#initialize_network ⇒ Object
141 142 143 144 145 146 147 |
# File 'lib/webkit_remote/client/network.rb', line 141 def initialize_network @disable_cache = false @network_events = false @network_resources = [] @network_resource_hash = {} @user_agent = nil end |
#network_resource(remote_id) ⇒ WebkitRemote::Client::NetworkResource
Looks up network resources by IDs assigned by the WebKit remote debugger.
121 122 123 124 125 126 127 128 129 |
# File 'lib/webkit_remote/client/network.rb', line 121 def network_resource(remote_id) if @network_resource_hash[remote_id] return @network_resource_hash[remote_id] end resource = WebkitRemote::Client::NetworkResource.new remote_id, self @network_resources << resource @network_resource_hash[remote_id] = resource end |