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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « LayoutTests/http/tests/htmlimports/resources/no-encoding.cgi ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 87
88 setState(finishWriting()); 88 setState(finishWriting());
89 } 89 }
90 90
91 HTMLImportLoader::State HTMLImportLoader::startWritingAndParsing(const ResourceR esponse& response) 91 HTMLImportLoader::State HTMLImportLoader::startWritingAndParsing(const ResourceR esponse& response)
92 { 92 {
93 DocumentInit init = DocumentInit(response.url(), 0, m_import->master()->cont extDocument(), m_import) 93 DocumentInit init = DocumentInit(response.url(), 0, m_import->master()->cont extDocument(), m_import)
94 .withRegistrationContext(m_import->master()->registrationContext()); 94 .withRegistrationContext(m_import->master()->registrationContext());
95 m_importedDocument = HTMLDocument::create(init); 95 m_importedDocument = HTMLDocument::create(init);
96 m_importedDocument->initContentSecurityPolicy(ContentSecurityPolicyResponseH eaders(response)); 96 m_importedDocument->initContentSecurityPolicy(ContentSecurityPolicyResponseH eaders(response));
97 m_writer = DocumentWriter::create(m_importedDocument.get(), response.mimeTyp e(), response.textEncodingName()); 97 AtomicString textEncoding = response.textEncodingName();
98 // FIXME: Should we test for more than emptiness here? For example, we could require that the encoding be some valid encoding.
99 if (textEncoding.isEmpty())
100 textEncoding = "UTF-8";
101 m_writer = DocumentWriter::create(m_importedDocument.get(), response.mimeTyp e(), textEncoding);
abarth-chromium 2014/02/24 22:30:27 e.g., just pass "UTF-8" unconditionally here
98 102
99 return StateLoading; 103 return StateLoading;
100 } 104 }
101 105
102 HTMLImportLoader::State HTMLImportLoader::finishWriting() 106 HTMLImportLoader::State HTMLImportLoader::finishWriting()
103 { 107 {
104 return StateWritten; 108 return StateWritten;
105 } 109 }
106 110
107 HTMLImportLoader::State HTMLImportLoader::finishParsing() 111 HTMLImportLoader::State HTMLImportLoader::finishParsing()
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 client->didFinishLoading(); 160 client->didFinishLoading();
157 } 161 }
158 162
159 void HTMLImportLoader::removeClient(HTMLImportLoaderClient* client) 163 void HTMLImportLoader::removeClient(HTMLImportLoaderClient* client)
160 { 164 {
161 ASSERT(kNotFound != m_clients.find(client)); 165 ASSERT(kNotFound != m_clients.find(client));
162 m_clients.remove(m_clients.find(client)); 166 m_clients.remove(m_clients.find(client));
163 } 167 }
164 168
165 } // namespace WebCore 169 } // namespace WebCore
OLDNEW
« 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