Auto merge of #24316 - tokarzkj:set-body-is-too-strict, r=jdm

Change setBody to be less strict when getting the immediate child

Step four of the dom document body calls for throwing an exception
if no document element was found. The current setBody implementation
was looking for a document element that is also an html element. It
has been updated to use GetDocumentElement which returns any document
element.

- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #24291

<!-- Either: -->
- [X] There are tests for these changes OR
- [ ] These changes do not require tests because ___

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/24316)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2019-09-30 09:35:23 -04:00 committed by GitHub
commit 45b68ecbfc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 5 deletions

View file

@ -3996,7 +3996,7 @@ impl DocumentMethods for Document {
return Ok(());
}
match (self.get_html_element(), &old_body) {
match (self.GetDocumentElement(), &old_body) {
// Step 3.
(Some(ref root), &Some(ref child)) => {
let root = root.upcast::<Node>();