Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Revert "Use freeze instead of close!"

This reverts commit 29592a7.
  • Loading branch information...
commit 03d561ad77085f17ba816ebec619a3d359b2164e 1 parent 5b0149a
@spastorino spastorino authored
View
7 actionpack/lib/action_dispatch/middleware/cookies.rb
@@ -115,10 +115,13 @@ def initialize(secret = nil, host = nil, secure = false)
@delete_cookies = {}
@host = host
@secure = secure
+ @closed = false
@cookies = {}
end
- alias :closed? :frozen?
+ attr_reader :closed
+ alias :closed? :closed
+ def close!; @closed = true end
# Returns the value of the cookie by +name+, or +nil+ if no such cookie exists.
def [](name)
@@ -327,7 +330,7 @@ def call(env)
[status, headers, body]
ensure
cookie_jar = ActionDispatch::Request.new(env).cookie_jar unless cookie_jar
- cookie_jar.freeze
+ cookie_jar.close!
end
end
end
View
12 actionpack/lib/action_dispatch/middleware/flash.rb
@@ -43,9 +43,12 @@ class Flash
class FlashNow #:nodoc:
def initialize(flash)
@flash = flash
+ @closed = false
end
- alias :closed? :frozen?
+ attr_reader :closed
+ alias :closed? :closed
+ def close!; @closed = true end
def []=(k, v)
raise ClosedError, :flash if closed?
@@ -73,9 +76,12 @@ class FlashHash < Hash
def initialize #:nodoc:
super
@used = Set.new
+ @closed = false
end
- alias :closed? :frozen?
+ attr_reader :closed
+ alias :closed? :closed
+ def close!; @closed = true end
def []=(k, v) #:nodoc:
raise ClosedError, :flash if closed?
@@ -194,7 +200,7 @@ def call(env)
if !flash_hash.empty? || session.key?('flash')
session["flash"] = flash_hash
end
- flash_hash.freeze
+ flash_hash.close!
end
if session.key?('flash') && session['flash'].empty?
View
6 actionpack/test/dispatch/cookies_test.rb
@@ -502,16 +502,10 @@ class CookiesIntegrationTest < ActionDispatch::IntegrationTest
class TestController < ActionController::Base
def dont_set_cookies
- # initialize lazy loaded objects
- cookies.permanent
- cookies.signed
head :ok
end
def set_cookies
- # initialize lazy loaded objects
- cookies.permanent
- cookies.signed
cookies["that"] = "hello"
head :ok
end
Please sign in to comment.
Something went wrong with that request. Please try again.