avm2: Implement ignoreComments/ignoreProcessingInstructions/ignoreWhitespace
This commit is contained in:
parent
da7ee01730
commit
6f2420d983
|
@ -286,6 +286,9 @@ impl<'gc> E4XNode<'gc> {
|
|||
pub fn parse(
|
||||
mut value: Value<'gc>,
|
||||
activation: &mut Activation<'_, 'gc>,
|
||||
ignore_comments: bool,
|
||||
ignore_processing_instructions: bool,
|
||||
ignore_white: bool,
|
||||
) -> Result<Vec<Self>, Error<'gc>> {
|
||||
let string = match &value {
|
||||
// The docs claim that this throws a TypeError, but it actually doesn't
|
||||
|
@ -305,11 +308,6 @@ impl<'gc> E4XNode<'gc> {
|
|||
let mut parser = Reader::from_str(&data_utf8);
|
||||
let mut open_tags: Vec<E4XNode<'gc>> = vec![];
|
||||
|
||||
// FIXME - look these up from static property and settings
|
||||
let ignore_comments = true;
|
||||
let ignore_processing_instructions = true;
|
||||
let ignore_white = true;
|
||||
|
||||
let mut top_level = vec![];
|
||||
|
||||
// This can't be a closure that captures these variables, because we need to modify them
|
||||
|
|
|
@ -51,10 +51,10 @@ package {
|
|||
}
|
||||
|
||||
public function XML(value:* = undefined) {
|
||||
this.init(value);
|
||||
this.init(value, XML.ignoreComments, XML.ignoreProcessingInstructions, XML.ignoreWhitespace);
|
||||
}
|
||||
|
||||
private native function init(value:*):void;
|
||||
private native function init(value:*, ignoreComments:Boolean, ignoreProcessingInstructions:Boolean, ignoreWhitespace:Boolean):void;
|
||||
|
||||
AS3 native function hasComplexContent():Boolean;
|
||||
AS3 native function hasSimpleContent():Boolean;
|
||||
|
|
|
@ -4,10 +4,10 @@ package {
|
|||
public final dynamic class XMLList {
|
||||
|
||||
public function XMLList(value:* = undefined) {
|
||||
this.init(value);
|
||||
this.init(value, XML.ignoreComments, XML.ignoreProcessingInstructions, XML.ignoreWhitespace);
|
||||
}
|
||||
|
||||
private native function init(value:*): void;
|
||||
private native function init(value:*, ignoreComments:Boolean, ignoreProcessingInstructions:Boolean, ignoreWhitespace:Boolean): void;
|
||||
|
||||
AS3 native function hasComplexContent():Boolean;
|
||||
AS3 native function hasSimpleContent():Boolean;
|
||||
|
|
|
@ -28,6 +28,9 @@ pub fn init<'gc>(
|
|||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
let this = this.as_xml_object().unwrap();
|
||||
let value = args[0];
|
||||
let ignore_comments = args.get_bool(1);
|
||||
let ignore_processing_instructions = args.get_bool(2);
|
||||
let ignore_whitespace = args.get_bool(3);
|
||||
|
||||
if let Some(obj) = value.as_object() {
|
||||
if let Some(xml_list) = obj.as_xml_list_object() {
|
||||
|
@ -41,7 +44,13 @@ pub fn init<'gc>(
|
|||
}
|
||||
}
|
||||
|
||||
let nodes = E4XNode::parse(value, activation)?;
|
||||
let nodes = E4XNode::parse(
|
||||
value,
|
||||
activation,
|
||||
ignore_comments,
|
||||
ignore_processing_instructions,
|
||||
ignore_whitespace,
|
||||
)?;
|
||||
|
||||
let node = match nodes.as_slice() {
|
||||
// XML defaults to an empty text node when nothing was parsed
|
||||
|
|
|
@ -39,6 +39,9 @@ pub fn init<'gc>(
|
|||
) -> Result<Value<'gc>, Error<'gc>> {
|
||||
let this = this.as_xml_list_object().unwrap();
|
||||
let value = args[0];
|
||||
let ignore_comments = args.get_bool(1);
|
||||
let ignore_processing_instructions = args.get_bool(2);
|
||||
let ignore_whitespace = args.get_bool(3);
|
||||
|
||||
if let Some(obj) = value.as_object() {
|
||||
if let Some(xml) = obj.as_xml_object() {
|
||||
|
@ -51,7 +54,13 @@ pub fn init<'gc>(
|
|||
}
|
||||
}
|
||||
|
||||
match E4XNode::parse(value, activation) {
|
||||
match E4XNode::parse(
|
||||
value,
|
||||
activation,
|
||||
ignore_comments,
|
||||
ignore_processing_instructions,
|
||||
ignore_whitespace,
|
||||
) {
|
||||
Ok(nodes) => {
|
||||
this.set_children(
|
||||
activation.context.gc_context,
|
||||
|
|
|
@ -1,2 +1 @@
|
|||
num_ticks = 1
|
||||
known_failure = true # https://github.com/ruffle-rs/ruffle/issues/12351
|
||||
|
|
|
@ -1,2 +1 @@
|
|||
num_ticks = 1
|
||||
known_failure = true
|
||||
|
|
|
@ -1,2 +1 @@
|
|||
num_ticks = 1
|
||||
known_failure = true
|
||||
|
|
|
@ -1,2 +1 @@
|
|||
num_ticks = 1
|
||||
known_failure = true
|
||||
|
|
|
@ -1,2 +1 @@
|
|||
num_ticks = 1
|
||||
known_failure = true
|
||||
|
|
|
@ -1,2 +1 @@
|
|||
num_ticks = 1
|
||||
known_failure = true
|
||||
|
|
Loading…
Reference in New Issue