| Index: Source/modules/encoding/TextDecoder.cpp
|
| diff --git a/Source/modules/encoding/TextDecoder.cpp b/Source/modules/encoding/TextDecoder.cpp
|
| index 2d84eb23c6d9fde95eca54fcb8d33f68a4cca3a1..59e5e2603d55acf79e50a07ef99bdde965994d4b 100644
|
| --- a/Source/modules/encoding/TextDecoder.cpp
|
| +++ b/Source/modules/encoding/TextDecoder.cpp
|
| @@ -54,14 +54,18 @@ TextDecoder* TextDecoder::create(const String& label, const Dictionary& options,
|
| bool fatal = false;
|
| options.get("fatal", fatal);
|
|
|
| - return new TextDecoder(encoding, fatal);
|
| + bool ignoreBOM = false;
|
| + options.get("ignoreBOM", ignoreBOM);
|
| +
|
| + return new TextDecoder(encoding, fatal, ignoreBOM);
|
| }
|
|
|
|
|
| -TextDecoder::TextDecoder(const WTF::TextEncoding& encoding, bool fatal)
|
| +TextDecoder::TextDecoder(const WTF::TextEncoding& encoding, bool fatal, bool ignoreBOM)
|
| : m_encoding(encoding)
|
| , m_codec(newTextCodec(encoding))
|
| , m_fatal(fatal)
|
| + , m_ignoreBOM(ignoreBOM)
|
| , m_bomSeen(false)
|
| {
|
| }
|
| @@ -98,7 +102,7 @@ String TextDecoder::decode(ArrayBufferView* input, const Dictionary& options, Ex
|
| return String();
|
| }
|
|
|
| - if (!m_bomSeen && !s.isEmpty()) {
|
| + if (!m_ignoreBOM && !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)
|
|
|