Bug 1408782 - Force punycode display for IDNs with a <dotless-i, combining mark above> sequence. r=valentin

This commit is contained in:
Jonathan Kew 2017-10-16 10:19:52 +01:00
Родитель f7a833d4c3
Коммит 290894f3c9
2 изменённых файлов: 16 добавлений и 0 удалений

Просмотреть файл

@ -750,6 +750,7 @@ bool nsIDNService::isLabelSafe(const nsAString &label)
Script lastScript = Script::INVALID;
uint32_t previousChar = 0;
uint32_t baseChar = 0; // last non-diacritic seen (base char for marks)
uint32_t savedNumberingSystem = 0;
// Simplified/Traditional Chinese check temporarily disabled -- bug 857481
#if 0
@ -830,6 +831,14 @@ bool nsIDNService::isLabelSafe(const nsAString &label)
}
}
}
// Check for diacritics on dotless-i, which would be indistinguishable
// from normal accented letter i.
if (baseChar == 0x0131 &&
((ch >= 0x0300 && ch <= 0x0314) || ch == 0x031a)) {
return false;
}
} else {
baseChar = ch;
}
if (script != Script::COMMON && script != Script::INHERITED) {

Просмотреть файл

@ -303,6 +303,13 @@ const testcases = [
// Hebrew diacritic also not allowed in Latin text (bug 1404349)
["goo\u05b4gle", "xn--google-rvh", false, false, false],
// Accents above dotless-i are not allowed
["na\u0131\u0308ve", "xn--nave-mza04z", false, false, false],
["d\u0131\u0302ner", "xn--dner-lza40z", false, false, false],
// but the corresponding accented-i (based on dotted i) is OK
["na\u00efve.com", "xn--nave-6pa.com", false, true, true],
["d\u00eener.com", "xn--dner-0pa.com", false, true, true],
];
const profiles = ["ASCII", "high", "moderate"];