summaryrefslogtreecommitdiffstats
path: root/netwerk/dns/nsIDNService.cpp
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2017-11-21 11:13:05 +0100
committerwolfbeast <mcwerewolf@gmail.com>2018-02-08 19:29:05 +0100
commitc65d475f9a29a596c4a170126593c39945e0d7b2 (patch)
tree0f4d80e5e5b144558f5e2700241e90a5227004d7 /netwerk/dns/nsIDNService.cpp
parentef794bb39b7c5d98bd198965c987089ca146c4dd (diff)
downloadUXP-c65d475f9a29a596c4a170126593c39945e0d7b2.tar
UXP-c65d475f9a29a596c4a170126593c39945e0d7b2.tar.gz
UXP-c65d475f9a29a596c4a170126593c39945e0d7b2.tar.lz
UXP-c65d475f9a29a596c4a170126593c39945e0d7b2.tar.xz
UXP-c65d475f9a29a596c4a170126593c39945e0d7b2.zip
Force punycode display for IDNs with a <dotless-i/j, combining mark above> sequence.
Diffstat (limited to 'netwerk/dns/nsIDNService.cpp')
-rw-r--r--netwerk/dns/nsIDNService.cpp19
1 files changed, 14 insertions, 5 deletions
diff --git a/netwerk/dns/nsIDNService.cpp b/netwerk/dns/nsIDNService.cpp
index d4f31027e..73a189b67 100644
--- a/netwerk/dns/nsIDNService.cpp
+++ b/netwerk/dns/nsIDNService.cpp
@@ -797,6 +797,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
@@ -846,11 +847,19 @@ bool nsIDNService::isLabelSafe(const nsAString &label)
}
}
- // Check for consecutive non-spacing marks
- if (previousChar != 0 &&
- previousChar == ch &&
- GetGeneralCategory(ch) == HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK) {
- return false;
+ if (GetGeneralCategory(ch) == HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK) {
+ // Check for consecutive non-spacing marks
+ if (previousChar != 0 && previousChar == ch) {
+ return false;
+ }
+ // Check for diacritics on dotless-i or dotless-j, which would be
+ // indistinguishable from normal accented letter.
+ if ((baseChar == 0x0237 || baseChar == 0x0131) &&
+ ((ch >= 0x0300 && ch <= 0x0314) || ch == 0x031a)) {
+ return false;
+ }
+ } else {
+ baseChar = ch;
}
// Simplified/Traditional Chinese check temporarily disabled -- bug 857481