Closed Bug 1102679 Opened 5 years ago Closed Last year

Implement ignoreBOM for TextDecoder

Categories

(Core :: DOM: Core & HTML, defect)

x86
macOS
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla63
Tracking Status
firefox63 --- fixed

People

(Reporter: bzbarsky, Assigned: bzbarsky)

References

(Blocks 1 open bug)

Details

Attachments

(2 files)

Spun off from bug 1092737.
Blocks: encoding
Depends on: 634541
Henri, how hard would this be to do?
Flags: needinfo?(hsivonen)
(In reply to Boris Zbarsky [:bz] (no decent commit message means r-) from comment #1)
> Henri, how hard would this be to do?

Should be extremely easy if I understood the spec correctly.

(My understanding is: Our current behavior of always dropping the BOM should become the behavior that takes place is ignoreBOM is true and when ignoreBOM is false, we shouldn't remove the BOM. To not remove the BOM, we should instantiate the mozilla::Decoder using the WithoutBOMHandling variant of the factory methods instead of the WithBOMRemoval factory method right about here: https://searchfox.org/mozilla-central/source/dom/encoding/TextDecoder.cpp#45 )
Flags: needinfo?(hsivonen)
Assignee: nobody → bzbarsky
Status: NEW → ASSIGNED
When ignoreBOM is true, the encoding spec says to not treat leading DOM bytes
specially, which corresponds to our NewDecoderWithoutBOMHandling factory method
for the encoder.
Attachment #8998011 - Flags: review?(hsivonen)
Comment on attachment 8998011 [details] [diff] [review]
part 2.  Implement support for the ignoreBOM option for TextDecoder

Review of attachment 8998011 [details] [diff] [review]:
-----------------------------------------------------------------

Thank you!
Attachment #8998011 - Flags: review?(hsivonen) → review+
Attachment #8998010 - Flags: review?(hsivonen) → review+
Pushed by bzbarsky@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/6bf52b9a4c93
part 1.  Pass around the TextDecoderOptions as needed, not just one boolean from it.  r=hsivonen
https://hg.mozilla.org/integration/mozilla-inbound/rev/4b78b0c012ad
part 2.  Implement support for the ignoreBOM option for TextDecoder.  r=hsivonen
Pushed by bzbarsky@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/686d11ab65e4
followup.  Restore failure annotation that should not have been removed.  r=bzbarsky
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.