Closed
Bug 943270
Opened 11 years ago
Closed 11 years ago
gfxFontUtils should use EncodingUtils::DecoderForEncoding instead of nsICharsetConverterManager::GetUnicodeDecoderRaw
Categories
(Core :: Graphics: Text, defect)
Core
Graphics: Text
Tracking
()
RESOLVED
FIXED
mozilla28
People
(Reporter: hsivonen, Assigned: jfkthame)
References
Details
(Whiteboard: [qa-])
Attachments
(1 file)
EncodingUtils::DecoderForEncoding is a deCOMtaminated replacement for nsICharsetConverterManager::GetUnicodeDecoderRaw. https://mxr.mozilla.org/mozilla-central/source/gfx/thebes/gfxFontUtils.cpp#1306 should use the new method. However, it's not quite a drop-in replacement, because gfxFontUtils sometimes passes in an empty string, but EncodingUtils::DecoderForEncoding only accepts real Gecko-canonical labels. Hence, gfxFontUtils would need to deal with failure to find a Gecko-canonical label on its own first.
Reporter | ||
Comment 1•11 years ago
|
||
For clarity, the new method is from bug 919935 and is on inbound at the moment.
Assignee | ||
Comment 2•11 years ago
|
||
AFAICS, gfxFontUtils::DecodeFontName() *won't* ever pass an empty string to this method. It gets the encoding label from GetCharsetForFontName(), which may indeed return either nullptr or "" in addition to valid labels, but these two "special" values are handled separately without trying to get an actual decoder.
Assignee | ||
Comment 3•11 years ago
|
||
Attachment #8338432 -
Flags: review?(jdaggett)
Assignee | ||
Updated•11 years ago
|
Assignee: nobody → jfkthame
Reporter | ||
Comment 4•11 years ago
|
||
Comment on attachment 8338432 [details] [diff] [review] use EncodingUtils::DecoderForEncoding instead of nsICharsetConverterManager::GetUnicodeDecoderRaw when decoding font names >+ nsCOMPtr<nsIUnicodeDecoder> decoder = >+ mozilla::dom::EncodingUtils::DecoderForEncoding(csName); >+ if (!decoder) { > NS_WARNING("failed to get the decoder for a font name string"); > return false; This should never happen if csName is indeed a Gecko-canonical label, since we have infallible malloc. (DecoderForEncoding MOZ_ASSERTs this.)
Assignee | ||
Comment 5•11 years ago
|
||
I believe the intention is that GetCharsetForFontName() should always return a Gecko-canonical name (or empty/null). Still, I'd be inclined to leave the extra null check here, as a safeguard against possible future changes (e.g. if we switch Gecko to using some other (more standard) naming system, or remove support for certain encodings, etc., and fail to update everything correctly). Some of the possible results from GetCharsetForFontName() are probably very rare, only occurring if a user happens to have an unusual font installed that has specific localized names, so I'm not confident we have unit test coverage that would immediately detect future breakage.
Reporter | ||
Comment 6•11 years ago
|
||
OK.
Updated•11 years ago
|
Attachment #8338432 -
Flags: review?(jdaggett) → review+
Assignee | ||
Comment 7•11 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/068411d02b1b
Target Milestone: --- → mozilla28
Reporter | ||
Comment 8•11 years ago
|
||
Thank you.
Comment 9•11 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/068411d02b1b
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Updated•10 years ago
|
Whiteboard: [qa-]
You need to log in
before you can comment on or make changes to this bug.
Description
•