From 3572367c8e99fd4361c349cd79e65a6d7c31213c Mon Sep 17 00:00:00 2001 From: Tom Schuster Date: Wed, 1 Nov 2023 16:38:56 +0100 Subject: [PATCH] avm2: Allow assigning XML objects without a name (eg. text) --- core/src/avm2/object/xml_list_object.rs | 12 ++++++------ .../swfs/from_avmplus/e4x/XML/e13_4_4_27/test.toml | 1 - 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/core/src/avm2/object/xml_list_object.rs b/core/src/avm2/object/xml_list_object.rs index ee228308af6a..7248b357f8bb 100644 --- a/core/src/avm2/object/xml_list_object.rs +++ b/core/src/avm2/object/xml_list_object.rs @@ -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]] diff --git a/tests/tests/swfs/from_avmplus/e4x/XML/e13_4_4_27/test.toml b/tests/tests/swfs/from_avmplus/e4x/XML/e13_4_4_27/test.toml index 29f3cef79022..cf6123969a1d 100644 --- a/tests/tests/swfs/from_avmplus/e4x/XML/e13_4_4_27/test.toml +++ b/tests/tests/swfs/from_avmplus/e4x/XML/e13_4_4_27/test.toml @@ -1,2 +1 @@ num_ticks = 1 -known_failure = true