webkit_remote 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +11 -0
- data/VERSION +1 -1
- data/lib/webkit_remote/client/dom.rb +21 -21
- data/lib/webkit_remote/client/dom_runtime.rb +34 -0
- data/lib/webkit_remote/client/runtime.rb +21 -1
- data/lib/webkit_remote/client.rb +6 -0
- data/lib/webkit_remote.rb +1 -0
- data/test/webkit_remote/client/network_test.rb +12 -0
- data/webkit_remote.gemspec +2 -1
- metadata +3 -2
data/README.md
CHANGED
@@ -30,6 +30,12 @@ have been implemented:
|
|
30
30
|
* Page
|
31
31
|
* Remote
|
32
32
|
|
33
|
+
This gem will only support officially released remote debugging protocol
|
34
|
+
features. If you need to use an unsupported feature, such as CSS debugging,
|
35
|
+
take a look at the
|
36
|
+
[webkit_remote_unstable](https:://github.com/pwnall/webkit_remote_unstable)
|
37
|
+
gem.
|
38
|
+
|
33
39
|
|
34
40
|
## Requirements
|
35
41
|
|
@@ -218,6 +224,11 @@ closes the debugging connection and shuts down the Google Chrome instance.
|
|
218
224
|
|
219
225
|
## Contributing
|
220
226
|
|
227
|
+
Please contribute support for stable features to
|
228
|
+
[webkit_remote](https:://github.com/pwnall/webkit_remote) and support for
|
229
|
+
unstable features at
|
230
|
+
[webkit_remote_unstable](https:://github.com/pwnall/webkit_remote_unstable).
|
231
|
+
|
221
232
|
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
222
233
|
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
|
223
234
|
* Fork the project.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.1
|
@@ -222,6 +222,27 @@ class DomNode
|
|
222
222
|
@system_id = nil
|
223
223
|
@value = nil
|
224
224
|
@xml_version = nil
|
225
|
+
|
226
|
+
initialize_modules
|
227
|
+
end
|
228
|
+
|
229
|
+
def initialize_modules
|
230
|
+
end
|
231
|
+
private :initialize_modules
|
232
|
+
|
233
|
+
# Registers a module initializer.
|
234
|
+
def self.initializer(name)
|
235
|
+
before_name = :"initialize_modules_before_#{name}"
|
236
|
+
alias_method before_name, :initialize_modules
|
237
|
+
private before_name
|
238
|
+
remove_method :initialize_modules
|
239
|
+
eval <<END_METHOD
|
240
|
+
def initialize_modules
|
241
|
+
#{name}
|
242
|
+
#{before_name.to_s}
|
243
|
+
end
|
244
|
+
END_METHOD
|
245
|
+
private :initialize_modules
|
225
246
|
end
|
226
247
|
|
227
248
|
# Updates node state to reflect new data from the Webkit debugging server.
|
@@ -270,27 +291,6 @@ class DomNode
|
|
270
291
|
}.freeze
|
271
292
|
end # class WebkitRemote::Client::DomNode
|
272
293
|
|
273
|
-
class JsObject
|
274
|
-
# @return [WebkitRemote::Client::DomNode] the DOM node wrapped by this
|
275
|
-
# JavaScript object
|
276
|
-
def dom_node
|
277
|
-
@dom_node ||= dom_node!
|
278
|
-
end
|
279
|
-
|
280
|
-
# Fetches the wrapped DOM node, bypassing the object's cache.
|
281
|
-
#
|
282
|
-
# @return [WebkitRemote::Client::DomNode] the DOM domain object wrapped by
|
283
|
-
# this JavaScript object
|
284
|
-
def dom_node!
|
285
|
-
result = @client.rpc.call 'DOM.requestNode', objectId: @remote_id
|
286
|
-
@dom_node = if result['nodeId']
|
287
|
-
@client.dom_node result['nodeId']
|
288
|
-
else
|
289
|
-
nil
|
290
|
-
end
|
291
|
-
end
|
292
|
-
end # class WebkitRemote::Client::JsObject
|
293
|
-
|
294
294
|
end # namespace WebkitRemote::Client
|
295
295
|
|
296
296
|
end # namespace WebkitRemote
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module WebkitRemote
|
2
|
+
|
3
|
+
class Client
|
4
|
+
|
5
|
+
class JsObject
|
6
|
+
# @return [WebkitRemote::Client::DomNode] the DOM node wrapped by this
|
7
|
+
# JavaScript object
|
8
|
+
def dom_node
|
9
|
+
@dom_node ||= dom_node!
|
10
|
+
end
|
11
|
+
|
12
|
+
# Fetches the wrapped DOM node, bypassing the object's cache.
|
13
|
+
#
|
14
|
+
# @return [WebkitRemote::Client::DomNode] the DOM domain object wrapped by
|
15
|
+
# this JavaScript object
|
16
|
+
def dom_node!
|
17
|
+
result = @client.rpc.call 'DOM.requestNode', objectId: @remote_id
|
18
|
+
@dom_node = if result['nodeId']
|
19
|
+
@client.dom_node result['nodeId']
|
20
|
+
else
|
21
|
+
nil
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
# @private Called by the JsObject constructor.
|
26
|
+
def initialize_dom
|
27
|
+
@dom_node = nil
|
28
|
+
end
|
29
|
+
initializer :initialize_dom
|
30
|
+
end # class WebkitRemote::Client::JsObject
|
31
|
+
|
32
|
+
end # namespace WebkitRemote::Client
|
33
|
+
|
34
|
+
end # namespace WebkitRemote
|
@@ -299,9 +299,29 @@ class JsObject
|
|
299
299
|
@js_subtype = nil
|
300
300
|
end
|
301
301
|
@value = raw_object['value']
|
302
|
-
@dom_node = nil
|
303
302
|
|
304
303
|
group.add self
|
304
|
+
|
305
|
+
initialize_modules
|
306
|
+
end
|
307
|
+
|
308
|
+
def initialize_modules
|
309
|
+
end
|
310
|
+
private :initialize_modules
|
311
|
+
|
312
|
+
# Registers a module initializer.
|
313
|
+
def self.initializer(name)
|
314
|
+
before_name = :"initialize_modules_before_#{name}"
|
315
|
+
alias_method before_name, :initialize_modules
|
316
|
+
private before_name
|
317
|
+
remove_method :initialize_modules
|
318
|
+
eval <<END_METHOD
|
319
|
+
def initialize_modules
|
320
|
+
#{name}
|
321
|
+
#{before_name.to_s}
|
322
|
+
end
|
323
|
+
END_METHOD
|
324
|
+
private :initialize_modules
|
305
325
|
end
|
306
326
|
|
307
327
|
# Informs this object that it was released as part of a group release.
|
data/lib/webkit_remote/client.rb
CHANGED
@@ -111,6 +111,7 @@ class Client
|
|
111
111
|
def self.initializer(name)
|
112
112
|
before_name = :"initialize_modules_before_#{name}"
|
113
113
|
alias_method before_name, :initialize_modules
|
114
|
+
private before_name
|
114
115
|
remove_method :initialize_modules
|
115
116
|
eval <<END_METHOD
|
116
117
|
def initialize_modules
|
@@ -118,12 +119,14 @@ class Client
|
|
118
119
|
#{before_name.to_s}
|
119
120
|
end
|
120
121
|
END_METHOD
|
122
|
+
private :initialize_modules
|
121
123
|
end
|
122
124
|
|
123
125
|
# Registers a module clearer.
|
124
126
|
def self.clearer(name)
|
125
127
|
before_name = :"clear_modules_before_#{name}"
|
126
128
|
alias_method before_name, :clear_modules
|
129
|
+
private before_name
|
127
130
|
remove_method :clear_modules
|
128
131
|
eval <<END_METHOD
|
129
132
|
def clear_modules
|
@@ -131,6 +134,7 @@ END_METHOD
|
|
131
134
|
#{before_name.to_s}
|
132
135
|
end
|
133
136
|
END_METHOD
|
137
|
+
private :clear_modules
|
134
138
|
end
|
135
139
|
|
136
140
|
# Called by the constructor. Aliased by the module initializers.
|
@@ -139,6 +143,7 @@ END_METHOD
|
|
139
143
|
def initialize_modules
|
140
144
|
# NOTE: this gets called after all the module initializers complete
|
141
145
|
end
|
146
|
+
private :initialize_modules
|
142
147
|
|
143
148
|
# Called by clear_all.
|
144
149
|
#
|
@@ -146,6 +151,7 @@ END_METHOD
|
|
146
151
|
def clear_modules
|
147
152
|
# NOTE: this gets called after all the module cleaners complete
|
148
153
|
end
|
154
|
+
private :clear_modules
|
149
155
|
|
150
156
|
# Debugging output.
|
151
157
|
def inspect
|
data/lib/webkit_remote.rb
CHANGED
@@ -10,6 +10,18 @@ describe WebkitRemote::Client::Network do
|
|
10
10
|
@client.close
|
11
11
|
end
|
12
12
|
|
13
|
+
describe 'can_clear_cookies?' do
|
14
|
+
it 'returns true in Chrome' do
|
15
|
+
@client.can_clear_cookies?.must_equal true
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
describe 'can_clear_network_cache?' do
|
20
|
+
it 'returns true in Chrome' do
|
21
|
+
@client.can_clear_network_cache?.must_equal true
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
13
25
|
describe 'without network events enabled' do
|
14
26
|
before :all do
|
15
27
|
@client.network_events = false
|
data/webkit_remote.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "webkit_remote"
|
8
|
-
s.version = "0.4.
|
8
|
+
s.version = "0.4.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Victor Costan"]
|
@@ -32,6 +32,7 @@ Gem::Specification.new do |s|
|
|
32
32
|
"lib/webkit_remote/client/console_events.rb",
|
33
33
|
"lib/webkit_remote/client/dom.rb",
|
34
34
|
"lib/webkit_remote/client/dom_events.rb",
|
35
|
+
"lib/webkit_remote/client/dom_runtime.rb",
|
35
36
|
"lib/webkit_remote/client/network.rb",
|
36
37
|
"lib/webkit_remote/client/network_events.rb",
|
37
38
|
"lib/webkit_remote/client/page.rb",
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: webkit_remote
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -259,6 +259,7 @@ files:
|
|
259
259
|
- lib/webkit_remote/client/console_events.rb
|
260
260
|
- lib/webkit_remote/client/dom.rb
|
261
261
|
- lib/webkit_remote/client/dom_events.rb
|
262
|
+
- lib/webkit_remote/client/dom_runtime.rb
|
262
263
|
- lib/webkit_remote/client/network.rb
|
263
264
|
- lib/webkit_remote/client/network_events.rb
|
264
265
|
- lib/webkit_remote/client/page.rb
|
@@ -306,7 +307,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
306
307
|
version: '0'
|
307
308
|
segments:
|
308
309
|
- 0
|
309
|
-
hash:
|
310
|
+
hash: 3710674464370196221
|
310
311
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
311
312
|
none: false
|
312
313
|
requirements:
|