Skip to content

Commit

Permalink
retry a command up to 3 times after a WebkitInvalidResponseError
Browse files Browse the repository at this point in the history
  • Loading branch information
ngauthier committed Oct 31, 2011
1 parent 8d2251d commit 0e303fd
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions lib/capybara/driver/webkit/browser.rb
Expand Up @@ -64,14 +64,7 @@ def frame_focus(frame_id_or_index=nil)
end

def command(name, *args)
@socket.puts name
@socket.puts args.size
args.each do |arg|
@socket.puts arg.to_s.bytesize
@socket.print arg.to_s
end
check
read_response
retry_command(0, name, *args)
end

def evaluate_script(script)
Expand Down Expand Up @@ -212,5 +205,22 @@ def default_proxy_options
:pass => ""
}
end

def retry_command(count, name, *args)
@socket.puts name
@socket.puts args.size
args.each do |arg|
@socket.puts arg.to_s.bytesize
@socket.print arg.to_s
end
check
read_response
rescue Capybara::Driver::Webkit::WebkitInvalidResponseError => ex
if count > 2
raise ex
else
retry_command(count+1, name, *args)
end
end
end
end

0 comments on commit 0e303fd

Please sign in to comment.