avm2: Allow setting XML methods as properties
This commit is contained in:
parent
58d786b869
commit
f6c0685992
|
@ -183,6 +183,7 @@ pub trait TObject<'gc>: 'gc + Collect + Debug + Into<Object<'gc>> + Clone + Copy
|
||||||
{
|
{
|
||||||
return self.get_property_local(multiname, activation);
|
return self.get_property_local(multiname, activation);
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(bound_method) = self.get_bound_method(disp_id) {
|
if let Some(bound_method) = self.get_bound_method(disp_id) {
|
||||||
return Ok(bound_method.into());
|
return Ok(bound_method.into());
|
||||||
}
|
}
|
||||||
|
@ -278,6 +279,13 @@ pub trait TObject<'gc>: 'gc + Collect + Debug + Into<Object<'gc>> + Clone + Copy
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
Some(Property::Method { .. }) => {
|
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(
|
return Err(error::make_reference_error(
|
||||||
activation,
|
activation,
|
||||||
error::ReferenceErrorCode::AssignToMethod,
|
error::ReferenceErrorCode::AssignToMethod,
|
||||||
|
|
|
@ -34,3 +34,9 @@ var xml = <a>xxx<foo>yyy</foo>zzz</a>;
|
||||||
trace("before: " + xml.toXMLString());
|
trace("before: " + xml.toXMLString());
|
||||||
xml.b = "abc";
|
xml.b = "abc";
|
||||||
trace("after: " + xml.toXMLString());
|
trace("after: " + xml.toXMLString());
|
||||||
|
|
||||||
|
var xml = <a/>;
|
||||||
|
trace("before: " + xml.toXMLString());
|
||||||
|
xml.name = "abc";
|
||||||
|
trace("xml.name: " + xml.name);
|
||||||
|
trace("after: " + xml.toXMLString());
|
||||||
|
|
|
@ -10,3 +10,6 @@ before: <a><b x="1"/></a>
|
||||||
after: <a><b x="1">abc</b></a>
|
after: <a><b x="1">abc</b></a>
|
||||||
before: <a>xxx<foo>yyy</foo>zzz</a>
|
before: <a>xxx<foo>yyy</foo>zzz</a>
|
||||||
after: <a>xxx<foo>yyy</foo>zzz<b>abc</b></a>
|
after: <a>xxx<foo>yyy</foo>zzz<b>abc</b></a>
|
||||||
|
before: <a/>
|
||||||
|
xml.name: abc
|
||||||
|
after: <a><name>abc</name></a>
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue