diff options
Diffstat (limited to 'actioncable')
-rw-r--r-- | actioncable/CHANGELOG.md | 46 | ||||
-rw-r--r-- | actioncable/README.md | 4 | ||||
-rw-r--r-- | actioncable/Rakefile | 36 | ||||
-rw-r--r-- | actioncable/lib/action_cable/connection/authorization.rb | 10 | ||||
-rw-r--r-- | actioncable/lib/action_cable/gem_version.rb | 4 | ||||
-rw-r--r-- | actioncable/package.json | 2 | ||||
-rw-r--r-- | actioncable/test/channel/stream_test.rb | 4 |
7 files changed, 50 insertions, 56 deletions
diff --git a/actioncable/CHANGELOG.md b/actioncable/CHANGELOG.md index a0254fe323..d5bd58cfdb 100644 --- a/actioncable/CHANGELOG.md +++ b/actioncable/CHANGELOG.md @@ -1,45 +1 @@ -## Rails 5.1.0.beta1 (February 23, 2017) ## - -* Redis subscription adapters now support `channel_prefix` option in `cable.yml` - - Avoids channel name collisions when multiple apps use the same Redis server. - - *Chad Ingram* - -* Permit same-origin connections by default. - - Added new option `config.action_cable.allow_same_origin_as_host = false` - to disable this behaviour. - - *Dávid Halász*, *Matthew Draper* - -* Prevent race where the client could receive and act upon a - subscription confirmation before the channel's `subscribed` method - completed. - - Fixes #25381. - - *Vladimir Dementyev* - -* Buffer now writes to WebSocket connections, to avoid blocking threads - that could be doing more useful things. - - *Matthew Draper*, *Tinco Andringa* - -* Protect against concurrent writes to a WebSocket connection from - multiple threads; the underlying OS write is not always threadsafe. - - *Tinco Andringa* - -* Add `ActiveSupport::Notifications` hook to `Broadcaster#broadcast`. - - *Matthew Wear* - -* Close hijacked socket when connection is shut down. - - Fixes #25613. - - *Tinco Andringa* - - -Please check [5-0-stable](https://github.com/rails/rails/blob/5-0-stable/actioncable/CHANGELOG.md) for previous changes. +Please check [5-1-stable](https://github.com/rails/rails/blob/5-1-stable/actioncable/CHANGELOG.md) for previous changes. diff --git a/actioncable/README.md b/actioncable/README.md index c55b7dc57b..e044f54b45 100644 --- a/actioncable/README.md +++ b/actioncable/README.md @@ -53,8 +53,8 @@ module ApplicationCable private def find_verified_user - if current_user = User.find_by(id: cookies.signed[:user_id]) - current_user + if verified_user = User.find_by(id: cookies.signed[:user_id]) + verified_user else reject_unauthorized_connection end diff --git a/actioncable/Rakefile b/actioncable/Rakefile index 87d443919c..bda8c7b6c8 100644 --- a/actioncable/Rakefile +++ b/actioncable/Rakefile @@ -1,12 +1,13 @@ require "rake/testtask" require "pathname" +require "open3" require "action_cable" dir = File.dirname(__FILE__) task default: :test -task package: "assets:compile" +task package: %w( assets:compile assets:verify ) Rake::TestTask.new do |t| t.libs << "test" @@ -37,6 +38,39 @@ namespace :assets do desc "Compile Action Cable assets" task :compile do require "blade" + require "sprockets" + require "sprockets/export" Blade.build end + + desc "Verify compiled Action Cable assets" + task :verify do + file = "lib/assets/compiled/action_cable.js" + pathname = Pathname.new("#{dir}/#{file}") + + print "[verify] #{file} exists " + if pathname.exist? + puts "[OK]" + else + $stderr.puts "[FAIL]" + fail + end + + print "[verify] #{file} is a UMD module " + if pathname.read =~ /module\.exports.*define\.amd/m + puts "[OK]" + else + $stderr.puts "[FAIL]" + fail + end + + print "[verify] #{dir} can be required as a module " + stdout, stderr, status = Open3.capture3("node", "--print", "window = {}; require('#{dir}');") + if status.success? + puts "[OK]" + else + $stderr.puts "[FAIL]\n#{stderr}" + fail + end + end end diff --git a/actioncable/lib/action_cable/connection/authorization.rb b/actioncable/lib/action_cable/connection/authorization.rb index 85df206445..989a67d6df 100644 --- a/actioncable/lib/action_cable/connection/authorization.rb +++ b/actioncable/lib/action_cable/connection/authorization.rb @@ -3,11 +3,11 @@ module ActionCable module Authorization class UnauthorizedError < StandardError; end - private - def reject_unauthorized_connection - logger.error "An unauthorized connection attempt was rejected" - raise UnauthorizedError - end + # Closes the \WebSocket connection if it is open and returns a 404 "File not Found" response. + def reject_unauthorized_connection + logger.error "An unauthorized connection attempt was rejected" + raise UnauthorizedError + end end end end diff --git a/actioncable/lib/action_cable/gem_version.rb b/actioncable/lib/action_cable/gem_version.rb index c09613a747..5d6f9af0bb 100644 --- a/actioncable/lib/action_cable/gem_version.rb +++ b/actioncable/lib/action_cable/gem_version.rb @@ -6,9 +6,9 @@ module ActionCable module VERSION MAJOR = 5 - MINOR = 1 + MINOR = 2 TINY = 0 - PRE = "beta1" + PRE = "alpha" STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".") end diff --git a/actioncable/package.json b/actioncable/package.json index 69ae3519d9..acec1e2e9c 100644 --- a/actioncable/package.json +++ b/actioncable/package.json @@ -1,6 +1,6 @@ { "name": "actioncable", - "version": "5.1.0-beta1", + "version": "5.2.0-alpha", "description": "WebSocket framework for Ruby on Rails.", "main": "lib/assets/compiled/action_cable.js", "files": [ diff --git a/actioncable/test/channel/stream_test.rb b/actioncable/test/channel/stream_test.rb index 31dcde2e29..50fc7be30b 100644 --- a/actioncable/test/channel/stream_test.rb +++ b/actioncable/test/channel/stream_test.rb @@ -55,6 +55,8 @@ module ActionCable::StreamTests channel = ChatChannel.new connection, "{id: 1}", id: 1 channel.subscribe_to_channel + wait_for_async + connection.expects(:pubsub).returns mock().tap { |m| m.expects(:unsubscribe) } channel.unsubscribe_from_channel end @@ -67,6 +69,8 @@ module ActionCable::StreamTests channel = SymbolChannel.new connection, "" channel.subscribe_to_channel + wait_for_async + connection.expects(:pubsub).returns mock().tap { |m| m.expects(:unsubscribe) } channel.unsubscribe_from_channel end |