diff --git a/core/src/avm2/globals/xml_list.rs b/core/src/avm2/globals/xml_list.rs index a0ab8816a..3e595126d 100644 --- a/core/src/avm2/globals/xml_list.rs +++ b/core/src/avm2/globals/xml_list.rs @@ -201,12 +201,7 @@ pub fn copy<'gc>( _args: &[Value<'gc>], ) -> Result, Error<'gc>> { let list = this.as_xml_list_object().unwrap(); - let children = list - .children() - .iter() - .map(|child| E4XOrXml::E4X(child.node().deep_copy(activation.context.gc_context))) - .collect(); - Ok(XmlListObject::new(activation, children, list.target()).into()) + Ok(list.deep_copy(activation).into()) } pub fn attribute<'gc>( diff --git a/core/src/avm2/object/xml_list_object.rs b/core/src/avm2/object/xml_list_object.rs index 70f7a84bd..93da55c53 100644 --- a/core/src/avm2/object/xml_list_object.rs +++ b/core/src/avm2/object/xml_list_object.rs @@ -97,6 +97,15 @@ impl<'gc> XmlListObject<'gc> { self.0.read().target } + pub fn deep_copy(&self, activation: &mut Activation<'_, 'gc>) -> XmlListObject<'gc> { + let children = self + .children() + .iter() + .map(|child| E4XOrXml::E4X(child.node().deep_copy(activation.context.gc_context))) + .collect(); + XmlListObject::new(activation, children, self.target()) + } + pub fn equals( &self, other: &Value<'gc>,