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

Unified Diff: Source/core/html/imports/HTMLImportLoader.cpp

Issue 178883002: Set encoding to UTF-8 for HTML Imports if no encoding is specified in the HTTP response (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 10 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 | « LayoutTests/http/tests/htmlimports/resources/no-encoding.cgi ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/imports/HTMLImportLoader.cpp
diff --git a/Source/core/html/imports/HTMLImportLoader.cpp b/Source/core/html/imports/HTMLImportLoader.cpp
index 4349ebb33cc5a84fb826ba364aebb4a20325c03b..9ef09bead4296cd5dde7a3fea6e098d78014c7ff 100644
--- a/Source/core/html/imports/HTMLImportLoader.cpp
+++ b/Source/core/html/imports/HTMLImportLoader.cpp
@@ -94,7 +94,11 @@ HTMLImportLoader::State HTMLImportLoader::startWritingAndParsing(const ResourceR
.withRegistrationContext(m_import->master()->registrationContext());
m_importedDocument = HTMLDocument::create(init);
m_importedDocument->initContentSecurityPolicy(ContentSecurityPolicyResponseHeaders(response));
- m_writer = DocumentWriter::create(m_importedDocument.get(), response.mimeType(), response.textEncodingName());
+ AtomicString textEncoding = response.textEncodingName();
+ // FIXME: Should we test for more than emptiness here? For example, we could require that the encoding be some valid encoding.
+ if (textEncoding.isEmpty())
+ textEncoding = "UTF-8";
+ m_writer = DocumentWriter::create(m_importedDocument.get(), response.mimeType(), textEncoding);
abarth-chromium 2014/02/24 22:30:27 e.g., just pass "UTF-8" unconditionally here
return StateLoading;
}
« no previous file with comments | « LayoutTests/http/tests/htmlimports/resources/no-encoding.cgi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698