New issue
Advanced search Search tips

Issue 700237 link

Starred by 3 users

Issue metadata

Status: Fixed
Owner: ----
Closed: Mar 2017
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug

Blocking:
issue 651744



Sign in to add a comment

Document created by DOMParser.parseFromString() doesn't have correct MIME type

Project Member Reported by tkent@chromium.org, Mar 10 2017

Issue description

Chrome Version: 59 canary
OS: All but iOS

What steps will reproduce the problem?
(1) Open http://w3c-test.org/dom/nodes/Document-createElement-namespace.html

What is the expected result?
No FAILs

What happens instead?
There are four FAILs.

Please use labels and text to provide additional information.
https://w3c.github.io/DOM-Parsing/#dom-domparser-parsefromstring
> In any case, the returned Document's content type must be the type argument.

DOMParser::parseFromString() should call |doc->setMimeType(type)|.

 

Comment 1 by tkent@chromium.org, Mar 10 2017

Description: Show this description
Currently making a patch for this.
(Sorry Loorong..., saw your message afterwards)
No worries, closed mine just now.

Comment 7 by tkent@chromium.org, Mar 13 2017

Labels: M-59
Status: Fixed (was: Available)
I found our imported Document-createElement-namespace.html still had FAILs after #6 because we didn't import some sub-resource files.

The tests that are failing due to the fact that the document.contentType of the source test files are determined in Chromium as "application/xhtml+xml", while in Firefox their document.contentType is determined to be "application/xml".

http://w3c-test.org/dom/nodes/Document-createElement-namespace-tests/xhtml.xml
http://w3c-test.org/dom/nodes/Document-createElement-namespace-tests/xhtml_ns_removed.xml
http://w3c-test.org/dom/nodes/Document-createElement-namespace-tests/xhtml_ns_changed.xml

I do not exactly know what the standards are, but since the xml files contain xhtml, it would make sense to me that their content-type is "application/xhtml+xml".

*To be clear: the test asserts that the document.contentType is "application/xml" and hence fails.

Comment 10 by tkent@chromium.org, Mar 14 2017

yeah, remaining failures are not related to DOMParser.parseFromString().

> http://w3c-test.org/dom/nodes/Document-createElement-namespace-tests/xhtml.xml

The header sent from the server contains:
    Content-Type: application/xml

Though the specification doesn't mention contentType processing for XML documents [1], setting Content-Type HTTP header value looks very straight-forward behavior.  We should check other browser's behavior.


[1] https://html.spec.whatwg.org/multipage/browsers.html#read-xml

After some searching I found that the mime type is changed from "application/xml" to " application/xhtml+xml" in https://cs.chromium.org/chromium/src/content/browser/loader/mime_sniffing_resource_handler.cc?l=280

Safari and Firefox both use "application/xml" for these documents.


Comment 12 by tkent@chromium.org, Mar 16 2017

Filed  Issue 702084  for the application/xhtml+xml issue.

Sign in to add a comment