Skip to content

Commit

Permalink
avm2: Allow assigning XML objects without a name (eg. text)
Browse files Browse the repository at this point in the history
  • Loading branch information
evilpie authored and torokati44 committed Nov 1, 2023
1 parent da06e1c commit 3572367
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
12 changes: 6 additions & 6 deletions core/src/avm2/object/xml_list_object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -731,12 +731,12 @@ impl<'gc> TObject<'gc> for XmlListObject<'gc> {

// 2.c.viii.2. If Type(V) is XML, let y.[[Name]] = V.[[Name]]
if let Some(xml) = value.as_object().and_then(|x| x.as_xml_object()) {
// FIXME: What if XML value does not have a local name?
y.set_local_name(
xml.node().local_name().expect("Not validated yet"),
activation.gc(),
);
// FIXME: Also set the namespace.
if let Some(name) = xml.node().local_name() {
y.set_local_name(name, activation.gc());
}
if let Some(namespace) = xml.node().namespace() {
y.set_namespace(namespace, activation.gc());
}
}

// 2.c.viii.3. Else if Type(V) is XMLList, let y.[[Name]] = V.[[TargetProperty]]
Expand Down
1 change: 0 additions & 1 deletion tests/tests/swfs/from_avmplus/e4x/XML/e13_4_4_27/test.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
num_ticks = 1
known_failure = true

0 comments on commit 3572367

Please sign in to comment.