Support the parsing of image/svg+xml elements (#31318)

* Support the parsing of image/svg+xml elements

* Update WPT test expectations
This commit is contained in:
Keith Yeung 2024-02-14 16:16:37 +08:00 committed by GitHub
parent d00312eb08
commit 123854faee
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 4 additions and 320 deletions

View file

@ -10,7 +10,7 @@ use crate::document_loader::DocumentLoader;
use crate::dom::bindings::codegen::Bindings::DOMParserBinding;
use crate::dom::bindings::codegen::Bindings::DOMParserBinding::DOMParserMethods;
use crate::dom::bindings::codegen::Bindings::DOMParserBinding::SupportedType::{
Application_xhtml_xml, Application_xml, Text_html, Text_xml,
Application_xhtml_xml, Application_xml, Image_svg_xml, Text_html, Text_xml,
};
use crate::dom::bindings::codegen::Bindings::DocumentBinding::DocumentReadyState;
use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowMethods;
@ -84,7 +84,7 @@ impl DOMParserMethods for DOMParser {
document.set_ready_state(DocumentReadyState::Complete);
Ok(document)
},
Text_xml | Application_xml | Application_xhtml_xml => {
Text_xml | Application_xml | Application_xhtml_xml | Image_svg_xml => {
let document = Document::new(
&self.window,
HasBrowsingContext::No,

View file

@ -10,8 +10,8 @@ enum SupportedType {
"text/html",
"text/xml",
"application/xml",
"application/xhtml+xml"/*,
"image/svg+xml"*/
"application/xhtml+xml",
"image/svg+xml"
};
[Exposed=Window]

View file

@ -1,31 +0,0 @@
[DOMParser-parseFromString-url-base-pushstate.html]
[image/svg+xml invalid XML: created using another iframe's DOMParser from this frame]
expected: FAIL
[image/svg+xml valid: created using another iframe's DOMParser from this frame]
expected: FAIL
[image/svg+xml invalid XML: created using another iframe's DOMParser from that frame]
expected: FAIL
[image/svg+xml invalid XML: created normally]
expected: FAIL
[image/svg+xml valid: created using a parser from the iframe and the method from this frame]
expected: FAIL
[image/svg+xml invalid XML: created using a parser from the iframe and the method from this frame]
expected: FAIL
[image/svg+xml valid: created normally]
expected: FAIL
[image/svg+xml valid: created using a parser from this frame and the method from the iframe]
expected: FAIL
[image/svg+xml invalid XML: created using a parser from this frame and the method from the iframe]
expected: FAIL
[image/svg+xml valid: created using another iframe's DOMParser from that frame]
expected: FAIL

View file

@ -1,31 +0,0 @@
[DOMParser-parseFromString-url-base.html]
[image/svg+xml invalid XML: created using another iframe's DOMParser from this frame]
expected: FAIL
[image/svg+xml valid: created using another iframe's DOMParser from this frame]
expected: FAIL
[image/svg+xml invalid XML: created using another iframe's DOMParser from that frame]
expected: FAIL
[image/svg+xml invalid XML: created normally]
expected: FAIL
[image/svg+xml valid: created using a parser from the iframe and the method from this frame]
expected: FAIL
[image/svg+xml invalid XML: created using a parser from the iframe and the method from this frame]
expected: FAIL
[image/svg+xml valid: created normally]
expected: FAIL
[image/svg+xml valid: created using a parser from this frame and the method from the iframe]
expected: FAIL
[image/svg+xml invalid XML: created using a parser from this frame and the method from the iframe]
expected: FAIL
[image/svg+xml valid: created using another iframe's DOMParser from that frame]
expected: FAIL

View file

@ -1,19 +0,0 @@
[DOMParser-parseFromString-url-moretests.html]
[Child window after navigation (image/svg+xml)]
expected: FAIL
[Child window with parent method (image/svg+xml)]
expected: FAIL
[Parent window with child method (image/svg+xml)]
expected: FAIL
[Child window (image/svg+xml)]
expected: FAIL
[Child window crossing navigation (image/svg+xml)]
expected: FAIL
[Parent window (image/svg+xml)]
expected: FAIL

View file

@ -1,31 +0,0 @@
[DOMParser-parseFromString-url-pushstate.html]
[image/svg+xml invalid XML: created using another iframe's DOMParser from this frame]
expected: FAIL
[image/svg+xml valid: created using another iframe's DOMParser from this frame]
expected: FAIL
[image/svg+xml invalid XML: created using another iframe's DOMParser from that frame]
expected: FAIL
[image/svg+xml invalid XML: created normally]
expected: FAIL
[image/svg+xml valid: created using a parser from the iframe and the method from this frame]
expected: FAIL
[image/svg+xml invalid XML: created using a parser from the iframe and the method from this frame]
expected: FAIL
[image/svg+xml valid: created normally]
expected: FAIL
[image/svg+xml valid: created using a parser from this frame and the method from the iframe]
expected: FAIL
[image/svg+xml invalid XML: created using a parser from this frame and the method from the iframe]
expected: FAIL
[image/svg+xml valid: created using another iframe's DOMParser from that frame]
expected: FAIL

View file

@ -1,31 +0,0 @@
[DOMParser-parseFromString-url.html]
[image/svg+xml invalid XML: created using another iframe's DOMParser from this frame]
expected: FAIL
[image/svg+xml valid: created using another iframe's DOMParser from this frame]
expected: FAIL
[image/svg+xml invalid XML: created using another iframe's DOMParser from that frame]
expected: FAIL
[image/svg+xml invalid XML: created normally]
expected: FAIL
[image/svg+xml valid: created using a parser from the iframe and the method from this frame]
expected: FAIL
[image/svg+xml invalid XML: created using a parser from the iframe and the method from this frame]
expected: FAIL
[image/svg+xml valid: created normally]
expected: FAIL
[image/svg+xml valid: created using a parser from this frame and the method from the iframe]
expected: FAIL
[image/svg+xml invalid XML: created using a parser from this frame and the method from the iframe]
expected: FAIL
[image/svg+xml valid: created using another iframe's DOMParser from that frame]
expected: FAIL

View file

@ -49,7 +49,3 @@
[DOMParser: <parsererror> element added on error, 6</span>]
expected: FAIL
[image/svg+xml is preserved in the error document]
expected: FAIL

View file

@ -9,18 +9,5 @@
[Should return an error document for XML wellformedness errors in type application/xhtml+xml]
expected: FAIL
[Should parse correctly in type image/svg+xml]
expected: FAIL
[XMLDocument interface for correctly parsed document with type image/svg+xml]
expected: FAIL
[Should return an error document for XML wellformedness errors in type image/svg+xml]
expected: FAIL
[XMLDocument interface for incorrectly parsed document with type image/svg+xml]
expected: FAIL
[scripting must be disabled with type image/svg+xml]
expected: FAIL

View file

@ -1,7 +1,4 @@
[Document-createElement-namespace.html]
[Created element's namespace in created SVG document by DOMParser ('image/svg+xml')]
expected: FAIL
[Created element's namespace in empty.svg]
expected: FAIL

View file

@ -1,30 +0,0 @@
[DOMParser-parseFromString-url-base-pushstate.html]
[image/svg+xml valid: created normally]
expected: FAIL
[image/svg+xml valid: created using another iframe's DOMParser from this frame]
expected: FAIL
[image/svg+xml valid: created using another iframe's DOMParser from that frame]
expected: FAIL
[image/svg+xml valid: created using a parser from this frame and the method from the iframe]
expected: FAIL
[image/svg+xml valid: created using a parser from the iframe and the method from this frame]
expected: FAIL
[image/svg+xml invalid XML: created normally]
expected: FAIL
[image/svg+xml invalid XML: created using another iframe's DOMParser from this frame]
expected: FAIL
[image/svg+xml invalid XML: created using another iframe's DOMParser from that frame]
expected: FAIL
[image/svg+xml invalid XML: created using a parser from this frame and the method from the iframe]
expected: FAIL
[image/svg+xml invalid XML: created using a parser from the iframe and the method from this frame]
expected: FAIL

View file

@ -1,30 +0,0 @@
[DOMParser-parseFromString-url-base.html]
[image/svg+xml valid: created normally]
expected: FAIL
[image/svg+xml valid: created using another iframe's DOMParser from this frame]
expected: FAIL
[image/svg+xml valid: created using another iframe's DOMParser from that frame]
expected: FAIL
[image/svg+xml valid: created using a parser from this frame and the method from the iframe]
expected: FAIL
[image/svg+xml valid: created using a parser from the iframe and the method from this frame]
expected: FAIL
[image/svg+xml invalid XML: created normally]
expected: FAIL
[image/svg+xml invalid XML: created using another iframe's DOMParser from this frame]
expected: FAIL
[image/svg+xml invalid XML: created using another iframe's DOMParser from that frame]
expected: FAIL
[image/svg+xml invalid XML: created using a parser from this frame and the method from the iframe]
expected: FAIL
[image/svg+xml invalid XML: created using a parser from the iframe and the method from this frame]
expected: FAIL

View file

@ -1,18 +0,0 @@
[DOMParser-parseFromString-url-moretests.html]
[Parent window (image/svg+xml)]
expected: FAIL
[Child window (image/svg+xml)]
expected: FAIL
[Parent window with child method (image/svg+xml)]
expected: FAIL
[Child window with parent method (image/svg+xml)]
expected: FAIL
[Child window crossing navigation (image/svg+xml)]
expected: FAIL
[Child window after navigation (image/svg+xml)]
expected: FAIL

View file

@ -1,30 +0,0 @@
[DOMParser-parseFromString-url-pushstate.html]
[image/svg+xml valid: created normally]
expected: FAIL
[image/svg+xml valid: created using another iframe's DOMParser from this frame]
expected: FAIL
[image/svg+xml valid: created using another iframe's DOMParser from that frame]
expected: FAIL
[image/svg+xml valid: created using a parser from this frame and the method from the iframe]
expected: FAIL
[image/svg+xml valid: created using a parser from the iframe and the method from this frame]
expected: FAIL
[image/svg+xml invalid XML: created normally]
expected: FAIL
[image/svg+xml invalid XML: created using another iframe's DOMParser from this frame]
expected: FAIL
[image/svg+xml invalid XML: created using another iframe's DOMParser from that frame]
expected: FAIL
[image/svg+xml invalid XML: created using a parser from this frame and the method from the iframe]
expected: FAIL
[image/svg+xml invalid XML: created using a parser from the iframe and the method from this frame]
expected: FAIL

View file

@ -1,30 +0,0 @@
[DOMParser-parseFromString-url.html]
[image/svg+xml valid: created normally]
expected: FAIL
[image/svg+xml valid: created using another iframe's DOMParser from this frame]
expected: FAIL
[image/svg+xml valid: created using another iframe's DOMParser from that frame]
expected: FAIL
[image/svg+xml valid: created using a parser from this frame and the method from the iframe]
expected: FAIL
[image/svg+xml valid: created using a parser from the iframe and the method from this frame]
expected: FAIL
[image/svg+xml invalid XML: created normally]
expected: FAIL
[image/svg+xml invalid XML: created using another iframe's DOMParser from this frame]
expected: FAIL
[image/svg+xml invalid XML: created using another iframe's DOMParser from that frame]
expected: FAIL
[image/svg+xml invalid XML: created using a parser from this frame and the method from the iframe]
expected: FAIL
[image/svg+xml invalid XML: created using a parser from the iframe and the method from this frame]
expected: FAIL

View file

@ -49,6 +49,3 @@
[DOMParser: <parsererror> element added on error, <span xmlns:p1 xmlns:p2="urn:x-test:test"/>17]
expected: FAIL
[image/svg+xml is preserved in the error document]
expected: FAIL

View file

@ -8,17 +8,5 @@
[Should return an error document for XML wellformedness errors in type application/xhtml+xml]
expected: FAIL
[Should parse correctly in type image/svg+xml]
expected: FAIL
[XMLDocument interface for correctly parsed document with type image/svg+xml]
expected: FAIL
[Should return an error document for XML wellformedness errors in type image/svg+xml]
expected: FAIL
[XMLDocument interface for incorrectly parsed document with type image/svg+xml]
expected: FAIL
[scripting must be disabled with type image/svg+xml]
expected: FAIL