Repository navigation
Don't bail on empty Serializer stack - #293
Conversation
Ygg01
left a comment
There was a problem hiding this comment.
Looks fine to me. Hopefully, others will comment and close this PR.
|
One thing that would help me understand is a unit test that fails before these changes and passes afterwards. |
94667c7 to
50b10a7
Compare
Ygg01
left a comment
There was a problem hiding this comment.
What are these changes? I don't remember them being originally here yesterday?
|
☔ The latest upstream changes (presumably #295) made this pull request unmergeable. Please resolve the merge conflicts. |
50b10a7 to
90d7771
Compare
|
Whoops, must have messed something up when I reverted an accidental push. Still working on a test case. |
b0087da to
0978968
Compare
|
@bors-servo: r+ |
|
@Ygg01: 🔑 Insufficient privileges: Not in reviewers |
|
|
||
| fn end_elem(&mut self, name: QualName) -> io::Result<()> { | ||
| let info = self.stack.pop().expect("no ElemInfo"); | ||
| let info = self.stack.pop().unwrap_or_else(|| { |
There was a problem hiding this comment.
Rather than unconditionally creating a missing element, I would prefer to add an option to SerializeOpts and only create the parent if this behaviour is specifically requested.
|
|
||
| test!(misnest, r#"<p><i>Hello!</p>, World!</i>"#, | ||
| r#"<p><i>Hello!</i></p><i>, World!</i>"#); | ||
| test!( |
There was a problem hiding this comment.
Are these changes caused by running rustfmt? I would prefer to split them into a separate commit or revert them entirely.
There was a problem hiding this comment.
Ah, yeah. Thought I git add -p'd around them, but I guess not. Should be an easy change.
0978968 to
5e9c4e1
Compare
5e9c4e1 to
1c3b7a4
Compare
|
@bors-servo: r+ |
|
📌 Commit 703d141 has been approved by |
Don't bail on empty Serializer stack This prevents panics if `end_elem` or `parent` is called with an empty stack by fabricating a new default ElemInfo. Normally, this will never happen with valid html, but in the event that someone needs to serialize a token stream representing a malformed tree, they can now do so. Fixes #292
|
☀️ Test successful - status-travis |
This prevents panics if
end_elemorparentis called with an empty stack by fabricating a new default ElemInfo.Normally, this will never happen with valid html, but in the event that someone needs to serialize a token stream representing a malformed tree, they can now do so.
Fixes #292