From cfacd397cf146d2b7fa36e927f945acaa1c046e5 Mon Sep 17 00:00:00 2001 From: David Wendt Date: Sun, 22 Dec 2019 00:21:02 -0500 Subject: [PATCH] Most XML properties return `null`, not `undefined`. Furthermore, `prefix` does not distinguish between `` and `<:test>` - they both have a `prefix` of `""`. --- core/src/avm1/globals/xml.rs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/core/src/avm1/globals/xml.rs b/core/src/avm1/globals/xml.rs index 9bc7f2763..fc5eb03e4 100644 --- a/core/src/avm1/globals/xml.rs +++ b/core/src/avm1/globals/xml.rs @@ -54,7 +54,7 @@ pub fn create_xmlnode_proto<'gc>( .as_xml_node() .and_then(|n| n.tag_name()) .map(|n| n.local_name().to_string().into()) - .unwrap_or_else(|| Value::Undefined.into())) + .unwrap_or_else(|| Value::Null.into())) }), None, ReadOnly.into(), @@ -67,7 +67,7 @@ pub fn create_xmlnode_proto<'gc>( .as_xml_node() .and_then(|n| n.tag_name()) .map(|n| n.node_name().into()) - .unwrap_or_else(|| Value::Undefined.into())) + .unwrap_or_else(|| Value::Null.into())) }), None, ReadOnly.into(), @@ -93,7 +93,7 @@ pub fn create_xmlnode_proto<'gc>( .as_xml_node() .and_then(|n| n.node_value()) .map(|n| n.into()) - .unwrap_or_else(|| Value::Undefined.into())) + .unwrap_or_else(|| Value::Null.into())) }), None, ReadOnly.into(), @@ -105,8 +105,12 @@ pub fn create_xmlnode_proto<'gc>( Ok(this .as_xml_node() .and_then(|n| n.tag_name()) - .and_then(|n| n.prefix().map(|n| n.to_string().into())) - .unwrap_or_else(|| Value::Undefined.into())) + .map(|n| { + n.prefix() + .map(|n| n.to_string().into()) + .unwrap_or("".to_string().into()) + }) + .unwrap_or_else(|| Value::Null.into())) }), None, ReadOnly.into(),