Check to make sure that overrides only apply to already-installed properties.

This commit is contained in:
David Wendt 2021-06-08 17:22:11 -04:00
parent 5662527c9e
commit 7d86c93ddc
1 changed files with 9 additions and 0 deletions

View File

@ -460,6 +460,15 @@ pub trait TObject<'gc>: 'gc + Collect + Debug + Into<Object<'gc>> + Clone + Copy
let receiver = (*self).into(); let receiver = (*self).into();
let scope = self.get_scope(); let scope = self.get_scope();
let trait_name = trait_entry.name().clone(); let trait_name = trait_entry.name().clone();
if trait_entry.is_override() && !self.has_own_property(&trait_name)? {
return Err(format!(
"Attempted to override property {:?}, which is not already defined",
trait_name
)
.into());
}
avm_debug!( avm_debug!(
activation.avm2(), activation.avm2(),
"Installing trait {:?} of kind {:?}", "Installing trait {:?} of kind {:?}",