Bug 120826 - DOMParser.parseFromString() should support creating HTML Document with mime-type text/html
Summary: DOMParser.parseFromString() should support creating HTML Document with mime-t...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Vivek Galatage
URL:
Keywords: BlinkMergeCandidate
Depends on:
Blocks:
 
Reported: 2013-09-05 21:38 PDT by Vivek Galatage
Modified: 2019-02-06 09:03 PST (History)
9 users (show)

See Also:


Attachments
Patch (9.67 KB, patch)
2013-09-05 21:43 PDT, Vivek Galatage
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from webkit-ews-09 for mac-mountainlion-wk2 (719.83 KB, application/zip)
2013-09-06 02:38 PDT, Build Bot
no flags Details
Patch (11.60 KB, patch)
2013-09-11 06:09 PDT, Vivek Galatage
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Vivek Galatage 2013-09-05 21:38:48 PDT
The specification http://domparsing.spec.whatwg.org/#the-domparser-interface for DOMParser.parseFromString()
allows the document creation if the mimeType is one of the supported types: 
["text/html", "text/xml", "application/xml", "application/xhtml+xml", "image/svg+xml"]

Also script elements get marked unexecutable and the contents of noscript get parsed as markup.

blink review URL: https://codereview.chromium.org/23903014/
Comment 1 Vivek Galatage 2013-09-05 21:43:29 PDT
Created attachment 210700 [details]
Patch
Comment 2 Build Bot 2013-09-06 02:38:43 PDT
Comment on attachment 210700 [details]
Patch

Attachment 210700 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.appspot.com/results/1714115

New failing tests:
media/video-object-fit.html
Comment 3 Build Bot 2013-09-06 02:38:44 PDT
Created attachment 210713 [details]
Archive of layout-test-results from webkit-ews-09 for mac-mountainlion-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: webkit-ews-09  Port: mac-mountainlion-wk2  Platform: Mac OS X 10.8.4
Comment 4 Vivek Galatage 2013-09-06 02:49:15 PDT
(In reply to comment #2)
> (From update of attachment 210700 [details])
> Attachment 210700 [details] did not pass mac-wk2-ews (mac-wk2):
> Output: http://webkit-queues.appspot.com/results/1714115
> 
> New failing tests:
> media/video-object-fit.html

I suppose the above failure is not related the proposed patch.
Comment 5 Ryosuke Niwa 2013-09-06 10:19:35 PDT
Comment on attachment 210700 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=210700&action=review

> Source/WebCore/xml/DOMParser.cpp:29
> +    if (!DOMImplementation::isXMLMIMEType(contentType) && contentType != "text/html")

isXMLMiMEType allows any MIME type that ends with +xml. That doesn't seem to match the spec.
Comment 6 Darin Adler 2013-09-06 12:39:43 PDT
Comment on attachment 210700 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=210700&action=review

>> Source/WebCore/xml/DOMParser.cpp:29
>> +    if (!DOMImplementation::isXMLMIMEType(contentType) && contentType != "text/html")
> 
> isXMLMiMEType allows any MIME type that ends with +xml. That doesn't seem to match the spec.

Lets make sure we have some test coverage for this, either way. Some bogus type that ends in "+xml" to make sure we don’t support it.

Also, should this be case sensitive or not? Need test coverage for that too.
Comment 7 Vivek Galatage 2013-09-11 06:09:06 PDT
Created attachment 211302 [details]
Patch
Comment 8 Vivek Galatage 2013-09-11 07:19:02 PDT
(In reply to comment #6)
> (From update of attachment 210700 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=210700&action=review
> 
> >> Source/WebCore/xml/DOMParser.cpp:29
> >> +    if (!DOMImplementation::isXMLMIMEType(contentType) && contentType != "text/html")
> > 
> > isXMLMiMEType allows any MIME type that ends with +xml. That doesn't seem to match the spec.
> 
> Lets make sure we have some test coverage for this, either way. Some bogus type that ends in "+xml" to make sure we don’t support it.
> 
> Also, should this be case sensitive or not? Need test coverage for that too.

FF and opera 12 raise exception in case of type mismatch or incorrect case. Matching our behavior with it. Also made changes in order to support only listed types. Please take a look, thank you.
Comment 9 WebKit Commit Bot 2013-09-11 18:40:48 PDT
Comment on attachment 211302 [details]
Patch

Clearing flags on attachment: 211302

Committed r155584: <http://trac.webkit.org/changeset/155584>
Comment 10 WebKit Commit Bot 2013-09-11 18:40:51 PDT
All reviewed patches have been landed.  Closing bug.
Comment 11 Lucas Forschler 2019-02-06 09:03:10 PST
Mass moving XML DOM bugs to the "DOM" Component.