Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(657)

Unified Diff: third_party/WebKit/Source/core/loader/TextResourceDecoderBuilder.cpp

Issue 2320433002: Disable autodetection for XML documents (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/TestExpectations ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/loader/TextResourceDecoderBuilder.cpp
diff --git a/third_party/WebKit/Source/core/loader/TextResourceDecoderBuilder.cpp b/third_party/WebKit/Source/core/loader/TextResourceDecoderBuilder.cpp
index bd0a0113396b685961780b39e4fa091d37636680..85946eddd0c63c0a31637bfda22ebca9f325042e 100644
--- a/third_party/WebKit/Source/core/loader/TextResourceDecoderBuilder.cpp
+++ b/third_party/WebKit/Source/core/loader/TextResourceDecoderBuilder.cpp
@@ -30,6 +30,7 @@
#include "core/loader/TextResourceDecoderBuilder.h"
+#include "core/dom/DOMImplementation.h"
#include "core/dom/Document.h"
#include "core/frame/LocalFrame.h"
#include "core/frame/Settings.h"
@@ -133,8 +134,10 @@ inline std::unique_ptr<TextResourceDecoder> TextResourceDecoderBuilder::createDe
{
const WTF::TextEncoding encodingFromDomain = getEncodingFromDomain(document->url());
if (LocalFrame* frame = document->frame()) {
- if (Settings* settings = frame->settings())
- return TextResourceDecoder::create(m_mimeType, encodingFromDomain.isValid() ? encodingFromDomain : settings->defaultTextEncodingName(), true);
+ if (Settings* settings = frame->settings()) {
+ // Disable autodetection for XML to honor the default encoding (UTF-8) for unlabelled documents.
+ return TextResourceDecoder::create(m_mimeType, encodingFromDomain.isValid() ? encodingFromDomain : settings->defaultTextEncodingName(), !DOMImplementation::isXMLMIMEType(m_mimeType));
+ }
}
return TextResourceDecoder::create(m_mimeType, encodingFromDomain);
« no previous file with comments | « third_party/WebKit/LayoutTests/TestExpectations ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698