From 73966f1b31f61973ee2c6cd83346f5a7c94c9a17 Mon Sep 17 00:00:00 2001 From: David Wendt Date: Tue, 25 Feb 2020 19:53:36 -0500 Subject: [PATCH] Make sure that we actually call the super constructor, not our own constructor. --- core/src/avm2.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/core/src/avm2.rs b/core/src/avm2.rs index 2b2b56a1c..6b2d9da05 100644 --- a/core/src/avm2.rs +++ b/core/src/avm2.rs @@ -1113,12 +1113,15 @@ impl<'gc> Avm2<'gc> { let args = self.pop_args(arg_count); let receiver = self.pop().as_object()?; let name = QName::new(Namespace::public_namespace(), "constructor"); - let function = self + let base_proto: Result, Error> = self .current_stack_frame() .unwrap() .read() .base_proto() - .unwrap_or(receiver) + .and_then(|p| p.proto()) + .ok_or_else(|| "No base prototype!".to_string().into()); + + let function = base_proto? .get_property(&name, self, context)? .resolve(self, context)? .as_object()?;