pub fn arg_integer_or(
interp: &mut Interp<'_>,
args: &[Value],
index: usize,
fallback: f64,
) -> JsResult<f64>Expand description
arg_int_or through ToIntegerOrInfinity, so an object argument is converted
properly.
arg_int_or uses Value::to_number, which is a plain field read for an object — it
answers NaN instead of running valueOf. That is fine for code that already has a
number and wrong for everything the spec says ToIntegerOrInfinity about:
"ABBABABAB".indexOf("AB", {valueOf: () => true}) was -1 because the object never
became 1. This version goes through the interpreter, so valueOf and toString run.