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

Unified Diff: Source/modules/encoding/TextDecoder.cpp

Issue 1071283004: Encoding API: ignore leading/trailing whitespace in labels (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 8 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 | « Source/modules/encoding/Encoding.cpp ('k') | Source/modules/encoding/TextEncoder.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/encoding/TextDecoder.cpp
diff --git a/Source/modules/encoding/TextDecoder.cpp b/Source/modules/encoding/TextDecoder.cpp
index b4230ef94675cbfcc17f079b03b6c86e247621aa..9d58adced3fdf7a56f02aa82ea080a085492e0d4 100644
--- a/Source/modules/encoding/TextDecoder.cpp
+++ b/Source/modules/encoding/TextDecoder.cpp
@@ -35,6 +35,7 @@
#include "core/dom/DOMArrayBuffer.h"
#include "core/dom/DOMArrayBufferView.h"
#include "core/dom/ExceptionCode.h"
+#include "modules/encoding/Encoding.h"
#include "wtf/StringExtras.h"
#include "wtf/text/TextEncodingRegistry.h"
@@ -42,7 +43,7 @@ namespace blink {
TextDecoder* TextDecoder::create(const String& label, const TextDecoderOptions& options, ExceptionState& exceptionState)
{
- WTF::TextEncoding encoding(label);
+ WTF::TextEncoding encoding(label.stripWhiteSpace(&Encoding::isASCIIWhiteSpace));
// The replacement encoding is not valid, but the Encoding API also
// rejects aliases of the replacement encoding.
if (!encoding.isValid() || !strcasecmp(encoding.name(), "replacement")) {
« no previous file with comments | « Source/modules/encoding/Encoding.cpp ('k') | Source/modules/encoding/TextEncoder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698