Bug 1364283 - Treat Aspirational scripts the same as Restricted, in anticipation of UAX#31 update. r=valentin a=gchang
authorJonathan Kew <jkew@mozilla.com>
Tue, 23 May 2017 23:33:46 +0100
changeset 396391 02e5b298abedc3fd641a8db70efd59009109ed82
parent 396390 bdcbbe17ac8f8b2147f25d2e50748d215554a38a
child 396392 3807de1f07721be122f471db176ae64a979be427
push id1468
push userasasaki@mozilla.com
push dateMon, 05 Jun 2017 19:31:07 +0000
treeherdermozilla-release@0641fc6ee9d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvalentin, gchang
bugs1364283
milestone54.0
Bug 1364283 - Treat Aspirational scripts the same as Restricted, in anticipation of UAX#31 update. r=valentin a=gchang
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],