Style tag in an XHR's responseXML shouldn't make the responseXML be null.

XMLHTTPRequest::response_document_ gets incorrectly cleared because
Document::well_formed_ is incorrectly false. This is because
well_formed_ is initialized in Document::ImplicitClose().
XMLHttpRequest used to call ImplicitClose() directly, but I changed
it to call Document::CheckCompleted() (which may then call
ImplicitClose) in
https://chromium.googlesource.com/chromium/src/+/716a136332fbd8efc12a3892b6ae2a6c0be94ba7

I had thought that CheckCompleted() would always call ImplicitClose()
for an XHR response document, but it's possible for CheckCompleted()
to early-exit because the document is not complete if a style element
has blocked load completion and won't un-block it until a timer is
fired.

There's no reason to wait until ImplicitClose() to set the well-formed
bit, though. Document::FinishedParsing() is sufficient, and setting it
there removes the need for XMLHttpRequest to manually call
CheckCompleted().

BUG=721225
TEST=http/tests/xmlhttprequest/style-tag-in-responseXML.html

Review-Url: https://codereview.chromium.org/2885633002
Cr-Commit-Position: refs/heads/master@{#473701}
4 files changed