blib/lib/HTTP/BrowserDetect.pm

filter: Statementstmt 90.0% 806 / 895 Branchbran 88.4% 658 / 744 Conditioncond 84.3% 485 / 575 MC/DCmcdc 48.6% 126 / 259 Subroutinesub 92.4% 61 / 66 Podpod 97.3% 37 / 38 totaltotal 84.3% 2173 / 2577 CC 570 SCAR 47.4
CC
570
Cov
88%
_init_os
304.2
_init_device
169.5
_init_version
98.6
CRAP 114.8
↑ Summary Build »
1 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 4 ▶use 5.006;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 package HTTP::BrowserDetect;
7 4 $HTTP::BrowserDetect::VERSION = '2.08';
8 4 ▶use vars qw(@ALL_TESTS);
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 # Operating Systems
11 4 our @OS_TESTS = qw(
12 windows mac os2
13 unix linux vms
14 bsd amiga
15 bb10 rimtabletos
16 chromeos ios
17 firefoxos
18 );
19  
20 # More precise Windows
21 4 our @WINDOWS_TESTS = qw(
22 win16 win3x win31
23 win95 win98 winnt
24 winme win32 win2k
25 winxp win2k3 winvista
26 win7 win8 win8_0
27 win8_1 win10 win10_0
28 wince winphone winphone7
29 winphone7_5 winphone8 winphone8_1
30 winphone10
31 );
32  
33 # More precise Mac
34 4 our @MAC_TESTS = qw(
35 macosx mac68k macppc
36 );
37  
38 # More precise Unix
39 4 our @UNIX_TESTS = qw(
40 sun sun4 sun5
41 suni86 irix irix5
42 irix6 hpux hpux9
43 hpux10 aix aix1
44 aix2 aix3 aix4
45 sco unixware mpras
46 reliant dec sinix
47 );
48  
49 # More precise BSDs
50 4 our @BSD_TESTS = qw(
51 freebsd
52 );
53  
54 # Gaming devices
55 4 our @GAMING_TESTS = qw(
56 ps3gameos pspgameos
57 );
58  
59 # Device related tests
60 4 our @DEVICE_TESTS = qw(
61 android audrey blackberry dsi iopener ipad
62 iphone ipod kindle n3ds palm ps3 psp wap webos
63 mobile tablet
64 );
65  
66 # Browsers
67 4 our @BROWSER_TESTS = qw(
68 mosaic netscape firefox
69 chrome safari ie
70 opera lynx links
71 elinks neoplanet neoplanet2
72 avantgo emacs mozilla
73 konqueror realplayer netfront
74 mobile_safari obigo aol
75 lotusnotes staroffice icab
76 webtv browsex silk
77 applecoremedia galeon seamonkey
78 epiphany ucbrowser dalvik
79 edge brave
80 );
81  
82 4 our @IE_TESTS = qw(
83 ie3 ie4 ie4up
84 ie5 ie5up ie55
85 ie55up ie6 ie7
86 ie8 ie9 ie10
87 ie11
88 ie_compat_mode
89 );
90  
91 4 our @OPERA_TESTS = qw(
92 opera3 opera4 opera5
93 opera6 opera7
94 );
95  
96 4 our @AOL_TESTS = qw(
97 aol3 aol4
98 aol5 aol6
99 );
100  
101 4 our @NETSCAPE_TESTS = qw(
102 nav2 nav3 nav4
103 nav4up nav45 nav45up
104 nav6 nav6up navgold
105 );
106  
107 # Firefox variants
108 4 our @FIREFOX_TESTS = qw(
109 firebird iceweasel phoenix
110 namoroka
111 );
112  
113 # Engine tests
114 4 our @ENGINE_TESTS = qw(
115 gecko trident webkit
116 presto khtml edgehtml
117 );
118  
119 4 our @ROBOT_TESTS = qw(
120 puf curl wget
121 getright robot slurp
122 yahoo mj12bot ahrefs
123 altavista lycos infoseek
124 lwp webcrawler linkexchange
125 googlemobile msn msnmobile
126 facebook baidu googleadsbot
127 askjeeves googleadsense googlebotvideo
128 googlebotnews googlebotimage google
129 linkchecker yandeximages specialarchiver
130 yandex java lib
131 indy golib rubylib
132 apache msoffice
133 );
134  
135 4 our @MISC_TESTS = qw(
136 dotnet x11
137 );
138  
139 4 push @ALL_TESTS,
140 (
141 @OS_TESTS, @WINDOWS_TESTS,
142 @MAC_TESTS, @UNIX_TESTS,
143 @BSD_TESTS, @GAMING_TESTS,
144 @DEVICE_TESTS, @BROWSER_TESTS,
145 @IE_TESTS, @OPERA_TESTS,
146 @AOL_TESTS, @NETSCAPE_TESTS,
147 @FIREFOX_TESTS, @ENGINE_TESTS,
148 @ROBOT_TESTS, @MISC_TESTS,
149 );
150  
151 sub _all_tests {
152 1 ▶ return @ALL_TESTS;
Subroutine _all_tests: called CC=1 SCAR=0.0
153 }
154  
155 # https://support.google.com/webmasters/answer/1061943?hl=en
156  
157 4 my %ROBOT_NAMES = (
158 ahrefs => 'Ahrefs',
159 altavista => 'AltaVista',
160 apache => 'Apache http client',
161 askjeeves => 'AskJeeves',
162 baidu => 'Baidu Spider',
163 curl => 'curl',
164 facebook => 'Facebook',
165 getright => 'GetRight',
166 google => 'Googlebot',
167 googleadsbot => 'Google AdsBot',
168 googleadsense => 'Google AdSense',
169 googlebotimage => 'Googlebot Images',
170 googlebotnews => 'Googlebot News',
171 googlebotvideo => 'Googlebot Video',
172 googlemobile => 'Googlebot Mobile',
173 golib => 'Go language http library',
174 indy => 'Indy Library',
175 infoseek => 'InfoSeek',
176 java => 'Java',
177 linkchecker => 'LinkChecker',
178 linkexchange => 'LinkExchange',
179 lwp => 'LWP::UserAgent',
180 lycos => 'Lycos',
181 mj12bot => 'Majestic-12 DSearch',
182 msn => 'MSN',
183 msnmobile => 'MSN Mobile',
184 msoffice => 'Microsoft Office',
185 puf => 'puf',
186 robot => 'robot',
187 rubylib => 'Ruby http library',
188 slurp => 'Yahoo! Slurp',
189 specialarchiver => 'archive.org_bot',
190 webcrawler => 'WebCrawler',
191 wget => 'wget',
192 yahoo => 'Yahoo',
193 yandex => 'Yandex',
194 yandeximages => 'YandexImages',
195 );
196  
197 4 my %BROWSER_NAMES = (
198 aol => 'AOL Browser',
199 applecoremedia => 'AppleCoreMedia',
200 blackberry => 'BlackBerry',
201 brave => 'Brave',
202 browsex => 'BrowseX',
203 chrome => 'Chrome',
204 curl => 'curl',
205 dalvik => 'Dalvik',
206 dsi => 'Nintendo DSi',
207 edge => 'Edge',
208 elinks => 'ELinks',
209 epiphany => 'Epiphany',
210 firefox => 'Firefox',
211 galeon => 'Galeon',
212 icab => 'iCab',
213 iceweasel => 'IceWeasel',
214 ie => 'MSIE',
215 konqueror => 'Konqueror',
216 links => 'Links',
217 lotusnotes => 'Lotus Notes',
218 lynx => 'Lynx',
219 mobile_safari => 'Mobile Safari',
220 mosaic => 'Mosaic',
221 mozilla => 'Mozilla',
222 n3ds => 'Nintendo 3DS',
223 netfront => 'NetFront',
224 netscape => 'Netscape',
225 obigo => 'Obigo',
226 opera => 'Opera',
227 puf => 'puf',
228 realplayer => 'RealPlayer',
229 safari => 'Safari',
230 seamonkey => 'SeaMonkey',
231 silk => 'Silk',
232 staroffice => 'StarOffice',
233 ucbrowser => 'UCBrowser',
234 webtv => 'WebTV',
235 );
236  
237 # Device names
238 4 my %DEVICE_NAMES = (
239 android => 'Android',
240 audrey => 'Audrey',
241 blackberry => 'BlackBerry',
242 dsi => 'Nintendo DSi',
243 iopener => 'iopener',
244 ipad => 'iPad',
245 iphone => 'iPhone',
246 ipod => 'iPod',
247 kindle => 'Amazon Kindle',
248 n3ds => 'Nintendo 3DS',
249 palm => 'Palm',
250 ps3 => 'Sony PlayStation 3',
251 psp => 'Sony PlayStation Portable',
252 wap => 'WAP capable phone',
253 webos => 'webOS',
254 );
255  
256 4 my %OS_NAMES = (
257 amiga => 'Amiga',
258 android => 'Android',
259 bb10 => 'BlackBerry 10',
260 chromeos => 'Chrome OS',
261 firefoxos => 'Firefox OS',
262 ios => 'iOS',
263 linux => 'Linux',
264 mac => 'Mac',
265 macosx => 'Mac OS X',
266 os2 => 'OS/2',
267 ps3gameos => 'Playstation 3 GameOS',
268 pspgameos => 'Playstation Portable GameOS',
269 rimtabletos => 'RIM Tablet OS',
270 unix => 'Unix',
271 vms => 'VMS',
272 win2k => 'Win2k',
273 win2k3 => 'Win2k3',
274 win3x => 'Win3x',
275 win7 => 'Win7',
276 win8 => 'Win8',
277 win8_0 => 'Win8.0',
278 win8_1 => 'Win8.1',
279 win10 => 'Win10',
280 win10_0 => 'Win10.0',
281 win95 => 'Win95',
282 win98 => 'Win98',
283 winme => 'WinME',
284 winnt => 'WinNT',
285 winphone => 'Windows Phone',
286 winvista => 'WinVista',
287 winxp => 'WinXP',
288 );
289  
290 # Safari build -> version map for versions prior to 3.0
291 # (since then, version appears in the user-agent string)
292  
293 4 my %safari_build_to_version = qw(
294 48 0.8
295 51 0.8.1
296 60 0.8.2
297 73 0.9
298 74 1.0b2v74
299 85 1.0
300 85.7 1.0.2
301 85.8 1.0.3
302 100 1.1
303 100.1 1.1.1
304 125 1.2
305 125.1 1.2.1
306 125.7 1.2.2
307 125.9 1.2.3
308 125.11 1.2.4
309 312 1.3
310 312.3 1.3.1
311 312.5 1.3.2
312 412 2.0
313 412.5 2.0.1
314 416.12 2.0.2
315 417.8 2.0.3
316 419.3 2.0.4
317 );
318  
319 #######################################################################################################
320 # BROWSER OBJECT
321  
322 4 my $default = undef;
323  
324 sub new {
325 6495 ▶ my ( $class, $user_agent ) = @_;
Subroutine new: called CC=3 SCAR=11.0
Pod documented
326  
327 6495 my $self = {};
328 6495 bless $self, $class;
329  
330 6495 ▶ unless ( defined $user_agent ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $user_agent) 1 6494 6495
331 1 $user_agent = $ENV{'HTTP_USER_AGENT'};
332 }
333  
334 6495 ▶ $self->{user_agent} = defined $user_agent ? $user_agent : '';
Branch: 1 branch
BranchTrueFalseTotal
defined $user_agent ? : 6494 1 6495
335 6495 $self->_init_core;
336  
337 6495 return $self;
338 }
339  
340 ### Accessors for computed-on-demand test attributes
341  
342 4 foreach my $test ( @ENGINE_TESTS, @MISC_TESTS ) {
343 4 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
344 32 *{$test} = sub {
345 15241 ▶ my ($self) = @_;
Subroutine __ANON__: called CC=2 SCAR=6.9
346 15241 ▶ return $self->{tests}->{$test} || 0;
Condition100%2/2
$self->{'tests'}{$test} || 0
l!l
381111430
MC/DC100%1/1
$self->{'tests'}{$test} || 0
$self->{'tests'}{$test}
Truth table100%2/2
A
A= $self->{'tests'}{$test}
Aresult
11
00
347 32 };
348 }
349  
350 4 foreach my $test (
351 @OS_TESTS, @WINDOWS_TESTS, @MAC_TESTS, @UNIX_TESTS,
352 @BSD_TESTS, @GAMING_TESTS
353 ) {
354 4 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
355 260 *{$test} = sub {
356 48021 ▶ my ($self) = @_;
Subroutine __ANON__: called CC=3 SCAR=11.0
357 48021 ▶ $self->_init_os() unless $self->{os_tests};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"os_tests"} 4885 43136 48021
358 48021 ▶ return $self->{os_tests}->{$test} || 0;
Condition100%2/2
$self->{'os_tests'}{$test} || 0
l!l
385244169
MC/DC100%1/1
$self->{'os_tests'}{$test} || 0
$self->{'os_tests'}{$test}
Truth table100%2/2
A
A= $self->{'os_tests'}{$test}
Aresult
11
00
359 260 };
360 }
361  
362 4 foreach my $test ( @BROWSER_TESTS, @FIREFOX_TESTS ) {
363 4 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
364 156 *{$test} = sub {
365 38199 ▶ my ($self) = @_;
Subroutine __ANON__: called CC=2 SCAR=6.9
366 38199 ▶ return $self->{browser_tests}->{$test} || 0;
Condition100%2/2
$self->{'browser_tests'}{$test} || 0
l!l
275735442
MC/DC100%1/1
$self->{'browser_tests'}{$test} || 0
$self->{'browser_tests'}{$test}
Truth table100%2/2
A
A= $self->{'browser_tests'}{$test}
Aresult
11
00
367 156 };
368 }
369  
370 4 foreach my $test (@ROBOT_TESTS) {
371 4 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
372 152 *{$test} = sub {
373 27602 ▶ my ($self) = @_;
Subroutine __ANON__: called CC=3 SCAR=11.0
374 27602 ▶ $self->_init_robots() unless $self->{robot_tests};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"robot_tests"} 5954 21648 27602
375 27602 ▶ return $self->{robot_tests}->{$test} || 0;
Condition100%2/2
$self->{'robot_tests'}{$test} || 0
l!l
59427008
MC/DC100%1/1
$self->{'robot_tests'}{$test} || 0
$self->{'robot_tests'}{$test}
Truth table100%2/2
A
A= $self->{'robot_tests'}{$test}
Aresult
11
00
376 152 };
377 }
378  
379 4 foreach my $test (
380 @NETSCAPE_TESTS, @IE_TESTS, @AOL_TESTS,
381 @OPERA_TESTS
382 ) {
383 4 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
384 128 *{$test} = sub {
385 23466 ▶ my ($self) = @_;
Subroutine __ANON__: called CC=3 SCAR=11.0
386 23466 ▶ $self->_init_version() unless $self->{version_tests};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"version_tests"} 4538 18928 23466
387 23466 ▶ return $self->{version_tests}->{$test} || 0;
Condition100%2/2
$self->{'version_tests'}{$test} || 0
l!l
199621470
MC/DC100%1/1
$self->{'version_tests'}{$test} || 0
$self->{'version_tests'}{$test}
Truth table100%2/2
A
A= $self->{'version_tests'}{$test}
Aresult
11
00
388 128 };
389 }
390  
391 4 foreach my $test (@DEVICE_TESTS) {
392 4 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
393 68 *{$test} = sub {
394 12445 ▶ my ($self) = @_;
Subroutine __ANON__: called CC=3 SCAR=11.0
395 12445 ▶ $self->_init_device() unless $self->{device_tests};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"device_tests"} 3942 8503 12445
396 12445 ▶ return $self->{device_tests}->{$test} || 0;
Condition100%2/2
$self->{'device_tests'}{$test} || 0
l!l
96211483
MC/DC100%1/1
$self->{'device_tests'}{$test} || 0
$self->{'device_tests'}{$test}
Truth table100%2/2
A
A= $self->{'device_tests'}{$test}
Aresult
11
00
397 68 };
398 }
399  
400 sub user_agent {
401 1083 ▶ my ( $self, $user_agent ) = @_;
Subroutine user_agent: called CC=2 SCAR=7.6
Pod documented
402 1083 ▶ if ( defined($user_agent) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $user_agent) { } 0 1083 1083
403 0 die
404 "Calling HTTP::BrowserDetect::user_agent() with an argument is no longer allowed; please use new().";
405 }
406 else {
407 1083 return $self->{user_agent};
408 }
409 }
410  
411 ### Code for initializing various pieces of the object. Since it would
412 ### be needlessly slow if we examined every user agent for every piece
413 ### of information we might possibly need, we only initialize things
414 ### when they're actually queried about. Specifically:
415 ###
416 ### _init_core() sets up:
417 ### $self->{browser_tests}
418 ### $self->{browser}
419 ### $self->{browser_string}
420 ### $self->{tests}
421 ### $self->{engine_version}
422 ### $self->{realplayer_version}
423 ###
424 ### _init_version() sets up:
425 ### $self->{version_tests}
426 ### $self->{major}
427 ### $self->{minor}
428 ### $self->{beta}
429 ### $self->{realplayer_version}
430 ###
431 ### _init_os() sets up:
432 ### $self->{os}
433 ### $self->{os_string}
434 ### $self->{os_tests}
435 ### $self->{os_version}
436 ###
437 ### _init_os_version() sets up:
438 ### $self->{os_version}
439 ###
440 ### _init_device() sets up:
441 ### $self->{device_tests}
442 ### $self->{device}
443 ### $self->{device_string}
444 ###
445 ### _init_robots() sets up:
446 ### $self->{robot}
447 ### $self->{robot_tests}
448 ### $self->{robot_string}
449 ### $self->{robot_fragment}
450 ###
451  
452 # Private method -- Set up the basics (browser and misc attributes)
453 # for a new user-agent string
454 sub _init_core {
455 6495 ▶ my ( $self, $new_ua ) = @_;
Subroutine _init_core: called CC=80 SCAR=44.2
456  
457 6495 my $ua = lc $self->{user_agent};
458  
459 # any UA via Google Translate gets this appended
460 6495 $ua =~ s{,gzip\(gfe\)\z}{};
461  
462 # These get filled in immediately
463 6495 $self->{tests} = {};
464 6495 $self->{browser_tests} = {};
465  
466 6495 my $tests = $self->{tests};
467 6495 my $browser_tests = $self->{browser_tests};
468 6495 my $browser = undef;
469 6495 my $browser_string = undef;
470  
471 # Detect engine
472 6495 $self->{engine_version} = undef;
473  
474 6495 ▶ if ( $ua =~ m{edge/([\d.]+)$} ) {
Branch: 6 branches
BranchTrueFalseTotal
if ($ua =~ m[edge/([\d.]+)$]) { } 30 6465 6495
elsif ($ua =~ m[trident/([\w\.\d]*)]) { } 931 5534 6465
elsif (index($ua, 'gecko') != -1 and index($ua, 'like gecko') == -1) { } 726 4808 5534
elsif ($ua =~ m[applewebkit/([\d.\+]+)]) { } 2364 2444 4808
elsif ($ua =~ m[presto/([\d.]+)]) { } 90 2354 2444
elsif ($ua =~ m[khtml/([\d.]+)]) { } 12 2342 2354
475 30 $tests->{edgehtml} = 1;
476 30 $self->{engine_version} = $1;
477 }
478 elsif ( $ua =~ /trident\/([\w\.\d]*)/ ) {
479 931 $tests->{trident} = 1;
480 931 $self->{engine_version} = $1;
481 }
482 ▶ elsif ( index( $ua, "gecko" ) != -1 && index( $ua, "like gecko" ) == -1 )
Condition100%3/3
index($ua, "gecko") != -1 and index($ua, "like gecko") == -1
!ll&&!rl&&r
24202388726
MC/DC100%2/2
index($ua, "gecko") != -1 and index($ua, "like gecko") == -1
index($ua, "gecko") != -1 index($ua, "like gecko") == -1
Truth table100%3/3
A and B
A= index($ua, "gecko") != -1B= index($ua, "like gecko") == -1
ABresult
0X0
100
111
483 {
484 726 $tests->{gecko} = 1;
485 726 ▶ if ( $ua =~ /\([^)]*rv:([\w.\d]*)/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ua =~ /\([^)]*rv:([\w.\d]*)/) 660 66 726
486 660 $self->{engine_version} = $1;
487 }
488 }
489 elsif ( $ua =~ m{applewebkit/([\d.\+]+)} ) {
490 2364 $tests->{webkit} = 1;
491 2364 $self->{engine_version} = $1;
492 }
493 elsif ( $ua =~ m{presto/([\d.]+)} ) {
494 90 $tests->{presto} = 1;
495 90 $self->{engine_version} = $1;
496 }
497 elsif ( $ua =~ m{khtml/([\d.]+)} ) {
498 12 $tests->{khtml} = 1;
499 12 $self->{engine_version} = $1;
500 }
501  
502 # Detect browser
503  
504 6495 ▶ if ( index( $ua, "galeon" ) != -1 ) {
Branch: 33 branches
BranchTrueFalseTotal
if (index($ua, 'galeon') != -1) { } 12 6483 6495
elsif (index($ua, 'epiphany') != -1) { } 6 6477 6483
elsif ($ua =~ m[^mozilla/.+windows (?:nt|phone) \d{2}\.\d+;?.+ applewebkit/.+ chrome/.+ safari/.+ edge/[\d.]+$]) { } 30 6447 6477
elsif ($ua =~ m[ (firebird|iceweasel|phoenix|namoroka|firefox) \/ ( [^.]* ) # Major version number is everything before first dot \. # The first dot ( [\d]* ) # Minor version nnumber is digits after first dot ]ox and index($ua, 'not firefox') == -1) { } 630 5817 6447
elsif ($ua =~ m[opera|opr\/]) { } 216 5601 5817
elsif ($tests->{'trident'} or index($ua, 'msie') != -1 or index($ua, 'microsoft internet explorer') != -1) { } 1711 3890 5601
elsif (index($ua, 'brave') != -1) { } 12 3878 3890
elsif (index($ua, 'silk') != -1) { } 42 3836 3878
elsif (index($ua, 'chrome/') != -1 or index($ua, 'crios') != -1) { } 1320 2516 3836
elsif (index($ua, 'blackberry') != -1 or index($ua, 'bb10') != -1 or index($ua, 'rim tablet os') != -1) { } 42 2474 2516
elsif ((index($ua, 'safari') != -1) or (index($ua, 'applewebkit') != -1)) { } 948 1526 2474
elsif (not $tests->{'trident'} and index($ua, 'mozilla') != -1 and index($ua, 'msie') == -1 and index($ua, 'spoofer') == -1 and index($ua, 'compatible') == -1 and index($ua, 'webtv') == -1 and index($ua, 'hotjava') == -1 and index($ua, 'nintendo') == -1 and index($ua, 'playstation 3') == -1 and index($ua, 'playstation portable') == -1 and index($ua, 'browsex') == -1) { } 168 1358 1526
elsif (index($ua, 'neoplanet') != -1) { } 0 1358 1358
elsif (index($ua, 'staroffice') != -1) { } 12 1346 1358
elsif (index($ua, 'icab') != -1) { } 6 1340 1346
elsif (index($ua, 'lotus-notes') != -1) { } 6 1334 1340
elsif (index($ua, 'konqueror') != -1) { } 24 1310 1334
elsif (index($ua, 'lynx') != -1) { } 6 1304 1310
elsif (index($ua, 'elinks') != -1) { } 6 1298 1304
elsif (index($ua, 'links') != -1) { } 12 1286 1298
elsif (index($ua, 'webtv') != -1) { } 0 1286 1286
elsif (index($ua, 'mosaic') != -1) { } 0 1286 1286
elsif (index($ua, 'emacs') != -1) { } 6 1280 1286
elsif (index($ua, 'playstation 3') != -1 or index($ua, 'playstation portable') != -1 or index($ua, 'netfront') != -1) { } 18 1262 1280
elsif (index($ua, 'nintendo 3ds') != -1) { } 6 1256 1262
elsif (index($ua, 'nintendo dsi') != -1) { } 0 1256 1256
elsif (index($ua, 'obigo') != -1) { } 30 1226 1256
elsif (index($ua, 'browsex') != -1) { } 6 1220 1226
elsif (index($ua, 'libcurl') != -1) { } 30 1190 1220
elsif (index($ua, 'puf/') != -1) { } 6 1184 1190
elsif (index($ua, 'applecoremedia/') != -1) { } 6 1178 1184
elsif (index($ua, 'dalvik') != -1) { } 12 1166 1178
elsif (index($ua, 'ucbrowser') != -1) { } 18 1148 1166
505  
506 # Needs to go above firefox
507  
508 12 $browser = "galeon";
509 12 $browser_tests->{galeon} = 1;
510 }
511 elsif ( index( $ua, "epiphany" ) != -1 ) {
512  
513 # Needs to go above firefox + mozilla
514  
515 6 $browser = "epiphany";
516 6 $browser_tests->{epiphany} = 1;
517 }
518 elsif ( $ua
519 =~ m{^mozilla/.+windows (?:nt|phone) \d{2}\.\d+;?.+ applewebkit/.+ chrome/.+ safari/.+ edge/[\d.]+$}
520 ) {
521 30 $browser = 'edge';
522 30 $browser_string = 'Edge';
523  
524 30 $browser_tests->{edge} = 1;
525 }
526 ▶ elsif (
Condition100%3/3
$ua =~ m[ (firebird|iceweasel|phoenix|namoroka|firefox) \/ ( [^.]* ) # Major version number is everything before first dot \. # The first dot ( [\d]* ) # Minor version nnumber is digits after first dot ]ox and index($ua, "not firefox") == -1
!ll&&!rl&&r
58116630
MC/DC100%2/2
$ua =~ m[ (firebird|iceweasel|phoenix|namoroka|firefox) \/ ( [^.]* ) # Major version number is everything before first dot \. # The first dot ( [\d]* ) # Minor version nnumber is digits after first dot ]ox and index($ua, "not firefox") == -1
$ua =~ m[ (firebird|iceweasel|phoenix|namoroka|firefox) \/ ( [^.]* ) # Major version number is everything before first dot \. # The first dot ( [\d]* ) # Minor version nnumber is digits after first dot ]ox index($ua, "not firefox") == -1
Truth table100%3/3
A and B
A= $ua =~ m[ (firebird|iceweasel|phoenix|namoroka|firefox) \/ ( [^.]* ) # Major version number is everything before first dot \. # The first dot ( [\d]* ) # Minor version nnumber is digits after first dot ]oxB= index($ua, "not firefox") == -1
ABresult
0X0
100
111
527 $ua =~ m{
528 (firebird|iceweasel|phoenix|namoroka|firefox)
529 \/
530 ( [^.]* ) # Major version number is everything before first dot
531 \. # The first dot
532 ( [\d]* ) # Minor version nnumber is digits after first dot
533 }xo
534 && index( $ua, "not firefox" ) == -1
535 ) # Hack for Yahoo Slurp
536 {
537 # Browser is Firefox, possibly under an alternate name
538  
539 630 $browser = 'firefox';
540 630 $browser_string = ucfirst $1;
541  
542 630 $browser_tests->{$1} = 1;
543 630 $browser_tests->{firefox} = 1;
544 }
545 elsif ( $ua =~ m{opera|opr\/} ) {
546  
547 # Browser is Opera
548  
549 216 $browser = 'opera';
550 216 $browser_tests->{opera} = 1;
551 }
552 ▶ elsif ($tests->{trident}
Condition83%5/6
$tests->{"trident"} or index($ua, "msie") != -1 or index($ua, "microsoft internet explorer") != -1
l!l&&r!l&&!r
171103890
$tests->{"trident"} or index($ua, "msie") != -1
l!l&&r!l&&!r
9317803890
MC/DC66%2/3
$tests->{"trident"} or index($ua, "msie") != -1 or index($ua, "microsoft internet explorer") != -1
$tests->{"trident"} index($ua, "msie") != -1 index($ua, "microsoft internet explorer") != -1
Truth table75%3/4
A or B or C
A= $tests->{"trident"}B= index($ua, "msie") != -1C= index($ua, "microsoft internet explorer") != -1
ABCresult
1XX1
01X1
0011
0000
553 || index( $ua, "msie" ) != -1
554 || index( $ua, 'microsoft internet explorer' ) != -1 ) {
555  
556 # Browser is MSIE (possibly AOL branded)
557  
558 1711 $browser = 'ie';
559 1711 $browser_tests->{ie} = 1;
560  
561 1711 ▶ if ( index( $ua, 'aol' ) != -1
Branch: 1 branch
BranchTrueFalseTotal
if (index($ua, "aol") != -1 or index($ua, "america online browser") != -1) 42 1669 1711
Condition100%3/3
index($ua, "aol") != -1 or index($ua, "america online browser") != -1
l!l&&r!l&&!r
3661669
MC/DC100%2/2
index($ua, "aol") != -1 or index($ua, "america online browser") != -1
index($ua, "aol") != -1 index($ua, "america online browser") != -1
Truth table100%3/3
A or B
A= index($ua, "aol") != -1B= index($ua, "america online browser") != -1
ABresult
1X1
011
000
562 || index( $ua, 'america online browser' ) != -1 ) {
563 42 $browser_string = 'AOL Browser';
564 42 $browser_tests->{aol} = 1;
565 }
566  
567 # Disabled for now -- need to figure out how to deal with version numbers
568 #elsif ( index ( $ua, 'acoobrowser' ) != -1 ) {
569 # $browser_string = 'Acoo Browser';
570 #}
571 #elsif ( index( $ua, 'avant' ) != -1 ) {
572 # $browser_string = 'Avant Browser';
573 #}
574 #elsif ( index( $ua, 'crazy browser' ) != -1 ) {
575 # $browser_string = 'Crazy Browser';
576 #}
577 #elsif ( index( $ua, 'deepnet explorer' ) != -1 ) {
578 # $browser_string = 'Deepnet Explorer';
579 #}
580 #elsif ( index( $ua, 'maxthon' ) != -1 ) {
581 # $browser_string = 'Maxthon';
582 #}
583 }
584 elsif ( index( $ua, "brave" ) != -1 ) {
585  
586 # Has to go above Chrome, it includes "like Chrome/"
587  
588 12 $browser = 'brave';
589 12 $browser_tests->{$browser} = 1;
590 }
591 elsif ( index( $ua, "silk" ) != -1 ) {
592  
593 # Has to go above Chrome, it includes "like Chrome/"
594  
595 42 $browser = 'silk';
596 42 $browser_tests->{$browser} = 1;
597 }
598 ▶ elsif (index( $ua, "chrome/" ) != -1
Condition100%3/3
index($ua, "chrome/") != -1 or index($ua, "crios") != -1
l!l&&r!l&&!r
1302182516
MC/DC100%2/2
index($ua, "chrome/") != -1 or index($ua, "crios") != -1
index($ua, "chrome/") != -1 index($ua, "crios") != -1
Truth table100%3/3
A or B
A= index($ua, "chrome/") != -1B= index($ua, "crios") != -1
ABresult
1X1
011
000
599 || index( $ua, "crios" ) != -1 ) {
600  
601 # Browser is Chrome
602  
603 1320 $browser = 'chrome';
604 1320 $browser_tests->{chrome} = 1;
605  
606 1320 ▶ if ( index( $ua, "chromium" ) != -1 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (index($ua, "chromium") != -1) 12 1308 1320
607 12 $browser_string = "Chromium";
608 }
609 }
610 ▶ elsif (index( $ua, "blackberry" ) != -1
Condition100%6/6
index($ua, "blackberry") != -1 or index($ua, "bb10") != -1 or index($ua, "rim tablet os") != -1
l!l&&r!l&&!r
3662474
index($ua, "blackberry") != -1 or index($ua, "bb10") != -1
l!l&&r!l&&!r
24122480
MC/DC100%3/3
index($ua, "blackberry") != -1 or index($ua, "bb10") != -1 or index($ua, "rim tablet os") != -1
index($ua, "blackberry") != -1 index($ua, "bb10") != -1 index($ua, "rim tablet os") != -1
Truth table100%4/4
A or B or C
A= index($ua, "blackberry") != -1B= index($ua, "bb10") != -1C= index($ua, "rim tablet os") != -1
ABCresult
1XX1
01X1
0011
0000
611 || index( $ua, "bb10" ) != -1
612 || index( $ua, "rim tablet os" ) != -1 ) {
613  
614 # Needs to go above the Safari check
615 42 $browser = 'blackberry'; # test gets set during device check
616 }
617 ▶ elsif (( index( $ua, "safari" ) != -1 )
Condition100%3/3
(index($ua, "safari") != -1) or (index($ua, "applewebkit") != -1)
l!l&&r!l&&!r
888601526
MC/DC100%2/2
(index($ua, "safari") != -1) or (index($ua, "applewebkit") != -1)
(index($ua, "safari") != -1) (index($ua, "applewebkit") != -1)
Truth table100%3/3
A or B
A= (index($ua, "safari") != -1)B= (index($ua, "applewebkit") != -1)
ABresult
1X1
011
000
618 || ( index( $ua, "applewebkit" ) != -1 ) ) {
619  
620 # Browser is Safari
621  
622 948 $browser_tests->{safari} = 1;
623 948 $browser = 'safari';
624 948 ▶ if ( index( $ua, " mobile safari/" ) != -1
Branch: 1 branch
BranchTrueFalseTotal
if (index($ua, " mobile safari/") != -1 or index($ua, "mobilesafari") != -1) 276 672 948
Condition100%3/3
index($ua, " mobile safari/") != -1 or index($ua, "mobilesafari") != -1
l!l&&r!l&&!r
26412672
MC/DC100%2/2
index($ua, " mobile safari/") != -1 or index($ua, "mobilesafari") != -1
index($ua, " mobile safari/") != -1 index($ua, "mobilesafari") != -1
Truth table100%3/3
A or B
A= index($ua, " mobile safari/") != -1B= index($ua, "mobilesafari") != -1
ABresult
1X1
011
000
625 || index( $ua, "mobilesafari" ) != -1 ) {
626 276 $browser_string = 'Mobile Safari';
627 276 $browser_tests->{mobile_safari} = 1;
628 }
629 948 ▶ if ( index( $ua, "puffin" ) != -1 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (index($ua, "puffin") != -1) 18 930 948
630 18 $browser_string = "Puffin";
631 }
632 }
633 ▶ elsif (!$tests->{trident}
Condition83%25/30
not $tests->{"trident"} and index($ua, "mozilla") != -1 and index($ua, "msie") == -1 and index($ua, "spoofer") == -1 and index($ua, "compatible") == -1 and index($ua, "webtv") == -1 and index($ua, "hotjava") == -1 and index($ua, "nintendo") == -1 and index($ua, "playstation 3") == -1 and index($ua, "playstation portable") == -1 and index($ua, "browsex") == -1
!ll&&!rl&&r
13526168
not $tests->{"trident"} and index($ua, "mozilla") != -1 and index($ua, "msie") == -1 and index($ua, "spoofer") == -1 and index($ua, "compatible") == -1 and index($ua, "webtv") == -1 and index($ua, "hotjava") == -1 and index($ua, "nintendo") == -1 and index($ua, "playstation 3") == -1 and index($ua, "playstation portable") == -1
!ll&&!rl&&r
13466174
not $tests->{"trident"} and index($ua, "mozilla") != -1 and index($ua, "msie") == -1 and index($ua, "spoofer") == -1 and index($ua, "compatible") == -1 and index($ua, "webtv") == -1 and index($ua, "hotjava") == -1 and index($ua, "nintendo") == -1 and index($ua, "playstation 3") == -1
!ll&&!rl&&r
13406180
not $tests->{"trident"} and index($ua, "mozilla") != -1 and index($ua, "msie") == -1 and index($ua, "spoofer") == -1 and index($ua, "compatible") == -1 and index($ua, "webtv") == -1 and index($ua, "hotjava") == -1 and index($ua, "nintendo") == -1
!ll&&!rl&&r
13346186
not $tests->{"trident"} and index($ua, "mozilla") != -1 and index($ua, "msie") == -1 and index($ua, "spoofer") == -1 and index($ua, "compatible") == -1 and index($ua, "webtv") == -1 and index($ua, "hotjava") == -1
!ll&&!rl&&r
13340192
not $tests->{"trident"} and index($ua, "mozilla") != -1 and index($ua, "msie") == -1 and index($ua, "spoofer") == -1 and index($ua, "compatible") == -1 and index($ua, "webtv") == -1
!ll&&!rl&&r
13340192
not $tests->{"trident"} and index($ua, "mozilla") != -1 and index($ua, "msie") == -1 and index($ua, "spoofer") == -1 and index($ua, "compatible") == -1
!ll&&!rl&&r
920414192
not $tests->{"trident"} and index($ua, "mozilla") != -1 and index($ua, "msie") == -1 and index($ua, "spoofer") == -1
!ll&&!rl&&r
9200606
not $tests->{"trident"} and index($ua, "mozilla") != -1 and index($ua, "msie") == -1
!ll&&!rl&&r
9200606
not $tests->{"trident"} and index($ua, "mozilla") != -1
!ll&&!rl&&r
0920606
MC/DC54%6/11
not $tests->{"trident"} and index($ua, "mozilla") != -1 and index($ua, "msie") == -1 and index($ua, "spoofer") == -1 and index($ua, "compatible") == -1 and index($ua, "webtv") == -1 and index($ua, "hotjava") == -1 and index($ua, "nintendo") == -1 and index($ua, "playstation 3") == -1 and index($ua, "playstation portable") == -1 and index($ua, "browsex") == -1
not $tests->{"trident"} index($ua, "mozilla") != -1 index($ua, "msie") == -1 index($ua, "spoofer") == -1 index($ua, "compatible") == -1 index($ua, "webtv") == -1 index($ua, "hotjava") == -1 index($ua, "nintendo") == -1 index($ua, "playstation 3") == -1 index($ua, "playstation portable") == -1 index($ua, "browsex") == -1
Truth table58%7/12
not(A) and B and C and D and E and F and G and H and I and J and K
A= not $tests->{"trident"}B= index($ua, "mozilla") != -1C= index($ua, "msie") == -1D= index($ua, "spoofer") == -1E= index($ua, "compatible") == -1F= index($ua, "webtv") == -1G= index($ua, "hotjava") == -1H= index($ua, "nintendo") == -1I= index($ua, "playstation 3") == -1J= index($ua, "playstation portable") == -1K= index($ua, "browsex") == -1
ABCDEFGHIJKresult
0XXXXXXXXXX0
10XXXXXXXXX0
110XXXXXXXX0
1110XXXXXXX0
11110XXXXXX0
111110XXXXX0
1111110XXXX0
11111110XXX0
111111110XX0
1111111110X0
111111111100
111111111111
634 && index( $ua, "mozilla" ) != -1
635 && index( $ua, "msie" ) == -1
636 && index( $ua, "spoofer" ) == -1
637 && index( $ua, "compatible" ) == -1
638 && index( $ua, "webtv" ) == -1
639 && index( $ua, "hotjava" ) == -1
640 && index( $ua, "nintendo" ) == -1
641 && index( $ua, "playstation 3" ) == -1
642 && index( $ua, "playstation portable" ) == -1
643 && index( $ua, "browsex" ) == -1 ) {
644  
645 # Browser is a Gecko-powered Netscape (i.e. Mozilla) version
646  
647 168 $browser = 'mozilla';
648 168 ▶ if ( index( $ua, "netscape" ) != -1
Branch: 2 branches
BranchTrueFalseTotal
if (index($ua, 'netscape') != -1 or not $tests->{'gecko'}) { } 108 60 168
elsif (index($ua, 'seamonkey') != -1) { } 6 54 60
Condition100%3/3
index($ua, "netscape") != -1 or not $tests->{"gecko"}
l!l&&r!l&&!r
189060
MC/DC100%2/2
index($ua, "netscape") != -1 or not $tests->{"gecko"}
index($ua, "netscape") != -1 not $tests->{"gecko"}
Truth table100%3/3
A or not(B)
A= index($ua, "netscape") != -1B= not $tests->{"gecko"}
ABresult
1X1
011
000
649 || !$tests->{gecko} ) {
650 108 $browser = "netscape";
651 }
652 elsif ( index( $ua, "seamonkey" ) != -1 ) {
653 6 $browser = 'seamonkey';
654 }
655 168 $browser_tests->{$browser} = 1;
656 168 $browser_tests->{netscape} = 1;
657 168 $browser_tests->{mozilla} = ( $tests->{gecko} );
658 }
659 elsif ( index( $ua, "neoplanet" ) != -1 ) {
660  
661 # Browser is Neoplanet
662  
663 0 $browser = 'ie';
664 0 $browser_tests->{$browser} = 1;
665 0 $browser_tests->{neoplanet} = 1;
666 0 ▶ $browser_tests->{neoplanet2} = 1 if ( index( $ua, "2." ) != -1 );
Branch: 1 branch
BranchTrueFalseTotal
if (index($ua, "2.") != -1) 0 0 0
667 }
668  
669 ## Long series of unlikely browsers
670 elsif ( index( $ua, "staroffice" ) != -1 ) {
671 12 $browser = 'staroffice';
672 12 $browser_tests->{$browser} = 1;
673 }
674 elsif ( index( $ua, "icab" ) != -1 ) {
675 6 $browser = 'icab';
676 6 $browser_tests->{$browser} = 1;
677 }
678 elsif ( index( $ua, "lotus-notes" ) != -1 ) {
679 6 $browser = 'lotusnotes';
680 6 $browser_tests->{$browser} = 1;
681 }
682 elsif ( index( $ua, "konqueror" ) != -1 ) {
683 24 $browser = 'konqueror';
684 24 $browser_tests->{$browser} = 1;
685 }
686 elsif ( index( $ua, "lynx" ) != -1 ) {
687 6 $browser = 'lynx';
688 6 $browser_tests->{$browser} = 1;
689 }
690 elsif ( index( $ua, "elinks" ) != -1 ) {
691 6 $browser = 'elinks';
692 6 $browser_tests->{$browser} = 1;
693 }
694 elsif ( index( $ua, "links" ) != -1 ) {
695 12 $browser = 'links';
696 12 $browser_tests->{$browser} = 1;
697 }
698 elsif ( index( $ua, "webtv" ) != -1 ) {
699 0 $browser = 'webtv';
700 0 $browser_tests->{$browser} = 1;
701 }
702 elsif ( index( $ua, "mosaic" ) != -1 ) {
703 0 $browser = 'mosaic';
704 0 $browser_tests->{$browser} = 1;
705 }
706 elsif ( index( $ua, 'emacs' ) != -1 ) {
707 6 $browser = 'emacs';
708 6 $browser_tests->{$browser} = 1;
709 }
710 ▶ elsif (index( $ua, "playstation 3" ) != -1
Condition100%6/6
index($ua, "playstation 3") != -1 or index($ua, "playstation portable") != -1 or index($ua, "netfront") != -1
l!l&&r!l&&!r
1261262
index($ua, "playstation 3") != -1 or index($ua, "playstation portable") != -1
l!l&&r!l&&!r
661268
MC/DC100%3/3
index($ua, "playstation 3") != -1 or index($ua, "playstation portable") != -1 or index($ua, "netfront") != -1
index($ua, "playstation 3") != -1 index($ua, "playstation portable") != -1 index($ua, "netfront") != -1
Truth table100%4/4
A or B or C
A= index($ua, "playstation 3") != -1B= index($ua, "playstation portable") != -1C= index($ua, "netfront") != -1
ABCresult
1XX1
01X1
0011
0000
711 || index( $ua, "playstation portable" ) != -1
712 || index( $ua, "netfront" ) != -1 ) {
713 18 $browser = 'netfront';
714 18 $browser_tests->{$browser} = 1;
715 }
716 elsif ( index( $ua, "nintendo 3ds" ) != -1 ) {
717 6 $browser = 'n3ds'; # Test gets set during device check
718 }
719 elsif ( index( $ua, "nintendo dsi" ) != -1 ) {
720 0 $browser = 'dsi'; # Test gets set during device check
721 }
722 elsif ( index( $ua, "obigo" ) != -1 ) {
723 30 $browser = 'obigo';
724 30 $browser_tests->{$browser} = 1;
725 }
726 elsif ( index( $ua, "browsex" ) != -1 ) {
727 6 $browser = 'browsex';
728 6 $browser_tests->{$browser} = 1;
729 }
730 elsif ( index( $ua, "libcurl" ) != -1 ) {
731 30 $browser = 'curl'; # Test gets set during robot check
732 }
733 elsif ( index( $ua, "puf/" ) != -1 ) {
734 6 $browser = 'puf'; # Test gets set during robot check
735 }
736 elsif ( index( $ua, "applecoremedia/" ) != -1 ) {
737 6 $browser = 'applecoremedia';
738 6 $browser_tests->{$browser} = 1;
739 }
740 elsif ( index( $ua, "dalvik" ) != -1 ) {
741 12 $browser = 'dalvik';
742 12 $browser_tests->{$browser} = 1;
743 }
744 elsif ( index( $ua, "ucbrowser" ) != -1 ) {
745 18 $browser = 'ucbrowser';
746 18 $browser_tests->{$browser} = 1;
747 }
748  
749 6495 $self->{browser} = $browser;
750 6495 ▶ $self->{browser_string} = $browser_string || $BROWSER_NAMES{$browser}
Branch: 1 branch
BranchTrueFalseTotal
if defined $browser 5347 1148 6495
Condition100%3/3
$browser_string || $BROWSER_NAMES{$browser}
l!l&&r!l&&!r
99643456
MC/DC100%2/2
$browser_string || $BROWSER_NAMES{$browser}
$browser_string $BROWSER_NAMES{$browser}
Truth table100%3/3
A || B
A= $browser_stringB= $BROWSER_NAMES{$browser}
ABresult
1X1
011
000
751 if defined($browser);
752  
753 # Other random tests
754  
755 6495 ▶ $tests->{x11} = 1 if index( $ua, "x11" ) != -1;
Branch: 1 branch
BranchTrueFalseTotal
if index($ua, "x11") != -1 432 6063 6495
756 6495 ▶ $tests->{dotnet} = 1 if index( $ua, ".net clr" ) != -1;
Branch: 1 branch
BranchTrueFalseTotal
if index($ua, ".net clr") != -1 1080 5415 6495
757  
758 6495 ▶ if ( index( $ua, "realplayer" ) != -1 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (index($ua, "realplayer") != -1) 18 6477 6495
759  
760 # Hack for Realplayer -- fix the version and "real" browser
761  
762 18 $self->_init_version; # Set appropriate tests for whatever the "real"
763 # browser is.
764  
765 # Now set the browser to Realplayer.
766 18 $self->{browser} = 'realplayer';
767 18 $self->{browser_string} = 'RealPlayer';
768 18 $browser_tests->{realplayer} = 1;
769  
770 # Now override the version with the Realplayer version (but leave
771 # alone the tests we already set, which might have been based on the
772 # "real" browser's version).
773 18 $self->{realplayer_version} = undef;
774  
775 18 ▶ if ( $ua =~ /realplayer\/([\d+\.]+)/ ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($ua =~ m[realplayer/([\d+\.]+)]) { } 12 6 18
elsif ($ua =~ /realplayer\s(\w+)/) { } 6 0 6
776 12 $self->{realplayer_version} = $1;
777 ( $self->{major}, $self->{minor} )
778 12 = split( /\./, $self->{realplayer_version} );
779 12 ▶ $self->{minor} = ".$self->{minor}" if defined( $self->{minor} );
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{"minor"} 12 0 12
780 }
781 elsif ( $ua =~ /realplayer\s(\w+)/ ) {
782 6 $self->{realplayer_version} = $1;
783 }
784 }
785  
786 6495 ▶ if ( index( $ua, "(r1 " ) != -1 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (index($ua, "(r1 ") != -1) 18 6477 6495
787  
788 # Realplayer plugin -- don't override browser but do set property
789 18 $browser_tests->{realplayer} = 1;
790 }
791  
792 }
793  
794 # Any of these fragments within a user-agent generally indicates it's
795 # a robot. If we find one, we store it in $self->{robot_fragment}, and
796 # if the user later asks for the robot string, we return the string
797 # in the immediate area of the fragment.
798 4 my @ROBOT_FRAGMENTS = qw(
799 agent
800 appender
801 babya
802 checker
803 bot
804 copy
805 crawl
806 explorador
807 fetch
808 find
809 ia_archive
810 index
811 netcraft
812 reap
813 resolver
814 sleuth
815 scan
816 service
817 spider
818 tiscali
819 validator
820 webcapture
821 worm
822 zyborg
823 );
824  
825 sub _init_robots {
826 7046 ▶ my $self = shift;
Subroutine _init_robots: called CC=55 SCAR=40.6
827  
828 7046 my $ua = lc $self->{user_agent};
829 7046 my $tests = $self->{tests};
830 7046 my $browser_tests = $self->{browser_tests};
831  
832 7046 my $robot_tests = $self->{robot_tests} = {};
833 7046 my $r = undef;
834  
835 7046 ▶ if ( index( $ua, "libwww-perl" ) != -1 || index( $ua, "lwp-" ) != -1 ) {
Branch: 37 branches
BranchTrueFalseTotal
if (index($ua, 'libwww-perl') != -1 or index($ua, 'lwp-') != -1) { } 18 7028 7046
elsif (index($ua, 'slurp') != -1) { } 12 7016 7028
elsif (index($ua, 'yahoo') != -1 and index($ua, 'jp.co.yahoo.android') == -1) { } 6 7010 7016
elsif (index($ua, 'msnbot-mobile') != -1 or index($ua, 'bingbot-mobile') != -1) { } 6 7004 7010
elsif (index($ua, 'msnbot') != -1 or index($ua, 'bingbot') != -1) { } 24 6980 7004
elsif (index($ua, 'microsoft office existence discovery') != -1) { } 6 6974 6980
elsif (index($ua, 'ahrefsbot') != -1) { } 6 6968 6974
elsif (index($ua, 'altavista') != -1) { } 0 6968 6968
elsif (index($ua, 'apache-httpclient') != -1) { } 12 6956 6968
elsif (index($ua, 'ask jeeves/teoma') != -1) { } 0 6956 6956
elsif (index($ua, 'baiduspider') != -1) { } 18 6938 6956
elsif (index($ua, 'libcurl') != -1) { } 30 6908 6938
elsif (index($ua, 'facebookexternalhit') != -1) { } 6 6902 6908
elsif (index($ua, 'getright') != -1) { } 6 6896 6902
elsif (index($ua, 'adsbot-google') != -1) { } 12 6884 6896
elsif (index($ua, 'mediapartners-google') != -1) { } 6 6878 6884
elsif (index($ua, 'googlebot-image') != -1) { } 6 6872 6878
elsif (index($ua, 'googlebot-news') != -1) { } 6 6866 6872
elsif (index($ua, 'googlebot-video') != -1) { } 6 6860 6866
elsif (index($ua, 'googlebot-mobile') != -1) { } 18 6842 6860
elsif (index($ua, 'googlebot') != -1) { } 36 6806 6842
elsif ($ua =~ /go.*package http/) { } 6 6800 6806
elsif (index($ua, 'indy library') != -1) { } 6 6794 6800
elsif (index($ua, 'infoseek') != -1) { } 0 6794 6794
elsif (index($ua, 'lecodechecker') != -1) { } 0 6794 6794
elsif (index($ua, 'linkchecker') != -1) { } 12 6782 6794
elsif (index($ua, 'lycos') != -1) { } 0 6782 6782
elsif (index($ua, 'mechanize') != -1) { } 12 6770 6782
elsif (index($ua, 'mj12bot/') != -1) { } 6 6764 6770
elsif (index($ua, 'puf/') != -1) { } 6 6758 6764
elsif (index($ua, 'scooter') != -1) { } 0 6758 6758
elsif (index($ua, 'special_archiver') != -1) { } 6 6752 6758
elsif (index($ua, 'webcrawler') != -1) { } 12 6740 6752
elsif (index($ua, 'wget') != -1) { } 12 6728 6740
elsif (index($ua, 'yandexbot') != -1) { } 6 6722 6728
elsif (index($ua, 'yandeximages') != -1) { } 6 6716 6722
elsif ($ua =~ /^java/ and not $self->{'browser'} or index($ua, 'jdk') != -1 or index($ua, 'jakarta commons-httpclient') != -1 or index($ua, 'google-http-java-client') != -1) { } 54 6662 6716
Condition66%2/3
index($ua, "libwww-perl") != -1 or index($ua, "lwp-") != -1
l!l&&r!l&&!r
1807028
MC/DC50%1/2
index($ua, "libwww-perl") != -1 or index($ua, "lwp-") != -1
index($ua, "libwww-perl") != -1 index($ua, "lwp-") != -1
Truth table66%2/3
A or B
A= index($ua, "libwww-perl") != -1B= index($ua, "lwp-") != -1
ABresult
1X1
011
000
836 18 $r = 'lwp';
837 18 $robot_tests->{lib} = 1;
838 }
839 elsif ( index( $ua, "slurp" ) != -1 ) {
840 12 $r = 'slurp';
841 12 $robot_tests->{yahoo} = 1;
842 }
843 ▶ elsif (index( $ua, "yahoo" ) != -1
Condition100%3/3
index($ua, "yahoo") != -1 and index($ua, "jp.co.yahoo.android") == -1
!ll&&!rl&&r
6997136
MC/DC100%2/2
index($ua, "yahoo") != -1 and index($ua, "jp.co.yahoo.android") == -1
index($ua, "yahoo") != -1 index($ua, "jp.co.yahoo.android") == -1
Truth table100%3/3
A and B
A= index($ua, "yahoo") != -1B= index($ua, "jp.co.yahoo.android") == -1
ABresult
0X0
100
111
844 && index( $ua, 'jp.co.yahoo.android' ) == -1 ) {
845 6 $r = 'yahoo';
846 }
847 ▶ elsif (index( $ua, "msnbot-mobile" ) != -1
Condition66%2/3
index($ua, "msnbot-mobile") != -1 or index($ua, "bingbot-mobile") != -1
l!l&&r!l&&!r
607004
MC/DC50%1/2
index($ua, "msnbot-mobile") != -1 or index($ua, "bingbot-mobile") != -1
index($ua, "msnbot-mobile") != -1 index($ua, "bingbot-mobile") != -1
Truth table66%2/3
A or B
A= index($ua, "msnbot-mobile") != -1B= index($ua, "bingbot-mobile") != -1
ABresult
1X1
011
000
848 || index( $ua, "bingbot-mobile" ) != -1 ) {
849 6 $r = 'msnmobile';
850 6 $robot_tests->{msn} = 1;
851 }
852 ▶ elsif ( index( $ua, "msnbot" ) != -1 || index( $ua, "bingbot" ) != -1 ) {
Condition100%3/3
index($ua, "msnbot") != -1 or index($ua, "bingbot") != -1
l!l&&r!l&&!r
6186980
MC/DC100%2/2
index($ua, "msnbot") != -1 or index($ua, "bingbot") != -1
index($ua, "msnbot") != -1 index($ua, "bingbot") != -1
Truth table100%3/3
A or B
A= index($ua, "msnbot") != -1B= index($ua, "bingbot") != -1
ABresult
1X1
011
000
853 24 $r = 'msn';
854 }
855 elsif ( index( $ua, "microsoft office existence discovery" ) != -1 ) {
856 6 $r = 'msoffice';
857 }
858 elsif ( index( $ua, "ahrefsbot" ) != -1 ) {
859 6 $r = 'ahrefs';
860 }
861 elsif ( index( $ua, "altavista" ) != -1 ) {
862 0 $r = 'altavista';
863 }
864 elsif ( index( $ua, "apache-httpclient" ) != -1 ) {
865 12 $r = 'apache';
866 }
867 elsif ( index( $ua, "ask jeeves/teoma" ) != -1 ) {
868 0 $r = 'askjeeves';
869 }
870 elsif ( index( $ua, "baiduspider" ) != -1 ) {
871 18 $r = 'baidu';
872 }
873 elsif ( index( $ua, "libcurl" ) != -1 ) {
874 30 $r = 'curl';
875 30 $robot_tests->{lib} = 1;
876 }
877 elsif ( index( $ua, "facebookexternalhit" ) != -1 ) {
878 6 $r = 'facebook';
879 }
880 elsif ( index( $ua, "getright" ) != -1 ) {
881 6 $r = 'getright';
882 }
883 elsif ( index( $ua, "adsbot-google" ) != -1 ) {
884 12 $r = 'googleadsbot';
885 12 $robot_tests->{google} = 1;
886 }
887 elsif ( index( $ua, "mediapartners-google" ) != -1 ) {
888 6 $r = 'googleadsense';
889 6 $robot_tests->{google} = 1;
890 }
891 elsif ( index( $ua, "googlebot-image" ) != -1 ) {
892 6 $r = 'googlebotimage';
893 6 $robot_tests->{google} = 1;
894 }
895 elsif ( index( $ua, "googlebot-news" ) != -1 ) {
896 6 $r = 'googlebotnews';
897 6 $robot_tests->{google} = 1;
898 }
899 elsif ( index( $ua, "googlebot-video" ) != -1 ) {
900 6 $r = 'googlebotvideo';
901 6 $robot_tests->{google} = 1;
902 }
903 elsif ( index( $ua, "googlebot-mobile" ) != -1 ) {
904 18 $r = 'googlemobile';
905 18 $robot_tests->{google} = 1;
906 }
907 elsif ( index( $ua, "googlebot" ) != -1 ) {
908 36 $r = 'google';
909 }
910 elsif ( $ua =~ m{go.*package http} ) {
911 6 $r = 'golib';
912 6 $robot_tests->{lib} = 1;
913 }
914 elsif ( index( $ua, "indy library" ) != -1 ) {
915 6 $r = 'indy';
916 6 $robot_tests->{lib} = 1;
917 }
918 elsif ( index( $ua, "infoseek" ) != -1 ) {
919 0 $r = 'infoseek';
920 }
921 elsif ( index( $ua, "lecodechecker" ) != -1 ) {
922 0 $r = 'linkexchange';
923 }
924 elsif ( index( $ua, "linkchecker" ) != -1 ) {
925 12 $r = 'linkchecker';
926 }
927 elsif ( index( $ua, "lycos" ) != -1 ) {
928 0 $r = 'lycos';
929 }
930 elsif ( index( $ua, "mechanize" ) != -1 ) {
931 12 $r = 'rubylib';
932 12 $robot_tests->{lib} = 1;
933 }
934 elsif ( index( $ua, "mj12bot/" ) != -1 ) {
935 6 $r = 'mj12bot';
936 }
937 elsif ( index( $ua, "puf/" ) != -1 ) {
938 6 $r = 'puf';
939 6 $robot_tests->{lib} = 1;
940 }
941 elsif ( index( $ua, "scooter" ) != -1 ) {
942 0 $r = 'scooter';
943 }
944 elsif ( index( $ua, "special_archiver" ) != -1 ) {
945 6 $r = 'specialarchiver';
946 }
947 elsif ( index( $ua, "webcrawler" ) != -1 ) {
948 12 $r = 'webcrawler';
949 }
950 elsif ( index( $ua, "wget" ) != -1 ) {
951 12 $r = 'wget';
952 }
953 elsif ( index( $ua, "yandexbot" ) != -1 ) {
954 6 $r = 'yandex';
955 }
956 elsif ( index( $ua, "yandeximages" ) != -1 ) {
957 6 $r = 'yandeximages';
958 }
959 ▶ elsif (( $ua =~ m{^java} && !$self->{browser} )
Condition83%10/12
$ua =~ /^java/ and not $self->{"browser"} or index($ua, "jdk") != -1 or index($ua, "jakarta commons-httpclient") != -1 or index($ua, "google-http-java-client") != -1
l!l&&r!l&&!r
4866662
$ua =~ /^java/ and not $self->{"browser"} or index($ua, "jdk") != -1 or index($ua, "jakarta commons-httpclient") != -1
l!l&&r!l&&!r
4266668
$ua =~ /^java/ and not $self->{"browser"} or index($ua, "jdk") != -1
l!l&&r!l&&!r
4206674
$ua =~ /^java/ and not $self->{"browser"}
!ll&&!rl&&r
6674042
MC/DC60%3/5
$ua =~ /^java/ and not $self->{"browser"} or index($ua, "jdk") != -1 or index($ua, "jakarta commons-httpclient") != -1 or index($ua, "google-http-java-client") != -1
$ua =~ /^java/ not $self->{"browser"} index($ua, "jdk") != -1 index($ua, "jakarta commons-httpclient") != -1 index($ua, "google-http-java-client") != -1
Truth table44%4/9
A and not(B) or C or D or E
A= $ua =~ /^java/B= not $self->{"browser"}C= index($ua, "jdk") != -1D= index($ua, "jakarta commons-httpclient") != -1E= index($ua, "google-http-java-client") != -1
ABCDEresult
11XXX1
0X1XX1
101XX1
0X01X1
1001X1
0X0011
100011
0X0000
100000
960 || index( $ua, "jdk" ) != -1
961 || index( $ua, "jakarta commons-httpclient" ) != -1
962 || index( $ua, "google-http-java-client" ) != -1 ) {
963 54 $r = 'java';
964 54 $robot_tests->{lib} = 1;
965 }
966  
967 7046 ▶ if ( $browser_tests->{applecoremedia}
Branch: 1 branch
BranchTrueFalseTotal
if ($browser_tests->{"applecoremedia"} or $browser_tests->{"dalvik"}) 20 7026 7046
Condition100%3/3
$browser_tests->{"applecoremedia"} or $browser_tests->{"dalvik"}
l!l&&r!l&&!r
7137026
MC/DC100%2/2
$browser_tests->{"applecoremedia"} or $browser_tests->{"dalvik"}
$browser_tests->{"applecoremedia"} $browser_tests->{"dalvik"}
Truth table100%3/3
A or B
A= $browser_tests->{"applecoremedia"}B= $browser_tests->{"dalvik"}
ABresult
1X1
011
000
968 || $browser_tests->{dalvik} ) {
969 20 $robot_tests->{lib} = 1;
970 }
971  
972 7046 ▶ if ($r) {
Branch: 1 branch
BranchTrueFalseTotal
if ($r) 384 6662 7046
973 384 $robot_tests->{$r} = 1;
974 384 $self->{robot_string} = $ROBOT_NAMES{$r}; # Including undef
975 }
976  
977 7046 ▶ if ($r) {
Branch: 4 branches
BranchTrueFalseTotal
if ($r) { } 384 6662 7046
elsif ($ua =~ /seek (?! mo (?: toolbar )? \s+ \d+\.\d+ )/x) { } 0 6662 6662
elsif ($ua =~ /search (?! [\w\s]* toolbar \b | bar \b )/x) { } 57 6605 6662
elsif ($self->{'user_agent'} =~ m[([\w /\.\-]+)[ \;\(\)]*\+http\:]i) { } 226 6379 6605
978  
979 # Got a named robot
980 384 $robot_tests->{robot} = $r;
981 }
982 elsif ( $ua =~ /seek (?! mo (?: toolbar )? \s+ \d+\.\d+ )/x ) {
983  
984 # Store the fragment for later, to determine full name
985 0 $self->{robot_fragment} = "seek";
986 0 $robot_tests->{robot} = 'unknown';
987 }
988 elsif ( $ua =~ /search (?! [\w\s]* toolbar \b | bar \b )/x ) {
989  
990 # Store the fragment for later, to determine full name
991 57 $self->{robot_fragment} = "search";
992 57 $robot_tests->{robot} = 'unknown';
993 }
994 elsif ( $self->{user_agent} =~ /([\w \/\.\-]+)[ \;\(\)]*\+http\:/i ) {
995  
996 # Something followed by +http
997 226 $self->{robot_string} = $1;
998 226 $self->{robot_string} =~ s/^ *(.+?)[ \;\(\)]*$/$1/;
999 226 $robot_tests->{robot} = 'unknown';
1000 }
1001 else {
1002 # See if we have a simple fragment
1003 6379 for my $fragment (@ROBOT_FRAGMENTS) {
1004 147298 ▶ if ( index( $ua, $fragment ) != -1 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (index($ua, $fragment) != -1) 398 146900 147298
1005 398 $self->{robot_fragment} = $fragment;
1006 398 $robot_tests->{robot} = 'unknown';
1007 398 last;
1008 }
1009 }
1010 }
1011 }
1012  
1013 ### OS tests, only run on demand
1014  
1015 sub _init_os {
1016 6492 ▶ my $self = shift;
Subroutine _init_os: called CC=101 SCAR=57.2
1017  
1018 6492 my $tests = $self->{tests};
1019 6492 my $browser_tests = $self->{browser_tests};
1020 6492 my $ua = lc $self->{user_agent};
1021  
1022 6492 my $os_tests = $self->{os_tests} = {};
1023 6492 my $os = undef;
1024 6492 my $os_string = undef;
1025  
1026 # Windows
1027  
1028 6492 ▶ if ( index( $ua, "16bit" ) != -1 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (index($ua, "16bit") != -1) 0 6492 6492
1029 0 $os = 'windows';
1030 0 $os_string = '16-bit Windows';
1031 0 $os_tests->{win16} = $os_tests->{windows} = 1;
1032 }
1033  
1034 6492 ▶ if ( index( $ua, "win" ) != -1 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (index($ua, "win") != -1) 2940 3552 6492
1035 2940 ▶ if ( index( $ua, "win16" ) != -1
Branch: 7 branches
BranchTrueFalseTotal
if (index($ua, 'win16') != -1 or index($ua, 'windows 3') != -1 or index($ua, 'windows 16-bit') != -1) { } 12 2928 2940
elsif (index($ua, 'win95') != -1 or index($ua, 'windows 95') != -1) { } 72 2856 2928
elsif (index($ua, 'win 9x 4.90') != -1 or index($ua, 'windows me') != -1) { } 30 2826 2856
elsif (index($ua, 'win98') != -1 or index($ua, 'windows 98') != -1) { } 24 2802 2826
elsif (index($ua, 'windows 2000') != -1) { } 12 2790 2802
elsif (index($ua, 'windows ce') != -1) { } 12 2778 2790
elsif (index($ua, 'windows phone') != -1) { } 54 2724 2778
Condition66%4/6
index($ua, "win16") != -1 or index($ua, "windows 3") != -1 or index($ua, "windows 16-bit") != -1
l!l&&r!l&&!r
1202928
index($ua, "win16") != -1 or index($ua, "windows 3") != -1
l!l&&r!l&&!r
0122928
MC/DC33%1/3
index($ua, "win16") != -1 or index($ua, "windows 3") != -1 or index($ua, "windows 16-bit") != -1
index($ua, "win16") != -1 index($ua, "windows 3") != -1 index($ua, "windows 16-bit") != -1
Truth table50%2/4
A or B or C
A= index($ua, "win16") != -1B= index($ua, "windows 3") != -1C= index($ua, "windows 16-bit") != -1
ABCresult
1XX1
01X1
0011
0000
1036 || index( $ua, "windows 3" ) != -1
1037 || index( $ua, "windows 16-bit" ) != -1 ) {
1038 12 $os_tests->{win16} = 1;
1039 12 $os_tests->{win3x} = 1;
1040 12 $os = "windows";
1041 12 ▶ if ( index( $ua, "windows 3.1" ) != -1 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (index($ua, 'windows 3.1') != -1) { } 6 6 12
1042 6 $os_tests->{win31} = 1;
1043 6 $os_string = 'Win3x'; # FIXME bug compatibility
1044 }
1045 else {
1046 6 $os_string = 'Win3x';
1047 }
1048 }
1049 ▶ elsif (index( $ua, "win95" ) != -1
Condition100%3/3
index($ua, "win95") != -1 or index($ua, "windows 95") != -1
l!l&&r!l&&!r
12602856
MC/DC100%2/2
index($ua, "win95") != -1 or index($ua, "windows 95") != -1
index($ua, "win95") != -1 index($ua, "windows 95") != -1
Truth table100%3/3
A or B
A= index($ua, "win95") != -1B= index($ua, "windows 95") != -1
ABresult
1X1
011
000
1050 || index( $ua, "windows 95" ) != -1 ) {
1051 72 $os = "windows";
1052 72 $os_string = 'Win95';
1053 72 $os_tests->{win95} = $os_tests->{win32} = 1;
1054 }
1055 ▶ elsif (
Condition100%3/3
index($ua, "win 9x 4.90") != -1 or index($ua, "windows me") != -1
l!l&&r!l&&!r
2462826
MC/DC100%2/2
index($ua, "win 9x 4.90") != -1 or index($ua, "windows me") != -1
index($ua, "win 9x 4.90") != -1 index($ua, "windows me") != -1
Truth table100%3/3
A or B
A= index($ua, "win 9x 4.90") != -1B= index($ua, "windows me") != -1
ABresult
1X1
011
000
1056 index( $ua, "win 9x 4.90" ) != -1 # whatever
1057 || index( $ua, "windows me" ) != -1
1058 ) {
1059 30 $os = "windows";
1060 30 $os_string = 'WinME';
1061 30 $os_tests->{winme} = $os_tests->{win32} = 1;
1062 }
1063 ▶ elsif (index( $ua, "win98" ) != -1
Condition100%3/3
index($ua, "win98") != -1 or index($ua, "windows 98") != -1
l!l&&r!l&&!r
12122802
MC/DC100%2/2
index($ua, "win98") != -1 or index($ua, "windows 98") != -1
index($ua, "win98") != -1 index($ua, "windows 98") != -1
Truth table100%3/3
A or B
A= index($ua, "win98") != -1B= index($ua, "windows 98") != -1
ABresult
1X1
011
000
1064 || index( $ua, "windows 98" ) != -1 ) {
1065 24 $os = "windows";
1066 24 $os_string = 'Win98';
1067 24 $os_tests->{win98} = $os_tests->{win32} = 1;
1068 }
1069 elsif ( index( $ua, "windows 2000" ) != -1 ) {
1070 12 $os = "windows";
1071 12 $os_string = 'Win2k';
1072 12 $os_tests->{win2k} = $os_tests->{winnt} = $os_tests->{win32} = 1;
1073 }
1074 elsif ( index( $ua, "windows ce" ) != -1 ) {
1075 12 $os = 'windows';
1076 12 $os_string = 'WinCE';
1077 12 $os_tests->{wince} = 1;
1078 }
1079 elsif ( index( $ua, "windows phone" ) != -1 ) {
1080 54 $os = 'winphone';
1081 54 $os_tests->{winphone} = 1;
1082  
1083 54 ▶ if ( index( $ua, "windows phone os 7.0" ) != -1 ) {
Branch: 5 branches
BranchTrueFalseTotal
if (index($ua, 'windows phone os 7.0') != -1) { } 6 48 54
elsif (index($ua, 'windows phone os 7.5') != -1) { } 12 36 48
elsif (index($ua, 'windows phone 8.0') != -1) { } 12 24 36
elsif (index($ua, 'windows phone 8.1') != -1) { } 18 6 24
elsif (index($ua, 'windows phone 10.0') != -1) { } 6 0 6
1084 6 $os_tests->{winphone7} = 1;
1085 }
1086 elsif ( index( $ua, "windows phone os 7.5" ) != -1 ) {
1087 12 $os_tests->{winphone7_5} = 1;
1088 }
1089 elsif ( index( $ua, "windows phone 8.0" ) != -1 ) {
1090 12 $os_tests->{winphone8} = 1;
1091 }
1092 elsif ( index( $ua, "windows phone 8.1" ) != -1 ) {
1093 18 $os_tests->{winphone8_1} = 1;
1094 }
1095 elsif ( index( $ua, "windows phone 10.0" ) != -1 ) {
1096 6 $os_tests->{winphone10} = 1;
1097 }
1098 }
1099 }
1100  
1101 6492 ▶ if ( index( $ua, "nt" ) != -1 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (index($ua, "nt") != -1) 3390 3102 6492
1102 3390 ▶ if ( index( $ua, "nt 5.0" ) != -1
Branch: 9 branches
BranchTrueFalseTotal
if (index($ua, 'nt 5.0') != -1 or index($ua, 'nt5') != -1) { } 90 3300 3390
elsif (index($ua, 'nt 5.1') != -1) { } 978 2322 3300
elsif (index($ua, 'nt 5.2') != -1) { } 126 2196 2322
elsif (index($ua, 'nt 6.0') != -1) { } 198 1998 2196
elsif (index($ua, 'nt 6.1') != -1) { } 966 1032 1998
elsif (index($ua, 'nt 6.2') != -1) { } 96 936 1032
elsif (index($ua, 'nt 6.3') != -1) { } 78 858 936
elsif (index($ua, 'nt 10.0') != -1) { } 24 834 858
elsif (index($ua, 'winnt') != -1 or index($ua, 'windows nt') != -1 or index($ua, 'nt4') != -1 or index($ua, 'nt3') != -1) { } 54 780 834
Condition66%2/3
index($ua, "nt 5.0") != -1 or index($ua, "nt5") != -1
l!l&&r!l&&!r
9003300
MC/DC50%1/2
index($ua, "nt 5.0") != -1 or index($ua, "nt5") != -1
index($ua, "nt 5.0") != -1 index($ua, "nt5") != -1
Truth table66%2/3
A or B
A= index($ua, "nt 5.0") != -1B= index($ua, "nt5") != -1
ABresult
1X1
011
000
1103 || index( $ua, "nt5" ) != -1 ) {
1104 90 $os = "windows";
1105 90 $os_string = 'Win2k';
1106 90 $os_tests->{win2k} = $os_tests->{winnt} = $os_tests->{win32} = 1;
1107 }
1108 elsif ( index( $ua, "nt 5.1" ) != -1 ) {
1109 978 $os = "windows";
1110 978 $os_string = 'WinXP';
1111 978 $os_tests->{winxp} = $os_tests->{winnt} = $os_tests->{win32} = 1;
1112 }
1113 elsif ( index( $ua, "nt 5.2" ) != -1 ) {
1114 126 $os = "windows";
1115 126 $os_string = 'Win2k3';
1116 126 $os_tests->{win2k3} = $os_tests->{winnt} = $os_tests->{win32} = 1;
1117 }
1118 elsif ( index( $ua, "nt 6.0" ) != -1 ) {
1119 198 $os = "windows";
1120 198 $os_string = 'WinVista';
1121 $os_tests->{winvista} = $os_tests->{winnt} = $os_tests->{win32}
1122 198 = 1;
1123 }
1124 elsif ( index( $ua, "nt 6.1" ) != -1 ) {
1125 966 $os = "windows";
1126 966 $os_string = 'Win7';
1127 966 $os_tests->{win7} = $os_tests->{winnt} = $os_tests->{win32} = 1;
1128 }
1129 elsif ( index( $ua, "nt 6.2" ) != -1 ) {
1130 96 $os = "windows";
1131 96 $os_string = 'Win8.0';
1132 $os_tests->{win8_0} = $os_tests->{win8} = $os_tests->{winnt}
1133 96 = $os_tests->{win32} = 1;
1134 }
1135 elsif ( index( $ua, "nt 6.3" ) != -1 ) {
1136 78 $os = "windows";
1137 78 $os_string = 'Win8.1';
1138 $os_tests->{win8_1} = $os_tests->{win8} = $os_tests->{winnt}
1139 78 = $os_tests->{win32} = 1;
1140 }
1141 elsif ( index( $ua, "nt 10.0" ) != -1 ) {
1142 24 $os = "windows";
1143 24 $os_string = 'Win10.0';
1144 $os_tests->{win10_0} = $os_tests->{win10} = $os_tests->{winnt}
1145 24 = $os_tests->{win32} = 1;
1146 }
1147 ▶ elsif (index( $ua, "winnt" ) != -1
Condition88%8/9
index($ua, "winnt") != -1 or index($ua, "windows nt") != -1 or index($ua, "nt4") != -1 or index($ua, "nt3") != -1
l!l&&r!l&&!r
540780
index($ua, "winnt") != -1 or index($ua, "windows nt") != -1 or index($ua, "nt4") != -1
l!l&&r!l&&!r
486780
index($ua, "winnt") != -1 or index($ua, "windows nt") != -1
l!l&&r!l&&!r
642786
MC/DC75%3/4
index($ua, "winnt") != -1 or index($ua, "windows nt") != -1 or index($ua, "nt4") != -1 or index($ua, "nt3") != -1
index($ua, "winnt") != -1 index($ua, "windows nt") != -1 index($ua, "nt4") != -1 index($ua, "nt3") != -1
Truth table80%4/5
A or B or C or D
A= index($ua, "winnt") != -1B= index($ua, "windows nt") != -1C= index($ua, "nt4") != -1D= index($ua, "nt3") != -1
ABCDresult
1XXX1
01XX1
001X1
00011
00000
1148 || index( $ua, "windows nt" ) != -1
1149 || index( $ua, "nt4" ) != -1
1150 || index( $ua, "nt3" ) != -1 ) {
1151 54 $os = "windows";
1152 54 $os_string = "WinNT";
1153 54 $os_tests->{winnt} = $os_tests->{win32} = 1;
1154 }
1155 }
1156  
1157 6492 ▶ if ($os) {
Branch: 28 branches
BranchTrueFalseTotal
if ($os) { } 2826 3666 6492
elsif (index($ua, 'macintosh') != -1 or index($ua, 'mac_') != -1) { } 438 3228 3666
elsif (index($ua, 'ipod') != -1 or index($ua, 'iphone') != -1 or index($ua, 'ipad') != -1) { } 348 2880 3228
elsif (index($ua, 'android') != -1) { } 906 1974 2880
elsif (index($ua, 'inux') != -1) { } 474 1500 1974
elsif ($tests->{'x11'} and index($ua, 'cros') != -1) { } 42 1458 1500
elsif (index($ua, 'amiga') != -1) { } 6 1452 1458
elsif (index($ua, 'os/2') != -1) { } 6 1446 1452
elsif (index($ua, 'solaris') != -1) { } 6 1440 1446
elsif (index($ua, 'samsung') == -1 and index($ua, 'sun') != -1) { } 0 1440 1440
elsif (index($ua, 'irix') != -1) { } 0 1440 1440
elsif (index($ua, 'hp-ux') != -1) { } 0 1440 1440
elsif (index($ua, 'aix') != -1) { } 0 1440 1440
elsif ($ua =~ /\bsco\b/ or index($ua, 'unix_sv') != -1) { } 0 1440 1440
elsif (index($ua, 'unix_system_v') != -1) { } 0 1440 1440
elsif ($ua =~ /\bncr\b/) { } 0 1440 1440
elsif (index($ua, 'reliantunix') != -1) { } 0 1440 1440
elsif (index($ua, 'dec') != -1 or index($ua, 'osf1') != -1 or index($ua, 'declpha') != -1 or index($ua, 'alphaserver') != -1 or index($ua, 'ultrix') != -1 or index($ua, 'alphastation') != -1) { } 0 1440 1440
elsif (index($ua, 'sinix') != -1) { } 0 1440 1440
elsif (index($ua, 'bsd') != -1) { } 30 1410 1440
elsif ($tests->{'x11'}) { } 6 1404 1410
elsif (index($ua, 'vax') != -1 or index($ua, 'openvms') != -1) { } 0 1404 1404
elsif (index($ua, 'bb10') != -1) { } 12 1392 1404
elsif (index($ua, 'rim tablet os') != -1) { } 6 1386 1392
elsif (index($ua, 'playstation 3') != -1) { } 6 1380 1386
elsif (index($ua, 'playstation portable') != -1) { } 6 1374 1380
elsif (index($ua, 'windows') != -1) { } 54 1320 1374
elsif (index($ua, 'win32') != -1) { } 18 1302 1320
1158  
1159 # windows, set through some path above
1160 2826 $os_tests->{windows} = 1;
1161 2826 ▶ $os_tests->{win32} = 1 if index( $ua, "win32" ) != -1;
Branch: 1 branch
BranchTrueFalseTotal
if index($ua, "win32") != -1 0 2826 2826
1162 }
1163 ▶ elsif ( index( $ua, "macintosh" ) != -1 || index( $ua, "mac_" ) != -1 ) {
Condition100%3/3
index($ua, "macintosh") != -1 or index($ua, "mac_") != -1
l!l&&r!l&&!r
43263228
MC/DC100%2/2
index($ua, "macintosh") != -1 or index($ua, "mac_") != -1
index($ua, "macintosh") != -1 index($ua, "mac_") != -1
Truth table100%3/3
A or B
A= index($ua, "macintosh") != -1B= index($ua, "mac_") != -1
ABresult
1X1
011
000
1164  
1165 # Mac operating systems
1166 438 $os_tests->{mac} = 1;
1167 438 ▶ if ( index( $ua, "mac os x" ) != -1 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (index($ua, 'mac os x') != -1) { } 414 24 438
1168 414 $os = "macosx";
1169 414 $os_tests->{$os} = 1;
1170 }
1171 else {
1172 24 $os = "mac";
1173 }
1174 438 ▶ if ( index( $ua, "68k" ) != -1 || index( $ua, "68000" ) != -1 ) {
Branch: 2 branches
BranchTrueFalseTotal
if (index($ua, '68k') != -1 or index($ua, '68000') != -1) { } 0 438 438
elsif (index($ua, 'ppc') != -1 or index($ua, 'powerpc') != -1) { } 126 312 438
Condition33%1/3
index($ua, "68k") != -1 or index($ua, 68000) != -1
l!l&&r!l&&!r
00438
MC/DC0%0/2
index($ua, "68k") != -1 or index($ua, 68000) != -1
index($ua, "68k") != -1 index($ua, 68000) != -1
Truth table33%1/3
A or B
A= index($ua, "68k") != -1B= index($ua, 68000) != -1
ABresult
1X1
011
000
1175 0 $os_tests->{mac68k} = 1;
1176 }
1177 ▶ elsif ( index( $ua, "ppc" ) != -1 || index( $ua, "powerpc" ) != -1 ) {
Condition100%3/3
index($ua, "ppc") != -1 or index($ua, "powerpc") != -1
l!l&&r!l&&!r
1206312
MC/DC100%2/2
index($ua, "ppc") != -1 or index($ua, "powerpc") != -1
index($ua, "ppc") != -1 index($ua, "powerpc") != -1
Truth table100%3/3
A or B
A= index($ua, "ppc") != -1B= index($ua, "powerpc") != -1
ABresult
1X1
011
000
1178 126 $os_tests->{macppc} = 1;
1179 }
1180 }
1181 ▶ elsif (index( $ua, "ipod" ) != -1
Condition100%6/6
index($ua, "ipod") != -1 or index($ua, "iphone") != -1 or index($ua, "ipad") != -1
l!l&&r!l&&!r
2041442880
index($ua, "ipod") != -1 or index($ua, "iphone") != -1
l!l&&r!l&&!r
181863024
MC/DC100%3/3
index($ua, "ipod") != -1 or index($ua, "iphone") != -1 or index($ua, "ipad") != -1
index($ua, "ipod") != -1 index($ua, "iphone") != -1 index($ua, "ipad") != -1
Truth table100%4/4
A or B or C
A= index($ua, "ipod") != -1B= index($ua, "iphone") != -1C= index($ua, "ipad") != -1
ABCresult
1XX1
01X1
0011
0000
1182 || index( $ua, "iphone" ) != -1
1183 || index( $ua, "ipad" ) != -1 ) {
1184  
1185 # iOS
1186 348 $os = 'ios';
1187 348 $os_tests->{$os} = 1;
1188 }
1189 elsif ( index( $ua, "android" ) != -1 ) {
1190  
1191 # Android
1192 906 $os = 'android'; # Test gets set in the device testing
1193 }
1194 elsif ( index( $ua, "inux" ) != -1 ) {
1195  
1196 # Linux
1197 474 $os = 'linux';
1198 474 $os_tests->{linux} = $os_tests->{unix} = 1;
1199 }
1200 ▶ elsif ( $tests->{x11} && index( $ua, "cros" ) != -1 ) {
Condition100%3/3
$tests->{"x11"} and index($ua, "cros") != -1
!ll&&!rl&&r
14283042
MC/DC100%2/2
$tests->{"x11"} and index($ua, "cros") != -1
$tests->{"x11"} index($ua, "cros") != -1
Truth table100%3/3
A and B
A= $tests->{"x11"}B= index($ua, "cros") != -1
ABresult
0X0
100
111
1201  
1202 # ChromeOS
1203 42 $os = 'chromeos';
1204 42 $os_tests->{chromeos} = 1;
1205 }
1206 ## Long series of unlikely OSs
1207 elsif ( index( $ua, 'amiga' ) != -1 ) {
1208 6 $os = 'amiga';
1209 6 $os_tests->{$os} = 1;
1210 }
1211 elsif ( index( $ua, 'os/2' ) != -1 ) {
1212 6 $os = 'os2';
1213 6 $os_tests->{$os} = 1;
1214 }
1215 elsif ( index( $ua, "solaris" ) != -1 ) {
1216 6 $os = 'unix';
1217 6 $os_string = 'Solaris';
1218 6 $os_tests->{sun} = $os_tests->{unix} = 1;
1219 }
1220 ▶ elsif ( index( $ua, "samsung" ) == -1 && index( $ua, "sun" ) != -1 ) {
Condition66%2/3
index($ua, "samsung") == -1 and index($ua, "sun") != -1
!ll&&!rl&&r
614340
MC/DC0%0/2
index($ua, "samsung") == -1 and index($ua, "sun") != -1
index($ua, "samsung") == -1 index($ua, "sun") != -1
Truth table66%2/3
A and B
A= index($ua, "samsung") == -1B= index($ua, "sun") != -1
ABresult
0X0
100
111
1221 0 $os = 'unix';
1222 0 $os_string = 'SunOS';
1223 0 $os_tests->{sun} = $os_tests->{unix} = 1;
1224 0 ▶ $os_tests->{suni86} = 1 if index( $ua, "i86" ) != -1;
Branch: 1 branch
BranchTrueFalseTotal
if index($ua, "i86") != -1 0 0 0
1225 0 ▶ $os_tests->{sun4} = 1 if index( $ua, "sunos 4" ) != -1;
Branch: 1 branch
BranchTrueFalseTotal
if index($ua, "sunos 4") != -1 0 0 0
1226 0 ▶ $os_tests->{sun5} = 1 if index( $ua, "sunos 5" ) != -1;
Branch: 1 branch
BranchTrueFalseTotal
if index($ua, "sunos 5") != -1 0 0 0
1227 }
1228 elsif ( index( $ua, "irix" ) != -1 ) {
1229 0 $os = 'unix';
1230 0 $os_string = 'Irix';
1231 0 $os_tests->{irix} = $os_tests->{unix} = 1;
1232 0 ▶ $os_tests->{irix5} = 1 if ( index( $ua, "irix5" ) != -1 );
Branch: 1 branch
BranchTrueFalseTotal
if (index($ua, "irix5") != -1) 0 0 0
1233 0 ▶ $os_tests->{irix6} = 1 if ( index( $ua, "irix6" ) != -1 );
Branch: 1 branch
BranchTrueFalseTotal
if (index($ua, "irix6") != -1) 0 0 0
1234 }
1235 elsif ( index( $ua, "hp-ux" ) != -1 ) {
1236 0 $os = 'unix';
1237 0 $os_string = 'HP-UX';
1238 0 $os_tests->{hpux} = $os_tests->{unix} = 1;
1239 0 ▶ $os_tests->{hpux9} = 1 if index( $ua, "09." ) != -1;
Branch: 1 branch
BranchTrueFalseTotal
if index($ua, "09.") != -1 0 0 0
1240 0 ▶ $os_tests->{hpux10} = 1 if index( $ua, "10." ) != -1;
Branch: 1 branch
BranchTrueFalseTotal
if index($ua, "10.") != -1 0 0 0
1241 }
1242 elsif ( index( $ua, "aix" ) != -1 ) {
1243 0 $os = 'unix';
1244 0 $os_string = 'AIX';
1245 0 $os_tests->{aix} = $os_tests->{unix} = 1;
1246 0 ▶ $os_tests->{aix1} = 1 if ( index( $ua, "aix 1" ) != -1 );
Branch: 1 branch
BranchTrueFalseTotal
if (index($ua, "aix 1") != -1) 0 0 0
1247 0 ▶ $os_tests->{aix2} = 1 if ( index( $ua, "aix 2" ) != -1 );
Branch: 1 branch
BranchTrueFalseTotal
if (index($ua, "aix 2") != -1) 0 0 0
1248 0 ▶ $os_tests->{aix3} = 1 if ( index( $ua, "aix 3" ) != -1 );
Branch: 1 branch
BranchTrueFalseTotal
if (index($ua, "aix 3") != -1) 0 0 0
1249 0 ▶ $os_tests->{aix4} = 1 if ( index( $ua, "aix 4" ) != -1 );
Branch: 1 branch
BranchTrueFalseTotal
if (index($ua, "aix 4") != -1) 0 0 0
1250 }
1251 ▶ elsif ( $ua =~ m{\bsco\b} || index( $ua, "unix_sv" ) != -1 ) {
Condition33%1/3
$ua =~ /\bsco\b/ or index($ua, "unix_sv") != -1
l!l&&r!l&&!r
001440
MC/DC0%0/2
$ua =~ /\bsco\b/ or index($ua, "unix_sv") != -1
$ua =~ /\bsco\b/ index($ua, "unix_sv") != -1
Truth table33%1/3
A or B
A= $ua =~ /\bsco\b/B= index($ua, "unix_sv") != -1
ABresult
1X1
011
000
1252 0 $os = 'unix';
1253 0 $os_string = 'SCO Unix';
1254 0 $os_tests->{sco} = $os_tests->{unix} = 1;
1255 }
1256 elsif ( index( $ua, "unix_system_v" ) != -1 ) {
1257 0 $os = 'unix';
1258 0 $os_string = 'System V Unix';
1259 0 $os_tests->{unixware} = $os_tests->{unix} = 1;
1260 }
1261 elsif ( $ua =~ m{\bncr\b} ) {
1262 0 $os = 'unix';
1263 0 $os_string = 'NCR Unix';
1264 0 $os_tests->{mpras} = $os_tests->{unix} = 1;
1265 }
1266 elsif ( index( $ua, "reliantunix" ) != -1 ) {
1267 0 $os = 'unix';
1268 0 $os_string = 'Reliant Unix';
1269 0 $os_tests->{reliant} = $os_tests->{unix} = 1;
1270 }
1271 ▶ elsif (index( $ua, "dec" ) != -1
Condition33%5/15
index($ua, "dec") != -1 or index($ua, "osf1") != -1 or index($ua, "declpha") != -1 or index($ua, "alphaserver") != -1 or index($ua, "ultrix") != -1 or index($ua, "alphastation") != -1
l!l&&r!l&&!r
001440
index($ua, "dec") != -1 or index($ua, "osf1") != -1 or index($ua, "declpha") != -1 or index($ua, "alphaserver") != -1 or index($ua, "ultrix") != -1
l!l&&r!l&&!r
001440
index($ua, "dec") != -1 or index($ua, "osf1") != -1 or index($ua, "declpha") != -1 or index($ua, "alphaserver") != -1
l!l&&r!l&&!r
001440
index($ua, "dec") != -1 or index($ua, "osf1") != -1 or index($ua, "declpha") != -1
l!l&&r!l&&!r
001440
index($ua, "dec") != -1 or index($ua, "osf1") != -1
l!l&&r!l&&!r
001440
MC/DC0%0/6
index($ua, "dec") != -1 or index($ua, "osf1") != -1 or index($ua, "declpha") != -1 or index($ua, "alphaserver") != -1 or index($ua, "ultrix") != -1 or index($ua, "alphastation") != -1
index($ua, "dec") != -1 index($ua, "osf1") != -1 index($ua, "declpha") != -1 index($ua, "alphaserver") != -1 index($ua, "ultrix") != -1 index($ua, "alphastation") != -1
Truth table14%1/7
A or B or C or D or E or F
A= index($ua, "dec") != -1B= index($ua, "osf1") != -1C= index($ua, "declpha") != -1D= index($ua, "alphaserver") != -1E= index($ua, "ultrix") != -1F= index($ua, "alphastation") != -1
ABCDEFresult
1XXXXX1
01XXXX1
001XXX1
0001XX1
00001X1
0000011
0000000
1272 || index( $ua, "osf1" ) != -1
1273 || index( $ua, "declpha" ) != -1
1274 || index( $ua, "alphaserver" ) != -1
1275 || index( $ua, "ultrix" ) != -1
1276 || index( $ua, "alphastation" ) != -1 ) {
1277 0 $os = 'unix';
1278 0 $os_tests->{dec} = $os_tests->{unix} = 1;
1279 }
1280 elsif ( index( $ua, "sinix" ) != -1 ) {
1281 0 $os = 'unix';
1282 0 $os_tests->{sinix} = $os_tests->{unix} = 1;
1283 }
1284 elsif ( index( $ua, "bsd" ) != -1 ) {
1285 30 $os = 'unix';
1286 30 ▶ if ( $self->{user_agent} =~ m{(\w*bsd\w*)}i ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"user_agent"} =~ /(\w*bsd\w*)/i) 30 0 30
1287 30 $os_string = $1;
1288 }
1289 30 $os_tests->{bsd} = $os_tests->{unix} = 1;
1290 30 ▶ $os_tests->{freebsd} = 1 if index( $ua, "freebsd" ) != -1;
Branch: 1 branch
BranchTrueFalseTotal
if index($ua, "freebsd") != -1 30 0 30
1291 }
1292 elsif ( $tests->{x11} ) {
1293  
1294 # Some Unix we didn't identify
1295 6 $os = 'unix';
1296 6 $os_tests->{unix} = 1;
1297 }
1298 ▶ elsif ( index( $ua, "vax" ) != -1 || index( $ua, "openvms" ) != -1 ) {
Condition33%1/3
index($ua, "vax") != -1 or index($ua, "openvms") != -1
l!l&&r!l&&!r
001404
MC/DC0%0/2
index($ua, "vax") != -1 or index($ua, "openvms") != -1
index($ua, "vax") != -1 index($ua, "openvms") != -1
Truth table33%1/3
A or B
A= index($ua, "vax") != -1B= index($ua, "openvms") != -1
ABresult
1X1
011
000
1299  
1300 0 $os = 'vms';
1301 0 $os_tests->{vms} = 1;
1302 }
1303 elsif ( index( $ua, "bb10" ) != -1 ) {
1304 12 $os = 'bb10';
1305 12 $os_tests->{bb10} = 1;
1306 }
1307 elsif ( index( $ua, "rim tablet os" ) != -1 ) {
1308 6 $os = 'rimtabletos';
1309 6 $os_tests->{rimtabletos} = 1;
1310 }
1311 elsif ( index( $ua, "playstation 3" ) != -1 ) {
1312 6 $os = 'ps3gameos';
1313 6 $os_tests->{ps3gameos} = 1;
1314 }
1315 elsif ( index( $ua, "playstation portable" ) != -1 ) {
1316 6 $os = 'pspgameos';
1317 6 $os_tests->{pspgameos} = 1;
1318 }
1319 elsif ( index( $ua, "windows" ) != -1 ) {
1320  
1321 # Windows again, the super generic version
1322 54 $os_tests->{windows} = 1;
1323 }
1324 elsif ( index( $ua, "win32" ) != -1 ) {
1325 18 $os_tests->{win32} = $os_tests->{windows} = 1;
1326 }
1327 else {
1328 1302 $os = undef;
1329 }
1330  
1331 # To deal with FirefoxOS we seem to have to load-on-demand devices
1332 # also, by calling ->mobile and ->tablet. We have to be careful;
1333 # if we ever created a loop back from _init_devices to _init_os
1334 # we'd run forever.
1335 6492 ▶ if ( !$os
Branch: 1 branch
BranchTrueFalseTotal
if (not $os and $browser_tests->{"firefox"} and index($ua, "fennec") == -1 and $self->mobile || $self->tablet) 12 6480 6492
Condition91%11/12
not $os and $browser_tests->{"firefox"} and index($ua, "fennec") == -1 and $self->mobile || $self->tablet
!ll&&!rl&&r
6474612
not $os and $browser_tests->{"firefox"} and index($ua, "fennec") == -1
!ll&&!rl&&r
6474018
not $os and $browser_tests->{"firefox"}
!ll&&!rl&&r
5118135618
$self->mobile or $self->tablet
l!l&&r!l&&!r
666
MC/DC60%3/5
not $os and $browser_tests->{"firefox"} and index($ua, "fennec") == -1 and $self->mobile || $self->tablet
not $os $browser_tests->{"firefox"} index($ua, "fennec") == -1 $self->mobile $self->tablet
Truth table66%4/6
not(A) and B and C and D or E
A= not $osB= $browser_tests->{"firefox"}C= index($ua, "fennec") == -1D= $self->mobileE= $self->tablet
ABCDEresult
0XXXX0
10XXX0
110XX0
111000
1111X1
111011
1336 && $browser_tests->{firefox}
1337 && index( $ua, "fennec" ) == -1
1338 && ( $self->mobile || $self->tablet ) ) {
1339 12 $os = 'firefoxos';
1340 12 $os_tests->{firefoxos} = 1;
1341 }
1342  
1343 6492 $self->{os} = $os;
1344 6492 ▶ if ( $os and !$os_string ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($os and not $os_string) 2322 4170 6492
Condition100%3/3
$os and not $os_string
!ll&&!rl&&r
136228082322
MC/DC100%2/2
$os and not $os_string
$os not $os_string
Truth table100%3/3
A and not(B)
A= $osB= not $os_string
ABresult
0X0
100
111
1345 2322 $os_string = $OS_NAMES{$os};
1346 }
1347 6492 $self->{os_string} = $os_string;
1348 }
1349  
1350 sub _init_os_version {
1351 2443 ▶ my ($self) = @_;
Subroutine _init_os_version: called CC=16 SCAR=27.8
1352  
1353 2443 my $os = $self->os;
1354 2443 my $os_string = $self->os_string;
1355 2443 my $ua = lc $self->{user_agent};
1356  
1357 2443 my $os_version = undef;
1358  
1359 2443 ▶ if ( !defined($os) ) {
Branch: 7 branches
BranchTrueFalseTotal
if (not defined $os) { } 466 1977 2443
elsif ($os eq 'winphone') { } 27 1950 1977
elsif ($os eq 'macosx') { } 186 1764 1950
elsif ($os eq 'ios') { } 176 1588 1764
elsif ($os eq 'chromeos') { } 21 1567 1588
elsif ($os eq 'android') { } 451 1116 1567
elsif ($os eq 'firefoxos') { } 6 1110 1116
1360  
1361 # Nothing is going to work if we have no OS. Skip everything.
1362 }
1363 elsif ( $os eq 'winphone' ) {
1364 27 ▶ if ( $ua =~ m{windows phone (?:os )?(\d+)(\.?\d*)([\.\d]*)} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ua =~ /windows phone (?:os )?(\d+)(\.?\d*)([\.\d]*)/) 27 0 27
1365 27 $os_version = [ $1, $2, $3 ];
1366 }
1367 }
1368 elsif ( $os eq 'macosx' ) {
1369 186 ▶ if ( $ua =~ m{os x (\d+)[\._](\d+)[\._]?(\d*)} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ua =~ /os x (\d+)[\._](\d+)[\._]?(\d*)/) 150 36 186
1370 150 ▶ $os_version = [ $1, ".$2", length($3) ? ".$3" : '' ];
Branch: 1 branch
BranchTrueFalseTotal
length $3 ? : 128 22 150
1371 }
1372 }
1373 elsif ( $os eq 'ios' ) {
1374 176 ▶ if ( $ua =~ m{ os (\d+)[\._ ](\d+)[\._ ]?(\d*)} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ua =~ / os (\d+)[\._ ](\d+)[\._ ]?(\d*)/) 173 3 176
1375 173 ▶ $os_version = [ $1, ".$2", length($3) ? ".$3" : '' ];
Branch: 1 branch
BranchTrueFalseTotal
length $3 ? : 118 55 173
1376 }
1377 }
1378 elsif ( $os eq 'chromeos' ) {
1379 21 ▶ if ( $ua =~ m{ cros \S* (\d+)(\.?\d*)([\.\d]*)} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ua =~ / cros \S* (\d+)(\.?\d*)([\.\d]*)/) 21 0 21
1380 21 $os_version = [ $1, $2, $3 ];
1381 }
1382 }
1383 elsif ( $os eq 'android' ) {
1384 451 ▶ if ( $ua =~ m{android (\d+)(\.?\d*)([\w\-\.]*)[\;\)]} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ua =~ /android (\d+)(\.?\d*)([\w\-\.]*)[\;\)]/) 438 13 451
1385 438 $os_version = [ $1, $2, $3 ];
1386 }
1387 }
1388 elsif ( $os eq 'firefoxos' ) {
1389 6 ▶ if ( $ua =~ m{firefox/(\d+)(\.?\d*)([\.\d]*)} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ua =~ m[firefox/(\d+)(\.?\d*)([\.\d]*)]) 6 0 6
1390 6 $os_version = [ $1, $2, $3 ];
1391 }
1392 }
1393  
1394 # Set the version. It might be set to undef, in which case we know
1395 # not to go through this next time.
1396 2443 $self->{os_version} = $os_version;
1397 }
1398  
1399 ### Version determination, only run on demand
1400  
1401 sub _init_version {
1402 6466 ▶ my ($self) = @_;
Subroutine _init_version: called CC=95 SCAR=45.9
1403  
1404 6466 my $ua = lc $self->{user_agent};
1405 6466 my $tests = $self->{tests};
1406 6466 my $browser_tests = $self->{browser_tests};
1407 6466 my $browser = $self->{browser};
1408  
1409 6466 $self->{version_tests} = {};
1410 6466 my $version_tests = $self->{version_tests};
1411  
1412 6466 my ( $major, $minor, $beta );
1413  
1414 ### First figure out version numbers. First, we test if we're
1415 ### using a browser that needs some special method to determine
1416 ### the version.
1417  
1418 6466 ▶ if ( defined($browser) && $browser eq 'opera' ) {
Branch: 11 branches
BranchTrueFalseTotal
if (defined $browser and $browser eq 'opera') { } 214 6252 6466
elsif ($ua =~ m[\b compatible; \s* [\w\-]* [/\s] ( [0-9]+ ) (?: .([0-9]+) (\S*) )? ;]x) { } 1851 4401 6252
elsif (not $browser) { } 943 3458 4401
elsif ($browser_tests->{'edge'}) { } 30 3428 3458
elsif ($browser_tests->{'safari'}) { } 927 2501 3428
elsif ($browser_tests->{'ie'}) { } 101 2400 2501
elsif ($browser eq 'n3ds') { } 6 2394 2400
elsif ($browser eq 'browsex') { } 6 2388 2394
elsif ($ua =~ m[netscape6/(\d+)\.(\d+)([\d.]*)]) { } 6 2382 2388
elsif ($browser eq 'brave') { } 12 2370 2382
elsif ($browser eq 'chrome' and $ua =~ m[crios/(\d+)\.(\d+)([\d.]*)]) { } 18 3410 3428
Condition100%3/3
defined $browser and $browser eq "opera"
!ll&&!rl&&r
11395113214
MC/DC100%2/2
defined $browser and $browser eq "opera"
defined $browser $browser eq "opera"
Truth table100%3/3
A and B
A= defined $browserB= $browser eq "opera"
ABresult
0X0
100
111
1419  
1420 # Opera has a "compatible; " section, but lies sometimes. It needs
1421 # special handling.
1422  
1423 # http://dev.opera.com/articles/view/opera-ua-string-changes/
1424 # http://my.opera.com/community/openweb/idopera/
1425 # Opera/9.80 (S60; SymbOS; Opera Mobi/320; U; sv) Presto/2.4.15 Version/10.00
1426 # Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.52 Safari/537.36 OPR/15.0.1147.100
1427  
1428 214 ▶ if ( $ua =~ m{\AOpera.*\sVersion/(\d*)\.(\d*)\z}i ) {
Branch: 3 branches
BranchTrueFalseTotal
if ($ua =~ m[\AOpera.*\sVersion/(\d*)\.(\d*)\z]i) { } 78 136 214
elsif ($ua =~ m[\bOPR/(\d+)\.(\d+)]i) { } 47 89 136
elsif ($ua =~ m[Opera[ /](\d+).(\d+)]i) { } 89 0 89
1429 78 $major = $1;
1430 78 $minor = $2;
1431 }
1432 elsif ( $ua =~ m{\bOPR/(\d+)\.(\d+)}i ) {
1433 47 $major = $1;
1434 47 $minor = $2;
1435 }
1436 elsif ( $ua =~ m{Opera[ /](\d+).(\d+)}i ) {
1437 89 $major = $1;
1438 89 $minor = $2;
1439 }
1440 }
1441 elsif ( $ua
1442 =~ m{\b compatible; \s* [\w\-]* [/\s] ( [0-9]+ ) (?: .([0-9]+) (\S*) )? ;}x
1443 ) {
1444 # MSIE and some others use a "compatible" format
1445 1851 ( $major, $minor, $beta ) = ( $1, $2, $3 );
1446 }
1447 elsif ( !$browser ) {
1448  
1449 # Nothing else is going to work if $browser isn't defined; skip the
1450 # specific approaches and go straight to the generic ones.
1451 }
1452 elsif ( $browser_tests->{edge} ) {
1453 30 ( $major, $minor, $beta ) = $ua =~ m{Edge/(\d+)(.\d+)(.\d+)?};
1454 }
1455 elsif ( $browser_tests->{safari} ) {
1456  
1457 # Safari Version
1458  
1459 927 ▶ if (
Branch: 2 branches
BranchTrueFalseTotal
if (do { $ua =~ m[ safari/ ( \d+ (?: \.\d+ )* ) ]x }) { } 855 72 927
elsif ($ua =~ m[applewebkit\/([\d\.]{1,})]xi) { } 60 12 72
1460 0
1461 && $ua =~ m{ # Disabled for bug compatibility
1462 version/
1463 ( \d+ ) # Major version number is everything before first dot
1464 \. # First dot
1465 ( \d+ )? # Minor version number follows dot
1466 }x
1467 ) {
1468 # Safari starting with version 3.0 provides its own public version
1469 ( $major, $minor ) = ( $1, $2, undef );
1470 }
1471 elsif ( $ua =~ m{ safari/ ( \d+ (?: \.\d+ )* ) }x ) {
1472 855 ▶ if ( my ( $safari_build, $safari_minor ) = split /\./, $1 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = split(/\./, $1, 3)) 855 0 855
1473 855 $major = int( $safari_build / 100 );
1474 855 $minor = int( $safari_build % 100 );
1475 855 ▶ $beta = ".$safari_minor" if $safari_minor;
Branch: 1 branch
BranchTrueFalseTotal
if $safari_minor 795 60 855
1476 }
1477 }
1478 elsif ( $ua =~ m{applewebkit\/([\d\.]{1,})}xi ) {
1479 60 ▶ if ( my ( $safari_build, $safari_minor ) = split /\./, $1 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = split(/\./, $1, 3)) 60 0 60
1480 60 $major = int( $safari_build / 100 );
1481 60 $minor = int( $safari_build % 100 );
1482 60 ▶ $beta = ".$safari_minor" if $safari_minor;
Branch: 1 branch
BranchTrueFalseTotal
if $safari_minor 48 12 60
1483 }
1484 }
1485 }
1486 elsif ( $browser_tests->{ie} ) {
1487  
1488 # MSIE
1489  
1490 101 ▶ if ( $ua =~ m{\b msie \s ( [0-9\.]+ ) (?: [a-z]+ [a-z0-9]* )? ;}x ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($ua =~ /\b msie \s ( [0-9\.]+ ) (?: [a-z]+ [a-z0-9]* )? ;/x) { } 17 84 101
elsif ($ua =~ /\b rv: ( [0-9\.]+ ) \b/x) { } 72 12 84
1491  
1492 # Internet Explorer
1493 17 ( $major, $minor, $beta ) = split /\./, $1;
1494 }
1495 elsif ( $ua =~ m{\b rv: ( [0-9\.]+ ) \b}x ) {
1496  
1497 # MSIE masking as Gecko really well ;)
1498 72 ( $major, $minor, $beta ) = split /\./, $1;
1499 }
1500 }
1501 elsif ( $browser eq 'n3ds' ) {
1502 6 ▶ if ( $ua =~ m{Nintendo 3DS;.*\sVersion/(\d*)\.(\d*)}i ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ua =~ m[Nintendo 3DS;.*\sVersion/(\d*)\.(\d*)]i) 6 0 6
1503 6 $major = $1;
1504 6 $minor = $2;
1505 }
1506 }
1507 elsif ( $browser eq 'browsex' ) {
1508 6 ▶ if ( $ua =~ m{BrowseX \((\d+)\.(\d+)([\d.]*)}i ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ua =~ /BrowseX \((\d+)\.(\d+)([\d.]*)/i) 6 0 6
1509 6 $major = $1;
1510 6 $minor = $2;
1511 6 $beta = $3;
1512 }
1513 }
1514 elsif ( $ua =~ m{netscape6/(\d+)\.(\d+)([\d.]*)} ) {
1515  
1516 # Other cases get handled below, we just need this to skip the "6"
1517 6 $major = $1;
1518 6 $minor = $2;
1519 6 $beta = $3;
1520 }
1521 elsif ( $browser eq 'brave' ) {
1522  
1523 # Note: since 0.7.10, Brave has changed the branding
1524 # of GitHub's "Electron" (http://electron.atom.io/) to "Brave".
1525 # This means the browser string has both "brave/" (the browser)
1526 # and "Brave/" (re-branded Electron) in it.
1527 # The generic section below looks at $self->{browser_string}, which is "Brave"
1528 # (Electron) and not $self->{browser} which is "brave".
1529 # Caveat parser.
1530 12 ▶ if ( $ua =~ m{brave/(\d+)\.(\d+)([\d.]*)} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ua =~ m[brave/(\d+)\.(\d+)([\d.]*)]) 12 0 12
1531 12 $major = $1;
1532 12 $minor = $2;
1533 12 $beta = $3;
1534 }
1535 }
1536 ▶ elsif ($browser eq 'chrome'
Condition100%3/3
$browser eq "chrome" and $ua =~ m[crios/(\d+)\.(\d+)([\d.]*)]
!ll&&!rl&&r
1058129418
MC/DC100%2/2
$browser eq "chrome" and $ua =~ m[crios/(\d+)\.(\d+)([\d.]*)]
$browser eq "chrome" $ua =~ m[crios/(\d+)\.(\d+)([\d.]*)]
Truth table100%3/3
A and B
A= $browser eq "chrome"B= $ua =~ m[crios/(\d+)\.(\d+)([\d.]*)]
ABresult
0X0
100
111
1537 && $ua =~ m{crios/(\d+)\.(\d+)([\d.]*)} ) {
1538 18 $major = $1;
1539 18 $minor = $2;
1540 18 $beta = $3;
1541 }
1542  
1543 # If we didn't match a browser-specific test, we look for
1544 # "$browser/x.y.z"
1545 6466 ▶ if ( !defined($major) and defined( $self->{browser_string} ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $major and defined $self->{"browser_string"}) 2400 4066 6466
Condition100%3/3
not defined $major and defined $self->{"browser_string"}
!ll&&!rl&&r
31179492400
MC/DC100%2/2
not defined $major and defined $self->{"browser_string"}
not defined $major defined $self->{"browser_string"}
Truth table100%3/3
not(A) and B
A= not defined $majorB= defined $self->{"browser_string"}
ABresult
0X0
100
111
1546 2400 my $version_index = index( $ua, lc "$self->{browser_string}/" );
1547 2400 ▶ if ( $version_index != -1 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($version_index != -1) 2196 204 2400
1548 2196 my $version_str
1549 = substr( $ua, $version_index + length($browser) );
1550 2196 ▶ if ( $version_str =~ m{/(\d+)\.(\d+)([\w.]*)} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($version_str =~ m[/(\d+)\.(\d+)([\w.]*)]) 2178 18 2196
1551 2178 $major = $1;
1552 2178 $minor = $2;
1553 2178 $beta = $3;
1554 }
1555 }
1556 }
1557  
1558 # If that didn't work, we try "Version/x.y.z"
1559 6466 ▶ if ( !defined($major) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $major) 1171 5295 6466
1560 1171 ▶ if ( $ua =~ m{version/(\d+)\.(\d+)([\w.]*)} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ua =~ m[version/(\d+)\.(\d+)([\w.]*)]) 24 1147 1171
1561 24 $major = $1;
1562 24 $minor = $2;
1563 24 $beta = $3;
1564 }
1565 }
1566  
1567 # If that didn't work, we start guessing. Just grab
1568 # anything after a word and a slash.
1569 6466 ▶ if ( !defined($major) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $major) 1147 5319 6466
1570  
1571 1147 ( $major, $minor, $beta ) = (
1572 $ua =~ m{
1573 \S+ # Greedily catch anything leading up to forward slash.
1574 \/ # Version starts with a slash
1575 [A-Za-z]* # Eat any letters before the major version
1576 ( [0-9]+ ) # Major version number is everything before the first dot
1577 \. # The first dot
1578 ([\d]* ) # Minor version number is every digit after the first dot
1579 # Throw away remaining numbers and dots
1580 ( [^\s]* ) # Beta version string is up to next space
1581 }x
1582 );
1583 }
1584  
1585 # If that didn't work, try even more generic.
1586 6466 ▶ if ( !defined($major) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $major) 327 6139 6466
1587  
1588 327 ▶ if ( $ua =~ /[A-Za-z]+\/(\d+)\;/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ua =~ m[[A-Za-z]+/(\d+)\;]) 0 327 327
1589 0 $major = $1;
1590 0 $minor = 0;
1591 }
1592 }
1593  
1594 # If that didn't work, give up.
1595 6466 ▶ $major = 0 if !$major;
Branch: 1 branch
BranchTrueFalseTotal
unless $major 482 5984 6466
1596 6466 ▶ $minor = 0 if !$minor;
Branch: 1 branch
BranchTrueFalseTotal
unless $minor 4476 1990 6466
1597 6466 ▶ $beta = undef if ( defined($beta) && $beta eq '' );
Branch: 1 branch
BranchTrueFalseTotal
if defined $beta and $beta eq "" 2759 3707 6466
Condition100%3/3
defined $beta and $beta eq ""
!ll&&!rl&&r
70829992759
MC/DC100%2/2
defined $beta and $beta eq ""
defined $beta $beta eq ""
Truth table100%3/3
A and B
A= defined $betaB= $beta eq ""
ABresult
0X0
100
111
1598  
1599 # Now set version tests
1600  
1601 6466 ▶ if ( $browser_tests->{netscape} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($browser_tests->{"netscape"}) 168 6298 6466
1602  
1603 # Netscape browsers
1604 168 ▶ $version_tests->{nav2} = 1 if $major == 2;
Branch: 1 branch
BranchTrueFalseTotal
if $major == 2 12 156 168
1605 168 ▶ $version_tests->{nav3} = 1 if $major == 3;
Branch: 1 branch
BranchTrueFalseTotal
if $major == 3 18 150 168
1606 168 ▶ $version_tests->{nav4} = 1 if $major == 4;
Branch: 1 branch
BranchTrueFalseTotal
if $major == 4 24 144 168
1607 168 ▶ $version_tests->{nav4up} = 1 if $major >= 4;
Branch: 1 branch
BranchTrueFalseTotal
if $major >= 4 114 54 168
1608 168 ▶ $version_tests->{nav45} = 1 if $major == 4 && $minor == 5;
Branch: 1 branch
BranchTrueFalseTotal
if $major == 4 and $minor == 5 6 162 168
Condition100%3/3
$major == 4 and $minor == 5
!ll&&!rl&&r
144186
MC/DC100%2/2
$major == 4 and $minor == 5
$major == 4 $minor == 5
Truth table100%3/3
A and B
A= $major == 4B= $minor == 5
ABresult
0X0
100
111
1609 168 ▶ $version_tests->{nav45up} = 1
Branch: 1 branch
BranchTrueFalseTotal
if $major == 4 and ".$minor" >= "0.5" or $major >= 5 96 72 168
Condition100%6/6
$major == 4 and ".$minor" >= "0.5" or $major >= 5
l!l&&r!l&&!r
69072
$major == 4 and ".$minor" >= "0.5"
!ll&&!rl&&r
144186
MC/DC100%3/3
$major == 4 and ".$minor" >= "0.5" or $major >= 5
$major == 4 ".$minor" >= "0.5" $major >= 5
Truth table80%4/5
A and B or C
A= $major == 4B= ".$minor" >= "0.5"C= $major >= 5
ABCresult
11X1
0X11
1011
0X00
1000
1610 if ( $major == 4 && ".$minor" >= .5 )
1611 || $major >= 5;
1612 168 ▶ $version_tests->{navgold} = 1
Branch: 1 branch
BranchTrueFalseTotal
if defined $beta and (index($beta, "gold") != -1) 6 162 168
Condition100%3/3
defined $beta and (index($beta, "gold") != -1)
!ll&&!rl&&r
150126
MC/DC100%2/2
defined $beta and (index($beta, "gold") != -1)
defined $beta (index($beta, "gold") != -1)
Truth table100%3/3
A and B
A= defined $betaB= (index($beta, "gold") != -1)
ABresult
0X0
100
111
1613 if defined($beta) && ( index( $beta, "gold" ) != -1 );
1614 168 ▶ $version_tests->{nav6} = 1
Branch: 1 branch
BranchTrueFalseTotal
if $major == 5 or $major == 6 84 84 168
Condition100%3/3
$major == 5 or $major == 6
l!l&&r!l&&!r
78684
MC/DC100%2/2
$major == 5 or $major == 6
$major == 5 $major == 6
Truth table100%3/3
A or B
A= $major == 5B= $major == 6
ABresult
1X1
011
000
1615 if ( $major == 5 || $major == 6 ); # go figure
1616 168 ▶ $version_tests->{nav6up} = 1 if $major >= 5;
Branch: 1 branch
BranchTrueFalseTotal
if $major >= 5 90 78 168
1617  
1618 168 ▶ if ( $browser eq 'seamonkey' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($browser eq "seamonkey") 6 162 168
1619  
1620 # Ugh, seamonkey versions started back at 1.
1621 6 $version_tests->{nav2} = 0;
1622 6 $version_tests->{nav4up} = 1;
1623 6 $version_tests->{nav45up} = 1;
1624 6 $version_tests->{nav6} = 1;
1625 6 $version_tests->{nav6up} = 1;
1626 }
1627 }
1628  
1629 6466 ▶ if ( $browser_tests->{ie} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($browser_tests->{"ie"}) 1702 4764 6466
1630 1702 ▶ $version_tests->{ie3} = 1 if ( $major == 3 );
Branch: 1 branch
BranchTrueFalseTotal
if $major == 3 24 1678 1702
1631 1702 ▶ $version_tests->{ie4} = 1 if ( $major == 4 );
Branch: 1 branch
BranchTrueFalseTotal
if $major == 4 36 1666 1702
1632 1702 ▶ $version_tests->{ie4up} = 1 if ( $major >= 4 );
Branch: 1 branch
BranchTrueFalseTotal
if $major >= 4 1666 36 1702
1633 1702 ▶ $version_tests->{ie5} = 1 if ( $major == 5 );
Branch: 1 branch
BranchTrueFalseTotal
if $major == 5 72 1630 1702
1634 1702 ▶ $version_tests->{ie5up} = 1 if ( $major >= 5 );
Branch: 1 branch
BranchTrueFalseTotal
if $major >= 5 1630 72 1702
1635 1702 ▶ $version_tests->{ie55} = 1 if ( $major == 5 && $minor == 5 );
Branch: 1 branch
BranchTrueFalseTotal
if $major == 5 and $minor == 5 24 1678 1702
Condition100%3/3
$major == 5 and $minor == 5
!ll&&!rl&&r
16304824
MC/DC100%2/2
$major == 5 and $minor == 5
$major == 5 $minor == 5
Truth table100%3/3
A and B
A= $major == 5B= $minor == 5
ABresult
0X0
100
111
1636 1702 ▶ $version_tests->{ie55up} = 1 if ( ".$minor" >= .5 || $major >= 6 );
Branch: 1 branch
BranchTrueFalseTotal
if ".$minor" >= "0.5" or $major >= 6 1582 120 1702
Condition100%3/3
".$minor" >= "0.5" or $major >= 6
l!l&&r!l&&!r
301552120
MC/DC100%2/2
".$minor" >= "0.5" or $major >= 6
".$minor" >= "0.5" $major >= 6
Truth table100%3/3
A or B
A= ".$minor" >= "0.5"B= $major >= 6
ABresult
1X1
011
000
1637 1702 ▶ $version_tests->{ie6} = 1 if ( $major == 6 );
Branch: 1 branch
BranchTrueFalseTotal
if $major == 6 382 1320 1702
1638 1702 ▶ $version_tests->{ie7} = 1 if ( $major == 7 );
Branch: 1 branch
BranchTrueFalseTotal
if $major == 7 316 1386 1702
1639 1702 ▶ $version_tests->{ie8} = 1 if ( $major == 8 );
Branch: 1 branch
BranchTrueFalseTotal
if $major == 8 605 1097 1702
1640 1702 ▶ $version_tests->{ie9} = 1 if ( $major == 9 );
Branch: 1 branch
BranchTrueFalseTotal
if $major == 9 112 1590 1702
1641 1702 ▶ $version_tests->{ie10} = 1 if ( $major == 10 );
Branch: 1 branch
BranchTrueFalseTotal
if $major == 10 65 1637 1702
1642 1702 ▶ $version_tests->{ie11} = 1 if ( $major == 11 );
Branch: 1 branch
BranchTrueFalseTotal
if $major == 11 72 1630 1702
1643  
1644 $version_tests->{ie_compat_mode}
1645 = ( $version_tests->{ie7}
1646 && $tests->{trident}
1647 1702 ▶ && $self->{engine_version} + 0 >= 4 );
Condition100%6/6
$version_tests->{'ie7'} && $tests->{'trident'} && $self->{'engine_version'} + 0 >= 4
!ll&&!rl&&r
1624672
$version_tests->{"ie7"} and $tests->{"trident"}
!ll&&!rl&&r
138623878
MC/DC100%3/3
$version_tests->{'ie7'} && $tests->{'trident'} && $self->{'engine_version'} + 0 >= 4
$version_tests->{"ie7"} $tests->{"trident"} $self->{'engine_version'} + 0 >= 4
Truth table100%4/4
A and B && C
A= $version_tests->{"ie7"}B= $tests->{"trident"}C= $self->{'engine_version'} + 0 >= 4
ABCresult
0XX0
10X0
1100
1111
1648 }
1649  
1650 6466 ▶ if ( $browser_tests->{aol} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($browser_tests->{"aol"}) 42 6424 6466
1651 $version_tests->{aol3} = 1
1652 if ( index( $ua, "aol 3.0" ) != -1
1653 42 ▶ || $version_tests->{ie3} );
Branch: 1 branch
BranchTrueFalseTotal
if index($ua, "aol 3.0") != -1 or $version_tests->{"ie3"} 6 36 42
Condition66%2/3
index($ua, "aol 3.0") != -1 or $version_tests->{"ie3"}
l!l&&r!l&&!r
6036
MC/DC50%1/2
index($ua, "aol 3.0") != -1 or $version_tests->{"ie3"}
index($ua, "aol 3.0") != -1 $version_tests->{"ie3"}
Truth table66%2/3
A or B
A= index($ua, "aol 3.0") != -1B= $version_tests->{"ie3"}
ABresult
1X1
011
000
1654 $version_tests->{aol4} = 1
1655 if ( index( $ua, "aol 4.0" ) != -1 )
1656 42 ▶ || $version_tests->{ie4};
Branch: 1 branch
BranchTrueFalseTotal
if (index($ua, "aol 4.0") != -1) or $version_tests->{"ie4"} 0 42 42
Condition33%1/3
(index($ua, "aol 4.0") != -1) or $version_tests->{"ie4"}
l!l&&r!l&&!r
0042
MC/DC0%0/2
(index($ua, "aol 4.0") != -1) or $version_tests->{"ie4"}
(index($ua, "aol 4.0") != -1) $version_tests->{"ie4"}
Truth table33%1/3
A or B
A= (index($ua, "aol 4.0") != -1)B= $version_tests->{"ie4"}
ABresult
1X1
011
000
1657 42 ▶ $version_tests->{aol5} = 1 if index( $ua, "aol 5.0" ) != -1;
Branch: 1 branch
BranchTrueFalseTotal
if index($ua, "aol 5.0") != -1 0 42 42
1658 42 ▶ $version_tests->{aol6} = 1 if index( $ua, "aol 6.0" ) != -1;
Branch: 1 branch
BranchTrueFalseTotal
if index($ua, "aol 6.0") != -1 6 36 42
1659 42 ▶ $version_tests->{aoltv} = 1 if index( $ua, "navio" ) != -1;
Branch: 1 branch
BranchTrueFalseTotal
if index($ua, "navio") != -1 0 42 42
1660 }
1661  
1662 6466 ▶ if ( $browser_tests->{opera} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($browser_tests->{"opera"}) 214 6252 6466
1663 214 ▶ $version_tests->{opera3} = 1
Branch: 1 branch
BranchTrueFalseTotal
if index($ua, "opera 3") != -1 or index($ua, "opera/3") != -1 6 208 214
Condition66%2/3
index($ua, "opera 3") != -1 or index($ua, "opera/3") != -1
l!l&&r!l&&!r
06208
MC/DC50%1/2
index($ua, "opera 3") != -1 or index($ua, "opera/3") != -1
index($ua, "opera 3") != -1 index($ua, "opera/3") != -1
Truth table66%2/3
A or B
A= index($ua, "opera 3") != -1B= index($ua, "opera/3") != -1
ABresult
1X1
011
000
1664 if index( $ua, "opera 3" ) != -1 || index( $ua, "opera/3" ) != -1;
1665 214 ▶ $version_tests->{opera4} = 1
Branch: 1 branch
BranchTrueFalseTotal
if (index($ua, "opera 4") != -1) or index($ua, "opera/4") != -1 and (index($ua, "nintendo dsi") == -1) 0 214 214
Condition50%3/6
(index($ua, "opera 4") != -1) or index($ua, "opera/4") != -1 and (index($ua, "nintendo dsi") == -1)
l!l&&r!l&&!r
00214
index($ua, "opera/4") != -1 and (index($ua, "nintendo dsi") == -1)
!ll&&!rl&&r
20950
MC/DC0%0/3
(index($ua, "opera 4") != -1) or index($ua, "opera/4") != -1 and (index($ua, "nintendo dsi") == -1)
(index($ua, "opera 4") != -1) index($ua, "opera/4") != -1 (index($ua, "nintendo dsi") == -1)
Truth table25%1/4
A or B and C
A= (index($ua, "opera 4") != -1)B= index($ua, "opera/4") != -1C= (index($ua, "nintendo dsi") == -1)
ABCresult
1XX1
0111
00X0
0100
1666 if ( index( $ua, "opera 4" ) != -1 )
1667 || ( index( $ua, "opera/4" ) != -1
1668 && ( index( $ua, "nintendo dsi" ) == -1 ) );
1669 214 ▶ $version_tests->{opera5} = 1
Branch: 1 branch
BranchTrueFalseTotal
if (index($ua, "opera 5") != -1) or (index($ua, "opera/5") != -1) 0 214 214
Condition33%1/3
(index($ua, "opera 5") != -1) or (index($ua, "opera/5") != -1)
l!l&&r!l&&!r
00214
MC/DC0%0/2
(index($ua, "opera 5") != -1) or (index($ua, "opera/5") != -1)
(index($ua, "opera 5") != -1) (index($ua, "opera/5") != -1)
Truth table33%1/3
A or B
A= (index($ua, "opera 5") != -1)B= (index($ua, "opera/5") != -1)
ABresult
1X1
011
000
1670 if ( index( $ua, "opera 5" ) != -1 )
1671 || ( index( $ua, "opera/5" ) != -1 );
1672 214 ▶ $version_tests->{opera6} = 1
Branch: 1 branch
BranchTrueFalseTotal
if (index($ua, "opera 6") != -1) or (index($ua, "opera/6") != -1) 12 202 214
Condition66%2/3
(index($ua, "opera 6") != -1) or (index($ua, "opera/6") != -1)
l!l&&r!l&&!r
120202
MC/DC50%1/2
(index($ua, "opera 6") != -1) or (index($ua, "opera/6") != -1)
(index($ua, "opera 6") != -1) (index($ua, "opera/6") != -1)
Truth table66%2/3
A or B
A= (index($ua, "opera 6") != -1)B= (index($ua, "opera/6") != -1)
ABresult
1X1
011
000
1673 if ( index( $ua, "opera 6" ) != -1 )
1674 || ( index( $ua, "opera/6" ) != -1 );
1675 214 ▶ $version_tests->{opera7} = 1
Branch: 1 branch
BranchTrueFalseTotal
if (index($ua, "opera 7") != -1) or (index($ua, "opera/7") != -1) 30 184 214
Condition100%3/3
(index($ua, "opera 7") != -1) or (index($ua, "opera/7") != -1)
l!l&&r!l&&!r
1812184
MC/DC100%2/2
(index($ua, "opera 7") != -1) or (index($ua, "opera/7") != -1)
(index($ua, "opera 7") != -1) (index($ua, "opera/7") != -1)
Truth table100%3/3
A or B
A= (index($ua, "opera 7") != -1)B= (index($ua, "opera/7") != -1)
ABresult
1X1
011
000
1676 if ( index( $ua, "opera 7" ) != -1 )
1677 || ( index( $ua, "opera/7" ) != -1 );
1678  
1679 }
1680  
1681 6466 $minor = ".$minor";
1682  
1683 6466 $self->{major} = $major;
1684 6466 $self->{minor} = $minor;
1685 6466 $self->{beta} = $beta;
1686 }
1687  
1688 ### Device tests, only run on demand
1689  
1690 sub _init_device {
1691 6947 ▶ my ($self) = @_;
Subroutine _init_device: called CC=128 SCAR=51.3
1692  
1693 6947 my $ua = lc $self->{user_agent};
1694 6947 my $browser_tests = $self->{browser_tests};
1695 6947 my $tests = $self->{tests};
1696  
1697 6947 my ( $device, $device_string );
1698 6947 my $device_tests = $self->{device_tests} = {};
1699  
1700 6947 ▶ if ( index( $ua, "windows phone" ) != -1 ) {
Branch: 17 branches
BranchTrueFalseTotal
if (index($ua, 'windows phone') != -1) { } 53 6894 6947
elsif (index($ua, 'android') != -1) { } 877 6017 6894
elsif (index($ua, 'blackberry') != -1 or index($ua, 'bb10') != -1 or index($ua, 'rim tablet os') != -1) { } 41 5976 6017
elsif (index($ua, 'ipod') != -1) { } 18 5958 5976
elsif (index($ua, 'ipad') != -1) { } 152 5806 5958
elsif (index($ua, 'iphone') != -1) { } 165 5641 5806
elsif (index($ua, 'webos') != -1) { } 4 5637 5641
elsif (index($ua, 'kindle') != -1) { } 12 5625 5637
elsif (index($ua, 'audrey') != -1) { } 0 5625 5625
elsif (index($ua, 'i-opener') != -1) { } 0 5625 5625
elsif (index($ua, 'avantgo') != -1) { } 0 5625 5625
elsif (index($ua, 'palmos') != -1) { } 0 5625 5625
elsif (index($ua, 'playstation 3') != -1) { } 6 5619 5625
elsif (index($ua, 'playstation portable') != -1) { } 6 5613 5619
elsif (index($ua, 'nintendo dsi') != -1) { } 6 5607 5613
elsif (index($ua, 'nintendo 3ds') != -1) { } 5 5602 5607
elsif ($browser_tests->{'obigo'} or index($ua, 'up.browser') != -1 or index($ua, 'nokia') != -1 and index($ua, 'windows phone') == -1 or index($ua, 'alcatel') != -1 or index($ua, 'ericsson') != -1 or index($ua, 'sie-') == 0 or index($ua, 'wmlib') != -1 or index($ua, ' wap') != -1 or index($ua, 'wap ') != -1 or index($ua, 'wap/') != -1 or index($ua, '-wap') != -1 or index($ua, 'wap-') != -1 or index($ua, 'wap') == 0 or index($ua, 'wapper') != -1 or index($ua, 'zetor') != -1) { } 115 5487 5602
1701 53 $device = 'winphone';
1702  
1703 # Test is set in _init_os()
1704 }
1705 elsif ( index( $ua, "android" ) != -1 ) {
1706 877 $device = 'android';
1707 877 $device_tests->{$device} = 1;
1708 }
1709 ▶ elsif (index( $ua, "blackberry" ) != -1
Condition100%6/6
index($ua, "blackberry") != -1 or index($ua, "bb10") != -1 or index($ua, "rim tablet os") != -1
l!l&&r!l&&!r
3565976
index($ua, "blackberry") != -1 or index($ua, "bb10") != -1
l!l&&r!l&&!r
23125982
MC/DC100%3/3
index($ua, "blackberry") != -1 or index($ua, "bb10") != -1 or index($ua, "rim tablet os") != -1
index($ua, "blackberry") != -1 index($ua, "bb10") != -1 index($ua, "rim tablet os") != -1
Truth table100%4/4
A or B or C
A= index($ua, "blackberry") != -1B= index($ua, "bb10") != -1C= index($ua, "rim tablet os") != -1
ABCresult
1XX1
01X1
0011
0000
1710 || index( $ua, "bb10" ) != -1
1711 || index( $ua, "rim tablet os" ) != -1 ) {
1712 41 $device = 'blackberry';
1713 41 $device_tests->{$device} = 1;
1714 }
1715 elsif ( index( $ua, "ipod" ) != -1 ) {
1716 18 $device = 'ipod';
1717 18 $device_tests->{$device} = 1;
1718 }
1719 elsif ( index( $ua, "ipad" ) != -1 ) {
1720 152 $device = 'ipad';
1721 152 $device_tests->{$device} = 1;
1722 }
1723 elsif ( index( $ua, "iphone" ) != -1 ) {
1724 165 $device = 'iphone';
1725 165 $device_tests->{$device} = 1;
1726 }
1727 elsif ( index( $ua, "webos" ) != -1 ) {
1728 4 $device = 'webos';
1729 4 $device_tests->{$device} = 1;
1730 }
1731 elsif ( index( $ua, "kindle" ) != -1 ) {
1732 12 $device = 'kindle';
1733 12 $device_tests->{$device} = 1;
1734 }
1735 elsif ( index( $ua, "audrey" ) != -1 ) {
1736 0 $device = 'audrey';
1737 0 $device_tests->{$device} = 1;
1738 }
1739 elsif ( index( $ua, "i-opener" ) != -1 ) {
1740 0 $device = 'iopener';
1741 0 $device_tests->{$device} = 1;
1742 }
1743 elsif ( index( $ua, "avantgo" ) != -1 ) {
1744 0 $device = 'avantgo';
1745 0 $device_tests->{$device} = 1;
1746 0 $device_tests->{palm} = 1;
1747 }
1748 elsif ( index( $ua, "palmos" ) != -1 ) {
1749 0 $device = 'palm';
1750 0 $device_tests->{$device} = 1;
1751 }
1752 elsif ( index( $ua, "playstation 3" ) != -1 ) {
1753 6 $device = 'ps3';
1754 6 $device_tests->{$device} = 1;
1755 }
1756 elsif ( index( $ua, "playstation portable" ) != -1 ) {
1757 6 $device = 'psp';
1758 6 $device_tests->{$device} = 1;
1759 }
1760 elsif ( index( $ua, "nintendo dsi" ) != -1 ) {
1761 6 $device = 'dsi';
1762 6 $device_tests->{$device} = 1;
1763 }
1764 elsif ( index( $ua, "nintendo 3ds" ) != -1 ) {
1765 5 $device = 'n3ds';
1766 5 $device_tests->{$device} = 1;
1767 }
1768 ▶ elsif (
Condition80%36/45
$browser_tests->{"obigo"} or index($ua, "up.browser") != -1 or index($ua, "nokia") != -1 and index($ua, "windows phone") == -1 or index($ua, "alcatel") != -1 or index($ua, "ericsson") != -1 or index($ua, "sie-") == 0 or index($ua, "wmlib") != -1 or index($ua, " wap") != -1 or index($ua, "wap ") != -1 or index($ua, "wap/") != -1 or index($ua, "-wap") != -1 or index($ua, "wap-") != -1 or index($ua, "wap") == 0 or index($ua, "wapper") != -1 or index($ua, "zetor") != -1
l!l&&r!l&&!r
11505487
$browser_tests->{"obigo"} or index($ua, "up.browser") != -1 or index($ua, "nokia") != -1 and index($ua, "windows phone") == -1 or index($ua, "alcatel") != -1 or index($ua, "ericsson") != -1 or index($ua, "sie-") == 0 or index($ua, "wmlib") != -1 or index($ua, " wap") != -1 or index($ua, "wap ") != -1 or index($ua, "wap/") != -1 or index($ua, "-wap") != -1 or index($ua, "wap-") != -1 or index($ua, "wap") == 0 or index($ua, "wapper") != -1
l!l&&r!l&&!r
11505487
$browser_tests->{"obigo"} or index($ua, "up.browser") != -1 or index($ua, "nokia") != -1 and index($ua, "windows phone") == -1 or index($ua, "alcatel") != -1 or index($ua, "ericsson") != -1 or index($ua, "sie-") == 0 or index($ua, "wmlib") != -1 or index($ua, " wap") != -1 or index($ua, "wap ") != -1 or index($ua, "wap/") != -1 or index($ua, "-wap") != -1 or index($ua, "wap-") != -1 or index($ua, "wap") == 0
l!l&&r!l&&!r
10965487
$browser_tests->{"obigo"} or index($ua, "up.browser") != -1 or index($ua, "nokia") != -1 and index($ua, "windows phone") == -1 or index($ua, "alcatel") != -1 or index($ua, "ericsson") != -1 or index($ua, "sie-") == 0 or index($ua, "wmlib") != -1 or index($ua, " wap") != -1 or index($ua, "wap ") != -1 or index($ua, "wap/") != -1 or index($ua, "-wap") != -1 or index($ua, "wap-") != -1
l!l&&r!l&&!r
10905493
$browser_tests->{"obigo"} or index($ua, "up.browser") != -1 or index($ua, "nokia") != -1 and index($ua, "windows phone") == -1 or index($ua, "alcatel") != -1 or index($ua, "ericsson") != -1 or index($ua, "sie-") == 0 or index($ua, "wmlib") != -1 or index($ua, " wap") != -1 or index($ua, "wap ") != -1 or index($ua, "wap/") != -1 or index($ua, "-wap") != -1
l!l&&r!l&&!r
10905493
$browser_tests->{"obigo"} or index($ua, "up.browser") != -1 or index($ua, "nokia") != -1 and index($ua, "windows phone") == -1 or index($ua, "alcatel") != -1 or index($ua, "ericsson") != -1 or index($ua, "sie-") == 0 or index($ua, "wmlib") != -1 or index($ua, " wap") != -1 or index($ua, "wap ") != -1 or index($ua, "wap/") != -1
l!l&&r!l&&!r
10365493
$browser_tests->{"obigo"} or index($ua, "up.browser") != -1 or index($ua, "nokia") != -1 and index($ua, "windows phone") == -1 or index($ua, "alcatel") != -1 or index($ua, "ericsson") != -1 or index($ua, "sie-") == 0 or index($ua, "wmlib") != -1 or index($ua, " wap") != -1 or index($ua, "wap ") != -1
l!l&&r!l&&!r
10305499
$browser_tests->{"obigo"} or index($ua, "up.browser") != -1 or index($ua, "nokia") != -1 and index($ua, "windows phone") == -1 or index($ua, "alcatel") != -1 or index($ua, "ericsson") != -1 or index($ua, "sie-") == 0 or index($ua, "wmlib") != -1 or index($ua, " wap") != -1
l!l&&r!l&&!r
9765499
$browser_tests->{"obigo"} or index($ua, "up.browser") != -1 or index($ua, "nokia") != -1 and index($ua, "windows phone") == -1 or index($ua, "alcatel") != -1 or index($ua, "ericsson") != -1 or index($ua, "sie-") == 0 or index($ua, "wmlib") != -1
l!l&&r!l&&!r
9705505
$browser_tests->{"obigo"} or index($ua, "up.browser") != -1 or index($ua, "nokia") != -1 and index($ua, "windows phone") == -1 or index($ua, "alcatel") != -1 or index($ua, "ericsson") != -1 or index($ua, "sie-") == 0
l!l&&r!l&&!r
9705505
$browser_tests->{"obigo"} or index($ua, "up.browser") != -1 or index($ua, "nokia") != -1 and index($ua, "windows phone") == -1 or index($ua, "alcatel") != -1 or index($ua, "ericsson") != -1
l!l&&r!l&&!r
85125505
$browser_tests->{"obigo"} or index($ua, "up.browser") != -1 or index($ua, "nokia") != -1 and index($ua, "windows phone") == -1 or index($ua, "alcatel") != -1
l!l&&r!l&&!r
8505517
$browser_tests->{"obigo"} or index($ua, "up.browser") != -1 or index($ua, "nokia") != -1 and index($ua, "windows phone") == -1
l!l&&r!l&&!r
39465517
$browser_tests->{"obigo"} or index($ua, "up.browser") != -1
l!l&&r!l&&!r
28115563
index($ua, "nokia") != -1 and index($ua, "windows phone") == -1
!ll&&!rl&&r
5517046
MC/DC43%7/16
$browser_tests->{"obigo"} or index($ua, "up.browser") != -1 or index($ua, "nokia") != -1 and index($ua, "windows phone") == -1 or index($ua, "alcatel") != -1 or index($ua, "ericsson") != -1 or index($ua, "sie-") == 0 or index($ua, "wmlib") != -1 or index($ua, " wap") != -1 or index($ua, "wap ") != -1 or index($ua, "wap/") != -1 or index($ua, "-wap") != -1 or index($ua, "wap-") != -1 or index($ua, "wap") == 0 or index($ua, "wapper") != -1 or index($ua, "zetor") != -1
$browser_tests->{"obigo"} index($ua, "up.browser") != -1 index($ua, "nokia") != -1 index($ua, "windows phone") == -1 index($ua, "alcatel") != -1 index($ua, "ericsson") != -1 index($ua, "sie-") == 0 index($ua, "wmlib") != -1 index($ua, " wap") != -1 index($ua, "wap ") != -1 index($ua, "wap/") != -1 index($ua, "-wap") != -1 index($ua, "wap-") != -1 index($ua, "wap") == 0 index($ua, "wapper") != -1 index($ua, "zetor") != -1
Truth table27%8/29
A or B or C and D or E or F or G or H or I or J or K or L or M or N or O or P
A= $browser_tests->{"obigo"}B= index($ua, "up.browser") != -1C= index($ua, "nokia") != -1D= index($ua, "windows phone") == -1E= index($ua, "alcatel") != -1F= index($ua, "ericsson") != -1G= index($ua, "sie-") == 0H= index($ua, "wmlib") != -1I= index($ua, " wap") != -1J= index($ua, "wap ") != -1K= index($ua, "wap/") != -1L= index($ua, "-wap") != -1M= index($ua, "wap-") != -1N= index($ua, "wap") == 0O= index($ua, "wapper") != -1P= index($ua, "zetor") != -1
ABCDEFGHIJKLMNOPresult
1XXXXXXXXXXXXXXX1
01XXXXXXXXXXXXXX1
0011XXXXXXXXXXXX1
000X1XXXXXXXXXXX1
00101XXXXXXXXXXX1
000X01XXXXXXXXXX1
001001XXXXXXXXXX1
000X001XXXXXXXXX1
0010001XXXXXXXXX1
000X0001XXXXXXXX1
00100001XXXXXXXX1
000X00001XXXXXXX1
001000001XXXXXXX1
000X000001XXXXXX1
0010000001XXXXXX1
000X0000001XXXXX1
00100000001XXXXX1
000X00000001XXXX1
001000000001XXXX1
000X000000001XXX1
0010000000001XXX1
000X0000000001XX1
00100000000001XX1
000X00000000001X1
001000000000001X1
000X0000000000011
00100000000000011
000X0000000000000
00100000000000000
1769 $browser_tests->{obigo}
1770 || index( $ua, "up.browser" ) != -1
1771 || ( index( $ua, "nokia" ) != -1
1772 && index( $ua, "windows phone" ) == -1 )
1773 || index( $ua, "alcatel" ) != -1
1774 || index( $ua, "ericsson" ) != -1
1775 || index( $ua, "sie-" ) == 0
1776 || index( $ua, "wmlib" ) != -1
1777 || index( $ua, " wap" ) != -1
1778 || index( $ua, "wap " ) != -1
1779 || index( $ua, "wap/" ) != -1
1780 || index( $ua, "-wap" ) != -1
1781 || index( $ua, "wap-" ) != -1
1782 || index( $ua, "wap" ) == 0
1783 || index( $ua, "wapper" ) != -1
1784 || index( $ua, "zetor" ) != -1
1785 ) {
1786 115 $device = 'wap';
1787 115 $device_tests->{$device} = 1;
1788 }
1789  
1790 $device_tests->{mobile} = (
1791 ( $browser_tests->{firefox} && index( $ua, "mobile" ) != -1 )
1792 || ( $browser_tests->{ie}
1793 && index( $ua, "windows phone" ) == -1
1794 && index( $ua, "arm" ) != -1 )
1795 || index( $ua, "windows phone" ) != -1
1796 || index( $ua, "up.browser" ) != -1
1797 || index( $ua, "nokia" ) != -1
1798 || index( $ua, "alcatel" ) != -1
1799 || index( $ua, "ericsson" ) != -1
1800 || index( $ua, "sie-" ) == 0
1801 || index( $ua, "wmlib" ) != -1
1802 || index( $ua, " wap" ) != -1
1803 || index( $ua, "wap " ) != -1
1804 || index( $ua, "wap/" ) != -1
1805 || index( $ua, "-wap" ) != -1
1806 || index( $ua, "wap-" ) != -1
1807 || index( $ua, "wap" ) == 0
1808 || index( $ua, "wapper" ) != -1
1809 || index( $ua, "blackberry" ) != -1
1810 || index( $ua, "iemobile" ) != -1
1811 || index( $ua, "palm" ) != -1
1812 || index( $ua, "smartphone" ) != -1
1813 || index( $ua, "windows ce" ) != -1
1814 || index( $ua, "palmsource" ) != -1
1815 || index( $ua, "iphone" ) != -1
1816 || index( $ua, "ipod" ) != -1
1817 || index( $ua, "ipad" ) != -1
1818 || ( index( $ua, "opera mini" ) != -1
1819 && index( $ua, "tablet" ) == -1 )
1820 || index( $ua, "htc_" ) != -1
1821 || index( $ua, "symbian" ) != -1
1822 || index( $ua, "webos" ) != -1
1823 || index( $ua, "samsung" ) != -1
1824 || index( $ua, "samsung" ) != -1
1825 || index( $ua, "zetor" ) != -1
1826 || index( $ua, "android" ) != -1
1827 || index( $ua, "symbos" ) != -1
1828 || index( $ua, "opera mobi" ) != -1
1829 || index( $ua, "fennec" ) != -1
1830 || index( $ua, "obigo" ) != -1
1831 || index( $ua, "opera tablet" ) != -1
1832 || index( $ua, "rim tablet" ) != -1
1833 || ( index( $ua, "bb10" ) != -1
1834 && index( $ua, "mobile" ) != -1 )
1835 || $device_tests->{psp}
1836 || $device_tests->{dsi}
1837 6947 ▶ || $device_tests->{'n3ds'}
Condition88%132/150
$browser_tests->{'firefox'} && index($ua, 'mobile') != -1 || $browser_tests->{'ie'} && index($ua, 'windows phone') == -1 && index($ua, 'arm') != -1 || index($ua, 'windows phone') != -1 || index($ua, 'up.browser') != -1 || index($ua, 'nokia') != -1 || index($ua, 'alcatel') != -1 || index($ua, 'ericsson') != -1 || index($ua, 'sie-') == 0 || index($ua, 'wmlib') != -1 || index($ua, ' wap') != -1 || index($ua, 'wap ') != -1 || index($ua, 'wap/') != -1 || index($ua, '-wap') != -1 || index($ua, 'wap-') != -1 || index($ua, 'wap') == 0 || index($ua, 'wapper') != -1 || index($ua, 'blackberry') != -1 || index($ua, 'iemobile') != -1 || index($ua, 'palm') != -1 || index($ua, 'smartphone') != -1 || index($ua, 'windows ce') != -1 || index($ua, 'palmsource') != -1 || index($ua, 'iphone') != -1 || index($ua, 'ipod') != -1 || index($ua, 'ipad') != -1 || index($ua, 'opera mini') != -1 && index($ua, 'tablet') == -1 || index($ua, 'htc_') != -1 || index($ua, 'symbian') != -1 || index($ua, 'webos') != -1 || index($ua, 'samsung') != -1 || index($ua, 'samsung') != -1 || index($ua, 'zetor') != -1 || index($ua, 'android') != -1 || index($ua, 'symbos') != -1 || index($ua, 'opera mobi') != -1 || index($ua, 'fennec') != -1 || index($ua, 'obigo') != -1 || index($ua, 'opera tablet') != -1 || index($ua, 'rim tablet') != -1 || index($ua, 'bb10') != -1 && index($ua, 'mobile') != -1 || $device_tests->{'psp'} || $device_tests->{'dsi'} || $device_tests->{'n3ds'} || index($ua, 'googlebot-mobile') != -1 || index($ua, 'msnbot-mobile') != -1 || index($ua, 'bingbot-mobile') != -1
l!l&&r!l&&!r
152205425
$browser_tests->{"firefox"} and index($ua, "mobile") != -1 or $browser_tests->{"ie"} and index($ua, "windows phone") == -1 and index($ua, "arm") != -1 or index($ua, "windows phone") != -1 or index($ua, "up.browser") != -1 or index($ua, "nokia") != -1 or index($ua, "alcatel") != -1 or index($ua, "ericsson") != -1 or index($ua, "sie-") == 0 or index($ua, "wmlib") != -1 or index($ua, " wap") != -1 or index($ua, "wap ") != -1 or index($ua, "wap/") != -1 or index($ua, "-wap") != -1 or index($ua, "wap-") != -1 or index($ua, "wap") == 0 or index($ua, "wapper") != -1 or index($ua, "blackberry") != -1 or index($ua, "iemobile") != -1 or index($ua, "palm") != -1 or index($ua, "smartphone") != -1 or index($ua, "windows ce") != -1 or index($ua, "palmsource") != -1 or index($ua, "iphone") != -1 or index($ua, "ipod") != -1 or index($ua, "ipad") != -1 or index($ua, "opera mini") != -1 and index($ua, "tablet") == -1 or index($ua, "htc_") != -1 or index($ua, "symbian") != -1 or index($ua, "webos") != -1 or index($ua, "samsung") != -1 or index($ua, "samsung") != -1 or index($ua, "zetor") != -1 or index($ua, "android") != -1 or index($ua, "symbos") != -1 or index($ua, "opera mobi") != -1 or index($ua, "fennec") != -1 or index($ua, "obigo") != -1 or index($ua, "opera tablet") != -1 or index($ua, "rim tablet") != -1 or index($ua, "bb10") != -1 and index($ua, "mobile") != -1 or $device_tests->{"psp"} or $device_tests->{"dsi"} or $device_tests->{"n3ds"} or index($ua, "googlebot-mobile") != -1 or index($ua, "msnbot-mobile") != -1
l!l&&r!l&&!r
152205425
$browser_tests->{"firefox"} and index($ua, "mobile") != -1 or $browser_tests->{"ie"} and index($ua, "windows phone") == -1 and index($ua, "arm") != -1 or index($ua, "windows phone") != -1 or index($ua, "up.browser") != -1 or index($ua, "nokia") != -1 or index($ua, "alcatel") != -1 or index($ua, "ericsson") != -1 or index($ua, "sie-") == 0 or index($ua, "wmlib") != -1 or index($ua, " wap") != -1 or index($ua, "wap ") != -1 or index($ua, "wap/") != -1 or index($ua, "-wap") != -1 or index($ua, "wap-") != -1 or index($ua, "wap") == 0 or index($ua, "wapper") != -1 or index($ua, "blackberry") != -1 or index($ua, "iemobile") != -1 or index($ua, "palm") != -1 or index($ua, "smartphone") != -1 or index($ua, "windows ce") != -1 or index($ua, "palmsource") != -1 or index($ua, "iphone") != -1 or index($ua, "ipod") != -1 or index($ua, "ipad") != -1 or index($ua, "opera mini") != -1 and index($ua, "tablet") == -1 or index($ua, "htc_") != -1 or index($ua, "symbian") != -1 or index($ua, "webos") != -1 or index($ua, "samsung") != -1 or index($ua, "samsung") != -1 or index($ua, "zetor") != -1 or index($ua, "android") != -1 or index($ua, "symbos") != -1 or index($ua, "opera mobi") != -1 or index($ua, "fennec") != -1 or index($ua, "obigo") != -1 or index($ua, "opera tablet") != -1 or index($ua, "rim tablet") != -1 or index($ua, "bb10") != -1 and index($ua, "mobile") != -1 or $device_tests->{"psp"} or $device_tests->{"dsi"} or $device_tests->{"n3ds"} or index($ua, "googlebot-mobile") != -1
l!l&&r!l&&!r
151575425
$browser_tests->{"firefox"} and index($ua, "mobile") != -1 or $browser_tests->{"ie"} and index($ua, "windows phone") == -1 and index($ua, "arm") != -1 or index($ua, "windows phone") != -1 or index($ua, "up.browser") != -1 or index($ua, "nokia") != -1 or index($ua, "alcatel") != -1 or index($ua, "ericsson") != -1 or index($ua, "sie-") == 0 or index($ua, "wmlib") != -1 or index($ua, " wap") != -1 or index($ua, "wap ") != -1 or index($ua, "wap/") != -1 or index($ua, "-wap") != -1 or index($ua, "wap-") != -1 or index($ua, "wap") == 0 or index($ua, "wapper") != -1 or index($ua, "blackberry") != -1 or index($ua, "iemobile") != -1 or index($ua, "palm") != -1 or index($ua, "smartphone") != -1 or index($ua, "windows ce") != -1 or index($ua, "palmsource") != -1 or index($ua, "iphone") != -1 or index($ua, "ipod") != -1 or index($ua, "ipad") != -1 or index($ua, "opera mini") != -1 and index($ua, "tablet") == -1 or index($ua, "htc_") != -1 or index($ua, "symbian") != -1 or index($ua, "webos") != -1 or index($ua, "samsung") != -1 or index($ua, "samsung") != -1 or index($ua, "zetor") != -1 or index($ua, "android") != -1 or index($ua, "symbos") != -1 or index($ua, "opera mobi") != -1 or index($ua, "fennec") != -1 or index($ua, "obigo") != -1 or index($ua, "opera tablet") != -1 or index($ua, "rim tablet") != -1 or index($ua, "bb10") != -1 and index($ua, "mobile") != -1 or $device_tests->{"psp"} or $device_tests->{"dsi"} or $device_tests->{"n3ds"}
l!l&&r!l&&!r
151055432
$browser_tests->{"firefox"} and index($ua, "mobile") != -1 or $browser_tests->{"ie"} and index($ua, "windows phone") == -1 and index($ua, "arm") != -1 or index($ua, "windows phone") != -1 or index($ua, "up.browser") != -1 or index($ua, "nokia") != -1 or index($ua, "alcatel") != -1 or index($ua, "ericsson") != -1 or index($ua, "sie-") == 0 or index($ua, "wmlib") != -1 or index($ua, " wap") != -1 or index($ua, "wap ") != -1 or index($ua, "wap/") != -1 or index($ua, "-wap") != -1 or index($ua, "wap-") != -1 or index($ua, "wap") == 0 or index($ua, "wapper") != -1 or index($ua, "blackberry") != -1 or index($ua, "iemobile") != -1 or index($ua, "palm") != -1 or index($ua, "smartphone") != -1 or index($ua, "windows ce") != -1 or index($ua, "palmsource") != -1 or index($ua, "iphone") != -1 or index($ua, "ipod") != -1 or index($ua, "ipad") != -1 or index($ua, "opera mini") != -1 and index($ua, "tablet") == -1 or index($ua, "htc_") != -1 or index($ua, "symbian") != -1 or index($ua, "webos") != -1 or index($ua, "samsung") != -1 or index($ua, "samsung") != -1 or index($ua, "zetor") != -1 or index($ua, "android") != -1 or index($ua, "symbos") != -1 or index($ua, "opera mobi") != -1 or index($ua, "fennec") != -1 or index($ua, "obigo") != -1 or index($ua, "opera tablet") != -1 or index($ua, "rim tablet") != -1 or index($ua, "bb10") != -1 and index($ua, "mobile") != -1 or $device_tests->{"psp"} or $device_tests->{"dsi"}
l!l&&r!l&&!r
150465437
$browser_tests->{"firefox"} and index($ua, "mobile") != -1 or $browser_tests->{"ie"} and index($ua, "windows phone") == -1 and index($ua, "arm") != -1 or index($ua, "windows phone") != -1 or index($ua, "up.browser") != -1 or index($ua, "nokia") != -1 or index($ua, "alcatel") != -1 or index($ua, "ericsson") != -1 or index($ua, "sie-") == 0 or index($ua, "wmlib") != -1 or index($ua, " wap") != -1 or index($ua, "wap ") != -1 or index($ua, "wap/") != -1 or index($ua, "-wap") != -1 or index($ua, "wap-") != -1 or index($ua, "wap") == 0 or index($ua, "wapper") != -1 or index($ua, "blackberry") != -1 or index($ua, "iemobile") != -1 or index($ua, "palm") != -1 or index($ua, "smartphone") != -1 or index($ua, "windows ce") != -1 or index($ua, "palmsource") != -1 or index($ua, "iphone") != -1 or index($ua, "ipod") != -1 or index($ua, "ipad") != -1 or index($ua, "opera mini") != -1 and index($ua, "tablet") == -1 or index($ua, "htc_") != -1 or index($ua, "symbian") != -1 or index($ua, "webos") != -1 or index($ua, "samsung") != -1 or index($ua, "samsung") != -1 or index($ua, "zetor") != -1 or index($ua, "android") != -1 or index($ua, "symbos") != -1 or index($ua, "opera mobi") != -1 or index($ua, "fennec") != -1 or index($ua, "obigo") != -1 or index($ua, "opera tablet") != -1 or index($ua, "rim tablet") != -1 or index($ua, "bb10") != -1 and index($ua, "mobile") != -1 or $device_tests->{"psp"}
l!l&&r!l&&!r
149865443
$browser_tests->{"firefox"} and index($ua, "mobile") != -1 or $browser_tests->{"ie"} and index($ua, "windows phone") == -1 and index($ua, "arm") != -1 or index($ua, "windows phone") != -1 or index($ua, "up.browser") != -1 or index($ua, "nokia") != -1 or index($ua, "alcatel") != -1 or index($ua, "ericsson") != -1 or index($ua, "sie-") == 0 or index($ua, "wmlib") != -1 or index($ua, " wap") != -1 or index($ua, "wap ") != -1 or index($ua, "wap/") != -1 or index($ua, "-wap") != -1 or index($ua, "wap-") != -1 or index($ua, "wap") == 0 or index($ua, "wapper") != -1 or index($ua, "blackberry") != -1 or index($ua, "iemobile") != -1 or index($ua, "palm") != -1 or index($ua, "smartphone") != -1 or index($ua, "windows ce") != -1 or index($ua, "palmsource") != -1 or index($ua, "iphone") != -1 or index($ua, "ipod") != -1 or index($ua, "ipad") != -1 or index($ua, "opera mini") != -1 and index($ua, "tablet") == -1 or index($ua, "htc_") != -1 or index($ua, "symbian") != -1 or index($ua, "webos") != -1 or index($ua, "samsung") != -1 or index($ua, "samsung") != -1 or index($ua, "zetor") != -1 or index($ua, "android") != -1 or index($ua, "symbos") != -1 or index($ua, "opera mobi") != -1 or index($ua, "fennec") != -1 or index($ua, "obigo") != -1 or index($ua, "opera tablet") != -1 or index($ua, "rim tablet") != -1 or index($ua, "bb10") != -1 and index($ua, "mobile") != -1
l!l&&r!l&&!r
1486125449
$browser_tests->{"firefox"} and index($ua, "mobile") != -1 or $browser_tests->{"ie"} and index($ua, "windows phone") == -1 and index($ua, "arm") != -1 or index($ua, "windows phone") != -1 or index($ua, "up.browser") != -1 or index($ua, "nokia") != -1 or index($ua, "alcatel") != -1 or index($ua, "ericsson") != -1 or index($ua, "sie-") == 0 or index($ua, "wmlib") != -1 or index($ua, " wap") != -1 or index($ua, "wap ") != -1 or index($ua, "wap/") != -1 or index($ua, "-wap") != -1 or index($ua, "wap-") != -1 or index($ua, "wap") == 0 or index($ua, "wapper") != -1 or index($ua, "blackberry") != -1 or index($ua, "iemobile") != -1 or index($ua, "palm") != -1 or index($ua, "smartphone") != -1 or index($ua, "windows ce") != -1 or index($ua, "palmsource") != -1 or index($ua, "iphone") != -1 or index($ua, "ipod") != -1 or index($ua, "ipad") != -1 or index($ua, "opera mini") != -1 and index($ua, "tablet") == -1 or index($ua, "htc_") != -1 or index($ua, "symbian") != -1 or index($ua, "webos") != -1 or index($ua, "samsung") != -1 or index($ua, "samsung") != -1 or index($ua, "zetor") != -1 or index($ua, "android") != -1 or index($ua, "symbos") != -1 or index($ua, "opera mobi") != -1 or index($ua, "fennec") != -1 or index($ua, "obigo") != -1 or index($ua, "opera tablet") != -1 or index($ua, "rim tablet") != -1
l!l&&r!l&&!r
148065461
$browser_tests->{"firefox"} and index($ua, "mobile") != -1 or $browser_tests->{"ie"} and index($ua, "windows phone") == -1 and index($ua, "arm") != -1 or index($ua, "windows phone") != -1 or index($ua, "up.browser") != -1 or index($ua, "nokia") != -1 or index($ua, "alcatel") != -1 or index($ua, "ericsson") != -1 or index($ua, "sie-") == 0 or index($ua, "wmlib") != -1 or index($ua, " wap") != -1 or index($ua, "wap ") != -1 or index($ua, "wap/") != -1 or index($ua, "-wap") != -1 or index($ua, "wap-") != -1 or index($ua, "wap") == 0 or index($ua, "wapper") != -1 or index($ua, "blackberry") != -1 or index($ua, "iemobile") != -1 or index($ua, "palm") != -1 or index($ua, "smartphone") != -1 or index($ua, "windows ce") != -1 or index($ua, "palmsource") != -1 or index($ua, "iphone") != -1 or index($ua, "ipod") != -1 or index($ua, "ipad") != -1 or index($ua, "opera mini") != -1 and index($ua, "tablet") == -1 or index($ua, "htc_") != -1 or index($ua, "symbian") != -1 or index($ua, "webos") != -1 or index($ua, "samsung") != -1 or index($ua, "samsung") != -1 or index($ua, "zetor") != -1 or index($ua, "android") != -1 or index($ua, "symbos") != -1 or index($ua, "opera mobi") != -1 or index($ua, "fennec") != -1 or index($ua, "obigo") != -1 or index($ua, "opera tablet") != -1
l!l&&r!l&&!r
147375467
$browser_tests->{"firefox"} and index($ua, "mobile") != -1 or $browser_tests->{"ie"} and index($ua, "windows phone") == -1 and index($ua, "arm") != -1 or index($ua, "windows phone") != -1 or index($ua, "up.browser") != -1 or index($ua, "nokia") != -1 or index($ua, "alcatel") != -1 or index($ua, "ericsson") != -1 or index($ua, "sie-") == 0 or index($ua, "wmlib") != -1 or index($ua, " wap") != -1 or index($ua, "wap ") != -1 or index($ua, "wap/") != -1 or index($ua, "-wap") != -1 or index($ua, "wap-") != -1 or index($ua, "wap") == 0 or index($ua, "wapper") != -1 or index($ua, "blackberry") != -1 or index($ua, "iemobile") != -1 or index($ua, "palm") != -1 or index($ua, "smartphone") != -1 or index($ua, "windows ce") != -1 or index($ua, "palmsource") != -1 or index($ua, "iphone") != -1 or index($ua, "ipod") != -1 or index($ua, "ipad") != -1 or index($ua, "opera mini") != -1 and index($ua, "tablet") == -1 or index($ua, "htc_") != -1 or index($ua, "symbian") != -1 or index($ua, "webos") != -1 or index($ua, "samsung") != -1 or index($ua, "samsung") != -1 or index($ua, "zetor") != -1 or index($ua, "android") != -1 or index($ua, "symbos") != -1 or index($ua, "opera mobi") != -1 or index($ua, "fennec") != -1 or index($ua, "obigo") != -1
l!l&&r!l&&!r
1451225474
$browser_tests->{"firefox"} and index($ua, "mobile") != -1 or $browser_tests->{"ie"} and index($ua, "windows phone") == -1 and index($ua, "arm") != -1 or index($ua, "windows phone") != -1 or index($ua, "up.browser") != -1 or index($ua, "nokia") != -1 or index($ua, "alcatel") != -1 or index($ua, "ericsson") != -1 or index($ua, "sie-") == 0 or index($ua, "wmlib") != -1 or index($ua, " wap") != -1 or index($ua, "wap ") != -1 or index($ua, "wap/") != -1 or index($ua, "-wap") != -1 or index($ua, "wap-") != -1 or index($ua, "wap") == 0 or index($ua, "wapper") != -1 or index($ua, "blackberry") != -1 or index($ua, "iemobile") != -1 or index($ua, "palm") != -1 or index($ua, "smartphone") != -1 or index($ua, "windows ce") != -1 or index($ua, "palmsource") != -1 or index($ua, "iphone") != -1 or index($ua, "ipod") != -1 or index($ua, "ipad") != -1 or index($ua, "opera mini") != -1 and index($ua, "tablet") == -1 or index($ua, "htc_") != -1 or index($ua, "symbian") != -1 or index($ua, "webos") != -1 or index($ua, "samsung") != -1 or index($ua, "samsung") != -1 or index($ua, "zetor") != -1 or index($ua, "android") != -1 or index($ua, "symbos") != -1 or index($ua, "opera mobi") != -1 or index($ua, "fennec") != -1
l!l&&r!l&&!r
144565496
$browser_tests->{"firefox"} and index($ua, "mobile") != -1 or $browser_tests->{"ie"} and index($ua, "windows phone") == -1 and index($ua, "arm") != -1 or index($ua, "windows phone") != -1 or index($ua, "up.browser") != -1 or index($ua, "nokia") != -1 or index($ua, "alcatel") != -1 or index($ua, "ericsson") != -1 or index($ua, "sie-") == 0 or index($ua, "wmlib") != -1 or index($ua, " wap") != -1 or index($ua, "wap ") != -1 or index($ua, "wap/") != -1 or index($ua, "-wap") != -1 or index($ua, "wap-") != -1 or index($ua, "wap") == 0 or index($ua, "wapper") != -1 or index($ua, "blackberry") != -1 or index($ua, "iemobile") != -1 or index($ua, "palm") != -1 or index($ua, "smartphone") != -1 or index($ua, "windows ce") != -1 or index($ua, "palmsource") != -1 or index($ua, "iphone") != -1 or index($ua, "ipod") != -1 or index($ua, "ipad") != -1 or index($ua, "opera mini") != -1 and index($ua, "tablet") == -1 or index($ua, "htc_") != -1 or index($ua, "symbian") != -1 or index($ua, "webos") != -1 or index($ua, "samsung") != -1 or index($ua, "samsung") != -1 or index($ua, "zetor") != -1 or index($ua, "android") != -1 or index($ua, "symbos") != -1 or index($ua, "opera mobi") != -1
l!l&&r!l&&!r
144505502
$browser_tests->{"firefox"} and index($ua, "mobile") != -1 or $browser_tests->{"ie"} and index($ua, "windows phone") == -1 and index($ua, "arm") != -1 or index($ua, "windows phone") != -1 or index($ua, "up.browser") != -1 or index($ua, "nokia") != -1 or index($ua, "alcatel") != -1 or index($ua, "ericsson") != -1 or index($ua, "sie-") == 0 or index($ua, "wmlib") != -1 or index($ua, " wap") != -1 or index($ua, "wap ") != -1 or index($ua, "wap/") != -1 or index($ua, "-wap") != -1 or index($ua, "wap-") != -1 or index($ua, "wap") == 0 or index($ua, "wapper") != -1 or index($ua, "blackberry") != -1 or index($ua, "iemobile") != -1 or index($ua, "palm") != -1 or index($ua, "smartphone") != -1 or index($ua, "windows ce") != -1 or index($ua, "palmsource") != -1 or index($ua, "iphone") != -1 or index($ua, "ipod") != -1 or index($ua, "ipad") != -1 or index($ua, "opera mini") != -1 and index($ua, "tablet") == -1 or index($ua, "htc_") != -1 or index($ua, "symbian") != -1 or index($ua, "webos") != -1 or index($ua, "samsung") != -1 or index($ua, "samsung") != -1 or index($ua, "zetor") != -1 or index($ua, "android") != -1 or index($ua, "symbos") != -1
l!l&&r!l&&!r
143965502
$browser_tests->{"firefox"} and index($ua, "mobile") != -1 or $browser_tests->{"ie"} and index($ua, "windows phone") == -1 and index($ua, "arm") != -1 or index($ua, "windows phone") != -1 or index($ua, "up.browser") != -1 or index($ua, "nokia") != -1 or index($ua, "alcatel") != -1 or index($ua, "ericsson") != -1 or index($ua, "sie-") == 0 or index($ua, "wmlib") != -1 or index($ua, " wap") != -1 or index($ua, "wap ") != -1 or index($ua, "wap/") != -1 or index($ua, "-wap") != -1 or index($ua, "wap-") != -1 or index($ua, "wap") == 0 or index($ua, "wapper") != -1 or index($ua, "blackberry") != -1 or index($ua, "iemobile") != -1 or index($ua, "palm") != -1 or index($ua, "smartphone") != -1 or index($ua, "windows ce") != -1 or index($ua, "palmsource") != -1 or index($ua, "iphone") != -1 or index($ua, "ipod") != -1 or index($ua, "ipad") != -1 or index($ua, "opera mini") != -1 and index($ua, "tablet") == -1 or index($ua, "htc_") != -1 or index($ua, "symbian") != -1 or index($ua, "webos") != -1 or index($ua, "samsung") != -1 or index($ua, "samsung") != -1 or index($ua, "zetor") != -1 or index($ua, "android") != -1
l!l&&r!l&&!r
7017385508
$browser_tests->{"firefox"} and index($ua, "mobile") != -1 or $browser_tests->{"ie"} and index($ua, "windows phone") == -1 and index($ua, "arm") != -1 or index($ua, "windows phone") != -1 or index($ua, "up.browser") != -1 or index($ua, "nokia") != -1 or index($ua, "alcatel") != -1 or index($ua, "ericsson") != -1 or index($ua, "sie-") == 0 or index($ua, "wmlib") != -1 or index($ua, " wap") != -1 or index($ua, "wap ") != -1 or index($ua, "wap/") != -1 or index($ua, "-wap") != -1 or index($ua, "wap-") != -1 or index($ua, "wap") == 0 or index($ua, "wapper") != -1 or index($ua, "blackberry") != -1 or index($ua, "iemobile") != -1 or index($ua, "palm") != -1 or index($ua, "smartphone") != -1 or index($ua, "windows ce") != -1 or index($ua, "palmsource") != -1 or index($ua, "iphone") != -1 or index($ua, "ipod") != -1 or index($ua, "ipad") != -1 or index($ua, "opera mini") != -1 and index($ua, "tablet") == -1 or index($ua, "htc_") != -1 or index($ua, "symbian") != -1 or index($ua, "webos") != -1 or index($ua, "samsung") != -1 or index($ua, "samsung") != -1 or index($ua, "zetor") != -1
l!l&&r!l&&!r
70106246
$browser_tests->{"firefox"} and index($ua, "mobile") != -1 or $browser_tests->{"ie"} and index($ua, "windows phone") == -1 and index($ua, "arm") != -1 or index($ua, "windows phone") != -1 or index($ua, "up.browser") != -1 or index($ua, "nokia") != -1 or index($ua, "alcatel") != -1 or index($ua, "ericsson") != -1 or index($ua, "sie-") == 0 or index($ua, "wmlib") != -1 or index($ua, " wap") != -1 or index($ua, "wap ") != -1 or index($ua, "wap/") != -1 or index($ua, "-wap") != -1 or index($ua, "wap-") != -1 or index($ua, "wap") == 0 or index($ua, "wapper") != -1 or index($ua, "blackberry") != -1 or index($ua, "iemobile") != -1 or index($ua, "palm") != -1 or index($ua, "smartphone") != -1 or index($ua, "windows ce") != -1 or index($ua, "palmsource") != -1 or index($ua, "iphone") != -1 or index($ua, "ipod") != -1 or index($ua, "ipad") != -1 or index($ua, "opera mini") != -1 and index($ua, "tablet") == -1 or index($ua, "htc_") != -1 or index($ua, "symbian") != -1 or index($ua, "webos") != -1 or index($ua, "samsung") != -1 or index($ua, "samsung") != -1
l!l&&r!l&&!r
70106246
$browser_tests->{"firefox"} and index($ua, "mobile") != -1 or $browser_tests->{"ie"} and index($ua, "windows phone") == -1 and index($ua, "arm") != -1 or index($ua, "windows phone") != -1 or index($ua, "up.browser") != -1 or index($ua, "nokia") != -1 or index($ua, "alcatel") != -1 or index($ua, "ericsson") != -1 or index($ua, "sie-") == 0 or index($ua, "wmlib") != -1 or index($ua, " wap") != -1 or index($ua, "wap ") != -1 or index($ua, "wap/") != -1 or index($ua, "-wap") != -1 or index($ua, "wap-") != -1 or index($ua, "wap") == 0 or index($ua, "wapper") != -1 or index($ua, "blackberry") != -1 or index($ua, "iemobile") != -1 or index($ua, "palm") != -1 or index($ua, "smartphone") != -1 or index($ua, "windows ce") != -1 or index($ua, "palmsource") != -1 or index($ua, "iphone") != -1 or index($ua, "ipod") != -1 or index($ua, "ipad") != -1 or index($ua, "opera mini") != -1 and index($ua, "tablet") == -1 or index($ua, "htc_") != -1 or index($ua, "symbian") != -1 or index($ua, "webos") != -1 or index($ua, "samsung") != -1
l!l&&r!l&&!r
5971046246
$browser_tests->{"firefox"} and index($ua, "mobile") != -1 or $browser_tests->{"ie"} and index($ua, "windows phone") == -1 and index($ua, "arm") != -1 or index($ua, "windows phone") != -1 or index($ua, "up.browser") != -1 or index($ua, "nokia") != -1 or index($ua, "alcatel") != -1 or index($ua, "ericsson") != -1 or index($ua, "sie-") == 0 or index($ua, "wmlib") != -1 or index($ua, " wap") != -1 or index($ua, "wap ") != -1 or index($ua, "wap/") != -1 or index($ua, "-wap") != -1 or index($ua, "wap-") != -1 or index($ua, "wap") == 0 or index($ua, "wapper") != -1 or index($ua, "blackberry") != -1 or index($ua, "iemobile") != -1 or index($ua, "palm") != -1 or index($ua, "smartphone") != -1 or index($ua, "windows ce") != -1 or index($ua, "palmsource") != -1 or index($ua, "iphone") != -1 or index($ua, "ipod") != -1 or index($ua, "ipad") != -1 or index($ua, "opera mini") != -1 and index($ua, "tablet") == -1 or index($ua, "htc_") != -1 or index($ua, "symbian") != -1 or index($ua, "webos") != -1
l!l&&r!l&&!r
59346350
$browser_tests->{"firefox"} and index($ua, "mobile") != -1 or $browser_tests->{"ie"} and index($ua, "windows phone") == -1 and index($ua, "arm") != -1 or index($ua, "windows phone") != -1 or index($ua, "up.browser") != -1 or index($ua, "nokia") != -1 or index($ua, "alcatel") != -1 or index($ua, "ericsson") != -1 or index($ua, "sie-") == 0 or index($ua, "wmlib") != -1 or index($ua, " wap") != -1 or index($ua, "wap ") != -1 or index($ua, "wap/") != -1 or index($ua, "-wap") != -1 or index($ua, "wap-") != -1 or index($ua, "wap") == 0 or index($ua, "wapper") != -1 or index($ua, "blackberry") != -1 or index($ua, "iemobile") != -1 or index($ua, "palm") != -1 or index($ua, "smartphone") != -1 or index($ua, "windows ce") != -1 or index($ua, "palmsource") != -1 or index($ua, "iphone") != -1 or index($ua, "ipod") != -1 or index($ua, "ipad") != -1 or index($ua, "opera mini") != -1 and index($ua, "tablet") == -1 or index($ua, "htc_") != -1 or index($ua, "symbian") != -1
l!l&&r!l&&!r
58946354
$browser_tests->{"firefox"} and index($ua, "mobile") != -1 or $browser_tests->{"ie"} and index($ua, "windows phone") == -1 and index($ua, "arm") != -1 or index($ua, "windows phone") != -1 or index($ua, "up.browser") != -1 or index($ua, "nokia") != -1 or index($ua, "alcatel") != -1 or index($ua, "ericsson") != -1 or index($ua, "sie-") == 0 or index($ua, "wmlib") != -1 or index($ua, " wap") != -1 or index($ua, "wap ") != -1 or index($ua, "wap/") != -1 or index($ua, "-wap") != -1 or index($ua, "wap-") != -1 or index($ua, "wap") == 0 or index($ua, "wapper") != -1 or index($ua, "blackberry") != -1 or index($ua, "iemobile") != -1 or index($ua, "palm") != -1 or index($ua, "smartphone") != -1 or index($ua, "windows ce") != -1 or index($ua, "palmsource") != -1 or index($ua, "iphone") != -1 or index($ua, "ipod") != -1 or index($ua, "ipad") != -1 or index($ua, "opera mini") != -1 and index($ua, "tablet") == -1 or index($ua, "htc_") != -1
l!l&&r!l&&!r
58906358
$browser_tests->{"firefox"} and index($ua, "mobile") != -1 or $browser_tests->{"ie"} and index($ua, "windows phone") == -1 and index($ua, "arm") != -1 or index($ua, "windows phone") != -1 or index($ua, "up.browser") != -1 or index($ua, "nokia") != -1 or index($ua, "alcatel") != -1 or index($ua, "ericsson") != -1 or index($ua, "sie-") == 0 or index($ua, "wmlib") != -1 or index($ua, " wap") != -1 or index($ua, "wap ") != -1 or index($ua, "wap/") != -1 or index($ua, "-wap") != -1 or index($ua, "wap-") != -1 or index($ua, "wap") == 0 or index($ua, "wapper") != -1 or index($ua, "blackberry") != -1 or index($ua, "iemobile") != -1 or index($ua, "palm") != -1 or index($ua, "smartphone") != -1 or index($ua, "windows ce") != -1 or index($ua, "palmsource") != -1 or index($ua, "iphone") != -1 or index($ua, "ipod") != -1 or index($ua, "ipad") != -1 or index($ua, "opera mini") != -1 and index($ua, "tablet") == -1
l!l&&r!l&&!r
541486358
$browser_tests->{"firefox"} and index($ua, "mobile") != -1 or $browser_tests->{"ie"} and index($ua, "windows phone") == -1 and index($ua, "arm") != -1 or index($ua, "windows phone") != -1 or index($ua, "up.browser") != -1 or index($ua, "nokia") != -1 or index($ua, "alcatel") != -1 or index($ua, "ericsson") != -1 or index($ua, "sie-") == 0 or index($ua, "wmlib") != -1 or index($ua, " wap") != -1 or index($ua, "wap ") != -1 or index($ua, "wap/") != -1 or index($ua, "-wap") != -1 or index($ua, "wap-") != -1 or index($ua, "wap") == 0 or index($ua, "wapper") != -1 or index($ua, "blackberry") != -1 or index($ua, "iemobile") != -1 or index($ua, "palm") != -1 or index($ua, "smartphone") != -1 or index($ua, "windows ce") != -1 or index($ua, "palmsource") != -1 or index($ua, "iphone") != -1 or index($ua, "ipod") != -1 or index($ua, "ipad") != -1
l!l&&r!l&&!r
4011406406
$browser_tests->{"firefox"} and index($ua, "mobile") != -1 or $browser_tests->{"ie"} and index($ua, "windows phone") == -1 and index($ua, "arm") != -1 or index($ua, "windows phone") != -1 or index($ua, "up.browser") != -1 or index($ua, "nokia") != -1 or index($ua, "alcatel") != -1 or index($ua, "ericsson") != -1 or index($ua, "sie-") == 0 or index($ua, "wmlib") != -1 or index($ua, " wap") != -1 or index($ua, "wap ") != -1 or index($ua, "wap/") != -1 or index($ua, "-wap") != -1 or index($ua, "wap-") != -1 or index($ua, "wap") == 0 or index($ua, "wapper") != -1 or index($ua, "blackberry") != -1 or index($ua, "iemobile") != -1 or index($ua, "palm") != -1 or index($ua, "smartphone") != -1 or index($ua, "windows ce") != -1 or index($ua, "palmsource") != -1 or index($ua, "iphone") != -1 or index($ua, "ipod") != -1
l!l&&r!l&&!r
40106546
$browser_tests->{"firefox"} and index($ua, "mobile") != -1 or $browser_tests->{"ie"} and index($ua, "windows phone") == -1 and index($ua, "arm") != -1 or index($ua, "windows phone") != -1 or index($ua, "up.browser") != -1 or index($ua, "nokia") != -1 or index($ua, "alcatel") != -1 or index($ua, "ericsson") != -1 or index($ua, "sie-") == 0 or index($ua, "wmlib") != -1 or index($ua, " wap") != -1 or index($ua, "wap ") != -1 or index($ua, "wap/") != -1 or index($ua, "-wap") != -1 or index($ua, "wap-") != -1 or index($ua, "wap") == 0 or index($ua, "wapper") != -1 or index($ua, "blackberry") != -1 or index($ua, "iemobile") != -1 or index($ua, "palm") != -1 or index($ua, "smartphone") != -1 or index($ua, "windows ce") != -1 or index($ua, "palmsource") != -1 or index($ua, "iphone") != -1
l!l&&r!l&&!r
2061956546
$browser_tests->{"firefox"} and index($ua, "mobile") != -1 or $browser_tests->{"ie"} and index($ua, "windows phone") == -1 and index($ua, "arm") != -1 or index($ua, "windows phone") != -1 or index($ua, "up.browser") != -1 or index($ua, "nokia") != -1 or index($ua, "alcatel") != -1 or index($ua, "ericsson") != -1 or index($ua, "sie-") == 0 or index($ua, "wmlib") != -1 or index($ua, " wap") != -1 or index($ua, "wap ") != -1 or index($ua, "wap/") != -1 or index($ua, "-wap") != -1 or index($ua, "wap-") != -1 or index($ua, "wap") == 0 or index($ua, "wapper") != -1 or index($ua, "blackberry") != -1 or index($ua, "iemobile") != -1 or index($ua, "palm") != -1 or index($ua, "smartphone") != -1 or index($ua, "windows ce") != -1 or index($ua, "palmsource") != -1
l!l&&r!l&&!r
20606741
$browser_tests->{"firefox"} and index($ua, "mobile") != -1 or $browser_tests->{"ie"} and index($ua, "windows phone") == -1 and index($ua, "arm") != -1 or index($ua, "windows phone") != -1 or index($ua, "up.browser") != -1 or index($ua, "nokia") != -1 or index($ua, "alcatel") != -1 or index($ua, "ericsson") != -1 or index($ua, "sie-") == 0 or index($ua, "wmlib") != -1 or index($ua, " wap") != -1 or index($ua, "wap ") != -1 or index($ua, "wap/") != -1 or index($ua, "-wap") != -1 or index($ua, "wap-") != -1 or index($ua, "wap") == 0 or index($ua, "wapper") != -1 or index($ua, "blackberry") != -1 or index($ua, "iemobile") != -1 or index($ua, "palm") != -1 or index($ua, "smartphone") != -1 or index($ua, "windows ce") != -1
l!l&&r!l&&!r
20066741
$browser_tests->{"firefox"} and index($ua, "mobile") != -1 or $browser_tests->{"ie"} and index($ua, "windows phone") == -1 and index($ua, "arm") != -1 or index($ua, "windows phone") != -1 or index($ua, "up.browser") != -1 or index($ua, "nokia") != -1 or index($ua, "alcatel") != -1 or index($ua, "ericsson") != -1 or index($ua, "sie-") == 0 or index($ua, "wmlib") != -1 or index($ua, " wap") != -1 or index($ua, "wap ") != -1 or index($ua, "wap/") != -1 or index($ua, "-wap") != -1 or index($ua, "wap-") != -1 or index($ua, "wap") == 0 or index($ua, "wapper") != -1 or index($ua, "blackberry") != -1 or index($ua, "iemobile") != -1 or index($ua, "palm") != -1 or index($ua, "smartphone") != -1
l!l&&r!l&&!r
19466747
$browser_tests->{"firefox"} and index($ua, "mobile") != -1 or $browser_tests->{"ie"} and index($ua, "windows phone") == -1 and index($ua, "arm") != -1 or index($ua, "windows phone") != -1 or index($ua, "up.browser") != -1 or index($ua, "nokia") != -1 or index($ua, "alcatel") != -1 or index($ua, "ericsson") != -1 or index($ua, "sie-") == 0 or index($ua, "wmlib") != -1 or index($ua, " wap") != -1 or index($ua, "wap ") != -1 or index($ua, "wap/") != -1 or index($ua, "-wap") != -1 or index($ua, "wap-") != -1 or index($ua, "wap") == 0 or index($ua, "wapper") != -1 or index($ua, "blackberry") != -1 or index($ua, "iemobile") != -1 or index($ua, "palm") != -1
l!l&&r!l&&!r
19406753
$browser_tests->{"firefox"} and index($ua, "mobile") != -1 or $browser_tests->{"ie"} and index($ua, "windows phone") == -1 and index($ua, "arm") != -1 or index($ua, "windows phone") != -1 or index($ua, "up.browser") != -1 or index($ua, "nokia") != -1 or index($ua, "alcatel") != -1 or index($ua, "ericsson") != -1 or index($ua, "sie-") == 0 or index($ua, "wmlib") != -1 or index($ua, " wap") != -1 or index($ua, "wap ") != -1 or index($ua, "wap/") != -1 or index($ua, "-wap") != -1 or index($ua, "wap-") != -1 or index($ua, "wap") == 0 or index($ua, "wapper") != -1 or index($ua, "blackberry") != -1 or index($ua, "iemobile") != -1
l!l&&r!l&&!r
19406753
$browser_tests->{"firefox"} and index($ua, "mobile") != -1 or $browser_tests->{"ie"} and index($ua, "windows phone") == -1 and index($ua, "arm") != -1 or index($ua, "windows phone") != -1 or index($ua, "up.browser") != -1 or index($ua, "nokia") != -1 or index($ua, "alcatel") != -1 or index($ua, "ericsson") != -1 or index($ua, "sie-") == 0 or index($ua, "wmlib") != -1 or index($ua, " wap") != -1 or index($ua, "wap ") != -1 or index($ua, "wap/") != -1 or index($ua, "-wap") != -1 or index($ua, "wap-") != -1 or index($ua, "wap") == 0 or index($ua, "wapper") != -1 or index($ua, "blackberry") != -1
l!l&&r!l&&!r
171236753
$browser_tests->{"firefox"} and index($ua, "mobile") != -1 or $browser_tests->{"ie"} and index($ua, "windows phone") == -1 and index($ua, "arm") != -1 or index($ua, "windows phone") != -1 or index($ua, "up.browser") != -1 or index($ua, "nokia") != -1 or index($ua, "alcatel") != -1 or index($ua, "ericsson") != -1 or index($ua, "sie-") == 0 or index($ua, "wmlib") != -1 or index($ua, " wap") != -1 or index($ua, "wap ") != -1 or index($ua, "wap/") != -1 or index($ua, "-wap") != -1 or index($ua, "wap-") != -1 or index($ua, "wap") == 0 or index($ua, "wapper") != -1
l!l&&r!l&&!r
17106776
$browser_tests->{"firefox"} and index($ua, "mobile") != -1 or $browser_tests->{"ie"} and index($ua, "windows phone") == -1 and index($ua, "arm") != -1 or index($ua, "windows phone") != -1 or index($ua, "up.browser") != -1 or index($ua, "nokia") != -1 or index($ua, "alcatel") != -1 or index($ua, "ericsson") != -1 or index($ua, "sie-") == 0 or index($ua, "wmlib") != -1 or index($ua, " wap") != -1 or index($ua, "wap ") != -1 or index($ua, "wap/") != -1 or index($ua, "-wap") != -1 or index($ua, "wap-") != -1 or index($ua, "wap") == 0
l!l&&r!l&&!r
16566776
$browser_tests->{"firefox"} and index($ua, "mobile") != -1 or $browser_tests->{"ie"} and index($ua, "windows phone") == -1 and index($ua, "arm") != -1 or index($ua, "windows phone") != -1 or index($ua, "up.browser") != -1 or index($ua, "nokia") != -1 or index($ua, "alcatel") != -1 or index($ua, "ericsson") != -1 or index($ua, "sie-") == 0 or index($ua, "wmlib") != -1 or index($ua, " wap") != -1 or index($ua, "wap ") != -1 or index($ua, "wap/") != -1 or index($ua, "-wap") != -1 or index($ua, "wap-") != -1
l!l&&r!l&&!r
16506782
$browser_tests->{"firefox"} and index($ua, "mobile") != -1 or $browser_tests->{"ie"} and index($ua, "windows phone") == -1 and index($ua, "arm") != -1 or index($ua, "windows phone") != -1 or index($ua, "up.browser") != -1 or index($ua, "nokia") != -1 or index($ua, "alcatel") != -1 or index($ua, "ericsson") != -1 or index($ua, "sie-") == 0 or index($ua, "wmlib") != -1 or index($ua, " wap") != -1 or index($ua, "wap ") != -1 or index($ua, "wap/") != -1 or index($ua, "-wap") != -1
l!l&&r!l&&!r
16506782
$browser_tests->{"firefox"} and index($ua, "mobile") != -1 or $browser_tests->{"ie"} and index($ua, "windows phone") == -1 and index($ua, "arm") != -1 or index($ua, "windows phone") != -1 or index($ua, "up.browser") != -1 or index($ua, "nokia") != -1 or index($ua, "alcatel") != -1 or index($ua, "ericsson") != -1 or index($ua, "sie-") == 0 or index($ua, "wmlib") != -1 or index($ua, " wap") != -1 or index($ua, "wap ") != -1 or index($ua, "wap/") != -1
l!l&&r!l&&!r
15966782
$browser_tests->{"firefox"} and index($ua, "mobile") != -1 or $browser_tests->{"ie"} and index($ua, "windows phone") == -1 and index($ua, "arm") != -1 or index($ua, "windows phone") != -1 or index($ua, "up.browser") != -1 or index($ua, "nokia") != -1 or index($ua, "alcatel") != -1 or index($ua, "ericsson") != -1 or index($ua, "sie-") == 0 or index($ua, "wmlib") != -1 or index($ua, " wap") != -1 or index($ua, "wap ") != -1
l!l&&r!l&&!r
15906788
$browser_tests->{"firefox"} and index($ua, "mobile") != -1 or $browser_tests->{"ie"} and index($ua, "windows phone") == -1 and index($ua, "arm") != -1 or index($ua, "windows phone") != -1 or index($ua, "up.browser") != -1 or index($ua, "nokia") != -1 or index($ua, "alcatel") != -1 or index($ua, "ericsson") != -1 or index($ua, "sie-") == 0 or index($ua, "wmlib") != -1 or index($ua, " wap") != -1
l!l&&r!l&&!r
15366788
$browser_tests->{"firefox"} and index($ua, "mobile") != -1 or $browser_tests->{"ie"} and index($ua, "windows phone") == -1 and index($ua, "arm") != -1 or index($ua, "windows phone") != -1 or index($ua, "up.browser") != -1 or index($ua, "nokia") != -1 or index($ua, "alcatel") != -1 or index($ua, "ericsson") != -1 or index($ua, "sie-") == 0 or index($ua, "wmlib") != -1
l!l&&r!l&&!r
15306794
$browser_tests->{"firefox"} and index($ua, "mobile") != -1 or $browser_tests->{"ie"} and index($ua, "windows phone") == -1 and index($ua, "arm") != -1 or index($ua, "windows phone") != -1 or index($ua, "up.browser") != -1 or index($ua, "nokia") != -1 or index($ua, "alcatel") != -1 or index($ua, "ericsson") != -1 or index($ua, "sie-") == 0
l!l&&r!l&&!r
15306794
$browser_tests->{"firefox"} and index($ua, "mobile") != -1 or $browser_tests->{"ie"} and index($ua, "windows phone") == -1 and index($ua, "arm") != -1 or index($ua, "windows phone") != -1 or index($ua, "up.browser") != -1 or index($ua, "nokia") != -1 or index($ua, "alcatel") != -1 or index($ua, "ericsson") != -1
l!l&&r!l&&!r
135186794
$browser_tests->{"firefox"} and index($ua, "mobile") != -1 or $browser_tests->{"ie"} and index($ua, "windows phone") == -1 and index($ua, "arm") != -1 or index($ua, "windows phone") != -1 or index($ua, "up.browser") != -1 or index($ua, "nokia") != -1 or index($ua, "alcatel") != -1
l!l&&r!l&&!r
123126812
$browser_tests->{"firefox"} and index($ua, "mobile") != -1 or $browser_tests->{"ie"} and index($ua, "windows phone") == -1 and index($ua, "arm") != -1 or index($ua, "windows phone") != -1 or index($ua, "up.browser") != -1 or index($ua, "nokia") != -1
l!l&&r!l&&!r
77466824
$browser_tests->{"firefox"} and index($ua, "mobile") != -1 or $browser_tests->{"ie"} and index($ua, "windows phone") == -1 and index($ua, "arm") != -1 or index($ua, "windows phone") != -1 or index($ua, "up.browser") != -1
l!l&&r!l&&!r
66116870
$browser_tests->{"firefox"} and index($ua, "mobile") != -1 or $browser_tests->{"ie"} and index($ua, "windows phone") == -1 and index($ua, "arm") != -1 or index($ua, "windows phone") != -1
l!l&&r!l&&!r
13536881
$browser_tests->{"firefox"} and index($ua, "mobile") != -1 or $browser_tests->{"ie"} and index($ua, "windows phone") == -1 and index($ua, "arm") != -1
l!l&&r!l&&!r
766934
$browser_tests->{"firefox"} and index($ua, "mobile") != -1
!ll&&!rl&&r
62387027
$browser_tests->{"ie"} and index($ua, "windows phone") == -1 and index($ua, "arm") != -1
!ll&&!rl&&r
511218226
$browser_tests->{"ie"} and index($ua, "windows phone") == -1
!ll&&!rl&&r
5066461828
index($ua, "opera mini") != -1 and index($ua, "tablet") == -1
!ll&&!rl&&r
6358048
index($ua, "bb10") != -1 and index($ua, "mobile") != -1
!ll&&!rl&&r
5449012
MC/DC0%0/51
$browser_tests->{'firefox'} && index($ua, 'mobile') != -1 || $browser_tests->{'ie'} && index($ua, 'windows phone') == -1 && index($ua, 'arm') != -1 || index($ua, 'windows phone') != -1 || index($ua, 'up.browser') != -1 || index($ua, 'nokia') != -1 || index($ua, 'alcatel') != -1 || index($ua, 'ericsson') != -1 || index($ua, 'sie-') == 0 || index($ua, 'wmlib') != -1 || index($ua, ' wap') != -1 || index($ua, 'wap ') != -1 || index($ua, 'wap/') != -1 || index($ua, '-wap') != -1 || index($ua, 'wap-') != -1 || index($ua, 'wap') == 0 || index($ua, 'wapper') != -1 || index($ua, 'blackberry') != -1 || index($ua, 'iemobile') != -1 || index($ua, 'palm') != -1 || index($ua, 'smartphone') != -1 || index($ua, 'windows ce') != -1 || index($ua, 'palmsource') != -1 || index($ua, 'iphone') != -1 || index($ua, 'ipod') != -1 || index($ua, 'ipad') != -1 || index($ua, 'opera mini') != -1 && index($ua, 'tablet') == -1 || index($ua, 'htc_') != -1 || index($ua, 'symbian') != -1 || index($ua, 'webos') != -1 || index($ua, 'samsung') != -1 || index($ua, 'samsung') != -1 || index($ua, 'zetor') != -1 || index($ua, 'android') != -1 || index($ua, 'symbos') != -1 || index($ua, 'opera mobi') != -1 || index($ua, 'fennec') != -1 || index($ua, 'obigo') != -1 || index($ua, 'opera tablet') != -1 || index($ua, 'rim tablet') != -1 || index($ua, 'bb10') != -1 && index($ua, 'mobile') != -1 || $device_tests->{'psp'} || $device_tests->{'dsi'} || $device_tests->{'n3ds'} || index($ua, 'googlebot-mobile') != -1 || index($ua, 'msnbot-mobile') != -1 || index($ua, 'bingbot-mobile') != -1
too many conditions
1838 || index( $ua, "googlebot-mobile" ) != -1
1839 || index( $ua, "msnbot-mobile" ) != -1
1840 || index( $ua, "bingbot-mobile" ) != -1
1841 );
1842  
1843 $device_tests->{tablet} = (
1844 index( $ua, "ipad" ) != -1
1845 || ( $browser_tests->{ie}
1846 && index( $ua, "windows phone" ) == -1
1847 && index( $ua, "arm" ) != -1 )
1848 || ( index( $ua, "android" ) != -1
1849 && index( $ua, "mobile" ) == -1
1850 && index( $ua, "safari" ) != -1 )
1851 6947 ▶ || ( $browser_tests->{firefox} && index( $ua, "tablet" ) != -1 )
Condition80%70/87
index($ua, 'ipad') != -1 || $browser_tests->{'ie'} && index($ua, 'windows phone') == -1 && index($ua, 'arm') != -1 || index($ua, 'android') != -1 && index($ua, 'mobile') == -1 && index($ua, 'safari') != -1 || $browser_tests->{'firefox'} && index($ua, 'tablet') != -1 || index($ua, 'kindle') != -1 || index($ua, 'xoom') != -1 || index($ua, 'flyer') != -1 || index($ua, 'jetstream') != -1 || index($ua, 'transformer') != -1 || index($ua, 'novo7') != -1 || index($ua, 'an10g2') != -1 || index($ua, 'an7bg3') != -1 || index($ua, 'an7fg3') != -1 || index($ua, 'an8g3') != -1 || index($ua, 'an8cg3') != -1 || index($ua, 'an7g3') != -1 || index($ua, 'an9g3') != -1 || index($ua, 'an7dg3') != -1 || index($ua, 'an7dg3st') != -1 || index($ua, 'an7dg3childpad') != -1 || index($ua, 'an10bg3') != -1 || index($ua, 'an10bg3dt') != -1 || index($ua, 'opera tablet') != -1 || index($ua, 'rim tablet') != -1 || index($ua, 'hp-tablet') != -1
l!l&&r!l&&!r
30556637
index($ua, "ipad") != -1 or $browser_tests->{"ie"} and index($ua, "windows phone") == -1 and index($ua, "arm") != -1 or index($ua, "android") != -1 and index($ua, "mobile") == -1 and index($ua, "safari") != -1 or $browser_tests->{"firefox"} and index($ua, "tablet") != -1 or index($ua, "kindle") != -1 or index($ua, "xoom") != -1 or index($ua, "flyer") != -1 or index($ua, "jetstream") != -1 or index($ua, "transformer") != -1 or index($ua, "novo7") != -1 or index($ua, "an10g2") != -1 or index($ua, "an7bg3") != -1 or index($ua, "an7fg3") != -1 or index($ua, "an8g3") != -1 or index($ua, "an8cg3") != -1 or index($ua, "an7g3") != -1 or index($ua, "an9g3") != -1 or index($ua, "an7dg3") != -1 or index($ua, "an7dg3st") != -1 or index($ua, "an7dg3childpad") != -1 or index($ua, "an10bg3") != -1 or index($ua, "an10bg3dt") != -1 or index($ua, "opera tablet") != -1 or index($ua, "rim tablet") != -1
l!l&&r!l&&!r
29966642
index($ua, "ipad") != -1 or $browser_tests->{"ie"} and index($ua, "windows phone") == -1 and index($ua, "arm") != -1 or index($ua, "android") != -1 and index($ua, "mobile") == -1 and index($ua, "safari") != -1 or $browser_tests->{"firefox"} and index($ua, "tablet") != -1 or index($ua, "kindle") != -1 or index($ua, "xoom") != -1 or index($ua, "flyer") != -1 or index($ua, "jetstream") != -1 or index($ua, "transformer") != -1 or index($ua, "novo7") != -1 or index($ua, "an10g2") != -1 or index($ua, "an7bg3") != -1 or index($ua, "an7fg3") != -1 or index($ua, "an8g3") != -1 or index($ua, "an8cg3") != -1 or index($ua, "an7g3") != -1 or index($ua, "an9g3") != -1 or index($ua, "an7dg3") != -1 or index($ua, "an7dg3st") != -1 or index($ua, "an7dg3childpad") != -1 or index($ua, "an10bg3") != -1 or index($ua, "an10bg3dt") != -1 or index($ua, "opera tablet") != -1
l!l&&r!l&&!r
29276648
index($ua, "ipad") != -1 or $browser_tests->{"ie"} and index($ua, "windows phone") == -1 and index($ua, "arm") != -1 or index($ua, "android") != -1 and index($ua, "mobile") == -1 and index($ua, "safari") != -1 or $browser_tests->{"firefox"} and index($ua, "tablet") != -1 or index($ua, "kindle") != -1 or index($ua, "xoom") != -1 or index($ua, "flyer") != -1 or index($ua, "jetstream") != -1 or index($ua, "transformer") != -1 or index($ua, "novo7") != -1 or index($ua, "an10g2") != -1 or index($ua, "an7bg3") != -1 or index($ua, "an7fg3") != -1 or index($ua, "an8g3") != -1 or index($ua, "an8cg3") != -1 or index($ua, "an7g3") != -1 or index($ua, "an9g3") != -1 or index($ua, "an7dg3") != -1 or index($ua, "an7dg3st") != -1 or index($ua, "an7dg3childpad") != -1 or index($ua, "an10bg3") != -1 or index($ua, "an10bg3dt") != -1
l!l&&r!l&&!r
29206655
index($ua, "ipad") != -1 or $browser_tests->{"ie"} and index($ua, "windows phone") == -1 and index($ua, "arm") != -1 or index($ua, "android") != -1 and index($ua, "mobile") == -1 and index($ua, "safari") != -1 or $browser_tests->{"firefox"} and index($ua, "tablet") != -1 or index($ua, "kindle") != -1 or index($ua, "xoom") != -1 or index($ua, "flyer") != -1 or index($ua, "jetstream") != -1 or index($ua, "transformer") != -1 or index($ua, "novo7") != -1 or index($ua, "an10g2") != -1 or index($ua, "an7bg3") != -1 or index($ua, "an7fg3") != -1 or index($ua, "an8g3") != -1 or index($ua, "an8cg3") != -1 or index($ua, "an7g3") != -1 or index($ua, "an9g3") != -1 or index($ua, "an7dg3") != -1 or index($ua, "an7dg3st") != -1 or index($ua, "an7dg3childpad") != -1 or index($ua, "an10bg3") != -1
l!l&&r!l&&!r
29206655
index($ua, "ipad") != -1 or $browser_tests->{"ie"} and index($ua, "windows phone") == -1 and index($ua, "arm") != -1 or index($ua, "android") != -1 and index($ua, "mobile") == -1 and index($ua, "safari") != -1 or $browser_tests->{"firefox"} and index($ua, "tablet") != -1 or index($ua, "kindle") != -1 or index($ua, "xoom") != -1 or index($ua, "flyer") != -1 or index($ua, "jetstream") != -1 or index($ua, "transformer") != -1 or index($ua, "novo7") != -1 or index($ua, "an10g2") != -1 or index($ua, "an7bg3") != -1 or index($ua, "an7fg3") != -1 or index($ua, "an8g3") != -1 or index($ua, "an8cg3") != -1 or index($ua, "an7g3") != -1 or index($ua, "an9g3") != -1 or index($ua, "an7dg3") != -1 or index($ua, "an7dg3st") != -1 or index($ua, "an7dg3childpad") != -1
l!l&&r!l&&!r
29206655
index($ua, "ipad") != -1 or $browser_tests->{"ie"} and index($ua, "windows phone") == -1 and index($ua, "arm") != -1 or index($ua, "android") != -1 and index($ua, "mobile") == -1 and index($ua, "safari") != -1 or $browser_tests->{"firefox"} and index($ua, "tablet") != -1 or index($ua, "kindle") != -1 or index($ua, "xoom") != -1 or index($ua, "flyer") != -1 or index($ua, "jetstream") != -1 or index($ua, "transformer") != -1 or index($ua, "novo7") != -1 or index($ua, "an10g2") != -1 or index($ua, "an7bg3") != -1 or index($ua, "an7fg3") != -1 or index($ua, "an8g3") != -1 or index($ua, "an8cg3") != -1 or index($ua, "an7g3") != -1 or index($ua, "an9g3") != -1 or index($ua, "an7dg3") != -1 or index($ua, "an7dg3st") != -1
l!l&&r!l&&!r
29206655
index($ua, "ipad") != -1 or $browser_tests->{"ie"} and index($ua, "windows phone") == -1 and index($ua, "arm") != -1 or index($ua, "android") != -1 and index($ua, "mobile") == -1 and index($ua, "safari") != -1 or $browser_tests->{"firefox"} and index($ua, "tablet") != -1 or index($ua, "kindle") != -1 or index($ua, "xoom") != -1 or index($ua, "flyer") != -1 or index($ua, "jetstream") != -1 or index($ua, "transformer") != -1 or index($ua, "novo7") != -1 or index($ua, "an10g2") != -1 or index($ua, "an7bg3") != -1 or index($ua, "an7fg3") != -1 or index($ua, "an8g3") != -1 or index($ua, "an8cg3") != -1 or index($ua, "an7g3") != -1 or index($ua, "an9g3") != -1 or index($ua, "an7dg3") != -1
l!l&&r!l&&!r
29206655
index($ua, "ipad") != -1 or $browser_tests->{"ie"} and index($ua, "windows phone") == -1 and index($ua, "arm") != -1 or index($ua, "android") != -1 and index($ua, "mobile") == -1 and index($ua, "safari") != -1 or $browser_tests->{"firefox"} and index($ua, "tablet") != -1 or index($ua, "kindle") != -1 or index($ua, "xoom") != -1 or index($ua, "flyer") != -1 or index($ua, "jetstream") != -1 or index($ua, "transformer") != -1 or index($ua, "novo7") != -1 or index($ua, "an10g2") != -1 or index($ua, "an7bg3") != -1 or index($ua, "an7fg3") != -1 or index($ua, "an8g3") != -1 or index($ua, "an8cg3") != -1 or index($ua, "an7g3") != -1 or index($ua, "an9g3") != -1
l!l&&r!l&&!r
29206655
index($ua, "ipad") != -1 or $browser_tests->{"ie"} and index($ua, "windows phone") == -1 and index($ua, "arm") != -1 or index($ua, "android") != -1 and index($ua, "mobile") == -1 and index($ua, "safari") != -1 or $browser_tests->{"firefox"} and index($ua, "tablet") != -1 or index($ua, "kindle") != -1 or index($ua, "xoom") != -1 or index($ua, "flyer") != -1 or index($ua, "jetstream") != -1 or index($ua, "transformer") != -1 or index($ua, "novo7") != -1 or index($ua, "an10g2") != -1 or index($ua, "an7bg3") != -1 or index($ua, "an7fg3") != -1 or index($ua, "an8g3") != -1 or index($ua, "an8cg3") != -1 or index($ua, "an7g3") != -1
l!l&&r!l&&!r
29206655
index($ua, "ipad") != -1 or $browser_tests->{"ie"} and index($ua, "windows phone") == -1 and index($ua, "arm") != -1 or index($ua, "android") != -1 and index($ua, "mobile") == -1 and index($ua, "safari") != -1 or $browser_tests->{"firefox"} and index($ua, "tablet") != -1 or index($ua, "kindle") != -1 or index($ua, "xoom") != -1 or index($ua, "flyer") != -1 or index($ua, "jetstream") != -1 or index($ua, "transformer") != -1 or index($ua, "novo7") != -1 or index($ua, "an10g2") != -1 or index($ua, "an7bg3") != -1 or index($ua, "an7fg3") != -1 or index($ua, "an8g3") != -1 or index($ua, "an8cg3") != -1
l!l&&r!l&&!r
29206655
index($ua, "ipad") != -1 or $browser_tests->{"ie"} and index($ua, "windows phone") == -1 and index($ua, "arm") != -1 or index($ua, "android") != -1 and index($ua, "mobile") == -1 and index($ua, "safari") != -1 or $browser_tests->{"firefox"} and index($ua, "tablet") != -1 or index($ua, "kindle") != -1 or index($ua, "xoom") != -1 or index($ua, "flyer") != -1 or index($ua, "jetstream") != -1 or index($ua, "transformer") != -1 or index($ua, "novo7") != -1 or index($ua, "an10g2") != -1 or index($ua, "an7bg3") != -1 or index($ua, "an7fg3") != -1 or index($ua, "an8g3") != -1
l!l&&r!l&&!r
29206655
index($ua, "ipad") != -1 or $browser_tests->{"ie"} and index($ua, "windows phone") == -1 and index($ua, "arm") != -1 or index($ua, "android") != -1 and index($ua, "mobile") == -1 and index($ua, "safari") != -1 or $browser_tests->{"firefox"} and index($ua, "tablet") != -1 or index($ua, "kindle") != -1 or index($ua, "xoom") != -1 or index($ua, "flyer") != -1 or index($ua, "jetstream") != -1 or index($ua, "transformer") != -1 or index($ua, "novo7") != -1 or index($ua, "an10g2") != -1 or index($ua, "an7bg3") != -1 or index($ua, "an7fg3") != -1
l!l&&r!l&&!r
29206655
index($ua, "ipad") != -1 or $browser_tests->{"ie"} and index($ua, "windows phone") == -1 and index($ua, "arm") != -1 or index($ua, "android") != -1 and index($ua, "mobile") == -1 and index($ua, "safari") != -1 or $browser_tests->{"firefox"} and index($ua, "tablet") != -1 or index($ua, "kindle") != -1 or index($ua, "xoom") != -1 or index($ua, "flyer") != -1 or index($ua, "jetstream") != -1 or index($ua, "transformer") != -1 or index($ua, "novo7") != -1 or index($ua, "an10g2") != -1 or index($ua, "an7bg3") != -1
l!l&&r!l&&!r
29206655
index($ua, "ipad") != -1 or $browser_tests->{"ie"} and index($ua, "windows phone") == -1 and index($ua, "arm") != -1 or index($ua, "android") != -1 and index($ua, "mobile") == -1 and index($ua, "safari") != -1 or $browser_tests->{"firefox"} and index($ua, "tablet") != -1 or index($ua, "kindle") != -1 or index($ua, "xoom") != -1 or index($ua, "flyer") != -1 or index($ua, "jetstream") != -1 or index($ua, "transformer") != -1 or index($ua, "novo7") != -1 or index($ua, "an10g2") != -1
l!l&&r!l&&!r
29206655
index($ua, "ipad") != -1 or $browser_tests->{"ie"} and index($ua, "windows phone") == -1 and index($ua, "arm") != -1 or index($ua, "android") != -1 and index($ua, "mobile") == -1 and index($ua, "safari") != -1 or $browser_tests->{"firefox"} and index($ua, "tablet") != -1 or index($ua, "kindle") != -1 or index($ua, "xoom") != -1 or index($ua, "flyer") != -1 or index($ua, "jetstream") != -1 or index($ua, "transformer") != -1 or index($ua, "novo7") != -1
l!l&&r!l&&!r
29206655
index($ua, "ipad") != -1 or $browser_tests->{"ie"} and index($ua, "windows phone") == -1 and index($ua, "arm") != -1 or index($ua, "android") != -1 and index($ua, "mobile") == -1 and index($ua, "safari") != -1 or $browser_tests->{"firefox"} and index($ua, "tablet") != -1 or index($ua, "kindle") != -1 or index($ua, "xoom") != -1 or index($ua, "flyer") != -1 or index($ua, "jetstream") != -1 or index($ua, "transformer") != -1
l!l&&r!l&&!r
29206655
index($ua, "ipad") != -1 or $browser_tests->{"ie"} and index($ua, "windows phone") == -1 and index($ua, "arm") != -1 or index($ua, "android") != -1 and index($ua, "mobile") == -1 and index($ua, "safari") != -1 or $browser_tests->{"firefox"} and index($ua, "tablet") != -1 or index($ua, "kindle") != -1 or index($ua, "xoom") != -1 or index($ua, "flyer") != -1 or index($ua, "jetstream") != -1
l!l&&r!l&&!r
29206655
index($ua, "ipad") != -1 or $browser_tests->{"ie"} and index($ua, "windows phone") == -1 and index($ua, "arm") != -1 or index($ua, "android") != -1 and index($ua, "mobile") == -1 and index($ua, "safari") != -1 or $browser_tests->{"firefox"} and index($ua, "tablet") != -1 or index($ua, "kindle") != -1 or index($ua, "xoom") != -1 or index($ua, "flyer") != -1
l!l&&r!l&&!r
29206655
index($ua, "ipad") != -1 or $browser_tests->{"ie"} and index($ua, "windows phone") == -1 and index($ua, "arm") != -1 or index($ua, "android") != -1 and index($ua, "mobile") == -1 and index($ua, "safari") != -1 or $browser_tests->{"firefox"} and index($ua, "tablet") != -1 or index($ua, "kindle") != -1 or index($ua, "xoom") != -1
l!l&&r!l&&!r
29206655
index($ua, "ipad") != -1 or $browser_tests->{"ie"} and index($ua, "windows phone") == -1 and index($ua, "arm") != -1 or index($ua, "android") != -1 and index($ua, "mobile") == -1 and index($ua, "safari") != -1 or $browser_tests->{"firefox"} and index($ua, "tablet") != -1 or index($ua, "kindle") != -1
l!l&&r!l&&!r
280126655
index($ua, "ipad") != -1 or $browser_tests->{"ie"} and index($ua, "windows phone") == -1 and index($ua, "arm") != -1 or index($ua, "android") != -1 and index($ua, "mobile") == -1 and index($ua, "safari") != -1 or $browser_tests->{"firefox"} and index($ua, "tablet") != -1
l!l&&r!l&&!r
27196667
index($ua, "ipad") != -1 or $browser_tests->{"ie"} and index($ua, "windows phone") == -1 and index($ua, "arm") != -1 or index($ua, "android") != -1 and index($ua, "mobile") == -1 and index($ua, "safari") != -1
l!l&&r!l&&!r
1581136676
index($ua, "ipad") != -1 or $browser_tests->{"ie"} and index($ua, "windows phone") == -1 and index($ua, "arm") != -1
l!l&&r!l&&!r
15266789
$browser_tests->{"ie"} and index($ua, "windows phone") == -1 and index($ua, "arm") != -1
!ll&&!rl&&r
496718226
$browser_tests->{"ie"} and index($ua, "windows phone") == -1
!ll&&!rl&&r
4921461828
index($ua, "android") != -1 and index($ua, "mobile") == -1 and index($ua, "safari") != -1
!ll&&!rl&&r
662947113
index($ua, "android") != -1 and index($ua, "mobile") == -1
!ll&&!rl&&r
5887742160
$browser_tests->{"firefox"} and index($ua, "tablet") != -1
!ll&&!rl&&r
59677009
MC/DC0%0/30
index($ua, 'ipad') != -1 || $browser_tests->{'ie'} && index($ua, 'windows phone') == -1 && index($ua, 'arm') != -1 || index($ua, 'android') != -1 && index($ua, 'mobile') == -1 && index($ua, 'safari') != -1 || $browser_tests->{'firefox'} && index($ua, 'tablet') != -1 || index($ua, 'kindle') != -1 || index($ua, 'xoom') != -1 || index($ua, 'flyer') != -1 || index($ua, 'jetstream') != -1 || index($ua, 'transformer') != -1 || index($ua, 'novo7') != -1 || index($ua, 'an10g2') != -1 || index($ua, 'an7bg3') != -1 || index($ua, 'an7fg3') != -1 || index($ua, 'an8g3') != -1 || index($ua, 'an8cg3') != -1 || index($ua, 'an7g3') != -1 || index($ua, 'an9g3') != -1 || index($ua, 'an7dg3') != -1 || index($ua, 'an7dg3st') != -1 || index($ua, 'an7dg3childpad') != -1 || index($ua, 'an10bg3') != -1 || index($ua, 'an10bg3dt') != -1 || index($ua, 'opera tablet') != -1 || index($ua, 'rim tablet') != -1 || index($ua, 'hp-tablet') != -1
too many conditions
1852 || index( $ua, "kindle" ) != -1
1853 || index( $ua, "xoom" ) != -1
1854 || index( $ua, "flyer" ) != -1
1855 || index( $ua, "jetstream" ) != -1
1856 || index( $ua, "transformer" ) != -1
1857 || index( $ua, "novo7" ) != -1
1858 || index( $ua, "an10g2" ) != -1
1859 || index( $ua, "an7bg3" ) != -1
1860 || index( $ua, "an7fg3" ) != -1
1861 || index( $ua, "an8g3" ) != -1
1862 || index( $ua, "an8cg3" ) != -1
1863 || index( $ua, "an7g3" ) != -1
1864 || index( $ua, "an9g3" ) != -1
1865 || index( $ua, "an7dg3" ) != -1
1866 || index( $ua, "an7dg3st" ) != -1
1867 || index( $ua, "an7dg3childpad" ) != -1
1868 || index( $ua, "an10bg3" ) != -1
1869 || index( $ua, "an10bg3dt" ) != -1
1870 || index( $ua, "opera tablet" ) != -1
1871 || index( $ua, "rim tablet" ) != -1
1872 || index( $ua, "hp-tablet" ) != -1
1873 );
1874  
1875 6947 ▶ if ( $browser_tests->{obigo} && $ua =~ /^(mot-[^ \/]+)/ ) {
Branch: 10 branches
BranchTrueFalseTotal
if ($browser_tests->{'obigo'} and $ua =~ m[^(mot-[^ /]+)]) { } 11 6936 6947
elsif ($ua =~ m[windows phone os [^\)]+ iemobile/[^;]+; ([^;]+; [^;\)]+)]g) { } 16 6920 6936
elsif ($ua =~ m[windows phone [^\)]+ iemobile/[^;]+; arm; touch; ([^;]+; [^;\)]+)]g) { } 12 6908 6920
elsif ($ua =~ m[windows phone 8[^\)]+ iemobile/[^;]+; ([^;]+; [^;\)]+)]g) { } 18 6890 6908
elsif ($ua =~ /bb10; ([^;\)]+)/g) { } 12 6878 6890
elsif ($ua =~ /blackberry ([\w.]+)/) { } 6 6872 6878
elsif ($ua =~ m[blackberry(\d+)/]) { } 17 6855 6872
elsif ($self->{'user_agent'} =~ /android .*\; ([^;]*) build/i) { } 830 6025 6855
elsif ($self->{'user_agent'} =~ m[\b((alcatel|huawei|lg|nokia|samsung|sonyericsson)[\w\-]*)/]i) { } 74 5951 6025
elsif ($device) { } 464 5487 5951
Condition100%3/3
$browser_tests->{"obigo"} and $ua =~ m[^(mot-[^ /]+)]
!ll&&!rl&&r
69191711
MC/DC100%2/2
$browser_tests->{"obigo"} and $ua =~ m[^(mot-[^ /]+)]
$browser_tests->{"obigo"} $ua =~ m[^(mot-[^ /]+)]
Truth table100%3/3
A and B
A= $browser_tests->{"obigo"}B= $ua =~ m[^(mot-[^ /]+)]
ABresult
0X0
100
111
1876 11 $device_string = substr $self->{user_agent}, 0, length $1;
1877 11 $device_string =~ s/^MOT-/Motorola /i;
1878 }
1879 elsif (
1880 $ua =~ /windows phone os [^\)]+ iemobile\/[^;]+; ([^;]+; [^;\)]+)/g )
1881 {
1882 # windows phone 7.x
1883 $device_string = substr $self->{user_agent},
1884 16 pos($ua) - length $1, length $1;
1885 16 $device_string =~ s/; / /;
1886 }
1887 elsif ( $ua
1888 =~ /windows phone [^\)]+ iemobile\/[^;]+; arm; touch; ([^;]+; [^;\)]+)/g
1889 ) {
1890 # windows phone 8.0
1891 $device_string = substr $self->{user_agent},
1892 12 pos($ua) - length $1, length $1;
1893 12 $device_string =~ s/; / /;
1894 }
1895 elsif (
1896 $ua =~ /windows phone 8[^\)]+ iemobile\/[^;]+; ([^;]+; [^;\)]+)/g ) {
1897  
1898 # windows phone 8.1
1899 $device_string = substr $self->{user_agent},
1900 18 pos($ua) - length $1, length $1;
1901 18 $device_string =~ s/; / /;
1902 }
1903 elsif ( $ua =~ /bb10; ([^;\)]+)/g ) {
1904 $device_string = 'BlackBerry ' . substr $self->{user_agent},
1905 12 pos($ua) - length $1, length $1;
1906 12 $device_string =~ s/Kbd/Q10/;
1907 }
1908 elsif ( $ua =~ /blackberry ([\w.]+)/ ) {
1909 6 $device_string = "BlackBerry $1";
1910 }
1911 elsif ( $ua =~ /blackberry(\d+)\// ) {
1912 17 $device_string = "BlackBerry $1";
1913 }
1914 elsif ( $self->{user_agent} =~ /android .*\; ([^;]*) build/i ) {
1915 830 ▶ if ( $device_tests->{tablet} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($device_tests->{'tablet'}) { } 113 717 830
1916 113 $device_string = "Android tablet ($1)";
1917 }
1918 else {
1919 717 $device_string = "Android ($1)";
1920 }
1921 }
1922 elsif ( $self->{user_agent}
1923 =~ /\b((alcatel|huawei|lg|nokia|samsung|sonyericsson)[\w\-]*)\//i ) {
1924 74 $device_string = $1;
1925 }
1926 elsif ($device) {
1927 464 $device_string = $DEVICE_NAMES{$device};
1928 }
1929 else {
1930 5487 $device_string = undef;
1931 }
1932  
1933 6947 ▶ if ($device) {
Branch: 1 branch
BranchTrueFalseTotal
if ($device) { } 1460 5487 6947
1934 1460 $self->{device} = $device;
1935 }
1936 else {
1937 $self->{device}
1938 5487 = undef; # Means we cache the fact that we found nothing
1939 }
1940  
1941 6947 ▶ if ($device_string) {
Branch: 1 branch
BranchTrueFalseTotal
if ($device_string) 1453 5494 6947
1942 1453 $self->{device_string} = $device_string;
1943 }
1944 }
1945  
1946 ### Now a big block of public accessors for tests and information
1947  
1948 sub browser {
1949 1602 ▶ my ($self) = @_;
Subroutine browser: called CC=2 SCAR=7.1
Pod documented
1950 1602 ▶ return undef unless defined $self->{user_agent};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{"user_agent"} 0 1602 1602
1951 1602 return $self->{browser};
1952 }
1953  
1954 sub browser_string {
1955 1558 ▶ my ($self) = @_;
Subroutine browser_string: called CC=2 SCAR=7.1
Pod documented
1956 1558 ▶ return undef unless defined $self->{user_agent};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{"user_agent"} 0 1558 1558
1957 1558 return $self->{browser_string};
1958 }
1959  
1960 sub os {
1961 3943 ▶ my ($self) = @_;
Subroutine os: called CC=3 SCAR=11.0
Pod documented
1962  
1963 3943 ▶ return undef unless defined $self->{user_agent};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{"user_agent"} 0 3943 3943
1964 3943 ▶ $self->_init_os unless $self->{os_tests};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"os_tests"} 1217 2726 3943
1965 3943 return $self->{os};
1966 }
1967  
1968 sub os_string {
1969 3928 ▶ my ($self) = @_;
Subroutine os_string: called CC=3 SCAR=11.0
Pod documented
1970  
1971 3928 ▶ return undef unless defined $self->{user_agent};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{"user_agent"} 0 3928 3928
1972 3928 ▶ $self->_init_os unless $self->{os_tests};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"os_tests"} 79 3849 3928
1973 3928 return $self->{os_string};
1974 }
1975  
1976 sub _os_version {
1977 3598 ▶ my ($self) = @_;
Subroutine _os_version: called CC=3 SCAR=11.0
1978 3598 ▶ $self->_init_os_version if !exists( $self->{os_version} );
Branch: 1 branch
BranchTrueFalseTotal
unless exists $self->{"os_version"} 2443 1155 3598
1979 3598 ▶ if ( $self->{os_version} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'os_version'}) { } 1513 2085 3598
1980 1513 return @{ $self->{os_version} };
1981 }
1982 else {
1983 2085 return ( undef, undef, undef );
1984 }
1985 }
1986  
1987 sub os_version {
1988 813 ▶ my ($self) = @_;
Subroutine os_version: called CC=2 SCAR=6.9
Pod documented
1989 813 my ( $major, $minor, $beta ) = $self->_os_version;
1990 813 ▶ if ( defined($major) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $major) { } 249 564 813
1991 249 return "$major$minor";
1992 }
1993 else {
1994 564 return undef;
1995 }
1996 }
1997  
1998 sub os_major {
1999 961 ▶ my ($self) = @_;
Subroutine os_major: called CC=1 SCAR=0.0
Pod documented
2000 961 my ( $major, $minor, $beta ) = $self->_os_version;
2001 961 return $major;
2002 }
2003  
2004 sub os_minor {
2005 956 ▶ my ($self) = @_;
Subroutine os_minor: called CC=1 SCAR=0.0
Pod documented
2006 956 my ( $major, $minor, $beta ) = $self->_os_version;
2007 956 return $minor;
2008 }
2009  
2010 sub os_beta {
2011 868 ▶ my ($self) = @_;
Subroutine os_beta: called CC=1 SCAR=0.0
Pod documented
2012 868 my ( $major, $minor, $beta ) = $self->_os_version;
2013 868 return $beta;
2014 }
2015  
2016 sub _realplayer_version {
2017 0 ▶ my ($self) = @_;
Subroutine _realplayer_version: not called CC=3 SCAR=24.8
2018  
2019 0 ▶ $self->_init_version unless $self->{version_tests};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"version_tests"} 0 0 0
2020 0 ▶ return $self->{realplayer_version} || 0;
Condition0%0/2
$self->{'realplayer_version'} || 0
l!l
00
MC/DC0%0/1
$self->{'realplayer_version'} || 0
$self->{'realplayer_version'}
Truth table0%0/2
A
A= $self->{'realplayer_version'}
Aresult
11
00
2021 }
2022  
2023 sub realplayer_browser {
2024 715 ▶ my ($self) = @_;
Subroutine realplayer_browser: called CC=2 SCAR=6.9
Pod documented
2025 715 ▶ return defined( $self->{browser} ) && $self->{browser} eq 'realplayer';
Condition100%3/3
defined $self->{'browser'} && $self->{'browser'} eq 'realplayer'
!ll&&!rl&&r
1315822
MC/DC100%2/2
defined $self->{'browser'} && $self->{'browser'} eq 'realplayer'
defined $self->{'browser'} $self->{'browser'} eq 'realplayer'
Truth table100%3/3
A && B
A= defined $self->{'browser'}B= $self->{'browser'} eq 'realplayer'
ABresult
0X0
100
111
2026 }
2027  
2028 sub gecko_version {
2029 738 ▶ my ($self) = @_;
Subroutine gecko_version: called CC=2 SCAR=6.9
Pod documented
2030  
2031 738 ▶ if ( $self->gecko ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->gecko) { } 87 651 738
2032 87 return $self->{engine_version};
2033 }
2034 else {
2035 651 return undef;
2036 }
2037 }
2038  
2039 sub version {
2040 901 ▶ my ($self) = @_;
Subroutine version: called CC=2 SCAR=6.9
Pod documented
2041 901 ▶ $self->_init_version() unless $self->{version_tests};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"version_tests"} 252 649 901
2042  
2043 901 my $version = "$self->{major}$self->{minor}";
2044 901 return $version;
2045 }
2046  
2047 sub major {
2048 1208 ▶ my ($self) = @_;
Subroutine major: called CC=2 SCAR=6.9
Pod documented
2049 1208 ▶ $self->_init_version() unless $self->{version_tests};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"version_tests"} 230 978 1208
2050  
2051 1208 my ($version) = $self->{major};
2052 1208 return $version;
2053 }
2054  
2055 sub minor {
2056 876 ▶ my ($self) = @_;
Subroutine minor: called CC=2 SCAR=6.9
Pod documented
2057 876 ▶ $self->_init_version() unless $self->{version_tests};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"version_tests"} 144 732 876
2058  
2059 876 my ($version) = $self->{minor};
2060 876 return $version;
2061 }
2062  
2063 sub public_version {
2064 867 ▶ my ($self) = @_;
Subroutine public_version: called CC=1 SCAR=0.0
Pod documented
2065 867 my ( $major, $minor ) = $self->_public;
2066  
2067 867 return "$major$minor";
2068 }
2069  
2070 sub public_major {
2071 853 ▶ my ($self) = @_;
Subroutine public_major: called CC=1 SCAR=0.0
Pod documented
2072 853 my ( $major, $minor ) = $self->_public;
2073  
2074 853 return $major;
2075 }
2076  
2077 sub public_minor {
2078 867 ▶ my ($self) = @_;
Subroutine public_minor: called CC=1 SCAR=0.0
Pod documented
2079 867 my ( $major, $minor ) = $self->_public;
2080  
2081 867 return $minor;
2082 }
2083  
2084 sub public_beta {
2085 0 ▶ my ($self) = @_;
Subroutine public_beta: not called CC=1 SCAR=6.9
Pod documented
2086 0 my ( $major, $minor, $beta ) = $self->_public;
2087  
2088 0 return $beta;
2089 }
2090  
2091 sub browser_version {
2092 0 ▶ my ($self) = @_;
Subroutine browser_version: not called CC=1 SCAR=6.9
Pod documented
2093 0 my ( $major, $minor ) = $self->_public;
2094  
2095 0 return "$major$minor";
2096 }
2097  
2098 sub browser_major {
2099 0 ▶ my ($self) = @_;
Subroutine browser_major: not called CC=1 SCAR=6.9
Pod documented
2100 0 my ( $major, $minor ) = $self->_public;
2101  
2102 0 return $major;
2103 }
2104  
2105 sub browser_minor {
2106 0 ▶ my ($self) = @_;
Subroutine browser_minor: not called CC=1 SCAR=6.9
Pod documented
2107 0 my ( $major, $minor ) = $self->_public;
2108  
2109 0 return $minor;
2110 }
2111  
2112 sub browser_beta {
2113 284 ▶ my ($self) = @_;
Subroutine browser_beta: called CC=1 SCAR=0.0
Pod documented
2114 284 my ( $major, $minor, $beta ) = $self->_public;
2115  
2116 284 return $beta;
2117 }
2118  
2119 sub _public {
2120 2871 ▶ my ($self) = @_;
Subroutine _public: called CC=11 SCAR=24.0
2121  
2122 # Return Public version of Safari. See RT #48727.
2123 2871 ▶ if ( $self->safari ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->safari) 444 2427 2871
2124 444 my $ua = lc $self->{user_agent};
2125  
2126 # Safari starting with version 3.0 provides its own public version
2127 444 ▶ if (
Branch: 1 branch
BranchTrueFalseTotal
if ($ua =~ m[ version/ ( \d+ ) # Major version number is everything before first dot ( \. \d+ )? # Minor version number is first dot and following digits ]x) 311 133 444
2128 $ua =~ m{
2129 version/
2130 ( \d+ ) # Major version number is everything before first dot
2131 ( \. \d+ )? # Minor version number is first dot and following digits
2132 }x
2133 ) {
2134 311 return ( $1, $2, undef );
2135 }
2136  
2137 # Safari before version 3.0 had only build numbers; use a lookup table
2138 # provided by Apple to convert to version numbers
2139  
2140 133 ▶ if ( $ua =~ m{ safari/ ( \d+ (?: \.\d+ )* ) }x ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ua =~ m[ safari/ ( \d+ (?: \.\d+ )* ) ]x) 103 30 133
2141 103 my $build = $1;
2142 103 my $version = $safari_build_to_version{$build};
2143 103 ▶ unless ($version) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($version) 60 43 103
2144  
2145 # if exact build -> version mapping doesn't exist, find next
2146 # lower build
2147  
2148 60 for my $maybe_build (
2149 4843 sort { $self->_cmp_versions( $b, $a ) }
2150 keys %safari_build_to_version
2151 ) {
2152 266 ▶ $version = $safari_build_to_version{$maybe_build}, last
Branch: 1 branch
BranchTrueFalseTotal
if $self->_cmp_versions($build, $maybe_build) >= 0 57 209 266
2153 if $self->_cmp_versions( $build, $maybe_build ) >= 0;
2154 }
2155  
2156 # Special case for specific worm that uses a malformed user agent
2157 60 ▶ return ( '1', '.2', undef ) if $ua =~ m{safari/12x};
Branch: 1 branch
BranchTrueFalseTotal
if $ua =~ m[safari/12x] 3 57 60
2158 }
2159 100 my ( $major, $minor ) = split /\./, $version;
2160 100 my $beta;
2161 100 ▶ $minor =~ s/(\D.*)// and $beta = $1;
Branch: 1 branch
BranchTrueFalseTotal
$minor =~ s/(\D.*)// and $beta = $1 2 98 100
2162 100 $minor = ( '.' . $minor );
2163 100 ▶ return ( $major, $minor, ( $beta ? 1 : undef ) );
Branch: 1 branch
BranchTrueFalseTotal
$beta ? : 2 98 100
2164 }
2165 }
2166  
2167 2457 ▶ $self->_init_version() unless $self->{version_tests};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"version_tests"} 763 1694 2457
2168 2457 return ( $self->{major}, $self->{minor}, $self->{beta} );
2169 }
2170  
2171 sub _cmp_versions {
2172 5109 ▶ my ( $self, $a, $b ) = @_;
Subroutine _cmp_versions: called CC=6 SCAR=17.9
2173  
2174 5109 my @a = split /\./, $a;
2175 5109 my @b = split /\./, $b;
2176  
2177 5109 ▶ while (@b) {
Branch: 1 branch
BranchTrueFalseTotal
if (@b) 5955 208 6163
2178 5955 ▶ return -1 if @a == 0 || $a[0] < $b[0];
Branch: 1 branch
BranchTrueFalseTotal
if @a == 0 or $a[0] < $b[0] 2995 2960 5955
Condition100%3/3
@a == 0 or $a[0] < $b[0]
l!l&&r!l&&!r
34326522960
MC/DC100%2/2
@a == 0 or $a[0] < $b[0]
@a == 0 $a[0] < $b[0]
Truth table100%3/3
A or B
A= @a == 0B= $a[0] < $b[0]
ABresult
1X1
011
000
2179 2960 ▶ return 1 if @b == 0 || $b[0] < $a[0];
Branch: 1 branch
BranchTrueFalseTotal
if @b == 0 or $b[0] < $a[0] 1906 1054 2960
Condition66%2/3
@b == 0 or $b[0] < $a[0]
l!l&&r!l&&!r
019061054
MC/DC50%1/2
@b == 0 or $b[0] < $a[0]
@b == 0 $b[0] < $a[0]
Truth table66%2/3
A or B
A= @b == 0B= $b[0] < $a[0]
ABresult
1X1
011
000
2180 1054 shift @a;
2181 1054 shift @b;
2182 }
2183  
2184 208 return @a <=> @b;
2185 }
2186  
2187 sub engine {
2188 1527 ▶ my ($self) = @_;
Subroutine engine: called CC=3 SCAR=11.0
Pod documented
2189  
2190 # *shrug*
2191 1527 ▶ if ( my $engine_string = $self->engine_string ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $engine_string = $self->engine_string) { } 1355 172 1527
2192 1355 ▶ if ( $engine_string eq 'MSIE' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($engine_string eq 'MSIE') { } 220 1135 1355
2193 220 return 'ie';
2194 }
2195 else {
2196 1135 return lc $engine_string;
2197 }
2198 }
2199 else {
2200 172 return undef;
2201 }
2202 }
2203  
2204 sub engine_string {
2205 2914 ▶ my ($self) = @_;
Subroutine engine_string: called CC=9 SCAR=22.0
Pod documented
2206  
2207 2914 ▶ if ( $self->gecko ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->gecko) 361 2553 2914
2208 361 return 'Gecko';
2209 }
2210  
2211 2553 ▶ if ( $self->trident ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->trident) 491 2062 2553
2212 491 return 'Trident';
2213 }
2214  
2215 2062 ▶ if ( $self->ie ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->ie) 400 1662 2062
2216 400 return 'MSIE';
2217 }
2218  
2219 1662 ▶ if ( $self->edge ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->edge) 18 1644 1662
2220 18 return 'EdgeHTML';
2221 }
2222  
2223 1644 ▶ if ( $self->webkit ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->webkit) 1259 385 1644
2224 1259 return 'WebKit';
2225 }
2226  
2227 385 ▶ if ( $self->presto ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->presto) 50 335 385
2228 50 return 'Presto';
2229 }
2230  
2231 335 ▶ if ( $self->netfront ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->netfront) 6 329 335
2232 6 return 'NetFront';
2233 }
2234  
2235 329 ▶ if ( $self->khtml ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->khtml) 7 322 329
2236 7 return 'KHTML';
2237 }
2238  
2239 322 return undef;
2240 }
2241  
2242 sub engine_version {
2243 905 ▶ my ($self) = @_;
Subroutine engine_version: called CC=3 SCAR=11.0
Pod documented
2244  
2245 905 ▶ if ( $self->{engine_version} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"engine_version"}) 617 288 905
2246 617 ▶ if ( $self->{engine_version} =~ m{^(\d+(\.\d+)?)} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"engine_version"} =~ /^(\d+(\.\d+)?)/) 617 0 617
2247 617 return $1;
2248 }
2249 }
2250  
2251 288 return $self->{engine_version};
2252 }
2253  
2254 sub engine_major {
2255 2015 ▶ my ($self) = @_;
Subroutine engine_major: called CC=3 SCAR=11.0
Pod documented
2256  
2257 2015 ▶ if ( $self->{engine_version} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"engine_version"}) 1498 517 2015
2258 1498 ▶ if ( $self->{engine_version} =~ m{^(\d+)} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"engine_version"} =~ /^(\d+)/) 1498 0 1498
2259 1498 return $1;
2260 }
2261 }
2262  
2263 517 return undef;
2264 }
2265  
2266 sub engine_minor {
2267 2054 ▶ my ($self) = @_;
Subroutine engine_minor: called CC=3 SCAR=11.0
Pod documented
2268  
2269 2054 ▶ if ( $self->{engine_version} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"engine_version"}) 1542 512 2054
2270 1542 ▶ if ( $self->{engine_version} =~ m{^\d+(\.\d+)} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"engine_version"} =~ /^\d+(\.\d+)/) 1519 23 1542
2271 1519 return $1;
2272 }
2273 }
2274  
2275 535 return undef;
2276 }
2277  
2278 sub engine_beta {
2279 849 ▶ my ($self) = @_;
Subroutine engine_beta: called CC=3 SCAR=11.0
Pod documented
2280  
2281 849 ▶ if ( $self->{engine_version} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"engine_version"}) 587 262 849
2282 587 ▶ if ( $self->{engine_version} =~ m{^\d+\.\d+([\.\d\+]*)} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"engine_version"} =~ /^\d+\.\d+([\.\d\+]*)/) 579 8 587
2283 579 return $1;
2284 }
2285 }
2286  
2287 270 return undef;
2288 }
2289  
2290 sub beta {
2291 687 ▶ my ($self) = @_;
Subroutine beta: called CC=2 SCAR=6.9
Pod documented
2292  
2293 687 ▶ $self->_init_version unless $self->{version_tests};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"version_tests"} 119 568 687
2294  
2295 687 my ($version) = $self->{beta};
2296 687 return $version;
2297 }
2298  
2299 sub language {
2300 893 ▶ my ($self) = @_;
Subroutine language: called CC=1 SCAR=0.0
Pod documented
2301  
2302 893 my $parsed = $self->_language_country();
2303 893 return $parsed->{'language'};
2304 }
2305  
2306 sub country {
2307 699 ▶ my ($self) = @_;
Subroutine country: called CC=1 SCAR=0.0
Pod documented
2308  
2309 699 my $parsed = $self->_language_country();
2310 699 return $parsed->{'country'};
2311 }
2312  
2313 sub device {
2314 3769 ▶ my ($self) = @_;
Subroutine device: called CC=2 SCAR=6.9
Pod documented
2315  
2316 3769 ▶ $self->_init_device if !exists( $self->{device} );
Branch: 1 branch
BranchTrueFalseTotal
unless exists $self->{"device"} 751 3018 3769
2317 3769 return $self->{device};
2318 }
2319  
2320 sub device_string {
2321 1660 ▶ my ($self) = @_;
Subroutine device_string: called CC=2 SCAR=6.9
Pod documented
2322  
2323 1660 ▶ $self->_init_device if !exists( $self->{device_string} );
Branch: 1 branch
BranchTrueFalseTotal
unless exists $self->{"device_string"} 1199 461 1660
2324 1660 return $self->{device_string};
2325 }
2326  
2327 sub device_name {
2328 701 ▶ my ($self) = @_;
Subroutine device_name: called CC=1 SCAR=0.0
Pod documented
2329 701 return $self->device_string;
2330 }
2331  
2332 sub _language_country {
2333 1592 ▶ my ($self) = @_;
Subroutine _language_country: called CC=12 SCAR=24.9
2334  
2335 1592 ▶ if ( $self->safari ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->safari) 296 1296 1592
2336 296 ▶ if ( $self->major == 1
Branch: 1 branch
BranchTrueFalseTotal
if ($self->major == 1 and $self->{"user_agent"} =~ /\s ( [a-z]{2} ) \)/msx) 10 286 296
Condition66%2/3
$self->major == 1 and $self->{"user_agent"} =~ /\s ( [a-z]{2} ) \)/msx
!ll&&!rl&&r
286010
MC/DC50%1/2
$self->major == 1 and $self->{"user_agent"} =~ /\s ( [a-z]{2} ) \)/msx
$self->major == 1 $self->{"user_agent"} =~ /\s ( [a-z]{2} ) \)/msx
Truth table66%2/3
A and B
A= $self->major == 1B= $self->{"user_agent"} =~ /\s ( [a-z]{2} ) \)/msx
ABresult
0X0
100
111
2337 && $self->{user_agent} =~ m/\s ( [a-z]{2} ) \)/xms ) {
2338 10 return { language => uc $1 };
2339 }
2340 286 ▶ if ( $self->{user_agent} =~ m/\s ([a-z]{2})-([A-Za-z]{2})/xms ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"user_agent"} =~ /\s ([a-z]{2})-([A-Za-z]{2})/msx) 144 142 286
2341 144 return { language => uc $1, country => uc $2 };
2342 }
2343 }
2344  
2345 1438 ▶ if ( $self->aol
Branch: 1 branch
BranchTrueFalseTotal
if ($self->aol and $self->{"user_agent"} =~ /;([A-Z]{2})_([A-Z]{2})\)/) 1 1437 1438
Condition100%3/3
$self->aol and $self->{"user_agent"} =~ /;([A-Z]{2})_([A-Z]{2})\)/
!ll&&!rl&&r
1424131
MC/DC100%2/2
$self->aol and $self->{"user_agent"} =~ /;([A-Z]{2})_([A-Z]{2})\)/
$self->aol $self->{"user_agent"} =~ /;([A-Z]{2})_([A-Z]{2})\)/
Truth table100%3/3
A and B
A= $self->aolB= $self->{"user_agent"} =~ /;([A-Z]{2})_([A-Z]{2})\)/
ABresult
0X0
100
111
2346 && $self->{user_agent} =~ m/;([A-Z]{2})_([A-Z]{2})\)/ ) {
2347 1 return { language => $1, country => $2 };
2348 }
2349  
2350 1437 ▶ if ( $self->{user_agent} =~ m/\b([a-z]{2})-([A-Za-z]{2})\b/xms ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"user_agent"} =~ /\b([a-z]{2})-([A-Za-z]{2})\b/msx) 251 1186 1437
2351 251 return { language => uc $1, country => uc $2 };
2352 }
2353  
2354 1186 ▶ if ( $self->{user_agent} =~ m/\[([a-z]{2})\]/xms ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"user_agent"} =~ /\[([a-z]{2})\]/msx) 24 1162 1186
2355 24 return { language => uc $1 };
2356 }
2357  
2358 1162 ▶ if ( $self->{user_agent} =~ m/\(([^)]+)\)/xms ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"user_agent"} =~ /\(([^)]+)\)/msx) 1030 132 1162
2359 1030 my @parts = split( /;/, $1 );
2360 1030 foreach my $part (@parts) {
2361 4162 ▶ if ( $part =~ /^\s*([a-z]{2})\s*$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($part =~ /^\s*([a-z]{2})\s*$/) 98 4064 4162
2362 98 return { language => uc $1 };
2363 }
2364 }
2365 }
2366  
2367 1064 return { language => undef, country => undef };
2368 }
2369  
2370 sub browser_properties {
2371 1806 ▶ my ($self) = @_;
Subroutine browser_properties: called CC=18 SCAR=28.9
Pod documented
2372  
2373 1806 my @browser_properties;
2374  
2375 1806 my ( $test, $value );
2376  
2377 1806 ▶ while ( ( $test, $value ) = each %{ $self->{tests} } ) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %{$$self{"tests"};}) 1577 1806 3383
2378 1577 ▶ push @browser_properties, $test if $value;
Branch: 1 branch
BranchTrueFalseTotal
if $value 1577 0 1577
2379 }
2380 1806 ▶ while ( ( $test, $value ) = each %{ $self->{browser_tests} } ) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %{$$self{"browser_tests"};}) 1623 1806 3429
2381 1623 ▶ push @browser_properties, $test if $value;
Branch: 1 branch
BranchTrueFalseTotal
if $value 1595 28 1623
2382 }
2383  
2384 1806 ▶ $self->_init_device unless $self->{device_tests};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"device_tests"} 1055 751 1806
2385 1806 ▶ $self->_init_os unless $self->{os_tests};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"os_tests"} 311 1495 1806
2386 1806 ▶ $self->_init_robots unless $self->{robot_tests};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"robot_tests"} 389 1417 1806
2387 1806 ▶ $self->_init_version unless $self->{version_tests};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"version_tests"} 402 1404 1806
2388  
2389 1806 ▶ while ( ( $test, $value ) = each %{ $self->{device_tests} } ) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %{$$self{"device_tests"};}) 4015 1806 5821
2390 4015 ▶ push @browser_properties, $test if $value;
Branch: 1 branch
BranchTrueFalseTotal
if $value 934 3081 4015
2391 }
2392 1806 ▶ while ( ( $test, $value ) = each %{ $self->{os_tests} } ) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %{$$self{"os_tests"};}) 3872 1806 5678
2393 3872 ▶ push @browser_properties, $test if $value;
Branch: 1 branch
BranchTrueFalseTotal
if $value 3872 0 3872
2394 }
2395 1806 ▶ while ( ( $test, $value ) = each %{ $self->{robot_tests} } ) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %{$$self{"robot_tests"};}) 438 1806 2244
2396 438 ▶ push @browser_properties, $test if $value;
Branch: 1 branch
BranchTrueFalseTotal
if $value 438 0 438
2397 }
2398 1806 ▶ while ( ( $test, $value ) = each %{ $self->{version_tests} } ) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %{$$self{"version_tests"};}) 2436 1806 4242
2399 2436 ▶ push @browser_properties, $test if $value;
Branch: 1 branch
BranchTrueFalseTotal
if $value 1978 458 2436
2400 }
2401  
2402 # devices are a property too but it's not stored in %tests
2403 # so I explicitly test for it and add it
2404 1806 ▶ push @browser_properties, 'device' if ( $self->device() );
Branch: 1 branch
BranchTrueFalseTotal
if $self->device 420 1386 1806
2405  
2406 1806 return sort @browser_properties;
2407 }
2408  
2409 sub robot_string {
2410 868 ▶ my $self = shift;
Subroutine robot_string: called CC=8 SCAR=20.8
Pod documented
2411  
2412 868 ▶ $self->_init_robots unless exists( $self->{robot_string} );
Branch: 1 branch
BranchTrueFalseTotal
unless exists $self->{"robot_string"} 703 165 868
2413 868 ▶ if ( defined( $self->{robot_fragment} )
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->{"robot_fragment"} and not defined $self->{"robot_string"}) 93 775 868
Condition100%3/3
defined $self->{"robot_fragment"} and not defined $self->{"robot_string"}
!ll&&!rl&&r
772393
MC/DC100%2/2
defined $self->{"robot_fragment"} and not defined $self->{"robot_string"}
defined $self->{"robot_fragment"} not defined $self->{"robot_string"}
Truth table100%3/3
A and not(B)
A= defined $self->{"robot_fragment"}B= not defined $self->{"robot_string"}
ABresult
0X0
100
111
2414 && !defined( $self->{robot_string} ) ) {
2415  
2416 # We haven't figured out what the name is, but we know which
2417 # fragment led us to identify the robot. Set the string based
2418 # on what surrounds the fragment.
2419 93 my $fragment = $self->{robot_fragment};
2420 93 ▶ if (
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"user_agent"} =~ m[\s* # Beginning whitespace ([\w .:,\-\@\/]* # Words before fragment $fragment # Match the fragment [\w .:,\-\@\/]*) # Words after fragment ]xi) 93 0 93
2421 $self->{user_agent} =~ m{\s* # Beginning whitespace
2422 ([\w .:,\-\@\/]* # Words before fragment
2423 $fragment # Match the fragment
2424 [\w .:,\-\@\/]*) # Words after fragment
2425 }ix
2426 ) {
2427 93 $self->{robot_string} = $1;
2428 93 $self->{robot_string} =~ s/ *$//; # Trim whitespace at end
2429 93 ▶ if (
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"user_agent"} eq $self->{"robot_string"} and $self->{"user_agent"} =~ m[\/.*\/] and $self->{"user_agent"} =~ m[ ([\w]* # Words before fragment $fragment # Match the fragment \/[\d\.]+ # Version [\w]*) # Beta stuff ]xi) 3 90 93
Condition100%6/6
$self->{"user_agent"} eq $self->{"robot_string"} and $self->{"user_agent"} =~ m[\/.*\/] and $self->{"user_agent"} =~ m[ ([\w]* # Words before fragment $fragment # Match the fragment \/[\d\.]+ # Version [\w]*) # Beta stuff ]xi
!ll&&!rl&&r
8643
$self->{"user_agent"} eq $self->{"robot_string"} and $self->{"user_agent"} =~ m[\/.*\/]
!ll&&!rl&&r
54327
MC/DC100%3/3
$self->{"user_agent"} eq $self->{"robot_string"} and $self->{"user_agent"} =~ m[\/.*\/] and $self->{"user_agent"} =~ m[ ([\w]* # Words before fragment $fragment # Match the fragment \/[\d\.]+ # Version [\w]*) # Beta stuff ]xi
$self->{"user_agent"} eq $self->{"robot_string"} $self->{"user_agent"} =~ m[\/.*\/] $self->{"user_agent"} =~ m[ ([\w]* # Words before fragment $fragment # Match the fragment \/[\d\.]+ # Version [\w]*) # Beta stuff ]xi
Truth table100%4/4
A and B and C
A= $self->{"user_agent"} eq $self->{"robot_string"}B= $self->{"user_agent"} =~ m[\/.*\/]C= $self->{"user_agent"} =~ m[ ([\w]* # Words before fragment $fragment # Match the fragment \/[\d\.]+ # Version [\w]*) # Beta stuff ]xi
ABCresult
0XX0
10X0
1100
1111
2430 $self->{user_agent} eq $self->{robot_string}
2431 && $self->{user_agent} =~ m{\/.*\/}
2432 && $self->{user_agent} =~ m{
2433 ([\w]* # Words before fragment
2434 $fragment # Match the fragment
2435 \/[\d\.]+ # Version
2436 [\w]*) # Beta stuff
2437 }ix
2438 ) {
2439 # We matched the whole string, but it seems to
2440 # make more sense as whitespace-separated
2441 # "thing/ver" tokens
2442 3 $self->{robot_string} = $1;
2443 }
2444 }
2445 }
2446 868 return $self->{robot_string};
2447 }
2448  
2449 sub robot_name {
2450 133 ▶ my ($self) = @_;
Subroutine robot_name: called CC=1 SCAR=0.0
Pod undocumented
2451 133 return $self->robot_string;
2452 }
2453  
2454 4 1;
2455  
2456 # ABSTRACT: Determine Web browser, version, and platform from an HTTP user agent string
2457  
2458 __END__
↑ Summary Build »