browser_sniffer 1.2.2 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +35 -0
- data/README.md +1 -1
- data/browser_sniffer.gemspec +1 -1
- data/lib/browser_sniffer/patterns.rb +15 -0
- data/lib/browser_sniffer/version.rb +1 -1
- data/lib/browser_sniffer.rb +9 -0
- data/test/browser_sniffer_test.rb +38 -0
- data/test/shopify_agents_test.rb +145 -19
- metadata +5 -5
- data/.travis.yml +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6a77c63b7563c544ce8ca42c0025fb9bad4dffe07be91652510f78d8e95c1c77
|
4
|
+
data.tar.gz: dd49278682198e0563dcd22171fdaa7fa5a2f7364e3c0e5bd52dad6c2fd68b41
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ab86e531c4cebcd5d6a5537e6a41cba81865b875f588d0d44296f89773321b935d9026ef5e3e2d05f1b30ae2082a603f6899b0b72e2eb3cf566141466ba347b7
|
7
|
+
data.tar.gz: 35fc400e3501ff5ed0f3682c914c80221c7c9c83a02f3f924792edf0eed98c8e32708c3b44658afbf68fe71577624e4a916d025e6a7ccca646c7f6d8ef6012af
|
@@ -0,0 +1,35 @@
|
|
1
|
+
name: Ruby CI
|
2
|
+
|
3
|
+
on:
|
4
|
+
pull_request:
|
5
|
+
push:
|
6
|
+
branches: master
|
7
|
+
|
8
|
+
jobs:
|
9
|
+
test:
|
10
|
+
runs-on: ubuntu-latest
|
11
|
+
name: Ruby ${{ matrix.version }}
|
12
|
+
strategy:
|
13
|
+
fail-fast: false
|
14
|
+
matrix:
|
15
|
+
version:
|
16
|
+
- 2.0
|
17
|
+
- 2.1
|
18
|
+
- 2.2
|
19
|
+
- 2.3
|
20
|
+
- 2.4
|
21
|
+
- 2.5
|
22
|
+
- 2.6
|
23
|
+
- 2.7
|
24
|
+
- 3.0
|
25
|
+
- 3.1
|
26
|
+
- jruby
|
27
|
+
steps:
|
28
|
+
- uses: actions/checkout@v3
|
29
|
+
- name: Set up Ruby ${{ matrix.version }}
|
30
|
+
uses: ruby/setup-ruby@v1
|
31
|
+
with:
|
32
|
+
bundler-cache: true
|
33
|
+
ruby-version: ${{ matrix.version }}
|
34
|
+
- name: Run Tests
|
35
|
+
run: bundle exec rake test
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
[![Build Status](https://
|
1
|
+
[![Build Status](https://github.com/Shopify/browser_sniffer/actions/workflows/test.yml/badge.svg?branch=master)](https://github.com/Shopify/browser_sniffer/actions/workflows/test.yml)
|
2
2
|
[![Gem Version](https://badge.fury.io/rb/browser_sniffer.png)](http://badge.fury.io/rb/browser_sniffer)
|
3
3
|
|
4
4
|
# BrowserSniffer
|
data/browser_sniffer.gemspec
CHANGED
@@ -15,7 +15,7 @@ Gem::Specification.new do |spec|
|
|
15
15
|
spec.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
16
16
|
spec.require_paths = ["lib"]
|
17
17
|
|
18
|
-
spec.required_ruby_version = ">=
|
18
|
+
spec.required_ruby_version = ">= 2.0.0"
|
19
19
|
|
20
20
|
spec.metadata['allowed_push_host'] = 'https://rubygems.org'
|
21
21
|
|
@@ -59,6 +59,12 @@ class BrowserSniffer
|
|
59
59
|
], [:name, :version], [
|
60
60
|
# Shopify POS for Android (Native App)
|
61
61
|
%r{.*(\sPOS\s-).*\s([\d+\.]+)(\/\d*)*\s}i,
|
62
|
+
], [[:name, 'Shopify POS'], :version], [
|
63
|
+
# Shopify POS for Android (React Native App)
|
64
|
+
%r{(Shopify POS)\/([\d\.]+)[^\/]*\/(Android)\/(\d+)}i,
|
65
|
+
], [[:name, 'Shopify POS'], :version], [
|
66
|
+
# Shopify POS for iOS (React Native App)
|
67
|
+
%r{(Shopify POS)\/([\d\.]+)[^\/]*\/(iOS)\/([\d\.]+)}i,
|
62
68
|
], [[:name, 'Shopify POS'], :version], [
|
63
69
|
# Shopify POS for Android (SmartWebView)
|
64
70
|
%r{.*(Shopify\sPOS)\s.*Android.*\s([\d+\.]+)(\/\d*)*\s}i,
|
@@ -171,6 +177,12 @@ class BrowserSniffer
|
|
171
177
|
# Shopify POS Next for iPod touch
|
172
178
|
%r{.*(?:Shopify POS Next|Shopify POS)/(?:iPhone\sOS|iOS)/[\d\.]+ \((iPod)([\d,]+)}i
|
173
179
|
], [[:type, :handheld], :model], [
|
180
|
+
# Shopify POS for iOS iPhone/iPod (React Native App)
|
181
|
+
%r{.*Shopify POS\/[\d\.]+[^\/]*\/(iOS)\/[\d\.]+\/Apple\/((iPhone|iPod)[^\/]*)\/}i,
|
182
|
+
], [[:type, :handheld], :model], [
|
183
|
+
# Shopify POS for iOS iPad (React Native App)
|
184
|
+
%r{.*Shopify POS\/[\d\.]+[^\/]*\/(iOS)\/[\d\.]+\/Apple\/(iPad[^\/]*)\/}i,
|
185
|
+
], [[:type, :tablet], :model], [
|
174
186
|
# Shopify Ping for iPhone
|
175
187
|
%r{.*Shopify Ping/(?:iPhone\sOS|iOS)/[\d\.]+ \((iPhone)([\d,]+)}i
|
176
188
|
], [[:type, :handheld], :model], [
|
@@ -294,6 +306,9 @@ class BrowserSniffer
|
|
294
306
|
# Shopify POS Next for iPhone or iPad
|
295
307
|
%r{.*(Shopify POS Next|Shopify POS)\/(?:iPhone\sOS|iOS)[\/\d\.]* \((iPhone|iPad|iPod).*\/([\d\.]+)\)}i
|
296
308
|
], [[:type, :ios], [:name, 'iOS'], :version], [
|
309
|
+
# Shopify POS for iOS (React Native App)
|
310
|
+
%r{.*Shopify POS\/[\d\.]+[^\/]*\/(iOS)\/([\d\.]+)\/(Apple)\/(iPhone|iPad|iPod)[^\/]*\/}i
|
311
|
+
], [[:type, :ios], :version, [:name, 'iOS']], [
|
297
312
|
# Shopify Ping for iOS
|
298
313
|
%r{.*Shopify Ping\/(iOS)\/[\d\.]+ \(.*\/([\d\.]+)\)}i
|
299
314
|
], [[:type, :ios], :version, [:name, 'iOS']], [
|
data/lib/browser_sniffer.rb
CHANGED
@@ -24,6 +24,15 @@ class BrowserSniffer
|
|
24
24
|
browser == :ie && major_browser_version == 11
|
25
25
|
end
|
26
26
|
|
27
|
+
# This method checks ie 11 mobile or ie11 rendering an older version in compatibility mode, in addition to `ie11?`.
|
28
|
+
# The `ie11?` method would return false in both those scenarios.
|
29
|
+
def ie11_actual?
|
30
|
+
ie11_engine = major_engine_version == 7 && engine_name == 'Trident'
|
31
|
+
ie_mobile11 = major_browser_version == 11 && browser_name == 'IEMobile'
|
32
|
+
|
33
|
+
ie11? || ie11_engine || ie_mobile11
|
34
|
+
end
|
35
|
+
|
27
36
|
def handheld?
|
28
37
|
form_factor == :handheld
|
29
38
|
end
|
@@ -454,6 +454,7 @@ class BrowserSnifferTest < Minitest::Test
|
|
454
454
|
:android? => false,
|
455
455
|
:desktop? => true,
|
456
456
|
:ie11? => false,
|
457
|
+
:ie11_actual? => false,
|
457
458
|
:engine => nil,
|
458
459
|
:major_engine_version => nil,
|
459
460
|
:os => :mac,
|
@@ -467,6 +468,7 @@ class BrowserSnifferTest < Minitest::Test
|
|
467
468
|
:form_factor => :desktop,
|
468
469
|
:ios? => false,
|
469
470
|
:ie11? => true,
|
471
|
+
:ie11_actual? => true,
|
470
472
|
:android? => false,
|
471
473
|
:desktop? => true,
|
472
474
|
:engine => :trident,
|
@@ -481,6 +483,7 @@ class BrowserSnifferTest < Minitest::Test
|
|
481
483
|
:form_factor => :desktop,
|
482
484
|
:ios? => false,
|
483
485
|
:ie11? => true,
|
486
|
+
:ie11_actual? => true,
|
484
487
|
:android? => false,
|
485
488
|
:desktop? => true,
|
486
489
|
:engine => :trident,
|
@@ -495,6 +498,7 @@ class BrowserSnifferTest < Minitest::Test
|
|
495
498
|
:form_factor => :desktop,
|
496
499
|
:ios? => false,
|
497
500
|
:ie11? => true,
|
501
|
+
:ie11_actual? => true,
|
498
502
|
:android? => false,
|
499
503
|
:desktop? => true,
|
500
504
|
:engine => :trident,
|
@@ -509,6 +513,7 @@ class BrowserSnifferTest < Minitest::Test
|
|
509
513
|
:form_factor => :desktop,
|
510
514
|
:ios? => false,
|
511
515
|
:ie11? => true,
|
516
|
+
:ie11_actual? => true,
|
512
517
|
:android? => false,
|
513
518
|
:desktop? => true,
|
514
519
|
:engine => :trident,
|
@@ -523,6 +528,7 @@ class BrowserSnifferTest < Minitest::Test
|
|
523
528
|
:form_factor => :desktop,
|
524
529
|
:ios? => false,
|
525
530
|
:ie11? => false,
|
531
|
+
:ie11_actual? => false,
|
526
532
|
:android? => false,
|
527
533
|
:desktop? => true,
|
528
534
|
:engine => :webkit,
|
@@ -558,6 +564,38 @@ class BrowserSnifferTest < Minitest::Test
|
|
558
564
|
:browser => :chrome,
|
559
565
|
:major_browser_version => 81,
|
560
566
|
},
|
567
|
+
:windows_phone_8_1_ie11 => {
|
568
|
+
:user_agent => "Mozilla/5.0 (Mobile; Windows Phone 8.1; Android 4.0; ARM; Trident/7.0; Touch; rv:11.0; IEMobile/11.0; Microsoft; " \
|
569
|
+
"Lumia 640 XL) like iPhone OS 7_0_3 Mac OS X AppleWebKit/537 (KHTML, like Gecko) Mobile Safari/537",
|
570
|
+
:form_factor => :handheld,
|
571
|
+
:ios? => false,
|
572
|
+
:ie11? => false,
|
573
|
+
:ie11_actual? => true,
|
574
|
+
:android? => false,
|
575
|
+
:desktop? => false,
|
576
|
+
:engine => :webkit,
|
577
|
+
:major_engine_version => 53,
|
578
|
+
:os => :windows,
|
579
|
+
:os_version => "8.1",
|
580
|
+
:browser => nil,
|
581
|
+
:major_browser_version => 11
|
582
|
+
},
|
583
|
+
:win10_ie11_in_ie7_compatibility_mode => {
|
584
|
+
:user_agent => "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 10.0; WOW64; Trident/7.0; .NET4.0C; .NET4.0E; .NET CLR 2.0.50727; " \
|
585
|
+
".NET CLR 3.0.30729; .NET CLR 3.5.30729; InfoPath.3; Tablet PC 2.0; Zoom 3.6.0)",
|
586
|
+
:form_factor => :desktop,
|
587
|
+
:ios? => false,
|
588
|
+
:ie11? => false,
|
589
|
+
:ie11_actual? => true,
|
590
|
+
:android? => false,
|
591
|
+
:desktop? => true,
|
592
|
+
:engine => :trident,
|
593
|
+
:major_engine_version => 7,
|
594
|
+
:os => :windows,
|
595
|
+
:os_version => "10",
|
596
|
+
:browser => :ie,
|
597
|
+
:major_browser_version => 7
|
598
|
+
},
|
561
599
|
}
|
562
600
|
|
563
601
|
AGENTS.each do |agent, attributes|
|
data/test/shopify_agents_test.rb
CHANGED
@@ -554,6 +554,97 @@ describe "Shopify agents" do
|
|
554
554
|
assert_equal sniffer.os_info, sniffer_with_suffix.os_info
|
555
555
|
end
|
556
556
|
|
557
|
+
it "Shopify POS on Android can be sniffed (React Native App)" do
|
558
|
+
user_agent = "com.jadedpixel.pos Shopify POS/4.23.0/Android/12/google/Pixel 5/production MobileMiddlewareSupported"
|
559
|
+
sniffer = BrowserSniffer.new(user_agent)
|
560
|
+
|
561
|
+
user_agent_with_mal = "com.jadedpixel.pos Shopify POS/4.23.0-mal+30112/Android/12/google/Android SDK built for " \
|
562
|
+
"x86/development MobileMiddlewareSupported"
|
563
|
+
sniffer_with_suffix = BrowserSniffer.new(user_agent_with_mal)
|
564
|
+
|
565
|
+
assert_equal ({
|
566
|
+
name: 'Shopify POS',
|
567
|
+
version: '4.23.0',
|
568
|
+
}), sniffer.browser_info
|
569
|
+
|
570
|
+
assert_equal ({
|
571
|
+
type: :handheld,
|
572
|
+
}), sniffer.device_info
|
573
|
+
|
574
|
+
assert_equal ({
|
575
|
+
type: :android,
|
576
|
+
version: '12',
|
577
|
+
name: 'Android',
|
578
|
+
}), sniffer.os_info
|
579
|
+
|
580
|
+
assert_equal sniffer.browser_info, sniffer_with_suffix.browser_info
|
581
|
+
assert_equal sniffer.device_info, sniffer_with_suffix.device_info
|
582
|
+
assert_equal sniffer.os_info, sniffer_with_suffix.os_info
|
583
|
+
end
|
584
|
+
|
585
|
+
it "Shopify POS on iPhone can be sniffed (React Native App)" do
|
586
|
+
user_agent = "com.jadedpixel.pos Shopify POS/7.0.0/iOS/15.4/Apple/iPhone 11/production"
|
587
|
+
sniffer = BrowserSniffer.new(user_agent)
|
588
|
+
|
589
|
+
assert_equal ({
|
590
|
+
name: 'Shopify POS',
|
591
|
+
version: '7.0.0',
|
592
|
+
}), sniffer.browser_info
|
593
|
+
|
594
|
+
assert_equal ({
|
595
|
+
type: :handheld,
|
596
|
+
model: 'iPhone 11',
|
597
|
+
}), sniffer.device_info
|
598
|
+
|
599
|
+
assert_equal ({
|
600
|
+
type: :ios,
|
601
|
+
version: '15.4',
|
602
|
+
name: 'iOS',
|
603
|
+
}), sniffer.os_info
|
604
|
+
end
|
605
|
+
|
606
|
+
it "Shopify POS on iPad can be sniffed (React Native App)" do
|
607
|
+
user_agent = "com.jadedpixel.pos Shopify POS/7.0.0/iOS/15.4/Apple/iPad/production"
|
608
|
+
sniffer = BrowserSniffer.new(user_agent)
|
609
|
+
|
610
|
+
assert_equal ({
|
611
|
+
name: 'Shopify POS',
|
612
|
+
version: '7.0.0',
|
613
|
+
}), sniffer.browser_info
|
614
|
+
|
615
|
+
assert_equal ({
|
616
|
+
type: :tablet,
|
617
|
+
model: 'iPad',
|
618
|
+
}), sniffer.device_info
|
619
|
+
|
620
|
+
assert_equal ({
|
621
|
+
type: :ios,
|
622
|
+
version: '15.4',
|
623
|
+
name: 'iOS',
|
624
|
+
}), sniffer.os_info
|
625
|
+
end
|
626
|
+
|
627
|
+
it "Shopify POS on iPod Touch can be sniffed (React Native App)" do
|
628
|
+
user_agent = "com.jadedpixel.pos Shopify POS/7.0.0/iOS/15.4/Apple/iPod Touch/production"
|
629
|
+
sniffer = BrowserSniffer.new(user_agent)
|
630
|
+
|
631
|
+
assert_equal ({
|
632
|
+
name: 'Shopify POS',
|
633
|
+
version: '7.0.0',
|
634
|
+
}), sniffer.browser_info
|
635
|
+
|
636
|
+
assert_equal ({
|
637
|
+
type: :handheld,
|
638
|
+
model: 'iPod Touch',
|
639
|
+
}), sniffer.device_info
|
640
|
+
|
641
|
+
assert_equal ({
|
642
|
+
type: :ios,
|
643
|
+
version: '15.4',
|
644
|
+
name: 'iOS',
|
645
|
+
}), sniffer.os_info
|
646
|
+
end
|
647
|
+
|
557
648
|
it "Shopify Mobile in debug mode can be parsed" do
|
558
649
|
user_agent = "Shopify Mobile/Android/6.0.0 (debug) (Build 1 with API 25 on Unknown Android SDK built for x86)"
|
559
650
|
sniffer = BrowserSniffer.new(user_agent)
|
@@ -680,33 +771,68 @@ describe "Shopify agents" do
|
|
680
771
|
}), sniffer.os_info
|
681
772
|
end
|
682
773
|
|
683
|
-
INCOMPATIBLE_USER_AGENTS =
|
684
|
-
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
"Mozilla/5.0 (
|
689
|
-
|
690
|
-
|
774
|
+
INCOMPATIBLE_USER_AGENTS = {
|
775
|
+
'missing' => nil,
|
776
|
+
|
777
|
+
# Safari on iOS 12 is broken
|
778
|
+
'iOS 12.0' => "Mozilla/5.0 (iPhone; CPU iPhone OS 12_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) GSA/87.0.279142407 Mobile/15E148 Safari/605.1",
|
779
|
+
'iOS 12.2' => "Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1 Mobile/15E148 Safari/604.1",
|
780
|
+
|
781
|
+
# Safari on MacOS 14 is broken
|
782
|
+
'MacOS 10.14 Safari' => "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0 Safari/605.1.15",
|
783
|
+
'MacOS 10.14 WebKit' => "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/605.1.15 (KHTML, like Gecko)",
|
784
|
+
|
785
|
+
# UC Browser versions before 12.13.2 are broken
|
786
|
+
'UC Browser 11.3.8' => "Mozilla/5.0 (Linux; U; Android 7.0; en-US; SM-G935F Build/NRD90M) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 UCBrowser/11.3.8.976 U3/0.8.0 Mobile Safari/534.30",
|
787
|
+
'UC Browser 12.13.0' => "Mozilla/5.0 (Linux; U; Android 8.0.0; en-US; moto g⁶ play Build/OPP27.91-88) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/57.0.2987.108 UCBrowser/12.13.0.1207 Mobile Safari/537.36",
|
788
|
+
|
789
|
+
# Chrome and Chromium versions between 51 and 66 inclusive are broken
|
790
|
+
'Chrome 51' => "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36",
|
791
|
+
'Chrome 66' => "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.139 Safari/537.36",
|
691
792
|
|
692
|
-
|
693
|
-
|
793
|
+
'Chromium 51' => "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/51.0.2704.79 Chrome/51.0.2704.79 Safari/537.36",
|
794
|
+
'Chromium 66' => "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/66.0.3359.181 Chrome/66.0.3359.181 Safari/537.36",
|
795
|
+
}
|
796
|
+
|
797
|
+
INCOMPATIBLE_USER_AGENTS.each do |label, user_agent|
|
798
|
+
it "#{label} user agent is correctly marked as incompatible" do
|
694
799
|
sniffer = BrowserSniffer.new(user_agent)
|
695
800
|
|
696
801
|
refute sniffer.same_site_none_compatible?
|
697
802
|
end
|
698
803
|
end
|
699
804
|
|
700
|
-
COMPATIBLE_USER_AGENTS =
|
701
|
-
"Mozilla/5.0 (
|
702
|
-
|
703
|
-
"Mozilla/5.0 (Macintosh; Intel Mac OS X
|
704
|
-
|
705
|
-
|
706
|
-
|
805
|
+
COMPATIBLE_USER_AGENTS = {
|
806
|
+
'iOS 13' => "Mozilla/5.0 (iPhone; CPU iPhone OS 13_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.5 Mobile/15E148 Safari/604.1",
|
807
|
+
|
808
|
+
'MacOS 10.13 Safari' => "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/604.5.6 (KHTML, like Gecko) Version/11.0.3 Safari/604.5.6",
|
809
|
+
|
810
|
+
'MacOS 10.14 Chrome' => "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36",
|
811
|
+
|
812
|
+
'MacOS 10.15 Safari' => "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_1) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Safari/605.1.15",
|
813
|
+
|
814
|
+
'MacOS 10.15 Firefox' => "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:72.0) Gecko/20100101 Firefox/72.0",
|
815
|
+
|
816
|
+
'UC Browser 13.3.8' => "Mozilla/5.0 (Linux; U; Android 11; en-US; SM-A715F Build/RP1A.200720.012) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/78.0.3904.108 UCBrowser/13.3.8.1305 Mobile Safari/537.36",
|
817
|
+
|
818
|
+
'Chrome 50' => "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36",
|
819
|
+
'Chrome 67' => "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36",
|
820
|
+
|
821
|
+
'Chromium 50' => "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/50.0.2661.102 Chrome/50.0.2661.102 Safari/537.36",
|
822
|
+
'Chromium 67' => "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/67.0.3396.99 Chrome/67.0.3396.99 Safari/537.36",
|
823
|
+
|
824
|
+
# False negative: library doesn't recognise WebKit user agents that aren't Safari or Chrome
|
825
|
+
# (These may be e.g. Webkit nightly builds)
|
826
|
+
# 'MacOS 10.13 WebKit' => "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/605.1.15 (KHTML, like Gecko)",
|
827
|
+
# 'MacOS 10.15 WebKit' => "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko)",
|
828
|
+
|
829
|
+
# False negative: library explicitly treats iOS 11 Safari as incompatible while reference code does not:
|
830
|
+
# https://www.chromium.org/updates/same-site/incompatible-clients
|
831
|
+
# 'iOS 11' => "Mozilla/5.0 (iPhone; CPU iPhone OS 11_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Mobile/15E148 Safari/604.1",
|
832
|
+
}
|
707
833
|
|
708
|
-
COMPATIBLE_USER_AGENTS.each do |user_agent|
|
709
|
-
it "user agent
|
834
|
+
COMPATIBLE_USER_AGENTS.each do |label, user_agent|
|
835
|
+
it "#{label} user agent is correctly marked as compatible" do
|
710
836
|
sniffer = BrowserSniffer.new(user_agent)
|
711
837
|
|
712
838
|
assert sniffer.same_site_none_compatible?
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: browser_sniffer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shopify
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-05-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -60,8 +60,8 @@ extensions: []
|
|
60
60
|
extra_rdoc_files: []
|
61
61
|
files:
|
62
62
|
- ".github/probots.yml"
|
63
|
+
- ".github/workflows/test.yml"
|
63
64
|
- ".gitignore"
|
64
|
-
- ".travis.yml"
|
65
65
|
- Gemfile
|
66
66
|
- LICENSE.txt
|
67
67
|
- README.md
|
@@ -89,14 +89,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
89
89
|
requirements:
|
90
90
|
- - ">="
|
91
91
|
- !ruby/object:Gem::Version
|
92
|
-
version:
|
92
|
+
version: 2.0.0
|
93
93
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
94
94
|
requirements:
|
95
95
|
- - ">="
|
96
96
|
- !ruby/object:Gem::Version
|
97
97
|
version: '0'
|
98
98
|
requirements: []
|
99
|
-
rubygems_version: 3.
|
99
|
+
rubygems_version: 3.2.20
|
100
100
|
signing_key:
|
101
101
|
specification_version: 4
|
102
102
|
summary: Parses user agent strings and boils it all down to a few simple classifications.
|