Bug 216108

Summary: TextDecoder should ignore byte-order-mark like other browsers and spec
Product: WebKit Reporter: Alex Christensen <achristensen>
Component: New BugsAssignee: Alex Christensen <achristensen>
Status: RESOLVED FIXED    
Severity: Normal CC: annevk, cdumez, darin, esprehn+autocc, ews-watchlist, kangil.han, mmaxfield, webkit-bug-importer, ysuzuki
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch darin: review+

Description Alex Christensen 2020-09-02 16:42:26 PDT
TextDecoder should ignore byte-order-mark like other browsers and spec
Comment 1 Alex Christensen 2020-09-02 16:43:01 PDT
Created attachment 407831 [details]
Patch
Comment 2 Alexey Proskuryakov 2020-09-02 18:10:32 PDT
Is this a dupe of bug 169858 or a dupe of bug 203832? Both, I guess.
Comment 3 Alex Christensen 2020-09-02 20:06:55 PDT
*** Bug 169858 has been marked as a duplicate of this bug. ***
Comment 4 Alex Christensen 2020-09-02 20:07:20 PDT
*** Bug 203832 has been marked as a duplicate of this bug. ***
Comment 5 Alex Christensen 2020-09-02 21:19:33 PDT
Created attachment 407864 [details]
Patch
Comment 6 Alex Christensen 2020-09-03 09:37:24 PDT
Comment on attachment 407864 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=407864&action=review

> Source/WebCore/dom/TextDecoder.cpp:72
> +    if (stream && length < bytesNeededForFullBOMIgnoreCheck())
> +        return WaitForMoreBOMBytes::Yes;

I also need to check if the bytes start with what may become a byte order mark here.  If they're other bytes, I need to return WaitForMoreBOMBytes::No
Comment 7 Darin Adler 2020-09-03 09:57:58 PDT
Comment on attachment 407864 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=407864&action=review

>> Source/WebCore/dom/TextDecoder.cpp:72
>> +        return WaitForMoreBOMBytes::Yes;
> 
> I also need to check if the bytes start with what may become a byte order mark here.  If they're other bytes, I need to return WaitForMoreBOMBytes::No

I guess the function would have a name like isBOMPrefix.
Comment 8 Alex Christensen 2020-09-03 09:58:03 PDT
http://trac.webkit.org/r266528
Comment 9 Radar WebKit Bug Importer 2020-09-03 09:59:27 PDT
<rdar://problem/68285403>