Skip to content

Commit 3ccca0c

Browse files
authored
Merge pull request rails#51121 from jamiemccarthy/jm-fix-allow-browser-versions
Fix AllowBrowser versions
2 parents fe4617f + dc34e29 commit 3ccca0c

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

actionpack/lib/action_controller/metal/allow_browser.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ module ClassMethods
2020
# In addition to specifically named browser versions, you can also pass
2121
# `:modern` as the set to restrict support to browsers natively supporting webp
2222
# images, web push, badges, import maps, CSS nesting, and CSS :has. This
23-
# includes Safari 17.2+, Chrome 119+, Firefox 121+, Opera 104+.
23+
# includes Safari 17.2+, Chrome 120+, Firefox 121+, Opera 106+.
2424
#
2525
# You can use https://caniuse.com to check for browser versions supporting the
2626
# features you use.
@@ -31,7 +31,7 @@ module ClassMethods
3131
# Examples:
3232
#
3333
# class ApplicationController < ActionController::Base
34-
# # Allow only browsers natively supporting webp images, web push, badges, import maps, CSS nesting + :has
34+
# # Allow only browsers natively supporting webp images, web push, badges, import maps, CSS nesting, and CSS :has
3535
# allow_browser versions: :modern
3636
# end
3737
#
@@ -62,7 +62,7 @@ def allow_browser(versions:, block:)
6262

6363
class BrowserBlocker
6464
SETS = {
65-
modern: { safari: 17.2, chrome: 119, firefox: 121, opera: 104, ie: false }
65+
modern: { safari: 17.2, chrome: 120, firefox: 121, opera: 106, ie: false }
6666
}
6767

6868
attr_reader :request, :versions

actionpack/test/controller/allow_browser_test.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
require "abstract_unit"
44

55
class AllowBrowserController < ActionController::Base
6-
allow_browser versions: { safari: "16.4", chrome: "119", firefox: "123", opera: "104", ie: false }, block: -> { head :upgrade_required }, only: :hello
6+
allow_browser versions: { safari: "16.4", chrome: "119", firefox: "123", opera: "106", ie: false }, block: -> { head :upgrade_required }, only: :hello
77
def hello
88
head :ok
99
end
@@ -22,7 +22,7 @@ class AllowBrowserTest < ActionController::TestCase
2222
SAFARI_17_2_0 = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.2.0 Safari/605.1.15"
2323
FIREFOX_114 = "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/114.0"
2424
IE_11 = "Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko"
25-
OPERA_104 = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36 OPR/104.0.4638.54"
25+
OPERA_106 = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 OPR/106.0.0.0"
2626

2727
test "blocked browser below version limit" do
2828
get_with_agent :hello, FIREFOX_114
@@ -41,7 +41,7 @@ class AllowBrowserTest < ActionController::TestCase
4141
get_with_agent :hello, CHROME_120
4242
assert_response :ok
4343

44-
get_with_agent :hello, OPERA_104
44+
get_with_agent :hello, OPERA_106
4545
assert_response :ok
4646
end
4747

@@ -55,7 +55,7 @@ class AllowBrowserTest < ActionController::TestCase
5555
get_with_agent :modern, CHROME_120
5656
assert_response :ok
5757

58-
get_with_agent :modern, OPERA_104
58+
get_with_agent :modern, OPERA_106
5959
assert_response :ok
6060
end
6161

0 commit comments

Comments
 (0)