diff --git a/core/src/avm2/object.rs b/core/src/avm2/object.rs index 0794bacc6..5464969a8 100644 --- a/core/src/avm2/object.rs +++ b/core/src/avm2/object.rs @@ -183,6 +183,7 @@ pub trait TObject<'gc>: 'gc + Collect + Debug + Into> + Clone + Copy { return self.get_property_local(multiname, activation); } + if let Some(bound_method) = self.get_bound_method(disp_id) { return Ok(bound_method.into()); } @@ -278,6 +279,13 @@ pub trait TObject<'gc>: 'gc + Collect + Debug + Into> + Clone + Copy ) } Some(Property::Method { .. }) => { + // Similar to the get_property special case for XML/XMLList. + if (self.as_xml_object().is_some() || self.as_xml_list_object().is_some()) + && multiname.contains_public_namespace() + { + return self.set_property_local(multiname, value, activation); + } + return Err(error::make_reference_error( activation, error::ReferenceErrorCode::AssignToMethod, diff --git a/tests/tests/swfs/avm2/xml_set_children/Test.as b/tests/tests/swfs/avm2/xml_set_children/Test.as index dab90f250..c0d507947 100644 --- a/tests/tests/swfs/avm2/xml_set_children/Test.as +++ b/tests/tests/swfs/avm2/xml_set_children/Test.as @@ -34,3 +34,9 @@ var xml = xxxyyyzzz; trace("before: " + xml.toXMLString()); xml.b = "abc"; trace("after: " + xml.toXMLString()); + +var xml = ; +trace("before: " + xml.toXMLString()); +xml.name = "abc"; +trace("xml.name: " + xml.name); +trace("after: " + xml.toXMLString()); diff --git a/tests/tests/swfs/avm2/xml_set_children/output.txt b/tests/tests/swfs/avm2/xml_set_children/output.txt index cf9654d40..eb341b3a7 100644 --- a/tests/tests/swfs/avm2/xml_set_children/output.txt +++ b/tests/tests/swfs/avm2/xml_set_children/output.txt @@ -10,3 +10,6 @@ before: after: abc before: xxxyyyzzz after: xxxyyyzzzabc +before: +xml.name: abc +after: abc diff --git a/tests/tests/swfs/avm2/xml_set_children/test.swf b/tests/tests/swfs/avm2/xml_set_children/test.swf index 4f00bfdfd..28e840457 100644 Binary files a/tests/tests/swfs/avm2/xml_set_children/test.swf and b/tests/tests/swfs/avm2/xml_set_children/test.swf differ