avm1: Pass undefined this for CallMethod with non-string method_name

This isn't the most accurate behavior, since it should be an unboxed
Value, but currently it's not possible due to #843.
This commit is contained in:
relrelb 2021-04-02 23:21:09 +03:00 committed by Mike Welsh
parent 6a34070e76
commit 95cffdc2f9
2 changed files with 4 additions and 3 deletions

View File

@ -860,8 +860,9 @@ impl<'a, 'gc, 'gc_context> Activation<'a, 'gc, 'gc_context> {
// Call `this[method_name]`
object.call_method(&method_name.as_str(), &args, self)?
} else {
// Undefined/empty method name; call `this` as a function
let this = self.target_clip_or_root()?.object().coerce_to_object(self);
// Undefined/empty method name; call `this` as a function.
// TODO: Pass primitive value instead of boxing (#843).
let this = Value::Undefined.coerce_to_object(self);
object.call("[Anonymous]", self, this, None, &args)?
};

View File

@ -50,7 +50,7 @@ impl<'gc> Timers<'gc> {
);
// TODO: `this` is undefined for non-method timer callbacks, but our VM
// currently doesn't allow `this` to be a Value.
// currently doesn't allow `this` to be a Value (#843).
let undefined = Value::Undefined.coerce_to_object(&mut activation);
let mut tick_count = 0;