File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -3831,6 +3831,7 @@ impl ElementMethods<crate::DomTypeHolder> for Element {
38313831 } else {
38323832 self . upcast :: < Node > ( )
38333833 . xml_serialize ( XmlChildrenOnly ( Some ( qname) ) )
3834+ . map_err ( |_| Error :: InvalidState ) ?
38343835 } ;
38353836
38363837 Ok ( TrustedHTMLOrNullIsEmptyString :: NullIsEmptyString ( result) )
@@ -3888,7 +3889,9 @@ impl ElementMethods<crate::DomTypeHolder> for Element {
38883889 self . upcast :: < Node > ( )
38893890 . html_serialize ( IncludeNode , false , vec ! [ ] , can_gc)
38903891 } else {
3891- self . upcast :: < Node > ( ) . xml_serialize ( XmlIncludeNode )
3892+ self . upcast :: < Node > ( )
3893+ . xml_serialize ( XmlIncludeNode )
3894+ . map_err ( |_| Error :: InvalidState ) ?
38923895 } ;
38933896
38943897 Ok ( TrustedHTMLOrNullIsEmptyString :: NullIsEmptyString ( result) )
Original file line number Diff line number Diff line change @@ -3150,17 +3150,17 @@ impl Node {
31503150 pub ( crate ) fn xml_serialize (
31513151 & self ,
31523152 traversal_scope : xml_serialize:: TraversalScope ,
3153- ) -> DOMString {
3153+ ) -> Result < DOMString , ( ) > {
31543154 let mut writer = vec ! [ ] ;
31553155 xml_serialize:: serialize (
31563156 & mut writer,
31573157 & self ,
31583158 xml_serialize:: SerializeOpts { traversal_scope } ,
31593159 )
3160- . expect ( "Cannot serialize node" ) ;
3160+ . map_err ( |_| ( ) ) ? ;
31613161
31623162 // FIXME(ajeffrey): Directly convert UTF8 to DOMString
3163- DOMString :: from ( String :: from_utf8 ( writer) . unwrap ( ) )
3163+ Ok ( DOMString :: from ( String :: from_utf8 ( writer) . unwrap ( ) ) )
31643164 }
31653165
31663166 /// <https://html.spec.whatwg.org/multipage/#fragment-serializing-algorithm-steps>
@@ -3187,6 +3187,7 @@ impl Node {
31873187 // TODO: xml5ever doesn't seem to want require_well_formed
31883188 let _ = require_well_formed;
31893189 self . xml_serialize ( xml_serialize:: TraversalScope :: ChildrenOnly ( None ) )
3190+ . unwrap ( )
31903191 }
31913192}
31923193
You can’t perform that action at this time.
0 commit comments