<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[177366] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/177366">177366</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2014-12-16 10:42:43 -0800 (Tue, 16 Dec 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Document.contentType implementation
https://bugs.webkit.org/show_bug.cgi?id=132269

Patch by Tibor Meszaros &lt;tmeszaros.u-szeged@partner.samsung.com&gt; on 2014-12-16
Reviewed by Darin Adler.

Chromium merge from https://codereview.chromium.org/151653004

Source/WebCore:

Tests: fast/dom/document-contentType-DOMParser.html
       fast/dom/document-contentType-createDocument.html
       fast/dom/document-contentType-data-uri.html
       fast/xsl/xslt-contentType.html
       http/tests/dom/document-contentType-meta.html
       http/tests/dom/document-contentType-xhr.html
       http/tests/dom/document-contentType.html

* dom/Document.cpp:
(WebCore::Document::overrideMIMEType):
(WebCore::Document::contentType):
(WebCore::Document::cloneDataFromDocument):
* dom/Document.h:
* dom/Document.idl:
* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::currentContentType):
* loader/DocumentLoader.h:
* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::responseXML):
* xml/XSLTProcessor.cpp:
(WebCore::XSLTProcessor::createDocumentFromSource):

LayoutTests:

* fast/dom/Document/clone-node-expected.txt:
* fast/dom/Document/clone-node.html:
* fast/dom/HTMLDocument/clone-node-quirks-mode-expected.txt:
* fast/dom/HTMLDocument/clone-node-quirks-mode.html:
* fast/dom/document-contentType-DOMParser-expected.txt: Added.
* fast/dom/document-contentType-DOMParser.html: Added.
* fast/dom/document-contentType-createDocument-expected.txt: Added.
* fast/dom/document-contentType-createDocument.html: Added.
* fast/dom/document-contentType-data-uri-expected.txt: Added.
* fast/dom/document-contentType-data-uri.html: Added.
* fast/xsl/xslt-contentType-expected.txt: Added.
* fast/xsl/xslt-contentType.html: Added.
* http/tests/dom/document-contentType-expected.txt: Added.
* http/tests/dom/document-contentType-meta-expected.txt: Added.
* http/tests/dom/document-contentType-meta.html: Added.
* http/tests/dom/document-contentType-xhr-expected.txt: Added.
* http/tests/dom/document-contentType-xhr.html: Added.
* http/tests/dom/document-contentType.html: Added.
* http/tests/dom/resources/dummy.css: Added.
(body):
* http/tests/dom/resources/dummy.html: Added.
* http/tests/dom/resources/dummy.js: Added.
* http/tests/dom/resources/dummy.txt: Added.
* http/tests/dom/resources/dummy.xml: Added.
* http/tests/dom/resources/send-mime-type.php: Added.
* http/tests/dom/resources/square20.bmp: Added.
* http/tests/dom/resources/square20.gif: Added.
* http/tests/dom/resources/square20.jpg: Added.
* http/tests/dom/resources/square20.png: Added.
* resources/js-test.js:
(shouldBeEqualToNumber):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsfastdomDocumentclonenodeexpectedtxt">trunk/LayoutTests/fast/dom/Document/clone-node-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomDocumentclonenodehtml">trunk/LayoutTests/fast/dom/Document/clone-node.html</a></li>
<li><a href="#trunkLayoutTestsfastdomHTMLDocumentclonenodequirksmodeexpectedtxt">trunk/LayoutTests/fast/dom/HTMLDocument/clone-node-quirks-mode-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomHTMLDocumentclonenodequirksmodehtml">trunk/LayoutTests/fast/dom/HTMLDocument/clone-node-quirks-mode.html</a></li>
<li><a href="#trunkLayoutTestsresourcesjstestjs">trunk/LayoutTests/resources/js-test.js</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoredomDocumentcpp">trunk/Source/WebCore/dom/Document.cpp</a></li>
<li><a href="#trunkSourceWebCoredomDocumenth">trunk/Source/WebCore/dom/Document.h</a></li>
<li><a href="#trunkSourceWebCoredomDocumentidl">trunk/Source/WebCore/dom/Document.idl</a></li>
<li><a href="#trunkSourceWebCoreloaderDocumentLoadercpp">trunk/Source/WebCore/loader/DocumentLoader.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderDocumentLoaderh">trunk/Source/WebCore/loader/DocumentLoader.h</a></li>
<li><a href="#trunkSourceWebCorexmlXMLHttpRequestcpp">trunk/Source/WebCore/xml/XMLHttpRequest.cpp</a></li>
<li><a href="#trunkSourceWebCorexmlXSLTProcessorcpp">trunk/Source/WebCore/xml/XSLTProcessor.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastdomdocumentcontentTypeDOMParserexpectedtxt">trunk/LayoutTests/fast/dom/document-contentType-DOMParser-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomdocumentcontentTypeDOMParserhtml">trunk/LayoutTests/fast/dom/document-contentType-DOMParser.html</a></li>
<li><a href="#trunkLayoutTestsfastdomdocumentcontentTypecreateDocumentexpectedtxt">trunk/LayoutTests/fast/dom/document-contentType-createDocument-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomdocumentcontentTypecreateDocumenthtml">trunk/LayoutTests/fast/dom/document-contentType-createDocument.html</a></li>
<li><a href="#trunkLayoutTestsfastdomdocumentcontentTypedatauriexpectedtxt">trunk/LayoutTests/fast/dom/document-contentType-data-uri-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomdocumentcontentTypedataurihtml">trunk/LayoutTests/fast/dom/document-contentType-data-uri.html</a></li>
<li><a href="#trunkLayoutTestsfastxslxsltcontentTypeexpectedtxt">trunk/LayoutTests/fast/xsl/xslt-contentType-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastxslxsltcontentTypehtml">trunk/LayoutTests/fast/xsl/xslt-contentType.html</a></li>
<li>trunk/LayoutTests/http/tests/dom/</li>
<li><a href="#trunkLayoutTestshttptestsdomdocumentcontentTypeexpectedtxt">trunk/LayoutTests/http/tests/dom/document-contentType-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestsdomdocumentcontentTypemetaexpectedtxt">trunk/LayoutTests/http/tests/dom/document-contentType-meta-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestsdomdocumentcontentTypemetahtml">trunk/LayoutTests/http/tests/dom/document-contentType-meta.html</a></li>
<li><a href="#trunkLayoutTestshttptestsdomdocumentcontentTypexhrexpectedtxt">trunk/LayoutTests/http/tests/dom/document-contentType-xhr-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestsdomdocumentcontentTypexhrhtml">trunk/LayoutTests/http/tests/dom/document-contentType-xhr.html</a></li>
<li><a href="#trunkLayoutTestshttptestsdomdocumentcontentTypehtml">trunk/LayoutTests/http/tests/dom/document-contentType.html</a></li>
<li>trunk/LayoutTests/http/tests/dom/resources/</li>
<li><a href="#trunkLayoutTestshttptestsdomresourcesdummycss">trunk/LayoutTests/http/tests/dom/resources/dummy.css</a></li>
<li><a href="#trunkLayoutTestshttptestsdomresourcesdummyhtml">trunk/LayoutTests/http/tests/dom/resources/dummy.html</a></li>
<li><a href="#trunkLayoutTestshttptestsdomresourcesdummyjs">trunk/LayoutTests/http/tests/dom/resources/dummy.js</a></li>
<li><a href="#trunkLayoutTestshttptestsdomresourcesdummytxt">trunk/LayoutTests/http/tests/dom/resources/dummy.txt</a></li>
<li><a href="#trunkLayoutTestshttptestsdomresourcesdummyxml">trunk/LayoutTests/http/tests/dom/resources/dummy.xml</a></li>
<li><a href="#trunkLayoutTestshttptestsdomresourcessendmimetypephp">trunk/LayoutTests/http/tests/dom/resources/send-mime-type.php</a></li>
<li><a href="#trunkLayoutTestshttptestsdomresourcessquare20bmp">trunk/LayoutTests/http/tests/dom/resources/square20.bmp</a></li>
<li><a href="#trunkLayoutTestshttptestsdomresourcessquare20gif">trunk/LayoutTests/http/tests/dom/resources/square20.gif</a></li>
<li><a href="#trunkLayoutTestshttptestsdomresourcessquare20jpg">trunk/LayoutTests/http/tests/dom/resources/square20.jpg</a></li>
<li><a href="#trunkLayoutTestshttptestsdomresourcessquare20png">trunk/LayoutTests/http/tests/dom/resources/square20.png</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (177365 => 177366)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-12-16 18:39:14 UTC (rev 177365)
+++ trunk/LayoutTests/ChangeLog        2014-12-16 18:42:43 UTC (rev 177366)
</span><span class="lines">@@ -1,3 +1,44 @@
</span><ins>+2014-12-16  Tibor Meszaros  &lt;tmeszaros.u-szeged@partner.samsung.com&gt;
+
+        Document.contentType implementation
+        https://bugs.webkit.org/show_bug.cgi?id=132269
+
+        Reviewed by Darin Adler.
+
+        Chromium merge from https://codereview.chromium.org/151653004
+
+        * fast/dom/Document/clone-node-expected.txt:
+        * fast/dom/Document/clone-node.html:
+        * fast/dom/HTMLDocument/clone-node-quirks-mode-expected.txt:
+        * fast/dom/HTMLDocument/clone-node-quirks-mode.html:
+        * fast/dom/document-contentType-DOMParser-expected.txt: Added.
+        * fast/dom/document-contentType-DOMParser.html: Added.
+        * fast/dom/document-contentType-createDocument-expected.txt: Added.
+        * fast/dom/document-contentType-createDocument.html: Added.
+        * fast/dom/document-contentType-data-uri-expected.txt: Added.
+        * fast/dom/document-contentType-data-uri.html: Added.
+        * fast/xsl/xslt-contentType-expected.txt: Added.
+        * fast/xsl/xslt-contentType.html: Added.
+        * http/tests/dom/document-contentType-expected.txt: Added.
+        * http/tests/dom/document-contentType-meta-expected.txt: Added.
+        * http/tests/dom/document-contentType-meta.html: Added.
+        * http/tests/dom/document-contentType-xhr-expected.txt: Added.
+        * http/tests/dom/document-contentType-xhr.html: Added.
+        * http/tests/dom/document-contentType.html: Added.
+        * http/tests/dom/resources/dummy.css: Added.
+        (body):
+        * http/tests/dom/resources/dummy.html: Added.
+        * http/tests/dom/resources/dummy.js: Added.
+        * http/tests/dom/resources/dummy.txt: Added.
+        * http/tests/dom/resources/dummy.xml: Added.
+        * http/tests/dom/resources/send-mime-type.php: Added.
+        * http/tests/dom/resources/square20.bmp: Added.
+        * http/tests/dom/resources/square20.gif: Added.
+        * http/tests/dom/resources/square20.jpg: Added.
+        * http/tests/dom/resources/square20.png: Added.
+        * resources/js-test.js:
+        (shouldBeEqualToNumber):
+
</ins><span class="cx"> 2014-12-16  Alexey Proskuryakov  &lt;ap@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         media/track/track-language-preference.html and media/track/track-prefer-captions.html time out on Mac
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomDocumentclonenodeexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dom/Document/clone-node-expected.txt (177365 => 177366)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/Document/clone-node-expected.txt        2014-12-16 18:39:14 UTC (rev 177365)
+++ trunk/LayoutTests/fast/dom/Document/clone-node-expected.txt        2014-12-16 18:42:43 UTC (rev 177366)
</span><span class="lines">@@ -6,10 +6,12 @@
</span><span class="cx"> PASS doc.cloneNode(false).__proto__ is Document.prototype
</span><span class="cx"> PASS className(doc.cloneNode(false)) is &quot;Document&quot;
</span><span class="cx"> PASS doc.cloneNode(true).documentElement.localName is &quot;root&quot;
</span><ins>+PASS doc.cloneNode(true).contentType is &quot;application/xml&quot;
</ins><span class="cx"> PASS document.cloneNode(true).compatMode is &quot;CSS1Compat&quot;
</span><span class="cx"> PASS document.cloneNode(false).URL is document.URL
</span><span class="cx"> PASS document.cloneNode(false).baseURI is document.baseURI
</span><span class="cx"> PASS document.cloneNode(false).characterSet is document.characterSet
</span><ins>+PASS document.cloneNode(true).contentType is &quot;text/html&quot;
</ins><span class="cx"> PASS successfullyParsed is true
</span><span class="cx"> 
</span><span class="cx"> TEST COMPLETE
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomDocumentclonenodehtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dom/Document/clone-node.html (177365 => 177366)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/Document/clone-node.html        2014-12-16 18:39:14 UTC (rev 177365)
+++ trunk/LayoutTests/fast/dom/Document/clone-node.html        2014-12-16 18:42:43 UTC (rev 177366)
</span><span class="lines">@@ -14,10 +14,12 @@
</span><span class="cx"> shouldBe('doc.cloneNode(false).__proto__', 'Document.prototype');
</span><span class="cx"> shouldBeEqualToString('className(doc.cloneNode(false))', 'Document');
</span><span class="cx"> shouldBeEqualToString('doc.cloneNode(true).documentElement.localName', 'root');
</span><ins>+shouldBeEqualToString('doc.cloneNode(true).contentType', 'application/xml');
</ins><span class="cx"> shouldBeEqualToString('document.cloneNode(true).compatMode', 'CSS1Compat');
</span><span class="cx"> shouldBe('document.cloneNode(false).URL', 'document.URL');
</span><span class="cx"> shouldBe('document.cloneNode(false).baseURI', 'document.baseURI');
</span><span class="cx"> shouldBe('document.cloneNode(false).characterSet', 'document.characterSet');
</span><ins>+shouldBeEqualToString('document.cloneNode(true).contentType', 'text/html');
</ins><span class="cx"> 
</span><span class="cx"> &lt;/script&gt;
</span><span class="cx"> &lt;script src=&quot;../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomHTMLDocumentclonenodequirksmodeexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dom/HTMLDocument/clone-node-quirks-mode-expected.txt (177365 => 177366)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/HTMLDocument/clone-node-quirks-mode-expected.txt        2014-12-16 18:39:14 UTC (rev 177365)
+++ trunk/LayoutTests/fast/dom/HTMLDocument/clone-node-quirks-mode-expected.txt        2014-12-16 18:42:43 UTC (rev 177366)
</span><span class="lines">@@ -7,10 +7,12 @@
</span><span class="cx"> PASS className(document.cloneNode(false)) is &quot;HTMLDocument&quot;
</span><span class="cx"> PASS document.cloneNode(true).title is document.title
</span><span class="cx"> PASS document.cloneNode(true).compatMode is &quot;BackCompat&quot;
</span><ins>+PASS document.cloneNode(true).contentType is &quot;text/html&quot;
</ins><span class="cx"> PASS doc.cloneNode(false).__proto__ is HTMLDocument.prototype
</span><span class="cx"> PASS className(doc.cloneNode(false)) is &quot;HTMLDocument&quot;
</span><span class="cx"> PASS doc.cloneNode(true).title is doc.title
</span><span class="cx"> PASS doc.cloneNode(true).compatMode is &quot;CSS1Compat&quot;
</span><ins>+PASS doc.cloneNode(true).contentType is &quot;text/html&quot;
</ins><span class="cx"> PASS successfullyParsed is true
</span><span class="cx"> 
</span><span class="cx"> TEST COMPLETE
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomHTMLDocumentclonenodequirksmodehtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dom/HTMLDocument/clone-node-quirks-mode.html (177365 => 177366)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/HTMLDocument/clone-node-quirks-mode.html        2014-12-16 18:39:14 UTC (rev 177365)
+++ trunk/LayoutTests/fast/dom/HTMLDocument/clone-node-quirks-mode.html        2014-12-16 18:42:43 UTC (rev 177366)
</span><span class="lines">@@ -11,12 +11,14 @@
</span><span class="cx"> shouldBeEqualToString('className(document.cloneNode(false))', 'HTMLDocument');
</span><span class="cx"> shouldBe('document.cloneNode(true).title', 'document.title');
</span><span class="cx"> shouldBeEqualToString('document.cloneNode(true).compatMode', 'BackCompat');
</span><ins>+shouldBeEqualToString('document.cloneNode(true).contentType', 'text/html');
</ins><span class="cx"> 
</span><span class="cx"> var doc = document.implementation.createHTMLDocument('title');
</span><span class="cx"> shouldBe('doc.cloneNode(false).__proto__', 'HTMLDocument.prototype');
</span><span class="cx"> shouldBeEqualToString('className(doc.cloneNode(false))', 'HTMLDocument');
</span><span class="cx"> shouldBe('doc.cloneNode(true).title', 'doc.title');
</span><span class="cx"> shouldBeEqualToString('doc.cloneNode(true).compatMode', 'CSS1Compat');
</span><ins>+shouldBeEqualToString('doc.cloneNode(true).contentType', 'text/html');
</ins><span class="cx"> 
</span><span class="cx"> &lt;/script&gt;
</span><span class="cx"> &lt;script src=&quot;../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomdocumentcontentTypeDOMParserexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/document-contentType-DOMParser-expected.txt (0 => 177366)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/document-contentType-DOMParser-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/dom/document-contentType-DOMParser-expected.txt        2014-12-16 18:42:43 UTC (rev 177366)
</span><span class="lines">@@ -0,0 +1,12 @@
</span><ins>+PASS new DOMParser().parseFromString(htmlContent, &quot;text/html&quot;).contentType is &quot;text/html&quot;
+PASS new DOMParser().parseFromString(xmlContent, &quot;application/xml&quot;).contentType is &quot;application/xml&quot;
+PASS new DOMParser().parseFromString(xhtmlContent, &quot;application/xhtml+xml&quot;).contentType is &quot;application/xhtml+xml&quot;
+PASS new DOMParser().parseFromString(svgImageContent, &quot;image/svg+xml&quot;).contentType is &quot;image/svg+xml&quot;
+PASS new DOMParser().parseFromString(xslContent, &quot;text/xsl&quot;).contentType threw exception TypeError: Type error.
+PASS new DOMParser().parseFromString(xmlContent, &quot;text/dummy+xml&quot;).contentType threw exception TypeError: Type error.
+PASS new DOMParser().parseFromString(xmlContent, &quot;text/XML&quot;).contentType threw exception TypeError: Type error.
+PASS new DOMParser().parseFromString(htmlContent, &quot;TEXT/html&quot;).contentType threw exception TypeError: Type error.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomdocumentcontentTypeDOMParserhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/document-contentType-DOMParser.html (0 => 177366)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/document-contentType-DOMParser.html                                (rev 0)
+++ trunk/LayoutTests/fast/dom/document-contentType-DOMParser.html        2014-12-16 18:42:43 UTC (rev 177366)
</span><span class="lines">@@ -0,0 +1,85 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;head&gt;
+ &lt;title&gt;document.contentType&lt;/title&gt;
+ &lt;link rel=&quot;help&quot; href=&quot;http://dom.spec.whatwg.org/#dom-document-contenttype&quot;&gt;
+ &lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+ &lt;script&gt;
+  
+var htmlContent =
+                &quot;&lt;html&gt;&quot; +
+                    &quot;&lt;head&gt;&quot; +
+                        &quot;&lt;noscript&gt;&quot; +
+                            &quot;Scripts must be disabled for the document created using DOMParser.parseFromString()&quot; +
+                        &quot;&lt;/noscript&gt;&quot; +
+                    &quot;&lt;/head&gt;&quot; +
+                    &quot;&lt;body&gt;&quot; +
+                        &quot;&lt;div id='text'&gt;Sample text content&lt;/div&gt;&quot; +
+                        &quot;&lt;script&gt;document.getElementById('text').textContent = 'Modified text content';&lt;\/script&gt;&quot; +
+                    &quot;&lt;/body&gt;&quot; +
+                &quot;&lt;/html&gt;&quot;;
+
+var xmlContent =
+                &quot;&lt;root&gt;&quot; +
+                &quot;&lt;/root&gt;&quot;;
+
+
+var xhtmlContent =
+                &quot;&lt;!DOCTYPE html&gt;&quot; +
+                &quot;&lt;html xmlns=\&quot;http://www.w3.org/1999/xhtml\&quot;&gt;&quot; +
+                    &quot;&lt;head&gt;&quot; +
+                        &quot;&lt;title&gt;Title of document&lt;/title&gt;&quot; +
+                        &quot;&lt;noscript&gt;&quot; +
+                            &quot;Scripts must be disabled for the document created using DOMParser.parseFromString()&quot; +
+                        &quot;&lt;/noscript&gt;&quot; +
+                    &quot;&lt;/head&gt;&quot; +
+                    &quot;&lt;body&gt;&quot; +
+                        &quot;&lt;div id='text'&gt;&lt;/div&gt;&quot; +
+                        &quot;&lt;script&gt;document.getElementById('text').textContent = 'Newly added text';&lt;\/script&gt;&quot; +
+                    &quot;&lt;/body&gt;&quot; +
+                &quot;&lt;/html&gt;&quot;;
+
+var svgImageContent =
+                &quot;&lt;svg xmlns=\&quot;http://www.w3.org/2000/svg\&quot; version=\&quot;1.1\&quot;&gt;&quot; +
+                    &quot;&lt;circle cx=\&quot;100\&quot; cy=\&quot;50\&quot; r=\&quot;40\&quot; stroke=\&quot;black\&quot; stroke-width=\&quot;2\&quot; fill=\&quot;red\&quot;/&gt;&quot; +
+                &quot;&lt;/svg&gt;&quot;;
+
+var xslContent =
+                &quot;&lt;?xml version=\&quot;1.0\&quot;?&gt;&quot; +
+                &quot;&lt;xsl:stylesheet version=\&quot;1.0\&quot; xmlns:xsl=\&quot;http://www.w3.org/1999/XSL/Transform\&quot;&gt;&quot; +
+                    &quot;&lt;xsl:template match=\&quot;/\&quot;&gt;&quot; +
+                        &quot;&lt;html&gt;&quot; +
+                            &quot;&lt;head&gt;&quot; +
+                                &quot;&lt;title&gt;XML XSL Example&lt;/title&gt;&quot; +
+                                &quot;&lt;style type=\&quot;text/css\&quot;&gt;&quot; +
+                                    &quot;body&quot; +
+                                    &quot;{&quot; +
+                                        &quot;background-color:red;&quot; +
+                                    &quot;}&quot; +
+                                &quot;&lt;/style&gt;&quot; +
+                            &quot;&lt;/head&gt;&quot; +
+                            &quot;&lt;body&gt;&quot; +
+                                &quot;&lt;xsl:apply-templates/&gt;&quot; +
+                            &quot;&lt;/body&gt;&quot; +
+                        &quot;&lt;/html&gt;&quot; +
+                    &quot;&lt;/xsl:template&gt;&quot; +
+                    &quot;&quot; +
+                    &quot;&lt;xsl:template match=\&quot;tutorial\&quot;&gt;&quot; +
+                        &quot;&lt;span&gt;&lt;xsl:value-of select=\&quot;name\&quot;/&gt;&lt;/span&gt;&quot; +
+                        &quot;&lt;span&gt;&lt;xsl:value-of select=\&quot;url\&quot;/&gt;&lt;/span&gt;&quot; +
+                    &quot;&lt;/xsl:template&gt;&quot; +
+                &quot;&lt;/xsl:stylesheet&gt;&quot;;
+
+shouldBeEqualToString('new DOMParser().parseFromString(htmlContent, &quot;text/html&quot;).contentType', 'text/html');
+shouldBeEqualToString('new DOMParser().parseFromString(xmlContent, &quot;application/xml&quot;).contentType', 'application/xml');
+shouldBeEqualToString('new DOMParser().parseFromString(xhtmlContent, &quot;application/xhtml+xml&quot;).contentType', 'application/xhtml+xml');
+shouldBeEqualToString('new DOMParser().parseFromString(svgImageContent, &quot;image/svg+xml&quot;).contentType', 'image/svg+xml');
+shouldThrow('new DOMParser().parseFromString(xslContent, &quot;text/xsl&quot;).contentType', &quot;'TypeError: Type error'&quot;);
+shouldThrow('new DOMParser().parseFromString(xmlContent, &quot;text/dummy+xml&quot;).contentType', &quot;'TypeError: Type error'&quot;);
+shouldThrow('new DOMParser().parseFromString(xmlContent, &quot;text/XML&quot;).contentType', &quot;'TypeError: Type error'&quot;);
+shouldThrow('new DOMParser().parseFromString(htmlContent, &quot;TEXT/html&quot;).contentType', &quot;'TypeError: Type error'&quot;);
+
+&lt;/script&gt;
+&lt;script src=&quot;../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomdocumentcontentTypecreateDocumentexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/document-contentType-createDocument-expected.txt (0 => 177366)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/document-contentType-createDocument-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/dom/document-contentType-createDocument-expected.txt        2014-12-16 18:42:43 UTC (rev 177366)
</span><span class="lines">@@ -0,0 +1,8 @@
</span><ins>+PASS doc.contentType is &quot;text/html&quot;
+PASS doc.contentType is &quot;application/xml&quot;
+PASS doc.contentType is &quot;application/xml&quot;
+PASS doc.contentType is &quot;image/svg+xml&quot;
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomdocumentcontentTypecreateDocumenthtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/document-contentType-createDocument.html (0 => 177366)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/document-contentType-createDocument.html                                (rev 0)
+++ trunk/LayoutTests/fast/dom/document-contentType-createDocument.html        2014-12-16 18:42:43 UTC (rev 177366)
</span><span class="lines">@@ -0,0 +1,19 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;title&gt;document.contentType&lt;/title&gt;
+&lt;link rel=&quot;help&quot; href=&quot;http://dom.spec.whatwg.org/#dom-document-contenttype&quot;&gt;
+&lt;script src=&quot;../../resources/js-test.js&quot;&gt;&lt;/script&gt;
+&lt;body&gt;
+&lt;script&gt;
+var doc = document.implementation.createHTMLDocument('f');
+shouldBe('doc.contentType', '&quot;text/html&quot;');
+
+doc = document.implementation.createDocument(null, 'root', null);
+shouldBe('doc.contentType', '&quot;application/xml&quot;');
+
+var foo = document.implementation.createDocumentType(&quot;foobar&quot;, &quot;&quot;, &quot;&quot;);
+doc = document.implementation.createDocument(null, null, foo);
+shouldBe('doc.contentType', '&quot;application/xml&quot;');
+
+doc = document.implementation.createDocument('http://www.w3.org/2000/svg', 'svg:svg', null);
+shouldBe('doc.contentType', '&quot;image/svg+xml&quot;');
+&lt;/script&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomdocumentcontentTypedatauriexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/document-contentType-data-uri-expected.txt (0 => 177366)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/document-contentType-data-uri-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/dom/document-contentType-data-uri-expected.txt        2014-12-16 18:42:43 UTC (rev 177366)
</span><span class="lines">@@ -0,0 +1,8 @@
</span><ins>+PASS &quot;application/xml&quot; is &quot;application/xml&quot;
+PASS &quot;image/svg+xml&quot; is &quot;image/svg+xml&quot;
+PASS &quot;text/html&quot; is &quot;text/html&quot;
+PASS &quot;text/xml&quot; is &quot;text/xml&quot;
+PASS successfullyParsed is true
+
+TEST COMPLETE
+   
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomdocumentcontentTypedataurihtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/document-contentType-data-uri.html (0 => 177366)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/document-contentType-data-uri.html                                (rev 0)
+++ trunk/LayoutTests/fast/dom/document-contentType-data-uri.html        2014-12-16 18:42:43 UTC (rev 177366)
</span><span class="lines">@@ -0,0 +1,55 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;title&gt;document.contentType&lt;/title&gt;
+&lt;link rel=&quot;help&quot; href=&quot;http://dom.spec.whatwg.org/#dom-document-contenttype&quot;&gt;
+&lt;script src=&quot;../../resources/js-test.js&quot;&gt;&lt;/script&gt;
+&lt;body&gt;
+&lt;p&gt;
+&lt;iframe data-mimetype=&quot;text/html&quot;&gt;&lt;/iframe&gt;
+&lt;iframe data-mimetype=&quot;text/xml&quot;&gt;&lt;/iframe&gt;
+&lt;iframe data-mimetype=&quot;application/xml&quot;&gt;&lt;/iframe&gt;
+&lt;iframe data-mimetype=&quot;image/svg+xml&quot;&gt;&lt;/iframe&gt;
+&lt;/p&gt;
+&lt;script&gt;
+window.jsTestIsAsync = true;
+var tests = new Array();
+
+window.onmessage = function(e) {
+    if (e.data)
+        tests[--expectedMessagesCount]=e.data;
+    else
+        testFailed(&quot;Null message payload&quot;);
+
+    if (expectedMessagesCount == 0) {
+        runTests();
+        finishJSTest();
+    }
+};
+
+function runTests(){
+    tests.sort(function(a,b){
+        if (a.obtained &gt; b.obtained)
+            return -1;
+        if (a.obtained &lt; b.obtained)
+            return 1;
+        return 0;
+    });
+
+    for (var i = tests.length - 1; i &gt;= 0; i--) {
+        shouldBe('&quot;' + tests[i].obtained + '&quot;', '&quot;' + tests[i].expected + '&quot;');
+    };
+}
+
+var documentContents = '&lt;script xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;' +
+    'parent.postMessage(' +
+        '{obtained: document.contentType, expected: &quot;{0}&quot;}, &quot;*&quot;);' +
+    '&lt;' + '/script&gt;';
+
+var iframes = document.getElementsByTagName('iframe');
+for (var k = 0, f; f = iframes[k]; k++) {
+    f.src = 'data:' + f.dataset.mimetype + ',' + encodeURIComponent(documentContents.replace('{0}', f.dataset.mimetype));
+}
+
+var expectedMessagesCount = iframes.length;
+
+&lt;/script&gt;
+&lt;/body&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsfastxslxsltcontentTypeexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/xsl/xslt-contentType-expected.txt (0 => 177366)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/xsl/xslt-contentType-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/xsl/xslt-contentType-expected.txt        2014-12-16 18:42:43 UTC (rev 177366)
</span><span class="lines">@@ -0,0 +1,9 @@
</span><ins>+PASS doc.contentType is &quot;text/html&quot;
+PASS doc.contentType is &quot;application/xml&quot;
+PASS doc.contentType is &quot;application/xhtml+xml&quot;
+PASS doc.contentType is &quot;application/xml&quot;
+PASS doc.contentType is &quot;application/xml&quot;
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastxslxsltcontentTypehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/xsl/xslt-contentType.html (0 => 177366)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/xsl/xslt-contentType.html                                (rev 0)
+++ trunk/LayoutTests/fast/xsl/xslt-contentType.html        2014-12-16 18:42:43 UTC (rev 177366)
</span><span class="lines">@@ -0,0 +1,53 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;head&gt;
+        &lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body &gt;
+        &lt;script&gt;
+        if (window.testRunner)
+            testRunner.dumpAsText();
+
+        var xsltp = new XSLTProcessor();
+        var doc;
+
+        function test(method) {
+                try {
+                        var xml = '&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;';
+                    var style = '&lt;xsl:stylesheet xmlns:xsl=&quot;http://www.w3.org/1999/XSL/Transform&quot; version=&quot;1.0&quot;&gt; \
+                                &lt;xsl:output indent=&quot;yes&quot; method=&quot;'+method+'&quot;/&gt; \
+                            &lt;/xsl:stylesheet&gt;';
+
+                var xmlDoc = new DOMParser().parseFromString(xml, &quot;text/xml&quot;);
+                var xslDoc = new DOMParser().parseFromString(style, &quot;text/xml&quot;);
+    
+                xsltp.importStylesheet(xslDoc);
+                doc = xsltp.transformToDocument(xmlDoc);
+
+                xsltp.reset();
+            } catch(e) {
+              document.write(&quot;Exception: &quot; + e);
+            }
+        }
+        
+        function runTests() {
+            test('html');
+            shouldBe('doc.contentType','&quot;text/html&quot;');
+
+            test('xml');
+            shouldBe('doc.contentType','&quot;application/xml&quot;');
+
+            test('text');
+            shouldBe('doc.contentType','&quot;application/xhtml+xml&quot;');
+
+            test('foo');
+            shouldBe('doc.contentType','&quot;application/xml&quot;');
+
+            test('xhtml/foo');
+            shouldBe('doc.contentType','&quot;application/xml&quot;');
+        }
+
+        runTests();
+    &lt;/script&gt;
+&lt;/body&gt;
+&lt;script src=&quot;../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestsdomdocumentcontentTypeexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/dom/document-contentType-expected.txt (0 => 177366)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/dom/document-contentType-expected.txt                                (rev 0)
+++ trunk/LayoutTests/http/tests/dom/document-contentType-expected.txt        2014-12-16 18:42:43 UTC (rev 177366)
</span><span class="lines">@@ -0,0 +1,32 @@
</span><ins>+PASS iframes[0].contentDocument.contentType is &quot;text/css&quot;
+PASS iframes[0].contentDocument.cloneNode(false).contentType is &quot;text/css&quot;
+PASS iframes[1].contentDocument.contentType is &quot;application/x-javascript&quot;
+PASS iframes[1].contentDocument.cloneNode(false).contentType is &quot;application/x-javascript&quot;
+PASS iframes[2].contentDocument.contentType is &quot;text/html&quot;
+PASS iframes[2].contentDocument.cloneNode(false).contentType is &quot;text/html&quot;
+PASS iframes[3].contentDocument.contentType is &quot;text/html&quot;
+PASS iframes[3].contentDocument.cloneNode(false).contentType is &quot;text/html&quot;
+PASS iframes[4].contentDocument.contentType is &quot;text/xml&quot;
+PASS iframes[4].contentDocument.cloneNode(false).contentType is &quot;text/xml&quot;
+PASS iframes[5].contentDocument.contentType is &quot;text/xml&quot;
+PASS iframes[5].contentDocument.cloneNode(false).contentType is &quot;text/xml&quot;
+PASS iframes[6].contentDocument.contentType is &quot;text/html&quot;
+PASS iframes[6].contentDocument.cloneNode(false).contentType is &quot;text/html&quot;
+PASS iframes[7].contentDocument.contentType is &quot;text/html&quot;
+PASS iframes[7].contentDocument.cloneNode(false).contentType is &quot;text/html&quot;
+PASS iframes[8].contentDocument.contentType is &quot;text/plain&quot;
+PASS iframes[8].contentDocument.cloneNode(false).contentType is &quot;text/plain&quot;
+PASS iframes[9].contentDocument.contentType is &quot;application/xml&quot;
+PASS iframes[9].contentDocument.cloneNode(false).contentType is &quot;application/xml&quot;
+PASS iframes[10].contentDocument.contentType is &quot;image/bmp&quot;
+PASS iframes[10].contentDocument.cloneNode(false).contentType is &quot;image/bmp&quot;
+PASS iframes[11].contentDocument.contentType is &quot;image/gif&quot;
+PASS iframes[11].contentDocument.cloneNode(false).contentType is &quot;image/gif&quot;
+PASS iframes[12].contentDocument.contentType is &quot;image/jpeg&quot;
+PASS iframes[12].contentDocument.cloneNode(false).contentType is &quot;image/jpeg&quot;
+PASS iframes[13].contentDocument.contentType is &quot;image/png&quot;
+PASS iframes[13].contentDocument.cloneNode(false).contentType is &quot;image/png&quot;
+PASS successfullyParsed is true
+
+TEST COMPLETE
+             
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestsdomdocumentcontentTypemetaexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/dom/document-contentType-meta-expected.txt (0 => 177366)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/dom/document-contentType-meta-expected.txt                                (rev 0)
+++ trunk/LayoutTests/http/tests/dom/document-contentType-meta-expected.txt        2014-12-16 18:42:43 UTC (rev 177366)
</span><span class="lines">@@ -0,0 +1,5 @@
</span><ins>+PASS document.getElementsByTagName(&quot;META&quot;)[0].content is &quot;text/xml&quot;
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestsdomdocumentcontentTypemetahtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/dom/document-contentType-meta.html (0 => 177366)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/dom/document-contentType-meta.html                                (rev 0)
+++ trunk/LayoutTests/http/tests/dom/document-contentType-meta.html        2014-12-16 18:42:43 UTC (rev 177366)
</span><span class="lines">@@ -0,0 +1,13 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;head&gt;
+ &lt;title&gt;document.contentType&lt;/title&gt;
+ &lt;link rel=&quot;help&quot; href=&quot;http://dom.spec.whatwg.org/#dom-document-contenttype&quot;&gt;
+ &lt;meta http-equiv=&quot;content-type&quot; content=&quot;text/xml&quot;&gt;
+ &lt;script src=&quot;/js-test-resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+ &lt;script&gt;
+  shouldBeEqualToString('document.getElementsByTagName(&quot;META&quot;)[0].content', 'text/xml');
+ &lt;/script&gt;
+ &lt;script src=&quot;/js-test-resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestshttptestsdomdocumentcontentTypexhrexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/dom/document-contentType-xhr-expected.txt (0 => 177366)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/dom/document-contentType-xhr-expected.txt                                (rev 0)
+++ trunk/LayoutTests/http/tests/dom/document-contentType-xhr-expected.txt        2014-12-16 18:42:43 UTC (rev 177366)
</span><span class="lines">@@ -0,0 +1,16 @@
</span><ins>+PASS xhr.status is 200
+PASS xhr.responseXML.contentType is &quot;text/html&quot;
+PASS xhr.status is 200
+PASS xhr.responseXML.contentType is &quot;text/xml&quot;
+PASS xhr.status is 200
+PASS xhr.responseXML.contentType is &quot;application/xml&quot;
+PASS xhr.status is 200
+PASS xhr.responseXML.contentType is &quot;text/html&quot;
+PASS xhr.status is 200
+PASS xhr.responseXML.contentType is &quot;text/xml&quot;
+PASS xhr.status is 200
+PASS xhr.responseXML.contentType is &quot;application/xml&quot;
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestsdomdocumentcontentTypexhrhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/dom/document-contentType-xhr.html (0 => 177366)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/dom/document-contentType-xhr.html                                (rev 0)
+++ trunk/LayoutTests/http/tests/dom/document-contentType-xhr.html        2014-12-16 18:42:43 UTC (rev 177366)
</span><span class="lines">@@ -0,0 +1,51 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;title&gt;document.contentType&lt;/title&gt;
+&lt;link rel=&quot;help&quot; href=&quot;http://dom.spec.whatwg.org/#dom-document-contenttype&quot;&gt;
+&lt;script src=&quot;/js-test-resources/js-test.js&quot;&gt;&lt;/script&gt;
+&lt;script&gt;
+window.jsTestIsAsync = true;
+
+if (window.testRunner) {
+    testRunner.waitUntilDone();
+}
+
+var toTest = [
+    { mimeType: &quot;text/html&quot;, uri: &quot;resources/send-mime-type.php?m=text/html&quot; },
+    { mimeType: &quot;text/xml&quot;, uri: &quot;resources/send-mime-type.php?m=text/xml&quot; },
+    { mimeType: &quot;application/xml&quot;, uri: &quot;resources/send-mime-type.php?m=application/xml&quot; },
+    { mimeType: &quot;text/html&quot;, uri: &quot;resources/send-mime-type.php?m=text/html;charset=utf-8&quot; },
+    { mimeType: &quot;text/xml&quot;, uri: &quot;resources/send-mime-type.php?m=text/xml;charset=utf-8&quot; },
+    { mimeType: &quot;application/xml&quot;, uri: &quot;resources/send-mime-type.php?m=application/xml;charset=utf-8&quot; }
+];
+
+function onrequestload(expectedMimeType) {
+    shouldBeEqualToNumber('xhr.status', 200);
+
+    if (xhr.responseXML)
+        shouldBeEqualToString('xhr.responseXML.contentType', expectedMimeType);
+    else
+        testFailed(&quot;Null document for mime-type &quot; + expectedMimeType);
+
+    stepTest();
+}
+
+var xhr;
+var testCounter = 0;
+
+function stepTest() {
+    if (testCounter != 6) {
+        var test = toTest[testCounter++];
+
+        xhr = new XMLHttpRequest();
+        xhr.responseType = 'document';
+        xhr.onload = function () { onrequestload(test.mimeType); };
+        xhr.open('GET', test.uri, true);
+        xhr.send(); 
+    } else {
+        finishJSTest();
+    }
+}
+&lt;/script&gt;
+
+&lt;body onload=&quot;stepTest();&quot;&gt;
+&lt;/body&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestshttptestsdomdocumentcontentTypehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/dom/document-contentType.html (0 => 177366)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/dom/document-contentType.html                                (rev 0)
+++ trunk/LayoutTests/http/tests/dom/document-contentType.html        2014-12-16 18:42:43 UTC (rev 177366)
</span><span class="lines">@@ -0,0 +1,37 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;title&gt;document.contentType&lt;/title&gt;
+&lt;link rel=&quot;help&quot; href=&quot;http://dom.spec.whatwg.org/#dom-document-contenttype&quot;&gt;
+&lt;script src=&quot;/js-test-resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;body&gt;
+&lt;p&gt;
+&lt;iframe data-mimetype=&quot;text/css&quot; src=&quot;resources/dummy.css&quot;&gt;&lt;/iframe&gt;
+&lt;iframe data-mimetype=&quot;application/x-javascript&quot; src=&quot;resources/dummy.js&quot;&gt;&lt;/iframe&gt;
+&lt;iframe data-mimetype=&quot;text/html&quot; src=&quot;resources/dummy.html&quot;&gt;&lt;/iframe&gt;
+&lt;iframe data-mimetype=&quot;text/html&quot; src=&quot;resources/send-mime-type.php&quot;&gt;&lt;/iframe&gt;
+&lt;iframe data-mimetype=&quot;text/xml&quot; src=&quot;resources/send-mime-type.php?m=text/xml&quot;&gt;&lt;/iframe&gt;
+&lt;iframe data-mimetype=&quot;text/xml&quot; src=&quot;resources/send-mime-type.php?m=text/xml;charset=utf-8&quot;&gt;&lt;/iframe&gt;
+&lt;iframe data-mimetype=&quot;text/html&quot; src=&quot;javascript:&amp;quot;hello world&amp;quot;;&quot;&gt;&lt;/iframe&gt;
+&lt;iframe data-mimetype=&quot;text/html&quot; src=&quot;about:blank&quot;&gt;&lt;/iframe&gt;
+&lt;iframe data-mimetype=&quot;text/plain&quot; src=&quot;resources/dummy.txt&quot;&gt;&lt;/iframe&gt;
+&lt;iframe data-mimetype=&quot;application/xml&quot; src=&quot;resources/dummy.xml&quot;&gt;&lt;/iframe&gt;
+&lt;iframe data-mimetype=&quot;image/bmp&quot; src=&quot;resources/square20.bmp&quot;&gt;&lt;/iframe&gt;
+&lt;iframe data-mimetype=&quot;image/gif&quot; src=&quot;resources/square20.gif&quot;&gt;&lt;/iframe&gt;
+&lt;iframe data-mimetype=&quot;image/jpeg&quot; src=&quot;resources/square20.jpg&quot;&gt;&lt;/iframe&gt;
+&lt;iframe data-mimetype=&quot;image/png&quot; src=&quot;resources/square20.png&quot;&gt;&lt;/iframe&gt;
+&lt;/p&gt;
+&lt;script&gt;
+var iframes;
+window.onload = function() {
+    iframes = document.getElementsByTagName('iframe');
+    for (var k = 0; iframes[k]; k++) {
+        shouldBeEqualToString('iframes[' + k + '].contentDocument.contentType',
+                              iframes[k].dataset.mimetype);
+        shouldBeEqualToString('iframes[' + k + '].contentDocument.cloneNode(false).contentType',
+                              iframes[k].dataset.mimetype);
+    }
+    wasPostTestScriptParsed = true;
+
+    finishJSTest();
+};
+&lt;/script&gt;
+&lt;body&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestshttptestsdomresourcesdummycss"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/dom/resources/dummy.css (0 => 177366)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/dom/resources/dummy.css                                (rev 0)
+++ trunk/LayoutTests/http/tests/dom/resources/dummy.css        2014-12-16 18:42:43 UTC (rev 177366)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+body {}
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestshttptestsdomresourcesdummyhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/dom/resources/dummy.html (0 => 177366)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/dom/resources/dummy.html                                (rev 0)
+++ trunk/LayoutTests/http/tests/dom/resources/dummy.html        2014-12-16 18:42:43 UTC (rev 177366)
</span><span class="lines">@@ -0,0 +1,2 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;body&gt;Hello world
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestshttptestsdomresourcesdummyjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/dom/resources/dummy.js (0 => 177366)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/dom/resources/dummy.js                                (rev 0)
+++ trunk/LayoutTests/http/tests/dom/resources/dummy.js        2014-12-16 18:42:43 UTC (rev 177366)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+var x;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestshttptestsdomresourcesdummytxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/dom/resources/dummy.txt (0 => 177366)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/dom/resources/dummy.txt                                (rev 0)
+++ trunk/LayoutTests/http/tests/dom/resources/dummy.txt        2014-12-16 18:42:43 UTC (rev 177366)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+Hello world
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestshttptestsdomresourcesdummyxml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/dom/resources/dummy.xml (0 => 177366)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/dom/resources/dummy.xml                                (rev 0)
+++ trunk/LayoutTests/http/tests/dom/resources/dummy.xml        2014-12-16 18:42:43 UTC (rev 177366)
</span><span class="lines">@@ -0,0 +1,2 @@
</span><ins>+&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
+&lt;root&gt;Text.me&lt;/root&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestshttptestsdomresourcessendmimetypephp"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/dom/resources/send-mime-type.php (0 => 177366)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/dom/resources/send-mime-type.php                                (rev 0)
+++ trunk/LayoutTests/http/tests/dom/resources/send-mime-type.php        2014-12-16 18:42:43 UTC (rev 177366)
</span><span class="lines">@@ -0,0 +1,6 @@
</span><ins>+&lt;?php
+header(&quot;HTTP/1.1 200 OK&quot;);
+if (isset($_GET['m']) &amp;&amp; $_GET['m'] != &quot;&quot;)
+        header(&quot;Content-Type: &quot; . $_GET['m']);
+echo &quot;&lt;h1&gt;Hello&lt;/h1&gt;&quot;
+?&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestshttptestsdomresourcessquare20bmp"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/dom/resources/square20.bmp (0 => 177366)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/dom/resources/square20.bmp                                (rev 0)
+++ trunk/LayoutTests/http/tests/dom/resources/square20.bmp        2014-12-16 18:42:43 UTC (rev 177366)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+BM*zl\xB0  BGRs\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF
 \xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF
 \xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestshttptestsdomresourcessquare20gif"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/dom/resources/square20.gif (0 => 177366)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/dom/resources/square20.gif                                (rev 0)
+++ trunk/LayoutTests/http/tests/dom/resources/square20.gif        2014-12-16 18:42:43 UTC (rev 177366)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+GIF87a\x80\xFF\xFF\xFF\xFF,\x84\x8F\xA9\xCB\xED\xA3\x9C\xB4ڋ\xB3޼\xFB\xAF;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestshttptestsdomresourcessquare20jpg"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/dom/resources/square20.jpg (0 => 177366)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/dom/resources/square20.jpg                                (rev 0)
+++ trunk/LayoutTests/http/tests/dom/resources/square20.jpg        2014-12-16 18:42:43 UTC (rev 177366)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+\xFF\xD8\xFF\xE0JFIFHH\xFF\xDBC\xFF\xDBC\xFF\xC2\xFF\xC4        \xFF\xC4        \xFF\xDA \x8E{\xF9+\xFF\xC40\xFF\xDA\xFF\xC40\xFF\xDA?\xFF\xC40\xFF\xDA?\xFF\xC40\xFF\xDA?\xFF\xC40\xFF\xDA?!\xFF\xDA \xFF\xC40\xFF\xDA?\xFF\xC40\xFF\xDA?\xFF\xC40\xFF\xDA?\xFF\xD9
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestshttptestsdomresourcessquare20png"></a>
<div class="binary"><h4>Added: trunk/LayoutTests/http/tests/dom/resources/square20.png</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<span class="cx">Property changes on: trunk/LayoutTests/http/tests/dom/resources/square20.png
</span><span class="cx">___________________________________________________________________
</span><a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="trunkLayoutTestsresourcesjstestjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/resources/js-test.js (177365 => 177366)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/resources/js-test.js        2014-12-16 18:39:14 UTC (rev 177365)
+++ trunk/LayoutTests/resources/js-test.js        2014-12-16 18:42:43 UTC (rev 177366)
</span><span class="lines">@@ -424,6 +424,14 @@
</span><span class="cx">   shouldBe(a, unevaledString);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+function shouldBeEqualToNumber(a, b)
+{
+  if (typeof a !== &quot;string&quot; || typeof b !== &quot;number&quot;)
+    debug(&quot;WARN: shouldBeEqualToNumber() expects a string and a number arguments&quot;);
+  var unevaledString = JSON.stringify(b);
+  shouldBe(a, unevaledString);
+}
+
</ins><span class="cx"> function shouldBeEmptyString(a) { shouldBeEqualToString(a, &quot;&quot;); }
</span><span class="cx"> 
</span><span class="cx"> function shouldEvaluateTo(actual, expected) {
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (177365 => 177366)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-12-16 18:39:14 UTC (rev 177365)
+++ trunk/Source/WebCore/ChangeLog        2014-12-16 18:42:43 UTC (rev 177366)
</span><span class="lines">@@ -1,3 +1,34 @@
</span><ins>+2014-12-16  Tibor Meszaros  &lt;tmeszaros.u-szeged@partner.samsung.com&gt;
+
+        Document.contentType implementation
+        https://bugs.webkit.org/show_bug.cgi?id=132269
+
+        Reviewed by Darin Adler.
+
+        Chromium merge from https://codereview.chromium.org/151653004
+
+        Tests: fast/dom/document-contentType-DOMParser.html
+               fast/dom/document-contentType-createDocument.html
+               fast/dom/document-contentType-data-uri.html
+               fast/xsl/xslt-contentType.html
+               http/tests/dom/document-contentType-meta.html
+               http/tests/dom/document-contentType-xhr.html
+               http/tests/dom/document-contentType.html
+
+        * dom/Document.cpp:
+        (WebCore::Document::overrideMIMEType):
+        (WebCore::Document::contentType):
+        (WebCore::Document::cloneDataFromDocument):
+        * dom/Document.h:
+        * dom/Document.idl:
+        * loader/DocumentLoader.cpp:
+        (WebCore::DocumentLoader::currentContentType):
+        * loader/DocumentLoader.h:
+        * xml/XMLHttpRequest.cpp:
+        (WebCore::XMLHttpRequest::responseXML):
+        * xml/XSLTProcessor.cpp:
+        (WebCore::XSLTProcessor::createDocumentFromSource):
+
</ins><span class="cx"> 2014-12-16  Anders Carlsson  &lt;andersca@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Put some common code in StorageNamespaceProvider
</span></span></pre></div>
<a id="trunkSourceWebCoredomDocumentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Document.cpp (177365 => 177366)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Document.cpp        2014-12-16 18:39:14 UTC (rev 177365)
+++ trunk/Source/WebCore/dom/Document.cpp        2014-12-16 18:42:43 UTC (rev 177366)
</span><span class="lines">@@ -1376,6 +1376,26 @@
</span><span class="cx">     return String();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void Document::overrideMIMEType(const String&amp; mimeType)
+{
+    m_overriddenMIMEType = mimeType;
+}
+
+String Document::contentType() const
+{
+    if (!m_overriddenMIMEType.isNull())
+        return m_overriddenMIMEType;
+
+    if (DocumentLoader* documentLoader = loader())
+        return documentLoader-&gt;currentContentType();
+
+    String mimeType = suggestedMIMEType();
+    if (!mimeType.isNull())
+        return mimeType;
+
+    return ASCIILiteral(&quot;application/xml&quot;);
+}
+
</ins><span class="cx"> Node* Document::nodeFromPoint(const LayoutPoint&amp; clientPoint, LayoutPoint* localPoint)
</span><span class="cx"> {
</span><span class="cx">     if (!frame() || !view())
</span><span class="lines">@@ -3216,6 +3236,7 @@
</span><span class="cx"> 
</span><span class="cx">     setCompatibilityMode(other.m_compatibilityMode);
</span><span class="cx">     setSecurityOrigin(other.securityOrigin());
</span><ins>+    overrideMIMEType(other.contentType());
</ins><span class="cx">     setDecoder(other.decoder());
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoredomDocumenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Document.h (177365 => 177366)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Document.h        2014-12-16 18:39:14 UTC (rev 177365)
+++ trunk/Source/WebCore/dom/Document.h        2014-12-16 18:42:43 UTC (rev 177366)
</span><span class="lines">@@ -465,6 +465,9 @@
</span><span class="cx"> 
</span><span class="cx">     String suggestedMIMEType() const;
</span><span class="cx"> 
</span><ins>+    void overrideMIMEType(const String&amp;);
+    String contentType() const;
+
</ins><span class="cx">     String contentLanguage() const { return m_contentLanguage; }
</span><span class="cx">     void setContentLanguage(const String&amp;);
</span><span class="cx"> 
</span><span class="lines">@@ -1408,6 +1411,9 @@
</span><span class="cx"> 
</span><span class="cx">     String m_baseTarget;
</span><span class="cx"> 
</span><ins>+    // MIME type of the document in case it was cloned or created by XHR.
+    String m_overriddenMIMEType;
+
</ins><span class="cx">     std::unique_ptr&lt;DOMImplementation&gt; m_implementation;
</span><span class="cx"> 
</span><span class="cx">     RefPtr&lt;CSSStyleSheet&gt; m_elementSheet;
</span></span></pre></div>
<a id="trunkSourceWebCoredomDocumentidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Document.idl (177365 => 177366)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Document.idl        2014-12-16 18:39:14 UTC (rev 177365)
+++ trunk/Source/WebCore/dom/Document.idl        2014-12-16 18:42:43 UTC (rev 177366)
</span><span class="lines">@@ -105,6 +105,8 @@
</span><span class="cx">     [ObjCLegacyUnnamedParameters] CSSStyleDeclaration getOverrideStyle([Default=Undefined] optional Element element,
</span><span class="cx">                                                         [Default=Undefined] optional DOMString pseudoElement);
</span><span class="cx"> 
</span><ins>+    readonly attribute DOMString contentType;
+
</ins><span class="cx">     // DOM Level 3 XPath (XPathEvaluator interface)
</span><span class="cx">     [ObjCLegacyUnnamedParameters, RaisesException] XPathExpression createExpression([Default=Undefined] optional DOMString expression,
</span><span class="cx">                                                     [Default=Undefined] optional XPathNSResolver resolver);
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderDocumentLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/DocumentLoader.cpp (177365 => 177366)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/DocumentLoader.cpp        2014-12-16 18:39:14 UTC (rev 177365)
+++ trunk/Source/WebCore/loader/DocumentLoader.cpp        2014-12-16 18:42:43 UTC (rev 177366)
</span><span class="lines">@@ -1283,6 +1283,11 @@
</span><span class="cx">     return m_response.mimeType();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+const String&amp; DocumentLoader::currentContentType() const
+{
+    return m_writer.mimeType();
+}
+
</ins><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx"> // FIXME: This method seems to violate the encapsulation of this class.
</span><span class="cx"> void DocumentLoader::setResponseMIMEType(const String&amp; responseMimeType)
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderDocumentLoaderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/DocumentLoader.h (177365 => 177366)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/DocumentLoader.h        2014-12-16 18:39:14 UTC (rev 177365)
+++ trunk/Source/WebCore/loader/DocumentLoader.h        2014-12-16 18:42:43 UTC (rev 177366)
</span><span class="lines">@@ -118,7 +118,7 @@
</span><span class="cx">         // FIXME: This method seems to violate the encapsulation of this class.
</span><span class="cx">         WEBCORE_EXPORT void setResponseMIMEType(const String&amp;);
</span><span class="cx"> #endif
</span><del>-
</del><ins>+        const String&amp; currentContentType() const;
</ins><span class="cx">         void replaceRequestURLForSameDocumentNavigation(const URL&amp;);
</span><span class="cx">         bool isStopping() const { return m_isStopping; }
</span><span class="cx">         void stopLoading();
</span></span></pre></div>
<a id="trunkSourceWebCorexmlXMLHttpRequestcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/xml/XMLHttpRequest.cpp (177365 => 177366)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/xml/XMLHttpRequest.cpp        2014-12-16 18:39:14 UTC (rev 177365)
+++ trunk/Source/WebCore/xml/XMLHttpRequest.cpp        2014-12-16 18:42:43 UTC (rev 177366)
</span><span class="lines">@@ -206,7 +206,8 @@
</span><span class="cx">         return nullptr;
</span><span class="cx"> 
</span><span class="cx">     if (!m_createdDocument) {
</span><del>-        bool isHTML = equalIgnoringCase(responseMIMEType(), &quot;text/html&quot;);
</del><ins>+        String mimeType = responseMIMEType();
+        bool isHTML = equalIgnoringCase(mimeType, &quot;text/html&quot;);
</ins><span class="cx"> 
</span><span class="cx">         // The W3C spec requires the final MIME type to be some valid XML type, or text/html.
</span><span class="cx">         // If it is text/html, then the responseType of &quot;document&quot; must have been supplied explicitly.
</span><span class="lines">@@ -222,6 +223,8 @@
</span><span class="cx">             // FIXME: Set Last-Modified.
</span><span class="cx">             m_responseDocument-&gt;setContent(m_responseBuilder.toStringPreserveCapacity());
</span><span class="cx">             m_responseDocument-&gt;setSecurityOrigin(securityOrigin());
</span><ins>+            m_responseDocument-&gt;overrideMIMEType(mimeType);
+
</ins><span class="cx">             if (!m_responseDocument-&gt;wellFormed())
</span><span class="cx">                 m_responseDocument = 0;
</span><span class="cx">         }
</span></span></pre></div>
<a id="trunkSourceWebCorexmlXSLTProcessorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/xml/XSLTProcessor.cpp (177365 => 177366)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/xml/XSLTProcessor.cpp        2014-12-16 18:39:14 UTC (rev 177365)
+++ trunk/Source/WebCore/xml/XSLTProcessor.cpp        2014-12-16 18:42:43 UTC (rev 177366)
</span><span class="lines">@@ -76,7 +76,7 @@
</span><span class="cx"> 
</span><span class="cx">     RefPtr&lt;Document&gt; result;
</span><span class="cx">     if (sourceMIMEType == &quot;text/plain&quot;) {
</span><del>-        result = Document::create(frame, sourceIsDocument ? ownerDocument-&gt;url() : URL());
</del><ins>+        result = Document::createXHTML(frame, sourceIsDocument ? ownerDocument-&gt;url() : URL());
</ins><span class="cx">         transformTextStringToXHTMLDocumentString(documentSource);
</span><span class="cx">     } else
</span><span class="cx">         result = DOMImplementation::createDocument(sourceMIMEType, frame, sourceIsDocument ? ownerDocument-&gt;url() : URL());
</span></span></pre>
</div>
</div>

</body>
</html>