Skip to content

Commit

Permalink
Remove deprecated speaker, vibrate, and vr permissions policy d…
Browse files Browse the repository at this point in the history
…irectives
  • Loading branch information
rafaelfranca committed Nov 22, 2023
1 parent d088d91 commit 30193dc
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 29 deletions.
4 changes: 4 additions & 0 deletions actionpack/CHANGELOG.md
@@ -1,3 +1,7 @@
* Remove deprecated `speaker`, `vibrate`, and `vr` permissions policy directives.

*Rafael Mendonça França*

* Remove deprecated `Rails.application.config.action_dispatch.return_only_request_media_type_on_content_type`.

*Rafael Mendonça França*
Expand Down
19 changes: 0 additions & 19 deletions actionpack/lib/action_dispatch/http/permissions_policy.rb
Expand Up @@ -132,25 +132,6 @@ def initialize_copy(other)
end
end

%w[speaker vibrate vr].each do |directive|
define_method(directive) do |*sources|
ActionDispatch.deprecator.warn(<<~MSG)
The `#{directive}` permissions policy directive is deprecated
and will be removed in Rails 7.2.
There is no browser support for this directive, and no plan
for browser support in the future. You can just remove this
directive from your application.
MSG

if sources.first
@directives[directive] = apply_mappings(sources)
else
@directives.delete(directive)
end
end
end

def build(context = nil)
build_directives(context).compact.join("; ")
end
Expand Down
10 changes: 0 additions & 10 deletions actionpack/test/dispatch/permissions_policy_test.rb
Expand Up @@ -39,16 +39,6 @@ def test_invalid_directive_source

assert_equal "Invalid HTTP permissions policy source: [:non_existent]", exception.message
end

def test_deprecated_directives
assert_deprecated(ActionDispatch.deprecator) { @policy.speaker :self }
assert_deprecated(ActionDispatch.deprecator) { @policy.vibrate :self }
assert_deprecated(ActionDispatch.deprecator) { @policy.vr :self }

assert_not_deprecated(ActionDispatch.deprecator) do
assert_equal "speaker 'self'; vibrate 'self'; vr 'self'", @policy.build
end
end
end

class PermissionsPolicyMiddlewareTest < ActionDispatch::IntegrationTest
Expand Down
2 changes: 2 additions & 0 deletions guides/source/7_2_release_notes.md
Expand Up @@ -58,6 +58,8 @@ Please refer to the [Changelog][action-pack] for detailed changes.

* Remove deprecated `Rails.application.config.action_dispatch.return_only_request_media_type_on_content_type`.

* Remove deprecated `speaker`, `vibrate`, and `vr` permissions policy directives.

### Deprecations

* Deprecate `Rails.application.config.action_controller.allow_deprecated_parameters_hash_equality`.
Expand Down

0 comments on commit 30193dc

Please sign in to comment.