Opened 3 years ago

Last modified 3 years ago

#17785 new defect

Unit tests for font whitelisting patch

Reported by: arthuredelstein Owned by: tbb-team
Priority: Medium Milestone:
Component: Applications/Tor Browser Version:
Severity: Normal Keywords:
Cc: Actual Points:
Parent ID: #18097 Points:
Reviewer: Sponsor:

Description

We need unit tests for the font whitelisting patch (#13313).

Child Tickets

Change History (7)

comment:1 Changed 3 years ago by arthuredelstein

Cases tested should include:

  • font-family in CSS
  • canvas fillText()
  • src: local() in @font-face

comment:2 Changed 3 years ago by arthuredelstein

Parent ID: 18097

comment:3 Changed 3 years ago by arthuredelstein

Parent ID: 18097#18097

comment:4 Changed 3 years ago by arthuredelstein

At present, the font.system.whitelist pref is static, so we can't easily write a mochitest. But I have written a manual test for enumerating available fonts. It can be tried here:
https://arthuredelstein.github.io/tordemos/enumerate-fonts.html

I'll report results for this test tomorrow on various platforms tomorrow.

comment:5 Changed 3 years ago by arthuredelstein

Here are the detected fonts for OS X 10.9.5, using 5.5a6.

    AppleGothic
    Arial
    Courier
    Geneva
    Georgia
    Heiti TC
    Helvetica
    Helvetica Neue
    Hiragino Kaku Gothic ProN
    Lucida Grande
    Monaco
    Noto Sans Armenian
    Noto Sans Bengali
    Noto Sans Canadian Aboriginal
    Noto Sans Cherokee
    Noto Sans Devanagari
    Noto Sans Ethiopic
    Noto Sans Gujarati
    Noto Sans Gurmukhi
    Noto Sans Kannada
    Noto Sans Khmer
    Noto Sans Lao
    Noto Sans Malayalam
    Noto Sans Mongolian
    Noto Sans Myanmar
    Noto Sans Oriya
    Noto Sans Sinhala
    Noto Sans Tamil
    Noto Sans Telugu
    Noto Sans Thaana
    Noto Sans Tibetan
    Noto Sans Yi
    STHeiti
    STIX Math
    Tahoma
    Thonburi
    Times
    Times New Roman
    Verdana
    ヒラギノ角ゴ ProN W3
    ヒラギノ角ゴ ProN W6
    华文黑体

This matches the whitelist:

AppleGothic, Arial, Courier, Geneva, Georgia, Heiti TC, Helvetica, Helvetica Neue, .Helvetica Neue DeskInterface, Hiragino Kaku Gothic ProN, Lucida Grande, Monaco, Noto Sans Armenian, Noto Sans Bengali, Noto Sans Canadian Aboriginal, Noto Sans Cherokee, Noto Sans Devanagari, Noto Sans Ethiopic, Noto Sans Gujarati, Noto Sans Gurmukhi, Noto Sans Kannada, Noto Sans Khmer, Noto Sans Lao, Noto Sans Malayalam, Noto Sans Mongolian, Noto Sans Myanmar, Noto Sans Oriya, Noto Sans Sinhala, Noto Sans Tamil, Noto Sans Telugu, Noto Sans Thaana, Noto Sans Tibetan, Noto Sans Yi, STHeiti, STIX Math, Tahoma, Thonburi, Times, Times New Roman, Verdana

Note that .Helvetica Neue DeskInterface is in the whitelist but not present in this version of OS X. Also, the detected ヒラギノ角ゴ ProN W3 and ヒラギノ角ゴ ProN W6 are alternate names for Hiragino Kaku Gothic ProN and 华文黑体 is another name for STHeiti.

comment:6 Changed 3 years ago by arthuredelstein

Here is the result for TBB5.5a6 on Windows 7:

    Arial
    Batang
    Cambria Math
    Courier
    Courier New
    Euphemia
    Gautami
    Georgia
    Gulim
    GulimChe
    Helvetica
    Iskoola Pota
    Kalinga
    Kartika
    Latha
    Lucida Console
    MS Gothic
    MS Mincho
    MS PGothic
    MS PMincho
    MV Boli
    Malgun Gothic
    Mangal
    Meiryo
    Meiryo UI
    Microsoft Himalaya
    Microsoft JhengHei
    Microsoft YaHei
    MingLiU
    Noto Sans Buginese
    Noto Sans Khmer
    Noto Sans Lao
    Noto Sans Myanmar
    Noto Sans Yi
    Nyala
    PMingLiU
    Plantagenet Cherokee
    Raavi
    Segoe UI
    Shruti
    SimSun
    Sylfaen
    Tahoma
    Times
    Times New Roman
    Tunga
    Verdana
    Vrinda
    宋体
    微软雅黑
    新細明體
    細明體
    굴림
    굴림체
    바탕
    MS ゴシック
    MS 明朝
    MS Pゴシック

This matches the whitelist:

Arial, Batang, 바탕, Cambria Math, Courier New, Euphemia, Gautami, Georgia, Gulim, 굴림, GulimChe, 굴림체, Iskoola Pota, Kalinga, Kartika, Latha, Lucida Console, MS Gothic, MS ゴシック, MS Mincho, MS 明朝, MS PGothic, MS Pゴシック, MS PMincho, MS P明朝, MV Boli, Malgun Gothic, Mangal, Meiryo, Meiryo UI, Microsoft Himalaya, Microsoft JhengHei, Microsoft YaHei, 微软雅黑, MingLiU, 細明體, Noto Sans Buginese, Noto Sans Khmer, Noto Sans Lao, Noto Sans Myanmar, Noto Sans Yi, Nyala, PMingLiU, 新細明體, Plantagenet Cherokee, Raavi, Segoe UI, Shruti, SimSun, 宋体, Sylfaen, Tahoma, Times New Roman, Tunga, Verdana, Vrinda, Yu Gothic UI

Two exceptions are Helvetica and Courier, which are "detected" because they appear to be automatically substituted with Arial and Courier New, respectively. Yu Gothic UI is not present on the system tested.

comment:7 Changed 3 years ago by arthuredelstein

And here are the fonts detected on Ubuntu:

    Arimo
    Cousine
    Noto Naskh Arabic
    Noto Sans Armenian
    Noto Sans Bengali
    Noto Sans Buginese
    Noto Sans CJK SC Regular
    Noto Sans Canadian Aboriginal
    Noto Sans Cherokee
    Noto Sans Devanagari
    Noto Sans Ethiopic
    Noto Sans Georgian
    Noto Sans Gujarati
    Noto Sans Gurmukhi
    Noto Sans Hebrew
    Noto Sans Kannada
    Noto Sans Khmer
    Noto Sans Lao
    Noto Sans Malayalam
    Noto Sans Mongolian
    Noto Sans Myanmar
    Noto Sans Oriya
    Noto Sans Sinhala
    Noto Sans Tamil
    Noto Sans Telugu
    Noto Sans Thaana
    Noto Sans Thai
    Noto Sans Tibetan
    Noto Sans Yi
    Noto Serif Armenian
    Noto Serif Khmer
    Noto Serif Lao
    Noto Serif Thai
    STIX Math
    Tinos

These match the fonts that are bundled with TBB:

Arimo-BoldItalic.ttf
Arimo-Bold.ttf
Arimo-Italic.ttf
Arimo-Regular.ttf
Cousine-Regular.ttf
NotoNaskhArabic-Regular.ttf
NotoSansArmenian-Regular.ttf
NotoSansBengali-Regular.ttf
NotoSansBuginese-Regular.ttf
NotoSansCanadianAboriginal-Regular.ttf
NotoSansCherokee-Regular.ttf
NotoSansCJKsc-Regular.otf
NotoSansDevanagari-Regular.ttf
NotoSansEthiopic-Regular.ttf
NotoSansGeorgian-Regular.ttf
NotoSansGujarati-Regular.ttf
NotoSansGurmukhi-Regular.ttf
NotoSansHebrew-Regular.ttf
NotoSansKannada-Regular.ttf
NotoSansKhmer-Regular.ttf
NotoSansLao-Regular.ttf
NotoSansMalayalam-Regular.ttf
NotoSansMongolian-Regular.ttf
NotoSansMyanmar-Regular.ttf
NotoSansOriya-Regular.ttf
NotoSansSinhala-Regular.ttf
NotoSansTamil-Regular.ttf
NotoSansTelugu-Regular.ttf
NotoSansThaana-Regular.ttf
NotoSansThai-Regular.ttf
NotoSansTibetan-Regular.ttf
NotoSansYi-Regular.ttf
NotoSerifArmenian-Regular.ttf
NotoSerifKhmer-Regular.ttf
NotoSerifLao-Regular.ttf
NotoSerifThai-Regular.ttf
STIXMath-Regular.otf
Tinos-BoldItalic.ttf
Tinos-Bold.ttf
Tinos-Italic.ttf
Tinos-Regular.ttf
Note: See TracTickets for help on using tickets.