Bug 1364283 - Treat Aspirational scripts the same as Restricted, in anticipation of UAX#31 update. r=valentin
authorJonathan Kew <jkew@mozilla.com>
Tue, 23 May 2017 23:33:46 +0100
changeset 360301 fa4c7abccb77836bd80ed8e5bfe9b44ed3e0c9c7
parent 360300 afcf9a101dfa3605df2ad962dd677dd7abed344b
child 360302 ecb5a09e6371b7f2ff5c16af0c89a2e5cce6dfa0
push id90625
push userjkew@mozilla.com
push dateTue, 23 May 2017 22:34:05 +0000
treeherdermozilla-inbound@fa4c7abccb77 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvalentin
bugs1364283
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1364283 - Treat Aspirational scripts the same as Restricted, in anticipation of UAX#31 update. r=valentin
netwerk/dns/nsIDNService.cpp
netwerk/test/unit/test_idn_urls.js
--- a/netwerk/dns/nsIDNService.cpp
+++ b/netwerk/dns/nsIDNService.cpp
@@ -808,22 +808,24 @@ bool nsIDNService::isLabelSafe(const nsA
   while (current != end) {
     uint32_t ch = *current++;
 
     if (NS_IS_HIGH_SURROGATE(ch) && current != end &&
         NS_IS_LOW_SURROGATE(*current)) {
       ch = SURROGATE_TO_UCS4(ch, *current++);
     }
 
-    // Check for restricted characters; aspirational scripts are permitted
+    // Check for restricted characters; aspirational scripts are NOT permitted,
+    // in anticipation of the category being merged into Limited-Use scripts
+    // in the upcoming (Unicode 10.0-based) revision of UAX #31.
     IdentifierType idType = GetIdentifierType(ch);
-    if (idType == IDTYPE_RESTRICTED) {
+    if (idType == IDTYPE_RESTRICTED || idType == IDTYPE_ASPIRATIONAL) {
       return false;
     }
-    MOZ_ASSERT(idType == IDTYPE_ALLOWED || idType == IDTYPE_ASPIRATIONAL);
+    MOZ_ASSERT(idType == IDTYPE_ALLOWED);
 
     // Check for mixed script
     Script script = GetScriptCode(ch);
     if (script != Script::COMMON &&
         script != Script::INHERITED &&
         script != lastScript) {
       if (illegalScriptCombo(script, savedScript)) {
         return false;
--- a/netwerk/test/unit/test_idn_urls.js
+++ b/netwerk/test/unit/test_idn_urls.js
@@ -33,18 +33,18 @@ const testcases = [
                  "xn---in-russian-1jg071b0a8bb4cpd", false, false, false],
 
     // Mixed script Latin/Cyrillic
     ["war-and-миръ", "xn--war-and--b9g3b7b3h",       false, false, false],
 
     // Cherokee (Restricted script)
     ["ᏣᎳᎩ",     "xn--f9dt7l",                        false, false, false],
 
-    // Yi (Aspirational script)
-    ["ꆈꌠꁱꂷ", "xn--4o7a6e1x64c",                  false, true,  true],
+    // Yi (former Aspirational script, now Restricted per Unicode 10.0 update to UAX 31)
+    ["ꆈꌠꁱꂷ", "xn--4o7a6e1x64c",                  false, false,  false],
 
     // Greek alone
     ["πλάτων",   "xn--hxa3ahjw4a",                   false, true,  true],
 
     // Mixed script Greek/Latin
     ["πλάτωνicrelationship",
                  "xn--icrelationship-96j4t9a3cwe2e", false, false, false],