Permalink
Browse files

Test to verify fix for #399

  • Loading branch information...
1 parent 808e23a commit 8e80fe635a1e8e64abd059e5b7423340cad7d0b5 @mhoran mhoran committed Dec 12, 2012
Showing with 51 additions and 0 deletions.
  1. +51 −0 spec/integration/session_spec.rb
@@ -131,4 +131,55 @@ module TestSessions
subject.response_headers['X-Capybara'].should == nil
end
end
+
+ context "slow iframe app" do
+ before do
+ @app = Class.new(ExampleApp) do
+ get '/' do
+ <<-HTML
+ <html>
+ <head>
+ <script>
+ function hang() {
+ xhr = new XMLHttpRequest();
+ xhr.onreadystatechange = function() {
+ if(xhr.readyState == 4){
+ document.getElementById('p').innerText = 'finished'
+ }
+ }
+ xhr.open('GET', '/slow', true);
+ xhr.send();
+ document.getElementById("f").src = '/iframe';
+ return false;
+ }
+ </script>
+ </head>
+ <body>
+ <a href="#" onclick="hang()">Click Me!</a>
+ <iframe src="about:blank" id="f"></iframe>
+ <p id="p"></p>
+ </body>
+ </html>
+ HTML
+ end
+
+ get '/slow' do
+ status 204
+ sleep 1
+ end
+
+ get '/iframe' do
+ status 204
+ end
+ end
+ end
+
+ it "should not hang the server" do
+ subject.visit("/")
+ subject.click_link('Click Me!')
+ Capybara.using_wait_time(5) do
+ subject.should have_content("finished")
+ end
+ end
+ end
end

0 comments on commit 8e80fe6

Please sign in to comment.