1
0
Fork 0
mirror of https://github.com/teampoltergeist/poltergeist.git synced 2022-11-09 12:05:00 -05:00

Fix time zone handling for cookie expiry time

PhantomJS parses the HTTP date format in the local time zone, even if it
is actually GMT. So we send the milliseconds from epoch instead to get
around that.

Closes #228
This commit is contained in:
Jon Leighton 2013-01-26 21:38:19 +00:00
parent a5eda0e7b2
commit 0a49d15d7e
3 changed files with 5 additions and 3 deletions

View file

@ -309,6 +309,8 @@ Include as much information as possible. For example:
[Issue #203] (@arnvald)
* Fix the `:js_errors` option. Previously errors were not being
reported, but would still cause commands to fail. [Issue #229]
* Fix incorrect time zone handling when setting cookie expiry time
[Issue #228]
### 1.0.2 ###

View file

@ -153,8 +153,8 @@ module Capybara::Poltergeist
end
def set_cookie(cookie)
if cookie[:expires].respond_to?(:httpdate)
cookie[:expires] = cookie[:expires].httpdate
if cookie[:expires]
cookie[:expires] = cookie[:expires].to_i * 1000
end
command 'set_cookie', cookie

View file

@ -29,7 +29,7 @@ module Capybara::Poltergeist
end
def expires
Time.parse @attributes['expires'] if @attributes['expires']
Time.at @attributes['expiry'] if @attributes['expiry']
end
end
end