Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Update quick-xml to 0.35.0 #16774

Merged
merged 2 commits into from
Jun 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ bitflags = { workspace = true }
smallvec = { version = "1.13.2", features = ["union"] }
num-traits = { workspace = true }
num-derive = { workspace = true }
quick-xml = "0.31.0"
quick-xml = "0.35.0"
downcast-rs = "1.2.1"
url = { workspace = true }
weak-table = "0.3.2"
Expand Down
12 changes: 9 additions & 3 deletions core/src/avm1/globals/xml.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use crate::context::GcContext;
use crate::string::{AvmString, WStr, WString};
use crate::xml::{custom_unescape, XmlNode, ELEMENT_NODE, TEXT_NODE};
use gc_arena::{Collect, GcCell, Mutation};
use quick_xml::errors::IllFormedError;
use quick_xml::events::attributes::AttrError;
use quick_xml::{events::Event, Reader};

Expand Down Expand Up @@ -141,13 +142,18 @@ impl<'gc> Xml<'gc> {
loop {
let event = parser.read_event().map_err(|error| {
self.0.write(activation.context.gc_context).status = match error {
quick_xml::Error::UnexpectedEof(_)
quick_xml::Error::Syntax(_)
| quick_xml::Error::InvalidAttr(AttrError::ExpectedEq(_))
| quick_xml::Error::InvalidAttr(AttrError::Duplicated(_, _)) => {
XmlStatus::ElementMalformed
}
quick_xml::Error::EndEventMismatch { .. } => XmlStatus::MismatchedEnd,
quick_xml::Error::XmlDeclWithoutVersion(_) => XmlStatus::DeclNotTerminated,
quick_xml::Error::IllFormed(
IllFormedError::MismatchedEndTag { .. }
| IllFormedError::UnmatchedEndTag { .. },
) => XmlStatus::MismatchedEnd,
quick_xml::Error::IllFormed(IllFormedError::MissingDeclVersion(_)) => {
XmlStatus::DeclNotTerminated
}
quick_xml::Error::InvalidAttr(AttrError::UnquotedValue(_)) => {
XmlStatus::AttributeNotTerminated
}
Expand Down
12 changes: 7 additions & 5 deletions core/src/avm2/e4x.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use std::{

use gc_arena::{Collect, GcCell, Mutation};
use quick_xml::{
errors::SyntaxError as XmlSyntaxError,
events::{attributes::AttrError as XmlAttrError, BytesStart, Event},
name::ResolveResult,
Error as XmlError, NsReader,
Expand Down Expand Up @@ -59,23 +60,24 @@ fn make_xml_error<'gc>(activation: &mut Activation<'_, 'gc>, err: XmlError) -> E
"Error #1104: Attribute was already specified for element.",
1104,
),
XmlError::UnexpectedEof(currently_parsing) => match currently_parsing.as_str() {
"CData" => type_error(

XmlError::Syntax(syntax_error) => match syntax_error {
XmlSyntaxError::UnclosedCData => type_error(
activation,
"Error #1091: XML parser failure: Unterminated CDATA section.",
1091,
),
"DOCTYPE" => type_error(
XmlSyntaxError::UnclosedDoctype => type_error(
activation,
"Error #1093: XML parser failure: Unterminated DOCTYPE declaration.",
1093,
),
"Comment" => type_error(
XmlSyntaxError::UnclosedComment => type_error(
activation,
"Error #1094: XML parser failure: Unterminated comment.",
1094,
),
"XmlDecl" => type_error(
XmlSyntaxError::UnclosedPIOrXmlDecl => type_error(
activation,
"Error #1097: XML parser failure: Unterminated processing instruction.",
1097,
Expand Down
7 changes: 5 additions & 2 deletions core/src/html/text_format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -671,8 +671,11 @@ impl FormatSpans {
let mut last_closed_font: Option<TextSpanFont> = None;

let mut reader = Reader::from_reader(&raw_bytes[..]);
reader.expand_empty_elements(true);
reader.check_end_names(false);
let reader_config = reader.config_mut();
reader_config.expand_empty_elements = true;
reader_config.check_end_names = false;
reader_config.allow_unmatched_ends = true;

loop {
match reader.read_event() {
Ok(Event::Start(ref e)) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
num_ticks = 1
known_failure = true