<!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 <tmeszaros.u-szeged@partner.samsung.com> 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 <tmeszaros.u-szeged@partner.samsung.com>
+
+ 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 <ap@apple.com>
</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 "Document"
</span><span class="cx"> PASS doc.cloneNode(true).documentElement.localName is "root"
</span><ins>+PASS doc.cloneNode(true).contentType is "application/xml"
</ins><span class="cx"> PASS document.cloneNode(true).compatMode is "CSS1Compat"
</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 "text/html"
</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"> </script>
</span><span class="cx"> <script src="../../../resources/js-test-post.js"></script>
</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 "HTMLDocument"
</span><span class="cx"> PASS document.cloneNode(true).title is document.title
</span><span class="cx"> PASS document.cloneNode(true).compatMode is "BackCompat"
</span><ins>+PASS document.cloneNode(true).contentType is "text/html"
</ins><span class="cx"> PASS doc.cloneNode(false).__proto__ is HTMLDocument.prototype
</span><span class="cx"> PASS className(doc.cloneNode(false)) is "HTMLDocument"
</span><span class="cx"> PASS doc.cloneNode(true).title is doc.title
</span><span class="cx"> PASS doc.cloneNode(true).compatMode is "CSS1Compat"
</span><ins>+PASS doc.cloneNode(true).contentType is "text/html"
</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"> </script>
</span><span class="cx"> <script src="../../../resources/js-test-post.js"></script>
</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, "text/html").contentType is "text/html"
+PASS new DOMParser().parseFromString(xmlContent, "application/xml").contentType is "application/xml"
+PASS new DOMParser().parseFromString(xhtmlContent, "application/xhtml+xml").contentType is "application/xhtml+xml"
+PASS new DOMParser().parseFromString(svgImageContent, "image/svg+xml").contentType is "image/svg+xml"
+PASS new DOMParser().parseFromString(xslContent, "text/xsl").contentType threw exception TypeError: Type error.
+PASS new DOMParser().parseFromString(xmlContent, "text/dummy+xml").contentType threw exception TypeError: Type error.
+PASS new DOMParser().parseFromString(xmlContent, "text/XML").contentType threw exception TypeError: Type error.
+PASS new DOMParser().parseFromString(htmlContent, "TEXT/html").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>+<!DOCTYPE html>
+<head>
+ <title>document.contentType</title>
+ <link rel="help" href="http://dom.spec.whatwg.org/#dom-document-contenttype">
+ <script src="../../resources/js-test-pre.js"></script>
+</head>
+<body>
+ <script>
+
+var htmlContent =
+ "<html>" +
+ "<head>" +
+ "<noscript>" +
+ "Scripts must be disabled for the document created using DOMParser.parseFromString()" +
+ "</noscript>" +
+ "</head>" +
+ "<body>" +
+ "<div id='text'>Sample text content</div>" +
+ "<script>document.getElementById('text').textContent = 'Modified text content';<\/script>" +
+ "</body>" +
+ "</html>";
+
+var xmlContent =
+ "<root>" +
+ "</root>";
+
+
+var xhtmlContent =
+ "<!DOCTYPE html>" +
+ "<html xmlns=\"http://www.w3.org/1999/xhtml\">" +
+ "<head>" +
+ "<title>Title of document</title>" +
+ "<noscript>" +
+ "Scripts must be disabled for the document created using DOMParser.parseFromString()" +
+ "</noscript>" +
+ "</head>" +
+ "<body>" +
+ "<div id='text'></div>" +
+ "<script>document.getElementById('text').textContent = 'Newly added text';<\/script>" +
+ "</body>" +
+ "</html>";
+
+var svgImageContent =
+ "<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\">" +
+ "<circle cx=\"100\" cy=\"50\" r=\"40\" stroke=\"black\" stroke-width=\"2\" fill=\"red\"/>" +
+ "</svg>";
+
+var xslContent =
+ "<?xml version=\"1.0\"?>" +
+ "<xsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\">" +
+ "<xsl:template match=\"/\">" +
+ "<html>" +
+ "<head>" +
+ "<title>XML XSL Example</title>" +
+ "<style type=\"text/css\">" +
+ "body" +
+ "{" +
+ "background-color:red;" +
+ "}" +
+ "</style>" +
+ "</head>" +
+ "<body>" +
+ "<xsl:apply-templates/>" +
+ "</body>" +
+ "</html>" +
+ "</xsl:template>" +
+ "" +
+ "<xsl:template match=\"tutorial\">" +
+ "<span><xsl:value-of select=\"name\"/></span>" +
+ "<span><xsl:value-of select=\"url\"/></span>" +
+ "</xsl:template>" +
+ "</xsl:stylesheet>";
+
+shouldBeEqualToString('new DOMParser().parseFromString(htmlContent, "text/html").contentType', 'text/html');
+shouldBeEqualToString('new DOMParser().parseFromString(xmlContent, "application/xml").contentType', 'application/xml');
+shouldBeEqualToString('new DOMParser().parseFromString(xhtmlContent, "application/xhtml+xml").contentType', 'application/xhtml+xml');
+shouldBeEqualToString('new DOMParser().parseFromString(svgImageContent, "image/svg+xml").contentType', 'image/svg+xml');
+shouldThrow('new DOMParser().parseFromString(xslContent, "text/xsl").contentType', "'TypeError: Type error'");
+shouldThrow('new DOMParser().parseFromString(xmlContent, "text/dummy+xml").contentType', "'TypeError: Type error'");
+shouldThrow('new DOMParser().parseFromString(xmlContent, "text/XML").contentType', "'TypeError: Type error'");
+shouldThrow('new DOMParser().parseFromString(htmlContent, "TEXT/html").contentType', "'TypeError: Type error'");
+
+</script>
+<script src="../../resources/js-test-post.js"></script>
+</body>
</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 "text/html"
+PASS doc.contentType is "application/xml"
+PASS doc.contentType is "application/xml"
+PASS doc.contentType is "image/svg+xml"
+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>+<!DOCTYPE html>
+<title>document.contentType</title>
+<link rel="help" href="http://dom.spec.whatwg.org/#dom-document-contenttype">
+<script src="../../resources/js-test.js"></script>
+<body>
+<script>
+var doc = document.implementation.createHTMLDocument('f');
+shouldBe('doc.contentType', '"text/html"');
+
+doc = document.implementation.createDocument(null, 'root', null);
+shouldBe('doc.contentType', '"application/xml"');
+
+var foo = document.implementation.createDocumentType("foobar", "", "");
+doc = document.implementation.createDocument(null, null, foo);
+shouldBe('doc.contentType', '"application/xml"');
+
+doc = document.implementation.createDocument('http://www.w3.org/2000/svg', 'svg:svg', null);
+shouldBe('doc.contentType', '"image/svg+xml"');
+</script>
</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 "application/xml" is "application/xml"
+PASS "image/svg+xml" is "image/svg+xml"
+PASS "text/html" is "text/html"
+PASS "text/xml" is "text/xml"
+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>+<!DOCTYPE html>
+<title>document.contentType</title>
+<link rel="help" href="http://dom.spec.whatwg.org/#dom-document-contenttype">
+<script src="../../resources/js-test.js"></script>
+<body>
+<p>
+<iframe data-mimetype="text/html"></iframe>
+<iframe data-mimetype="text/xml"></iframe>
+<iframe data-mimetype="application/xml"></iframe>
+<iframe data-mimetype="image/svg+xml"></iframe>
+</p>
+<script>
+window.jsTestIsAsync = true;
+var tests = new Array();
+
+window.onmessage = function(e) {
+ if (e.data)
+ tests[--expectedMessagesCount]=e.data;
+ else
+ testFailed("Null message payload");
+
+ if (expectedMessagesCount == 0) {
+ runTests();
+ finishJSTest();
+ }
+};
+
+function runTests(){
+ tests.sort(function(a,b){
+ if (a.obtained > b.obtained)
+ return -1;
+ if (a.obtained < b.obtained)
+ return 1;
+ return 0;
+ });
+
+ for (var i = tests.length - 1; i >= 0; i--) {
+ shouldBe('"' + tests[i].obtained + '"', '"' + tests[i].expected + '"');
+ };
+}
+
+var documentContents = '<script xmlns="http://www.w3.org/1999/xhtml">' +
+ 'parent.postMessage(' +
+ '{obtained: document.contentType, expected: "{0}"}, "*");' +
+ '<' + '/script>';
+
+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;
+
+</script>
+</body>
</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 "text/html"
+PASS doc.contentType is "application/xml"
+PASS doc.contentType is "application/xhtml+xml"
+PASS doc.contentType is "application/xml"
+PASS doc.contentType is "application/xml"
+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>+<!DOCTYPE html>
+<head>
+        <script src="../../resources/js-test-pre.js"></script>
+</head>
+<body >
+        <script>
+ if (window.testRunner)
+ testRunner.dumpAsText();
+
+ var xsltp = new XSLTProcessor();
+ var doc;
+
+ function test(method) {
+         try {
+                 var xml = '<?xml version="1.0" encoding="UTF-8"?>';
+         var style = '<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> \
+ <xsl:output indent="yes" method="'+method+'"/> \
+ </xsl:stylesheet>';
+
+ var xmlDoc = new DOMParser().parseFromString(xml, "text/xml");
+ var xslDoc = new DOMParser().parseFromString(style, "text/xml");
+
+ xsltp.importStylesheet(xslDoc);
+ doc = xsltp.transformToDocument(xmlDoc);
+
+ xsltp.reset();
+ } catch(e) {
+ document.write("Exception: " + e);
+ }
+ }
+
+ function runTests() {
+ test('html');
+ shouldBe('doc.contentType','"text/html"');
+
+ test('xml');
+ shouldBe('doc.contentType','"application/xml"');
+
+ test('text');
+ shouldBe('doc.contentType','"application/xhtml+xml"');
+
+ test('foo');
+ shouldBe('doc.contentType','"application/xml"');
+
+ test('xhtml/foo');
+ shouldBe('doc.contentType','"application/xml"');
+ }
+
+ runTests();
+ </script>
+</body>
+<script src="../../resources/js-test-post.js"></script>
+</html>
</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 "text/css"
+PASS iframes[0].contentDocument.cloneNode(false).contentType is "text/css"
+PASS iframes[1].contentDocument.contentType is "application/x-javascript"
+PASS iframes[1].contentDocument.cloneNode(false).contentType is "application/x-javascript"
+PASS iframes[2].contentDocument.contentType is "text/html"
+PASS iframes[2].contentDocument.cloneNode(false).contentType is "text/html"
+PASS iframes[3].contentDocument.contentType is "text/html"
+PASS iframes[3].contentDocument.cloneNode(false).contentType is "text/html"
+PASS iframes[4].contentDocument.contentType is "text/xml"
+PASS iframes[4].contentDocument.cloneNode(false).contentType is "text/xml"
+PASS iframes[5].contentDocument.contentType is "text/xml"
+PASS iframes[5].contentDocument.cloneNode(false).contentType is "text/xml"
+PASS iframes[6].contentDocument.contentType is "text/html"
+PASS iframes[6].contentDocument.cloneNode(false).contentType is "text/html"
+PASS iframes[7].contentDocument.contentType is "text/html"
+PASS iframes[7].contentDocument.cloneNode(false).contentType is "text/html"
+PASS iframes[8].contentDocument.contentType is "text/plain"
+PASS iframes[8].contentDocument.cloneNode(false).contentType is "text/plain"
+PASS iframes[9].contentDocument.contentType is "application/xml"
+PASS iframes[9].contentDocument.cloneNode(false).contentType is "application/xml"
+PASS iframes[10].contentDocument.contentType is "image/bmp"
+PASS iframes[10].contentDocument.cloneNode(false).contentType is "image/bmp"
+PASS iframes[11].contentDocument.contentType is "image/gif"
+PASS iframes[11].contentDocument.cloneNode(false).contentType is "image/gif"
+PASS iframes[12].contentDocument.contentType is "image/jpeg"
+PASS iframes[12].contentDocument.cloneNode(false).contentType is "image/jpeg"
+PASS iframes[13].contentDocument.contentType is "image/png"
+PASS iframes[13].contentDocument.cloneNode(false).contentType is "image/png"
+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("META")[0].content is "text/xml"
+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>+<!DOCTYPE html>
+<head>
+ <title>document.contentType</title>
+ <link rel="help" href="http://dom.spec.whatwg.org/#dom-document-contenttype">
+ <meta http-equiv="content-type" content="text/xml">
+ <script src="/js-test-resources/js-test-pre.js"></script>
+</head>
+<body>
+ <script>
+ shouldBeEqualToString('document.getElementsByTagName("META")[0].content', 'text/xml');
+ </script>
+ <script src="/js-test-resources/js-test-post.js"></script>
+</body>
</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 "text/html"
+PASS xhr.status is 200
+PASS xhr.responseXML.contentType is "text/xml"
+PASS xhr.status is 200
+PASS xhr.responseXML.contentType is "application/xml"
+PASS xhr.status is 200
+PASS xhr.responseXML.contentType is "text/html"
+PASS xhr.status is 200
+PASS xhr.responseXML.contentType is "text/xml"
+PASS xhr.status is 200
+PASS xhr.responseXML.contentType is "application/xml"
+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>+<!DOCTYPE html>
+<title>document.contentType</title>
+<link rel="help" href="http://dom.spec.whatwg.org/#dom-document-contenttype">
+<script src="/js-test-resources/js-test.js"></script>
+<script>
+window.jsTestIsAsync = true;
+
+if (window.testRunner) {
+ testRunner.waitUntilDone();
+}
+
+var toTest = [
+ { mimeType: "text/html", uri: "resources/send-mime-type.php?m=text/html" },
+ { mimeType: "text/xml", uri: "resources/send-mime-type.php?m=text/xml" },
+ { mimeType: "application/xml", uri: "resources/send-mime-type.php?m=application/xml" },
+ { mimeType: "text/html", uri: "resources/send-mime-type.php?m=text/html;charset=utf-8" },
+ { mimeType: "text/xml", uri: "resources/send-mime-type.php?m=text/xml;charset=utf-8" },
+ { mimeType: "application/xml", uri: "resources/send-mime-type.php?m=application/xml;charset=utf-8" }
+];
+
+function onrequestload(expectedMimeType) {
+ shouldBeEqualToNumber('xhr.status', 200);
+
+ if (xhr.responseXML)
+ shouldBeEqualToString('xhr.responseXML.contentType', expectedMimeType);
+ else
+ testFailed("Null document for mime-type " + 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();
+ }
+}
+</script>
+
+<body onload="stepTest();">
+</body>
</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>+<!DOCTYPE html>
+<title>document.contentType</title>
+<link rel="help" href="http://dom.spec.whatwg.org/#dom-document-contenttype">
+<script src="/js-test-resources/js-test-pre.js"></script>
+<body>
+<p>
+<iframe data-mimetype="text/css" src="resources/dummy.css"></iframe>
+<iframe data-mimetype="application/x-javascript" src="resources/dummy.js"></iframe>
+<iframe data-mimetype="text/html" src="resources/dummy.html"></iframe>
+<iframe data-mimetype="text/html" src="resources/send-mime-type.php"></iframe>
+<iframe data-mimetype="text/xml" src="resources/send-mime-type.php?m=text/xml"></iframe>
+<iframe data-mimetype="text/xml" src="resources/send-mime-type.php?m=text/xml;charset=utf-8"></iframe>
+<iframe data-mimetype="text/html" src="javascript:&quot;hello world&quot;;"></iframe>
+<iframe data-mimetype="text/html" src="about:blank"></iframe>
+<iframe data-mimetype="text/plain" src="resources/dummy.txt"></iframe>
+<iframe data-mimetype="application/xml" src="resources/dummy.xml"></iframe>
+<iframe data-mimetype="image/bmp" src="resources/square20.bmp"></iframe>
+<iframe data-mimetype="image/gif" src="resources/square20.gif"></iframe>
+<iframe data-mimetype="image/jpeg" src="resources/square20.jpg"></iframe>
+<iframe data-mimetype="image/png" src="resources/square20.png"></iframe>
+</p>
+<script>
+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();
+};
+</script>
+<body>
</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>+<!DOCTYPE html>
+<body>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>+<?xml version="1.0" encoding="utf-8"?>
+<root>Text.me</root>
</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>+<?php
+header("HTTP/1.1 200 OK");
+if (isset($_GET['m']) && $_GET['m'] != "")
+        header("Content-Type: " . $_GET['m']);
+echo "<h1>Hello</h1>"
+?>
</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\xB0BGRs\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF
\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF
\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\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 !== "string" || typeof b !== "number")
+ debug("WARN: shouldBeEqualToNumber() expects a string and a number arguments");
+ var unevaledString = JSON.stringify(b);
+ shouldBe(a, unevaledString);
+}
+
</ins><span class="cx"> function shouldBeEmptyString(a) { shouldBeEqualToString(a, ""); }
</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 <tmeszaros.u-szeged@partner.samsung.com>
+
+ 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 <andersca@apple.com>
</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& mimeType)
+{
+ m_overriddenMIMEType = mimeType;
+}
+
+String Document::contentType() const
+{
+ if (!m_overriddenMIMEType.isNull())
+ return m_overriddenMIMEType;
+
+ if (DocumentLoader* documentLoader = loader())
+ return documentLoader->currentContentType();
+
+ String mimeType = suggestedMIMEType();
+ if (!mimeType.isNull())
+ return mimeType;
+
+ return ASCIILiteral("application/xml");
+}
+
</ins><span class="cx"> Node* Document::nodeFromPoint(const LayoutPoint& 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&);
+ String contentType() const;
+
</ins><span class="cx"> String contentLanguage() const { return m_contentLanguage; }
</span><span class="cx"> void setContentLanguage(const String&);
</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<DOMImplementation> m_implementation;
</span><span class="cx">
</span><span class="cx"> RefPtr<CSSStyleSheet> 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& 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& 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&);
</span><span class="cx"> #endif
</span><del>-
</del><ins>+ const String& currentContentType() const;
</ins><span class="cx"> void replaceRequestURLForSameDocumentNavigation(const URL&);
</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(), "text/html");
</del><ins>+ String mimeType = responseMIMEType();
+ bool isHTML = equalIgnoringCase(mimeType, "text/html");
</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 "document" 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->setContent(m_responseBuilder.toStringPreserveCapacity());
</span><span class="cx"> m_responseDocument->setSecurityOrigin(securityOrigin());
</span><ins>+ m_responseDocument->overrideMIMEType(mimeType);
+
</ins><span class="cx"> if (!m_responseDocument->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<Document> result;
</span><span class="cx"> if (sourceMIMEType == "text/plain") {
</span><del>- result = Document::create(frame, sourceIsDocument ? ownerDocument->url() : URL());
</del><ins>+ result = Document::createXHTML(frame, sourceIsDocument ? ownerDocument->url() : URL());
</ins><span class="cx"> transformTextStringToXHTMLDocumentString(documentSource);
</span><span class="cx"> } else
</span><span class="cx"> result = DOMImplementation::createDocument(sourceMIMEType, frame, sourceIsDocument ? ownerDocument->url() : URL());
</span></span></pre>
</div>
</div>
</body>
</html>