File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed
dotnet/src/webdriver/BiDi/Modules/Script Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -93,9 +93,6 @@ public static LocalValue ConvertFrom(object? value)
9393 }
9494 }
9595
96- private static readonly BigInteger MaxDouble = new BigInteger ( double . MaxValue ) ;
97- private static readonly BigInteger MinDouble = new BigInteger ( double . MinValue ) ;
98-
9996 public static LocalValue ConvertFrom ( JsonNode ? node )
10097 {
10198 if ( node is null )
@@ -121,14 +118,16 @@ public static LocalValue ConvertFrom(JsonNode? node)
121118 {
122119 var numberString = node . ToString ( ) ;
123120
124- var bigNumber = BigInteger . Parse ( numberString ) ;
121+ var numberAsDouble = double . Parse ( numberString ) ;
125122
126- if ( bigNumber > MaxDouble || bigNumber < MinDouble )
123+ if ( double . IsInfinity ( numberAsDouble ) )
127124 {
125+ // Numbers outside of Int64's range will successfully parse, but become +- Infinity
126+ // We can retain the value using a BigInt
128127 return new BigIntLocalValue ( numberString ) ;
129128 }
130129
131- return new NumberLocalValue ( double . Parse ( numberString ) ) ;
130+ return new NumberLocalValue ( numberAsDouble ) ;
132131 }
133132
134133 case System . Text . Json . JsonValueKind . Array :
You can’t perform that action at this time.
0 commit comments