Bug 1404349 - Extend check from bug 1370497 to apply to marks with a specific Script property, as well as those with Script=Inherited. r=valentin
authorJonathan Kew <jkew@mozilla.com>
Mon, 09 Oct 2017 13:23:18 +0100
changeset 385155 e92d092fdacc83b14dd65a4ec3c9cada16406ce6
parent 385154 359f2f4a8a6c968f4762b8f2bba97da186c208c2
child 385156 da9caebfed4112f7cf84a1358c3b9ac461e5688d
push id32647
push userarchaeopteryx@coole-files.de
push dateMon, 09 Oct 2017 21:55:00 +0000
treeherdermozilla-central@2ed5e7fbf39e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvalentin
bugs1404349, 1370497
milestone58.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 1404349 - Extend check from bug 1370497 to apply to marks with a specific Script property, as well as those with Script=Inherited. r=valentin
netwerk/dns/nsIDNService.cpp
netwerk/test/unit/test_idn_urls.js
--- a/netwerk/dns/nsIDNService.cpp
+++ b/netwerk/dns/nsIDNService.cpp
@@ -775,17 +775,16 @@ bool nsIDNService::isLabelSafe(const nsA
     // Check for mixed script
     Script script = GetScriptCode(ch);
     if (script != Script::COMMON &&
         script != Script::INHERITED &&
         script != lastScript) {
       if (illegalScriptCombo(script, savedScript)) {
         return false;
       }
-      lastScript = script;
     }
 
     // Check for mixed numbering systems
     auto genCat = GetGeneralCategory(ch);
     if (genCat == HB_UNICODE_GENERAL_CATEGORY_DECIMAL_NUMBER) {
       uint32_t zeroCharacter = ch - GetNumericValue(ch);
       if (savedNumberingSystem == 0) {
         // If we encounter a decimal number, save the zero character from that
@@ -828,16 +827,20 @@ bool nsIDNService::isLabelSafe(const nsA
           }
           if (nScripts == -1) {
             return false;
           }
         }
       }
     }
 
+    if (script != Script::COMMON && script != Script::INHERITED) {
+      lastScript = script;
+    }
+
     // Simplified/Traditional Chinese check temporarily disabled -- bug 857481
 #if 0
 
     // Check for both simplified-only and traditional-only Chinese characters
     HanVariantType hanVariant = GetHanVariant(ch);
     if (hanVariant == HVT_SimplifiedOnly || hanVariant == HVT_TraditionalOnly) {
       if (savedHanVariant == HVT_NotHan) {
         savedHanVariant = hanVariant;
--- a/netwerk/test/unit/test_idn_urls.js
+++ b/netwerk/test/unit/test_idn_urls.js
@@ -295,16 +295,19 @@ const testcases = [
     ["䕮䕵䕶䕱.中国123", "xn--google.xn--123-u68dy61b",           false, true,  true],
     ["xn--accountlogin.䕮䕵䕶䕱", "xn--accountlogin.xn--google", false, true,  true],
     ["䕮䕵䕶䕱.xn--accountlogin", "xn--google.xn--accountlogin", false, true,  true],
 
     // Arabic diacritic not allowed in Latin text (bug 1370497)
     ["goo\u0650gle", "xn--google-yri", false, false, false],
     // ...but Arabic diacritics are allowed on Arabic text
     ["العَرَبِي", "xn--mgbc0a5a6cxbzabt", false, true, true],
+
+    // Hebrew diacritic also not allowed in Latin text (bug 1404349)
+    ["goo\u05b4gle", "xn--google-rvh", false, false, false],
 ];
 
 const profiles = ["ASCII", "high", "moderate"];
 
 function run_test() {
     var pbi = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch);
     var oldProfile = pbi.getCharPref("network.IDN.restriction_profile", "moderate");
     var oldWhitelistCom = pbi.getBoolPref("network.IDN.whitelist.com", false);