avm1: If a NaN is provided to new Date(timestamp), fail immediately
This commit is contained in:
parent
9dfc20e1ba
commit
f50b29151c
|
@ -584,13 +584,18 @@ fn constructor<'gc>(
|
|||
.millisecond_opt(args.get(6))?
|
||||
.adjust_year(|year| if year < 100 { year + 1900 } else { year })
|
||||
.apply(this);
|
||||
} else if let LocalResult::Single(time) =
|
||||
Utc.timestamp_millis_opt(timestamp.coerce_to_f64(activation)? as i64)
|
||||
{
|
||||
} else {
|
||||
let timestamp = timestamp.coerce_to_f64(activation)?;
|
||||
if timestamp.is_finite() {
|
||||
if let LocalResult::Single(time) = Utc.timestamp_millis_opt(timestamp as i64) {
|
||||
this.set_date_time(activation.context.gc_context, Some(time))
|
||||
} else {
|
||||
this.set_date_time(activation.context.gc_context, None);
|
||||
}
|
||||
} else {
|
||||
this.set_date_time(activation.context.gc_context, None);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.set_date_time(
|
||||
activation.context.gc_context,
|
||||
|
|
Loading…
Reference in New Issue