line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Woothee::Browser; |
2
|
|
|
|
|
|
|
|
3
|
6
|
|
|
6
|
|
43
|
use strict; |
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
176
|
|
4
|
6
|
|
|
6
|
|
28
|
use warnings; |
|
6
|
|
|
|
|
10
|
|
|
6
|
|
|
|
|
141
|
|
5
|
6
|
|
|
6
|
|
25
|
use Carp; |
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
314
|
|
6
|
|
|
|
|
|
|
|
7
|
6
|
|
|
6
|
|
2264
|
use Woothee::Util qw/update_map update_category update_version update_os/; |
|
6
|
|
|
|
|
18
|
|
|
6
|
|
|
|
|
398
|
|
8
|
6
|
|
|
6
|
|
40
|
use Woothee::DataSet qw/dataset/; |
|
6
|
|
|
|
|
9
|
|
|
6
|
|
|
|
|
9987
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = "v1.10.0"; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub challenge_msie { |
13
|
567
|
|
|
567
|
0
|
952
|
my ($ua,$result) = @_; |
14
|
|
|
|
|
|
|
|
15
|
567
|
100
|
100
|
|
|
4205
|
return 0 if index($ua, "compatible; MSIE") < 0 and index($ua, "Trident/") < 0 and index($ua, "IEMobile"); |
|
|
|
66
|
|
|
|
|
16
|
|
|
|
|
|
|
|
17
|
66
|
|
|
|
|
105
|
my $version; |
18
|
66
|
100
|
33
|
|
|
577
|
if ($ua =~ m{MSIE ([.0-9]+);}o) { |
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
19
|
45
|
|
|
|
|
123
|
$version = $1; |
20
|
|
|
|
|
|
|
} elsif ($ua =~ m{Trident/([.0-9]+);}o and $ua =~ m{ rv:([.0-9]+)}o) { |
21
|
21
|
|
|
|
|
60
|
$version = $1; |
22
|
|
|
|
|
|
|
} elsif ($ua =~ m{IEMobile/([.0-9]+);}o) { |
23
|
0
|
|
|
|
|
0
|
$version = $1; |
24
|
|
|
|
|
|
|
} else { |
25
|
0
|
|
|
|
|
0
|
$version = Woothee::DataSet->const('VALUE_UNKNOWN'); |
26
|
|
|
|
|
|
|
} |
27
|
66
|
|
|
|
|
234
|
update_map($result, dataset('MSIE')); |
28
|
66
|
|
|
|
|
210
|
update_version($result, $version); |
29
|
66
|
|
|
|
|
221
|
return 1; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub challenge_yandex_browser { |
33
|
492
|
|
|
492
|
0
|
890
|
my ($ua, $result) = @_; |
34
|
|
|
|
|
|
|
|
35
|
492
|
100
|
|
|
|
1694
|
return 0 if index($ua, "YaBrowser/") < 0; |
36
|
|
|
|
|
|
|
|
37
|
6
|
|
|
|
|
25
|
my $version = Woothee::DataSet->const('VALUE_UNKNOWN'); |
38
|
|
|
|
|
|
|
|
39
|
6
|
50
|
|
|
|
57
|
if ($ua =~ m{YaBrowser/([.0-9]+)}o) { |
40
|
6
|
|
|
|
|
22
|
$version = $1; |
41
|
|
|
|
|
|
|
} |
42
|
6
|
|
|
|
|
19
|
update_map($result, dataset('YaBrowser')); |
43
|
6
|
|
|
|
|
24
|
update_version($result, $version); |
44
|
6
|
|
|
|
|
21
|
return 1; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub challenge_vivaldi { |
48
|
501
|
|
|
501
|
0
|
947
|
my ($ua, $result) = @_; |
49
|
|
|
|
|
|
|
|
50
|
501
|
100
|
|
|
|
1801
|
return 0 if index($ua, "Vivaldi/") < 0; |
51
|
|
|
|
|
|
|
|
52
|
9
|
|
|
|
|
32
|
my $version = Woothee::DataSet->const('VALUE_UNKNOWN'); |
53
|
|
|
|
|
|
|
|
54
|
9
|
50
|
|
|
|
76
|
if ($ua =~ m{Vivaldi/([.0-9]+)}o) { |
55
|
9
|
|
|
|
|
29
|
$version = $1; |
56
|
|
|
|
|
|
|
} |
57
|
9
|
|
|
|
|
25
|
update_map($result, dataset('Vivaldi')); |
58
|
9
|
|
|
|
|
34
|
update_version($result, $version); |
59
|
9
|
|
|
|
|
31
|
return 1; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub challenge_safari_chrome { # and Opera(blink) |
63
|
486
|
|
|
486
|
0
|
842
|
my ($ua,$result) = @_; |
64
|
|
|
|
|
|
|
|
65
|
486
|
100
|
|
|
|
1731
|
return 0 if index($ua, "Safari/") < 0; |
66
|
|
|
|
|
|
|
|
67
|
87
|
|
|
|
|
316
|
my $version = Woothee::DataSet->const('VALUE_UNKNOWN'); |
68
|
|
|
|
|
|
|
|
69
|
87
|
100
|
|
|
|
363
|
if ($ua =~ m{(?:Edge|Edg|EdgiOS|EdgA)/([.0-9]+)}o) { |
70
|
|
|
|
|
|
|
# MS Edge |
71
|
12
|
|
|
|
|
36
|
$version = $1; |
72
|
12
|
|
|
|
|
33
|
update_map($result, dataset("Edge")); |
73
|
12
|
|
|
|
|
43
|
update_version($result, $version); |
74
|
12
|
|
|
|
|
45
|
return 1; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
75
|
100
|
|
|
|
252
|
if ($ua =~ m{FxiOS/([.0-9]+)}o) { |
78
|
|
|
|
|
|
|
# Firefox for iOS |
79
|
3
|
|
|
|
|
8
|
$version = $1; |
80
|
3
|
|
|
|
|
13
|
update_map($result, dataset("Firefox")); |
81
|
3
|
|
|
|
|
12
|
update_version($result, $version); |
82
|
3
|
|
|
|
|
11
|
return 1; |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
72
|
100
|
|
|
|
473
|
if ($ua =~ m{(?:Chrome|CrMo|CriOS)/([.0-9]+)}o) { |
86
|
|
|
|
|
|
|
# Opera (blink) |
87
|
36
|
100
|
|
|
|
141
|
if ($ua =~ m{OPR/([.0-9]+)}o) { |
88
|
9
|
|
|
|
|
29
|
$version = $1; |
89
|
9
|
|
|
|
|
32
|
update_map($result, dataset("Opera")); |
90
|
9
|
|
|
|
|
33
|
update_version($result, $version); |
91
|
9
|
|
|
|
|
36
|
return 1; |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
#WebView |
95
|
27
|
100
|
|
|
|
104
|
if (index($ua, "wv") > -1) { |
96
|
3
|
|
|
|
|
13
|
return 0; |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
# Chrome |
100
|
24
|
|
|
|
|
69
|
$version = $1; |
101
|
24
|
|
|
|
|
71
|
update_map($result, dataset("Chrome")); |
102
|
24
|
|
|
|
|
74
|
update_version($result, $version); |
103
|
24
|
|
|
|
|
94
|
return 1; |
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
# Safari |
107
|
36
|
100
|
|
|
|
210
|
if ($ua =~ m{Version/([.0-9]+)}o) { |
108
|
30
|
|
|
|
|
86
|
$version = $1; |
109
|
|
|
|
|
|
|
} |
110
|
36
|
|
|
|
|
114
|
update_map($result, dataset("Safari")); |
111
|
36
|
|
|
|
|
132
|
update_version($result, $version); |
112
|
36
|
|
|
|
|
129
|
return 1; |
113
|
|
|
|
|
|
|
} |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
sub challenge_firefox { |
116
|
402
|
|
|
402
|
0
|
748
|
my ($ua,$result) = @_; |
117
|
|
|
|
|
|
|
|
118
|
402
|
100
|
|
|
|
1405
|
return 0 if index($ua, "Firefox/") < 0; |
119
|
|
|
|
|
|
|
|
120
|
27
|
|
|
|
|
49
|
my $version; |
121
|
27
|
50
|
|
|
|
185
|
if ($ua =~ m{Firefox/([.0-9]+)}o) { |
122
|
27
|
|
|
|
|
83
|
$version = $1; |
123
|
|
|
|
|
|
|
} |
124
|
|
|
|
|
|
|
else { |
125
|
0
|
|
|
|
|
0
|
$version = Woothee::DataSet->const('VALUE_UNKNOWN'); |
126
|
|
|
|
|
|
|
} |
127
|
27
|
|
|
|
|
87
|
update_map($result, dataset("Firefox")); |
128
|
27
|
|
|
|
|
94
|
update_version($result, $version); |
129
|
27
|
|
|
|
|
99
|
return 1; |
130
|
|
|
|
|
|
|
} |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
sub challenge_opera { |
133
|
375
|
|
|
375
|
0
|
673
|
my ($ua,$result) = @_; |
134
|
|
|
|
|
|
|
|
135
|
375
|
100
|
|
|
|
1247
|
return 0 if index($ua, "Opera") < 0; |
136
|
|
|
|
|
|
|
|
137
|
30
|
|
|
|
|
59
|
my $version; |
138
|
30
|
100
|
|
|
|
269
|
if ($ua =~ m{Version/([.0-9]+)}o) { |
|
|
50
|
|
|
|
|
|
139
|
12
|
|
|
|
|
37
|
$version = $1; |
140
|
|
|
|
|
|
|
} |
141
|
|
|
|
|
|
|
elsif ($ua =~ m{Opera[/ ]([.0-9]+)}o) { |
142
|
18
|
|
|
|
|
54
|
$version = $1; |
143
|
|
|
|
|
|
|
} |
144
|
|
|
|
|
|
|
else { |
145
|
0
|
|
|
|
|
0
|
$version = Woothee::DataSet->const('VALUE_UNKNOWN'); |
146
|
|
|
|
|
|
|
} |
147
|
30
|
|
|
|
|
149
|
update_map($result, dataset("Opera")); |
148
|
30
|
|
|
|
|
100
|
update_version($result, $version); |
149
|
30
|
|
|
|
|
97
|
return 1; |
150
|
|
|
|
|
|
|
} |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
sub challenge_webview { |
153
|
345
|
|
|
345
|
0
|
647
|
my ($ua,$result) = @_; |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
|
156
|
345
|
|
|
|
|
1113
|
my $version = Woothee::DataSet->const('VALUE_UNKNOWN'); |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
# iOS |
159
|
345
|
100
|
|
|
|
1638
|
if ($ua =~ m{iP(hone;|ad;|od) .*like Mac OS X}o) { |
|
|
100
|
|
|
|
|
|
160
|
9
|
50
|
|
|
|
38
|
return 0 if index($ua, "Safari/") > -1; |
161
|
|
|
|
|
|
|
|
162
|
9
|
100
|
|
|
|
39
|
if ($ua =~ m{Version/([.0-9]+)}o) { |
163
|
3
|
|
|
|
|
12
|
$version = $1; |
164
|
|
|
|
|
|
|
} |
165
|
|
|
|
|
|
|
|
166
|
9
|
|
|
|
|
31
|
update_version($result, $version); |
167
|
9
|
|
|
|
|
25
|
update_map($result, dataset("Webview")); |
168
|
9
|
|
|
|
|
33
|
return 1; |
169
|
|
|
|
|
|
|
} |
170
|
|
|
|
|
|
|
elsif (index($ua, "wv") > -1) { #WebView |
171
|
3
|
50
|
|
|
|
24
|
if ($ua =~ m{Version/([.0-9]+)}o) { |
172
|
3
|
|
|
|
|
9
|
$version = $1; |
173
|
|
|
|
|
|
|
} |
174
|
|
|
|
|
|
|
|
175
|
3
|
|
|
|
|
14
|
update_version($result, $version); |
176
|
3
|
|
|
|
|
12
|
update_map($result, dataset("Webview")); |
177
|
3
|
|
|
|
|
11
|
return 1; |
178
|
|
|
|
|
|
|
} |
179
|
|
|
|
|
|
|
|
180
|
333
|
|
|
|
|
836
|
return 0; |
181
|
|
|
|
|
|
|
} |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
sub challenge_sleipnir { |
185
|
168
|
|
|
168
|
0
|
303
|
my ($ua,$result) = @_; |
186
|
|
|
|
|
|
|
|
187
|
168
|
100
|
|
|
|
599
|
return 0 if index($ua, "Sleipnir/") < 0; |
188
|
|
|
|
|
|
|
|
189
|
3
|
|
|
|
|
6
|
my $version; |
190
|
3
|
50
|
|
|
|
27
|
if ($ua =~ m{Sleipnir/([.0-9]+)}o) { |
191
|
3
|
|
|
|
|
11
|
$version = $1; |
192
|
|
|
|
|
|
|
} |
193
|
|
|
|
|
|
|
else { |
194
|
0
|
|
|
|
|
0
|
$version = Woothee::DataSet->const('VALUE_UNKNOWN'); |
195
|
|
|
|
|
|
|
} |
196
|
3
|
|
|
|
|
11
|
update_map($result, dataset("Sleipnir")); |
197
|
3
|
|
|
|
|
13
|
update_version($result, $version); |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
# Sleipnir's user-agent doesn't contain Windows version, so put 'Windows UNKNOWN Ver'. |
200
|
|
|
|
|
|
|
# Sleipnir is IE component browser, so for Windows only. |
201
|
3
|
|
|
|
|
9
|
my $win = dataset("Win"); |
202
|
3
|
|
|
|
|
9
|
update_category($result, $win->{Woothee::DataSet->const('KEY_CATEGORY')}); |
203
|
3
|
|
|
|
|
11
|
update_os($result, $win->{Woothee::DataSet->const('KEY_NAME')}); |
204
|
|
|
|
|
|
|
|
205
|
3
|
|
|
|
|
11
|
return 1; |
206
|
|
|
|
|
|
|
} |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
1; |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
__END__ |