capybara-webkit 1.5.1 → 1.5.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cfdf16446ea82ddfb76352fcddb30f280a252622
4
- data.tar.gz: 036edb4e104031410e3babac1c4d2076e83df99f
3
+ metadata.gz: b7ab00fe907aecf18f18973fe2bcc061ed182978
4
+ data.tar.gz: c54ebbc9979ef8cbf0ef185e1eb53bddb11967f0
5
5
  SHA512:
6
- metadata.gz: c76fe34598fef3fd313303b5d0665ca5184f63a98d066bef64a0c7f8e59ef03fc847e75df354d7836532d97710a862fb3f0ad9cae1b02adc82766c3c08e9fcf2
7
- data.tar.gz: 62163e9a180e75705c4df3af95fa79fa57479b5fec24421f3cb023345fe4cff695312c802b6d8b69d9c36097f36440a306c7ee26178351c3a7dcfbf706510c03
6
+ metadata.gz: f58d3a1b7368ccdb11de8a7b1b4504722d8f92a272133e4c7d547437e796837ac700dea1f17f6c04cf4b723bb327b9432f54af5eee1a304621bde7089c722e3b
7
+ data.tar.gz: 16b5ed8715b7b388e8392c7af85900116f15afa2235c85f46fa672c38cf46751de2fe2c2e8eb7b80e2fc2c21d5926d8c6c5e135362859bc356aa2f7f5443026b
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- capybara-webkit (1.5.1)
4
+ capybara-webkit (1.5.2)
5
5
  capybara (>= 2.3.0, < 2.5.0)
6
6
  json
7
7
 
@@ -30,7 +30,7 @@ GEM
30
30
  launchy (2.4.2-java)
31
31
  addressable (~> 2.3)
32
32
  spoon (~> 0.0.1)
33
- mime-types (2.4.3)
33
+ mime-types (2.5)
34
34
  mini_magick (3.2.1)
35
35
  subexec (~> 0.0.4)
36
36
  mini_portile (0.6.2)
data/NEWS.md CHANGED
@@ -1,3 +1,12 @@
1
+ New for 1.5.2:
2
+
3
+ * Fixes bug where aborted Ajax requests caused a crash during reset.
4
+
5
+ New for 1.5.1:
6
+
7
+ * Fixes bug where Ajax requests would continue after a reset, causing native
8
+ alerts to appear for some users and crashes for others.
9
+
1
10
  New for 1.5.0:
2
11
 
3
12
  * Fixes for OpenBSD
@@ -1,7 +1,7 @@
1
1
  module Capybara
2
2
  module Driver
3
3
  class Webkit
4
- VERSION = '1.5.1'.freeze
4
+ VERSION = '1.5.2'.freeze
5
5
  end
6
6
  end
7
7
  end
@@ -7,8 +7,12 @@ require 'base64'
7
7
  describe Capybara::Webkit::Driver do
8
8
  include AppRunner
9
9
 
10
- def visit(url, driver=self.driver)
11
- driver.visit("#{AppRunner.app_host}#{url}")
10
+ def visit(path, driver=self.driver)
11
+ driver.visit(url(path))
12
+ end
13
+
14
+ def url(path)
15
+ "#{AppRunner.app_host}#{path}"
12
16
  end
13
17
 
14
18
  context "iframe app" do
@@ -2993,6 +2997,53 @@ CACHE MANIFEST
2993
2997
  end
2994
2998
  end
2995
2999
 
3000
+ context "with unfinished responses" do
3001
+ it_behaves_like "output writer" do
3002
+ let(:driver) do
3003
+ count = 0
3004
+ driver_for_app browser do
3005
+ get "/" do
3006
+ count += 1
3007
+ <<-HTML
3008
+ <html>
3009
+ <body>
3010
+ <script type="text/javascript">
3011
+ setTimeout(function () {
3012
+ xhr = new XMLHttpRequest();
3013
+ xhr.open('GET', '/async?#{count}', true);
3014
+ xhr.setRequestHeader('Content-Type', 'text/plain');
3015
+ xhr.send();
3016
+ }, 50);
3017
+ </script>
3018
+ </body>
3019
+ </html>
3020
+ HTML
3021
+ end
3022
+
3023
+ get "/async" do
3024
+ sleep 2
3025
+ ""
3026
+ end
3027
+ end
3028
+ end
3029
+
3030
+ it "aborts unfinished responses" do
3031
+ driver.enable_logging
3032
+ visit "/"
3033
+ sleep 0.5
3034
+ visit "/"
3035
+ sleep 0.5
3036
+ driver.reset!
3037
+ stderr.should abort_request_to("/async?2")
3038
+ stderr.should_not abort_request_to("/async?1")
3039
+ end
3040
+
3041
+ def abort_request_to(path)
3042
+ include(%{Aborting request to "#{url(path)}"})
3043
+ end
3044
+ end
3045
+ end
3046
+
2996
3047
  def driver_url(driver, path)
2997
3048
  URI.parse(driver.current_url).merge(path).to_s
2998
3049
  end
@@ -25,10 +25,10 @@ module AppRunner
25
25
  AppRunner.app = app
26
26
  end
27
27
 
28
- def driver_for_app(&body)
28
+ def driver_for_app(*driver_args, &body)
29
29
  app = Class.new(ExampleApp, &body)
30
30
  run_application app
31
- build_driver
31
+ build_driver(*driver_args)
32
32
  end
33
33
 
34
34
  def driver_for_html(html, *driver_args)
@@ -92,6 +92,11 @@ void WebPageManager::requestCreated(QByteArray &url, QNetworkReply *reply) {
92
92
  else {
93
93
  m_pendingReplies.append(reply);
94
94
  connect(reply, SIGNAL(finished()), SLOT(handleReplyFinished()));
95
+ connect(
96
+ reply,
97
+ SIGNAL(destroyed(QObject *)),
98
+ SLOT(replyDestroyed(QObject *))
99
+ );
95
100
  }
96
101
  }
97
102
 
@@ -107,6 +112,10 @@ void WebPageManager::replyFinished(QNetworkReply *reply) {
107
112
  m_pendingReplies.removeAll(reply);
108
113
  }
109
114
 
115
+ void WebPageManager::replyDestroyed(QObject *reply) {
116
+ m_pendingReplies.removeAll((QNetworkReply *) reply);
117
+ }
118
+
110
119
  void WebPageManager::setPageStatus(bool success) {
111
120
  logger() << "Page finished with" << success;
112
121
  m_started.remove(qobject_cast<WebPage *>(sender()));
@@ -48,6 +48,7 @@ class WebPageManager : public QObject {
48
48
  void setPageStatus(bool);
49
49
  void requestCreated(QByteArray &url, QNetworkReply *reply);
50
50
  void handleReplyFinished();
51
+ void replyDestroyed(QObject *);
51
52
 
52
53
  signals:
53
54
  void pageFinished(bool);
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capybara-webkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.1
4
+ version: 1.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - thoughtbot
@@ -13,7 +13,7 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2015-04-23 00:00:00.000000000 Z
16
+ date: 2015-06-05 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: capybara
@@ -416,4 +416,3 @@ test_files:
416
416
  - spec/support/app_runner.rb
417
417
  - spec/support/matchers/include_response.rb
418
418
  - spec/support/output_writer.rb
419
- has_rdoc: