avm1: Fix String.lastIndexOf(undefined)

This commit is contained in:
Nathan Adams 2020-09-04 14:13:21 +02:00 committed by Mike Welsh
parent ea7a9758c4
commit b2dc564628
4 changed files with 7 additions and 1 deletions

View File

@ -319,7 +319,7 @@ fn last_index_of<'gc>(
.encode_utf16()
.collect::<Vec<u16>>();
let pattern = match args.get(0) {
None | Some(Value::Undefined) => return Ok(Value::Undefined),
None => return Ok(Value::Undefined),
Some(s) => s
.clone()
.coerce_to_string(activation)?

View File

@ -140,6 +140,12 @@ undefined
// s.lastIndexOf(null)
17
// s.lastIndexOf(undefined)
-1
// "hello undefined hi".lastIndexOf(undefined)
6
// slice
// s.slice(1, 4)
ell