Constructing a new object sets `constructor` on that object for SWFv6 and lower.

This commit is contained in:
David Wendt 2020-04-15 23:07:20 -04:00
parent b8fd1eac9c
commit 17d96a0fa6
1 changed files with 9 additions and 0 deletions

View File

@ -2077,6 +2077,10 @@ impl<'gc> Avm1<'gc> {
let this = prototype.new(self, context, prototype, &args)?;
if self.current_swf_version() < 7 {
this.set("constructor", constructor.into(), self, context)?;
}
//TODO: What happens if you `ActionNewMethod` without a method name?
constructor
.call(self, context, this, None, &args)?
@ -2114,6 +2118,11 @@ impl<'gc> Avm1<'gc> {
.as_object()
{
let this = prototype.new(self, context, prototype, &args)?;
if self.current_swf_version() < 7 {
this.set("constructor", constructor.into(), self, context)?;
}
constructor
.call(self, context, this, None, &args)?
.resolve(self, context)?;