webkit_remote 0.5.2 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/webkit_remote/process.rb +27 -12
- data/test/fixtures/html/console.html +1 -1
- data/test/fixtures/html/dom.html +1 -2
- data/test/fixtures/html/load.html +1 -1
- data/test/fixtures/html/network.html +1 -1
- data/test/fixtures/html/popup.html +14 -0
- data/test/fixtures/html/popup_user.html +20 -0
- data/test/fixtures/html/runtime.html +1 -1
- data/test/helper.rb +0 -1
- data/test/webkit_remote/process_flags_test.rb +24 -0
- data/webkit_remote.gemspec +5 -2
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb3ccfba70d3f677946e7aea83a46d515858b56a
|
4
|
+
data.tar.gz: c35c1614ca83eecbd4ab0259227221aec466bee5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1cfc3b83187a5d4d6d36ee3fb5113471027ef8f522f7a7434f685315774fd8353edeadba6285c0575a1d4602af7ba3e244a1c94ac392722f5b022f8d5c8f7d09
|
7
|
+
data.tar.gz: 14960e8733fec9ebba3563c620800b93415d5fa18a96b5b6919b6f4d58eb39c014227c62908cb26d31e7cb72564943b7428d9ddeb510f4fa467e62adc97a9062
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.3
|
@@ -21,6 +21,9 @@ class Process
|
|
21
21
|
# real screen; set the :display, :width, :height, :depth and :dpi of the
|
22
22
|
# server, or use the default display number 20, at 1280x1024x32 with
|
23
23
|
# 72dpi
|
24
|
+
# @option opts [Boolean] allow_popups when true, the popup blocker is
|
25
|
+
# disabled; this is sometimes necessary when driving a Web UI via
|
26
|
+
# JavaScript
|
24
27
|
def initialize(opts = {})
|
25
28
|
@port = opts[:port] || 9292
|
26
29
|
@timeout = opts[:timeout] || 10
|
@@ -148,6 +151,28 @@ class Process
|
|
148
151
|
[
|
149
152
|
chrome_env(opts),
|
150
153
|
self.class.chrome_binary,
|
154
|
+
] + chrome_cli_flags(opts) + [
|
155
|
+
"--remote-debugging-port=#{@port}", # Webkit remote debugging
|
156
|
+
"--user-data-dir=#{@data_dir}", # really ensure a clean slate
|
157
|
+
"--window-position=#{@window[:left]},#{@window[:top]}",
|
158
|
+
"--window-size=#{@window[:width]},#{@window[:height]}",
|
159
|
+
|
160
|
+
'about:blank', # don't load the homepage
|
161
|
+
{
|
162
|
+
chdir: @data_dir,
|
163
|
+
in: '/dev/null',
|
164
|
+
out: File.join(@data_dir, '.stdout'),
|
165
|
+
err: File.join(@data_dir, '.stderr')
|
166
|
+
},
|
167
|
+
]
|
168
|
+
end
|
169
|
+
|
170
|
+
# Flags used on the command-line that launches Google Chrome / Chromium.
|
171
|
+
#
|
172
|
+
# @param [Hash] opts options passed to the WebkitRemote::Process constructor
|
173
|
+
# @return [Array<String>] flags used on the command line for launching Chrome
|
174
|
+
def chrome_cli_flags(opts)
|
175
|
+
flags = [
|
151
176
|
'--bwsi', # disable extensions, sync, bookmarks
|
152
177
|
'--disable-default-apps', # no bundled apps
|
153
178
|
'--disable-extensions', # no extensions
|
@@ -170,19 +195,9 @@ class Process
|
|
170
195
|
'--no-message-box', # don't let user scripts show dialogs
|
171
196
|
'--no-service-autorun', # don't mess with autorun settings
|
172
197
|
'--noerrdialogs', # don't hang on error dialogs
|
173
|
-
"--remote-debugging-port=#{@port}", # Webkit remote debugging
|
174
|
-
"--user-data-dir=#{@data_dir}", # really ensure a clean slate
|
175
|
-
"--window-position=#{@window[:left]},#{@window[:top]}", # randomness--
|
176
|
-
"--window-size=#{@window[:width]},#{@window[:height]}", # randomness--
|
177
|
-
|
178
|
-
'about:blank', # don't load the homepage
|
179
|
-
{
|
180
|
-
chdir: @data_dir,
|
181
|
-
in: '/dev/null',
|
182
|
-
out: File.join(@data_dir, '.stdout'),
|
183
|
-
err: File.join(@data_dir, '.stderr')
|
184
|
-
},
|
185
198
|
]
|
199
|
+
flags << '--disable-popup-blocking' if opts[:allow_popups]
|
200
|
+
flags
|
186
201
|
end
|
187
202
|
|
188
203
|
# Environment variables set when launching Chrome.
|
data/test/fixtures/html/dom.html
CHANGED
@@ -0,0 +1,14 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Popup window for WebkitRemote Process allow_popups test</title>
|
5
|
+
<script type="text/javascript">
|
6
|
+
window.opener.postMessage('popup says hi', '*');
|
7
|
+
</script>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
<p>Popup for Process allow_popups test loaded.</p>
|
11
|
+
</body>
|
12
|
+
</html>
|
13
|
+
|
14
|
+
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>WebkitRemote Process allow_popups test</title>
|
5
|
+
<script type="text/javascript">
|
6
|
+
(function() {
|
7
|
+
window.addEventListener('message', function (event) {
|
8
|
+
if (event.data === 'popup says hi') {
|
9
|
+
console.log('Received popup message.');
|
10
|
+
}
|
11
|
+
});
|
12
|
+
window.open('popup.html');
|
13
|
+
})();
|
14
|
+
</script>
|
15
|
+
</head>
|
16
|
+
<body>
|
17
|
+
<p>Process allow_popups test loaded</p>
|
18
|
+
</body>
|
19
|
+
</html>
|
20
|
+
|
data/test/helper.rb
CHANGED
@@ -0,0 +1,24 @@
|
|
1
|
+
require File.expand_path('../helper.rb', File.dirname(__FILE__))
|
2
|
+
|
3
|
+
# This tests the command-line flags code by making sure that Chrome works in
|
4
|
+
# the intended fashion. By the nature of the test, it looks more like an
|
5
|
+
# integration test than the unit-level Process tests in process_test.rb.
|
6
|
+
|
7
|
+
describe WebkitRemote::Process do
|
8
|
+
after :all do
|
9
|
+
@client.close if @client
|
10
|
+
end
|
11
|
+
|
12
|
+
describe 'with allow_popups: true' do
|
13
|
+
before :all do
|
14
|
+
@client = WebkitRemote.local port: 9669, allow_popups: true
|
15
|
+
@client.console_events = true
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'runs through a page that uses window.open without a gesture' do
|
19
|
+
@client.navigate_to fixture_url(:popup_user)
|
20
|
+
events = @client.wait_for type: WebkitRemote::Event::ConsoleMessage
|
21
|
+
events.last.message.text.must_equal 'Received popup message.'
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/webkit_remote.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "webkit_remote"
|
8
|
-
s.version = "0.5.
|
8
|
+
s.version = "0.5.3"
|
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"]
|
12
|
-
s.date = "2014-03-
|
12
|
+
s.date = "2014-03-19"
|
13
13
|
s.description = "Launches Google Chrome instances and controls them via the Remote Debugging server"
|
14
14
|
s.email = "victor@costan.us"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -47,6 +47,8 @@ Gem::Specification.new do |s|
|
|
47
47
|
"test/fixtures/html/dom.html",
|
48
48
|
"test/fixtures/html/load.html",
|
49
49
|
"test/fixtures/html/network.html",
|
50
|
+
"test/fixtures/html/popup.html",
|
51
|
+
"test/fixtures/html/popup_user.html",
|
50
52
|
"test/fixtures/html/runtime.html",
|
51
53
|
"test/fixtures/js/network.js",
|
52
54
|
"test/fixtures/png/network.png",
|
@@ -61,6 +63,7 @@ Gem::Specification.new do |s|
|
|
61
63
|
"test/webkit_remote/client/runtime_test.rb",
|
62
64
|
"test/webkit_remote/client_test.rb",
|
63
65
|
"test/webkit_remote/event_test.rb",
|
66
|
+
"test/webkit_remote/process_flags_test.rb",
|
64
67
|
"test/webkit_remote/process_test.rb",
|
65
68
|
"test/webkit_remote/rpc_test.rb",
|
66
69
|
"test/webkit_remote_test.rb",
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: webkit_remote
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Victor Costan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-03-
|
11
|
+
date: 2014-03-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ws_sync_client
|
@@ -217,6 +217,8 @@ files:
|
|
217
217
|
- test/fixtures/html/dom.html
|
218
218
|
- test/fixtures/html/load.html
|
219
219
|
- test/fixtures/html/network.html
|
220
|
+
- test/fixtures/html/popup.html
|
221
|
+
- test/fixtures/html/popup_user.html
|
220
222
|
- test/fixtures/html/runtime.html
|
221
223
|
- test/fixtures/js/network.js
|
222
224
|
- test/fixtures/png/network.png
|
@@ -231,6 +233,7 @@ files:
|
|
231
233
|
- test/webkit_remote/client/runtime_test.rb
|
232
234
|
- test/webkit_remote/client_test.rb
|
233
235
|
- test/webkit_remote/event_test.rb
|
236
|
+
- test/webkit_remote/process_flags_test.rb
|
234
237
|
- test/webkit_remote/process_test.rb
|
235
238
|
- test/webkit_remote/rpc_test.rb
|
236
239
|
- test/webkit_remote_test.rb
|