26
26
import java .util .TimeZone ;
27
27
28
28
import org .apache .commons .io .FilenameUtils ;
29
- import org .htmlunit .javascript .configuration .AbstractJavaScriptConfiguration ;
30
29
import org .htmlunit .javascript .configuration .BrowserFeature ;
31
30
import org .htmlunit .javascript .configuration .SupportedBrowser ;
32
31
import org .htmlunit .util .MimeType ;
64
63
@ SuppressWarnings ("PMD.AvoidDuplicateLiterals" )
65
64
public final class BrowserVersion implements Serializable {
66
65
67
- /**
68
- * Application name the Netscape navigator series of browsers.
69
- */
70
- private static final String NETSCAPE = "Netscape" ;
71
-
72
- /**
73
- * United States English language identifier.
74
- */
75
- private static final String LANGUAGE_ENGLISH_US = "en-US" ;
76
-
77
- /**
78
- * United States.
79
- */
80
- private static final String TIMEZONE_NEW_YORK = "America/New_York" ;
81
-
82
- /**
83
- * The WIN32 platform.
84
- */
85
- private static final String PLATFORM_WIN32 = "Win32" ;
86
-
87
66
/** Latest Firefox. */
88
67
public static final BrowserVersion FIREFOX = new BrowserVersion (133 , "FF" );
89
68
@@ -117,6 +96,7 @@ public final class BrowserVersion implements Serializable {
117
96
+ FIREFOX_ESR .getBrowserVersionNumeric () + ".0) Gecko/20100101 Firefox/"
118
97
+ FIREFOX_ESR .getBrowserVersionNumeric () + ".0" ;
119
98
FIREFOX_ESR .buildId_ = "20181001000000" ;
99
+ FIREFOX_ESR .vendor_ = "" ;
120
100
FIREFOX_ESR .productSub_ = "20100101" ;
121
101
FIREFOX_ESR .headerNamesOrdered_ = new String [] {
122
102
HttpHeader .HOST ,
@@ -152,6 +132,7 @@ public final class BrowserVersion implements Serializable {
152
132
+ FIREFOX .getBrowserVersionNumeric () + ".0) Gecko/20100101 Firefox/"
153
133
+ FIREFOX .getBrowserVersionNumeric () + ".0" ;
154
134
FIREFOX .buildId_ = "20181001000000" ;
135
+ FIREFOX .vendor_ = "" ;
155
136
FIREFOX .productSub_ = "20100101" ;
156
137
FIREFOX .headerNamesOrdered_ = new String [] {
157
138
HttpHeader .HOST ,
@@ -188,7 +169,6 @@ public final class BrowserVersion implements Serializable {
188
169
CHROME .userAgent_ = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/"
189
170
+ CHROME .getBrowserVersionNumeric () + ".0.0.0 Safari/537.36" ;
190
171
191
- CHROME .applicationCodeName_ = "Mozilla" ;
192
172
CHROME .vendor_ = "Google Inc." ;
193
173
CHROME .productSub_ = "20030107" ;
194
174
CHROME .headerNamesOrdered_ = new String [] {
@@ -234,7 +214,6 @@ public final class BrowserVersion implements Serializable {
234
214
+ EDGE .getBrowserVersionNumeric () + ".0.0.0 Safari/537.36 Edg/"
235
215
+ EDGE .getBrowserVersionNumeric () + ".0.0.0" ;
236
216
237
- EDGE .applicationCodeName_ = "Mozilla" ;
238
217
EDGE .vendor_ = "Google Inc." ;
239
218
EDGE .productSub_ = "20030107" ;
240
219
EDGE .headerNamesOrdered_ = new String [] {
@@ -387,17 +366,17 @@ public final class BrowserVersion implements Serializable {
387
366
private final int browserVersionNumeric_ ;
388
367
private final String nickname_ ;
389
368
390
- private String applicationCodeName_ = "Mozilla" ;
391
- private String applicationMinorVersion_ = "0" ;
369
+ private String applicationCodeName_ ;
370
+ private String applicationMinorVersion_ ;
392
371
private String applicationName_ ;
393
372
private String applicationVersion_ ;
394
373
private String buildId_ ;
395
374
private String productSub_ ;
396
- private String vendor_ = "" ;
397
- private Locale browserLocale_ = Locale . forLanguageTag ( LANGUAGE_ENGLISH_US ) ;
398
- private boolean onLine_ = true ;
399
- private String platform_ = PLATFORM_WIN32 ;
400
- private TimeZone systemTimezone_ = TimeZone . getTimeZone ( TIMEZONE_NEW_YORK ) ;
375
+ private String vendor_ ;
376
+ private Locale browserLocale_ ;
377
+ private boolean onLine_ ;
378
+ private String platform_ ;
379
+ private TimeZone systemTimezone_ ;
401
380
private String userAgent_ ;
402
381
private final Set <BrowserVersionFeatures > features_ ;
403
382
private String acceptEncodingHeader_ ;
@@ -423,7 +402,15 @@ public final class BrowserVersion implements Serializable {
423
402
browserVersionNumeric_ = browserVersionNumeric ;
424
403
nickname_ = nickname ;
425
404
426
- applicationName_ = NETSCAPE ;
405
+ applicationCodeName_ = "Mozilla" ;
406
+ applicationMinorVersion_ = "0" ;
407
+ applicationName_ = "Netscape" ;
408
+ onLine_ = true ;
409
+ platform_ = "Win32" ;
410
+
411
+ browserLocale_ = Locale .forLanguageTag ("en-US" );
412
+ systemTimezone_ = TimeZone .getTimeZone ("America/New_York" );
413
+
427
414
acceptEncodingHeader_ = "gzip, deflate, br" ;
428
415
htmlAcceptHeader_ = "*/*" ;
429
416
imgAcceptHeader_ = "*/*" ;
@@ -468,7 +455,7 @@ else if (isFirefox()) {
468
455
final BrowserFeature browserFeature = field .getAnnotation (BrowserFeature .class );
469
456
if (browserFeature != null ) {
470
457
for (final SupportedBrowser browser : browserFeature .value ()) {
471
- if (AbstractJavaScriptConfiguration . isCompatible ( expectedBrowser , browser ) ) {
458
+ if (expectedBrowser == browser ) {
472
459
features_ .add (features );
473
460
}
474
461
}
0 commit comments