| Index: Source/modules/encoding/TextDecoder.cpp
|
| diff --git a/Source/modules/encoding/TextDecoder.cpp b/Source/modules/encoding/TextDecoder.cpp
|
| index 06bf788e0f7aacde318748d8c796432d20bd9c67..db0be85569a0558e1b83857c5cb7b6340d6e2bd4 100644
|
| --- a/Source/modules/encoding/TextDecoder.cpp
|
| +++ b/Source/modules/encoding/TextDecoder.cpp
|
| @@ -38,9 +38,9 @@
|
|
|
| namespace WebCore {
|
|
|
| -PassRefPtr<TextDecoder> TextDecoder::create(const String& label, const Dictionary& options, ExceptionState& exceptionState)
|
| +PassRefPtr<TextDecoder> TextDecoder::create(const String& utfLabel, const Dictionary& options, ExceptionState& exceptionState)
|
| {
|
| - const String& encodingLabel = label.isNull() ? String("utf-8") : label;
|
| + const String& encodingLabel = utfLabel.isNull() ? String("utf-8") : utfLabel;
|
|
|
| WTF::TextEncoding encoding(encodingLabel);
|
| if (!encoding.isValid()) {
|
| @@ -51,13 +51,12 @@ PassRefPtr<TextDecoder> TextDecoder::create(const String& label, const Dictionar
|
| bool fatal = false;
|
| options.get("fatal", fatal);
|
|
|
| - return adoptRef(new TextDecoder(encoding.name(), fatal));
|
| + return adoptRef(new TextDecoder(encodingLabel, encoding.name(), fatal));
|
| }
|
|
|
| -
|
| -TextDecoder::TextDecoder(const String& encoding, bool fatal)
|
| - : m_encoding(encoding)
|
| - , m_codec(newTextCodec(m_encoding))
|
| +TextDecoder::TextDecoder(const String& label, const String& name, bool fatal)
|
| + : m_encoding(name)
|
| + , m_codec(newTextCodec(label))
|
| , m_fatal(fatal)
|
| , m_bomSeen(false)
|
| {
|
| @@ -69,7 +68,7 @@ TextDecoder::~TextDecoder()
|
|
|
| String TextDecoder::encoding() const
|
| {
|
| - String name = String(m_encoding.name()).lower();
|
| + String name = m_encoding.lower();
|
| // Where possible, encoding aliases should be handled by changes to Chromium's ICU or Blink's WTF.
|
| // The same codec is used, but WTF maintains a different name/identity for these.
|
| if (name == "iso-8859-1" || name == "us-ascii")
|
| @@ -100,8 +99,7 @@ String TextDecoder::decode(ArrayBufferView* input, const Dictionary& options, Ex
|
|
|
| if (!m_bomSeen && !s.isEmpty()) {
|
| m_bomSeen = true;
|
| - String name(m_encoding.name());
|
| - if ((name == "UTF-8" || name == "UTF-16LE" || name == "UTF-16BE") && s[0] == 0xFEFF)
|
| + if ((m_encoding == "UTF-8" || m_encoding == "UTF-16LE" || m_encoding == "UTF-16BE") && s[0] == 0xFEFF)
|
| s.remove(0);
|
| }
|
|
|
|
|