Skip to content

Commit

Permalink
avm2: Handle setting tabIndex to -1
Browse files Browse the repository at this point in the history
Despite throwing an error that `tabIndex` cannot be negative,
the value of -1 is allowed, and it means that `tabIndex` is unset.
  • Loading branch information
kjarosh authored and Dinnerbone committed Apr 30, 2024
1 parent f40cb64 commit 8ee514e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion core/src/avm2/globals/flash/display/interactive_object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,9 @@ pub fn set_tab_index<'gc>(
) -> Result<Value<'gc>, Error<'gc>> {
if let Some(obj) = this.as_display_object().and_then(|o| o.as_interactive()) {
let value = args.get_i32(activation, 0)?;
if value < 0 {
// Despite throwing an error that tabIndex cannot be negative,
// the value of -1 is allowed, and it means that tabIndex is unset.
if value < -1 {
return Err(make_error_2027(activation, value));
}
obj.set_tab_index(&mut activation.context, Some(value));
Expand Down

0 comments on commit 8ee514e

Please sign in to comment.