9
9
INCOMPATIBLE_ANDROID_UNSUPPORTED ,
10
10
INCOMPATIBLE_FIREFOX_FOR_IOS ,
11
11
INCOMPATIBLE_NOT_FIREFOX ,
12
+ INCOMPATIBLE_OLD_ROOT_CERT_VERSION ,
12
13
INCOMPATIBLE_OVER_MAX_VERSION ,
13
14
INCOMPATIBLE_UNDER_MIN_VERSION ,
14
15
INCOMPATIBLE_UNSUPPORTED_PLATFORM ,
@@ -27,6 +28,7 @@ import {
27
28
isFirefox ,
28
29
isFirefoxForAndroid ,
29
30
isFirefoxForIOS ,
31
+ isFirefoxWithOldRootCerts ,
30
32
} from 'amo/utils/compatibility' ;
31
33
import {
32
34
createFakeLocation ,
@@ -90,6 +92,40 @@ describe(__filename, () => {
90
92
} ) ;
91
93
} ) ;
92
94
95
+ describe ( 'isFirefoxWithOldRootCerts' , ( ) => {
96
+ it . each ( [
97
+ ...userAgents . androidWebkit ,
98
+ ...userAgents . chromeAndroid ,
99
+ ...userAgents . chrome ,
100
+ ] ) ( 'returns false for %s' , ( userAgent ) => {
101
+ expect (
102
+ isFirefoxWithOldRootCerts ( { userAgentInfo : UAParser ( userAgent ) } ) ,
103
+ ) . toEqual ( false ) ;
104
+ } ) ;
105
+
106
+ it . each ( [
107
+ userAgentsByPlatform . windows . firefox115 ,
108
+ userAgentsByPlatform . mac . firefox128 ,
109
+ userAgentsByPlatform . mac . firefox136 ,
110
+ userAgentsByPlatform . android . firefox136 ,
111
+ ] ) ( 'returns false for %s' , ( userAgent ) => {
112
+ expect (
113
+ isFirefoxWithOldRootCerts ( { userAgentInfo : UAParser ( userAgent ) } ) ,
114
+ ) . toEqual ( false ) ;
115
+ } ) ;
116
+
117
+ it . each ( [
118
+ userAgentsByPlatform . windows . firefox40 ,
119
+ userAgentsByPlatform . mac . firefox69 ,
120
+ userAgentsByPlatform . linux . firefox10 ,
121
+ userAgentsByPlatform . android . firefox70 ,
122
+ ] ) ( 'returns true for %s' , ( userAgent ) => {
123
+ expect (
124
+ isFirefoxWithOldRootCerts ( { userAgentInfo : UAParser ( userAgent ) } ) ,
125
+ ) . toEqual ( true ) ;
126
+ } ) ;
127
+ } ) ;
128
+
93
129
describe ( 'isDesktop' , ( ) => {
94
130
it . each ( [ ...userAgents . chrome , ...userAgents . firefox ] ) (
95
131
'returns true for %s' ,
@@ -112,7 +148,7 @@ describe(__filename, () => {
112
148
const _isCompatibleWithUserAgent = ( {
113
149
addon = createInternalAddonWithLang ( fakeAddon ) ,
114
150
currentVersion = createInternalVersionWithLang ( fakeAddon . current_version ) ,
115
- userAgentInfo = UAParser ( userAgentsByPlatform . windows . firefox40 ) ,
151
+ userAgentInfo = UAParser ( userAgentsByPlatform . windows . firefox115 ) ,
116
152
...rest
117
153
} ) => {
118
154
return isCompatibleWithUserAgent ( {
@@ -126,7 +162,7 @@ describe(__filename, () => {
126
162
it ( 'is compatible with Firefox' , ( ) => {
127
163
expect (
128
164
_isCompatibleWithUserAgent ( {
129
- userAgentInfo : UAParser ( userAgents . firefox [ 0 ] ) ,
165
+ userAgentInfo : UAParser ( userAgentsByPlatform . windows . firefox115 ) ,
130
166
} ) ,
131
167
) . toEqual ( { compatible : true , reason : null } ) ;
132
168
} ) ;
@@ -141,24 +177,10 @@ describe(__filename, () => {
141
177
} ) ;
142
178
} ) ;
143
179
144
- it ( 'is compatible with Firefox for Android, when promoted' , ( ) => {
145
- userAgents . firefoxAndroid . forEach ( ( userAgent ) => {
146
- expect (
147
- _isCompatibleWithUserAgent ( {
148
- addon : createInternalAddonWithLang ( {
149
- ...fakeAddon ,
150
- promoted : { category : RECOMMENDED , apps : [ CLIENT_APP_ANDROID ] } ,
151
- } ) ,
152
- userAgentInfo : UAParser ( userAgent ) ,
153
- } ) ,
154
- ) . toEqual ( { compatible : true , reason : null } ) ;
155
- } ) ;
156
- } ) ;
157
-
158
- it ( 'is compatible with Firefox >= 69' , ( ) => {
180
+ it ( 'is compatible with Firefox >= 128' , ( ) => {
159
181
expect (
160
182
_isCompatibleWithUserAgent ( {
161
- userAgentInfo : UAParser ( userAgentsByPlatform . mac . firefox69 ) ,
183
+ userAgentInfo : UAParser ( userAgentsByPlatform . mac . firefox128 ) ,
162
184
} ) ,
163
185
) . toEqual ( { compatible : true , reason : null } ) ;
164
186
} ) ;
@@ -185,23 +207,23 @@ describe(__filename, () => {
185
207
) . toEqual ( { compatible : false , reason : INCOMPATIBLE_NOT_FIREFOX } ) ;
186
208
} ) ;
187
209
188
- it ( 'should mark Firefox 10 as incompatible with a minVersion of 10 .1' , ( ) => {
210
+ it ( 'should mark Firefox 128 as incompatible with a minVersion of 128 .1' , ( ) => {
189
211
const userAgentInfo = {
190
- browser : { name : 'Firefox' , version : '10 .0' } ,
212
+ browser : { name : 'Firefox' , version : '128 .0' } ,
191
213
os : { name : 'Windows' } ,
192
214
} ;
193
215
expect (
194
216
_isCompatibleWithUserAgent ( {
195
- minVersion : '10 .1' ,
217
+ minVersion : '128 .1' ,
196
218
userAgentInfo,
197
219
} ) ,
198
220
) . toEqual ( { compatible : false , reason : INCOMPATIBLE_UNDER_MIN_VERSION } ) ;
199
221
} ) ;
200
222
201
- it ( 'should mark Firefox 24 as compatible with a maxVersion of 8' , ( ) => {
223
+ it ( 'should mark Firefox 115 as compatible with a maxVersion of 8' , ( ) => {
202
224
// https://github.com/mozilla/addons-frontend/issues/2074
203
225
const userAgentInfo = {
204
- browser : { name : 'Firefox' , version : '24 .0' } ,
226
+ browser : { name : 'Firefox' , version : '115 .0' } ,
205
227
os : { name : 'Windows' } ,
206
228
} ;
207
229
expect (
@@ -218,7 +240,7 @@ describe(__filename, () => {
218
240
219
241
it ( 'should mark Firefox as compatible when no min or max version' , ( ) => {
220
242
const userAgentInfo = {
221
- browser : { name : 'Firefox' , version : '10 .0' } ,
243
+ browser : { name : 'Firefox' , version : '128 .0' } ,
222
244
os : { name : 'Windows' } ,
223
245
} ;
224
246
expect (
@@ -232,7 +254,7 @@ describe(__filename, () => {
232
254
// WebExtensions are marked as having a maxVersion of "*" by addons-server
233
255
// if their manifests don't contain explicit version information.
234
256
const userAgentInfo = {
235
- browser : { name : 'Firefox' , version : '54 .0' } ,
257
+ browser : { name : 'Firefox' , version : '128 .0' } ,
236
258
os : { name : 'Windows' } ,
237
259
} ;
238
260
expect (
@@ -324,13 +346,44 @@ describe(__filename, () => {
324
346
promoted : { category : RECOMMENDED , apps : [ CLIENT_APP_ANDROID ] } ,
325
347
} ) ,
326
348
currentVersion,
327
- userAgentInfo : UAParser ( userAgentsByPlatform . android . firefox40Mobile ) ,
349
+ userAgentInfo : UAParser ( userAgentsByPlatform . android . firefox136 ) ,
328
350
} ) ,
329
351
) . toEqual ( {
330
352
compatible : false ,
331
353
reason : INCOMPATIBLE_ANDROID_UNSUPPORTED ,
332
354
} ) ;
333
355
} ) ;
356
+
357
+ it ( 'is incompatible with Firefox < 128 because of root cert expiration' , ( ) => {
358
+ const userAgentInfo = {
359
+ browser : { name : 'Firefox' , version : '127.0' } ,
360
+ os : { name : 'Windows' } ,
361
+ } ;
362
+ // Would normally be considered compatible, but because Firefox is < 128
363
+ // (and not 115, see test below) it's not.
364
+ expect (
365
+ _isCompatibleWithUserAgent ( {
366
+ minVersion : '57.0' ,
367
+ userAgentInfo,
368
+ } ) ,
369
+ ) . toEqual ( {
370
+ compatible : false ,
371
+ reason : INCOMPATIBLE_OLD_ROOT_CERT_VERSION ,
372
+ } ) ;
373
+ } ) ;
374
+
375
+ it ( 'is still compatible with Firefox 115' , ( ) => {
376
+ const userAgentInfo = {
377
+ browser : { name : 'Firefox' , version : '115.0' } ,
378
+ os : { name : 'Windows' } ,
379
+ } ;
380
+ expect (
381
+ _isCompatibleWithUserAgent ( {
382
+ minVersion : '57.0' ,
383
+ userAgentInfo,
384
+ } ) ,
385
+ ) . toEqual ( { compatible : true , reason : null } ) ;
386
+ } ) ;
334
387
} ) ;
335
388
336
389
describe ( 'getCompatibleVersions' , ( ) => {
@@ -463,7 +516,7 @@ describe(__filename, () => {
463
516
} ;
464
517
465
518
it ( 'returns true for Firefox (reason undefined when compatibile)' , ( ) => {
466
- const { browser, os } = UAParser ( userAgentsByPlatform . mac . firefox57 ) ;
519
+ const { browser, os } = UAParser ( userAgentsByPlatform . mac . firefox136 ) ;
467
520
const userAgentInfo = { browser, os } ;
468
521
const clientApp = CLIENT_APP_FIREFOX ;
469
522
const currentVersion = createInternalVersionWithLang ( {
@@ -491,7 +544,7 @@ describe(__filename, () => {
491
544
} ) ;
492
545
493
546
it ( 'returns maxVersion when set' , ( ) => {
494
- const { browser, os } = UAParser ( userAgents . firefox [ 0 ] ) ;
547
+ const { browser, os } = UAParser ( userAgentsByPlatform . mac . firefox136 ) ;
495
548
const userAgentInfo = { browser, os } ;
496
549
497
550
expect (
@@ -514,7 +567,7 @@ describe(__filename, () => {
514
567
} ) ;
515
568
516
569
it ( 'returns minVersion when set' , ( ) => {
517
- const { browser, os } = UAParser ( userAgents . firefox [ 0 ] ) ;
570
+ const { browser, os } = UAParser ( userAgentsByPlatform . mac . firefox136 ) ;
518
571
const userAgentInfo = { browser, os } ;
519
572
520
573
expect (
@@ -565,7 +618,7 @@ describe(__filename, () => {
565
618
} ) ;
566
619
567
620
it ( 'returns incompatible when currentVersion is null' , ( ) => {
568
- const { browser, os } = UAParser ( userAgents . firefox [ 0 ] ) ;
621
+ const { browser, os } = UAParser ( userAgentsByPlatform . mac . firefox136 ) ;
569
622
const userAgentInfo = { browser, os } ;
570
623
const clientApp = CLIENT_APP_FIREFOX ;
571
624
@@ -584,7 +637,7 @@ describe(__filename, () => {
584
637
} ) ;
585
638
586
639
it ( 'returns compatible if strict compatibility is off' , ( ) => {
587
- const { browser, os } = UAParser ( userAgents . firefox [ 4 ] ) ;
640
+ const { browser, os } = UAParser ( userAgentsByPlatform . mac . firefox136 ) ;
588
641
const userAgentInfo = { browser, os } ;
589
642
590
643
expect (
@@ -595,7 +648,7 @@ describe(__filename, () => {
595
648
compatibility : {
596
649
...fakeAddon . current_version . compatibility ,
597
650
[ CLIENT_APP_FIREFOX ] : {
598
- max : '56 .*' ,
651
+ max : '135 .*' ,
599
652
min : '24.0' ,
600
653
} ,
601
654
} ,
@@ -608,7 +661,7 @@ describe(__filename, () => {
608
661
} ) ;
609
662
610
663
it ( 'returns incompatible if strict compatibility enabled' , ( ) => {
611
- const { browser, os } = UAParser ( userAgents . firefox [ 5 ] ) ;
664
+ const { browser, os } = UAParser ( userAgentsByPlatform . mac . firefox136 ) ;
612
665
const userAgentInfo = { browser, os } ;
613
666
614
667
expect (
@@ -619,7 +672,7 @@ describe(__filename, () => {
619
672
compatibility : {
620
673
...fakeAddon . current_version . compatibility ,
621
674
[ CLIENT_APP_FIREFOX ] : {
622
- max : '56 .*' ,
675
+ max : '135 .*' ,
623
676
min : '24.0' ,
624
677
} ,
625
678
} ,
@@ -635,7 +688,7 @@ describe(__filename, () => {
635
688
} ) ;
636
689
637
690
it ( 'returns incompatible when add-on does not support client app' , ( ) => {
638
- const { browser, os } = UAParser ( userAgentsByPlatform . mac . firefox57 ) ;
691
+ const { browser, os } = UAParser ( userAgentsByPlatform . mac . firefox136 ) ;
639
692
const userAgentInfo = { browser, os } ;
640
693
641
694
expect (
@@ -656,9 +709,7 @@ describe(__filename, () => {
656
709
} ) ;
657
710
658
711
it ( 'returns correct reason when add-on is incompatible with android' , ( ) => {
659
- const { browser, os } = UAParser (
660
- userAgentsByPlatform . android . firefox40Mobile ,
661
- ) ;
712
+ const { browser, os } = UAParser ( userAgentsByPlatform . android . firefox136 ) ;
662
713
const userAgentInfo = { browser, os } ;
663
714
664
715
expect (
@@ -715,7 +766,7 @@ describe(__filename, () => {
715
766
_correctedLocationForPlatform ( {
716
767
clientApp : CLIENT_APP_FIREFOX ,
717
768
lang,
718
- userAgentInfo : UAParser ( userAgentsByPlatform . android . firefox40Mobile ) ,
769
+ userAgentInfo : UAParser ( userAgentsByPlatform . android . firefox136 ) ,
719
770
} ) ,
720
771
) . toEqual ( getMobileHomepageLink ( lang ) ) ;
721
772
} ) ;
@@ -728,7 +779,7 @@ describe(__filename, () => {
728
779
isHomePage : false ,
729
780
lang,
730
781
location : createFakeLocation ( { pathname : '/some/path' } ) ,
731
- userAgentInfo : UAParser ( userAgentsByPlatform . android . firefox40Mobile ) ,
782
+ userAgentInfo : UAParser ( userAgentsByPlatform . android . firefox136 ) ,
732
783
} ) ,
733
784
) . toEqual ( null ) ;
734
785
} ) ;
@@ -739,7 +790,7 @@ describe(__filename, () => {
739
790
clientApp : CLIENT_APP_ANDROID ,
740
791
isHomePage : true ,
741
792
location : createFakeLocation ( { pathname : '/some/path' } ) ,
742
- userAgentInfo : UAParser ( userAgentsByPlatform . android . firefox40Mobile ) ,
793
+ userAgentInfo : UAParser ( userAgentsByPlatform . android . firefox136 ) ,
743
794
} ) ,
744
795
) . toEqual ( null ) ;
745
796
} ) ;
@@ -750,7 +801,7 @@ describe(__filename, () => {
750
801
clientApp : CLIENT_APP_ANDROID ,
751
802
isHomePage : false ,
752
803
location : createFakeLocation ( { pathname : '/search/' } ) ,
753
- userAgentInfo : UAParser ( userAgentsByPlatform . android . firefox40Mobile ) ,
804
+ userAgentInfo : UAParser ( userAgentsByPlatform . android . firefox136 ) ,
754
805
} ) ,
755
806
) . toEqual ( null ) ;
756
807
} ) ;
@@ -763,7 +814,7 @@ describe(__filename, () => {
763
814
_correctedLocationForPlatform ( {
764
815
clientApp : CLIENT_APP_ANDROID ,
765
816
location : createFakeLocation ( { pathname, search } ) ,
766
- userAgentInfo : UAParser ( userAgentsByPlatform . mac . firefox69 ) ,
817
+ userAgentInfo : UAParser ( userAgentsByPlatform . mac . firefox136 ) ,
767
818
} ) ,
768
819
) . toEqual ( `/en-US/${ CLIENT_APP_FIREFOX } /addon/slug/${ search } ` ) ;
769
820
} ) ;
@@ -779,7 +830,7 @@ describe(__filename, () => {
779
830
clientApp : CLIENT_APP_ANDROID ,
780
831
lang : 'en-US' ,
781
832
location : createFakeLocation ( { pathname, search } ) ,
782
- userAgentInfo : UAParser ( userAgentsByPlatform . mac . firefox69 ) ,
833
+ userAgentInfo : UAParser ( userAgentsByPlatform . mac . firefox136 ) ,
783
834
} ) ,
784
835
) . toEqual ( `/en-US/${ CLIENT_APP_FIREFOX } /addon/slug/${ search } ` ) ;
785
836
} ) ;
@@ -791,7 +842,7 @@ describe(__filename, () => {
791
842
_correctedLocationForPlatform ( {
792
843
clientApp : CLIENT_APP_ANDROID ,
793
844
location : createFakeLocation ( { pathname } ) ,
794
- userAgentInfo : UAParser ( userAgentsByPlatform . mac . firefox69 ) ,
845
+ userAgentInfo : UAParser ( userAgentsByPlatform . mac . firefox136 ) ,
795
846
} ) ,
796
847
) . toEqual (
797
848
`/en-US/${ CLIENT_APP_FIREFOX } /addon/awesome-android-extension/` ,
@@ -802,7 +853,7 @@ describe(__filename, () => {
802
853
expect (
803
854
_correctedLocationForPlatform ( {
804
855
clientApp : CLIENT_APP_FIREFOX ,
805
- userAgentInfo : UAParser ( userAgentsByPlatform . mac . firefox69 ) ,
856
+ userAgentInfo : UAParser ( userAgentsByPlatform . mac . firefox136 ) ,
806
857
} ) ,
807
858
) . toEqual ( null ) ;
808
859
} ) ;
0 commit comments