@@ -638,10 +638,10 @@ const get_scr_orientation = (METRIC) => new Promise(resolve => {
638
638
// NOTE: a screen.orientation.addEventListener('change'.. event
639
639
// does not detect css changes, but a resize event does, which
640
640
// is the only one we use, so treat css as truthy
641
- let oData = { 'screen ' : { } , 'window' : { } } , oDisplay = { } , lieCount = 0
641
+ let oData = { 'device ' : { } , 'window' : { } } , oDisplay = { }
642
642
// matchmedia: sorted names
643
643
let oTests = {
644
- 'screen ' : { '-moz-device-orientation' : '#cssOm' , 'device-aspect-ratio' : '#cssDAR' } ,
644
+ 'device ' : { '-moz-device-orientation' : '#cssOm' , 'device-aspect-ratio' : '#cssDAR' } ,
645
645
'window' : { 'aspect-ratio' : '#cssAR' , 'orientation' : '#cssO' }
646
646
}
647
647
let l = 'landscape' , p = 'portrait' , q = '(orientation: ' , s = 'square' , a = 'aspect-ratio'
@@ -669,7 +669,7 @@ const get_scr_orientation = (METRIC) => new Promise(resolve => {
669
669
if ( runST ) { value = undefined } else if ( runSL ) { value += '_fake' }
670
670
if ( value == undefined ) { throw zErrType + 'undefined' } // we expect values (in gecko)
671
671
} catch ( e ) {
672
- log_error ( 1 , METRIC + '_' + item , e )
672
+ log_error ( 1 , METRIC + '_' + type + '_' + item , e )
673
673
value = zErr
674
674
isErr = true
675
675
}
@@ -680,17 +680,17 @@ const get_scr_orientation = (METRIC) => new Promise(resolve => {
680
680
let isLies = ( ! isErr && ! isErrCss && value !== cssvalue )
681
681
oDisplay [ METRIC + '_' + item ] = { 'value' : value , 'lies' : isLies }
682
682
if ( isSmart && isLies ) {
683
- log_known ( 1 , METRIC + '_' + item , value )
683
+ log_known ( 1 , METRIC + '_' + type + '_' + item , value )
684
684
value = zLIE
685
- lieCount ++
686
685
}
687
686
oData [ type ] [ item ] = value
688
687
oData [ type ] [ cssitem ] = cssvalue
689
688
}
690
689
}
691
- // try and get a valid css value
692
- let check = oData . screen [ '-moz-device-orientation_css' ]
693
- if ( zErr == check ) { check = oData . screen [ 'device-aspect-ratio_css' ] }
690
+
691
+ // device: try and get a valid css value
692
+ let check = oData . device [ '-moz-device-orientation_css' ]
693
+ if ( zErr == check ) { check = oData . device [ 'device-aspect-ratio_css' ] }
694
694
if ( 'square' == check ) { check = 'portrait' }
695
695
696
696
// screen
@@ -720,50 +720,51 @@ const get_scr_orientation = (METRIC) => new Promise(resolve => {
720
720
// check mozOrientation + .type matches css
721
721
// note: we can't check the angle, it could be anything - see Piero tablet tests
722
722
if ( 'string' == expected && value . split ( '-' ) [ 0 ] !== check ) {
723
- log_known ( 1 , METRIC + '_ ' + item , value )
723
+ log_known ( 1 , METRIC + '_device_ ' + item , value )
724
724
isLies = true
725
- lieCount ++
726
725
}
727
726
}
728
727
} catch ( e ) {
729
- log_error ( 1 , METRIC + '_ ' + item , e )
728
+ log_error ( 1 , METRIC + '_device_ ' + item , e )
730
729
value = zErr
731
730
}
732
731
oDisplay [ METRIC + '_' + item ] = { 'value' : value , 'lies' : isLies }
733
- oData [ 'screen ' ] [ item ] = isLies ? zLIE : value
732
+ oData [ 'device ' ] [ item ] = isLies ? zLIE : value
734
733
} )
735
734
736
735
// https://searchfox.org/mozilla-central/source/testing/web-platform/tests/screen-orientation/orientation-reading.html
737
736
// see expectedAnglesLandscape + expectedAnglesPortrait
738
- // harden
739
- // ToDo: 2 x css match | 2 x matchmedia match | 2 x mozOrientation + .type match
740
- // this is done with aGood below, but for non-RFP, we could check
741
- // and update oDisplay and oData and lieCount
742
-
743
- for ( const k of Object . keys ( oDisplay ) ) {
744
- addDisplay ( 1 , k , oDisplay [ k ] [ 'value' ] , '' , '' , oDisplay [ k ] [ 'lies' ] )
737
+ // display, data
738
+ for ( const k of Object . keys ( oDisplay ) ) { addDisplay ( 1 , k , oDisplay [ k ] [ 'value' ] , '' , '' , oDisplay [ k ] [ 'lies' ] ) }
739
+ for ( const k of Object . keys ( oData ) ) {
740
+ // objects are already sorted
741
+ let data = oData [ k ]
742
+ let hash = mini ( data )
743
+ addData ( 1 , METRIC + '_' + k , oData [ k ] , hash )
744
+ if ( 'device' == k ) {
745
+ // device health check
746
+ // FF132+: 1607032 + 1918202 | FF133+: 1922204 | backported to BB
747
+ // RFP is always primary | on android the angle of 0 vs 90 is reversed
748
+
749
+ // type | angle | orientation (css) + aspect ratio (css)
750
+ let oGood = {
751
+ 'a1de035c' : 'landscape-primary | 0 | landscape' ,
752
+ 'ccc8dc6d' : 'portrait-primary | 90 | portrait' ,
753
+ 'fb6084ad' : 'portrait-primary | 90 | portrait | square' ,
754
+ }
755
+ if ( 'android' == isOS ) {
756
+ oGood = {
757
+ '813838a9' : 'landscape-primary | 90 | landscape' ,
758
+ '360dd99a' : 'portrait-primary | 0 | portrait' ,
759
+ 'fdc0295a' : 'portrait-primary | 0 | portrait | square' ,
760
+ }
761
+ }
762
+ let display = undefined !== oGood [ hash ] ? oGood [ hash ] : hash
763
+ addDisplay ( 1 , METRIC + '_' + k + '_summary' , display )
764
+ addDisplay ( 1 , METRIC + '_' + k , '' , '' , ( undefined !== oGood [ hash ] ? rfp_green : rfp_red ) )
765
+ }
745
766
}
746
767
747
- // objects are already sorted
748
- let hash = mini ( oData )
749
- // FF132+: 1607032 + 1918202 | FF133+: 1922204 | backported to TB
750
- // all seven metrics should always return one of 3 hashes
751
- // landscape, portrait, portrait but square
752
- // RFP is always primary | on android the angle of 0 vs 90 is reversed
753
- let aGood = [
754
- '7a1ec766' , // 0 landscape
755
- '5c281761' , // 90 portrait
756
- 'a55cb95d' , // 90 portrait/square
757
- ]
758
- if ( 'android' == isOS ) {
759
- aGood = [
760
- 'bd9328e9' , // 90 landscape
761
- 'df6d41d8' , // 0 portrait
762
- 'e6c593d4' , // 0 portrait/square
763
- ]
764
- }
765
- addDisplay ( 1 , METRIC , '' , '' , ( aGood . includes ( hash ) ? orientation_green : orientation_red ) )
766
- addData ( 1 , METRIC , oData , hash )
767
768
return resolve ( )
768
769
} )
769
770
0 commit comments