Bug 479520: Implement IDNA2008 standard for International Domain Names, patch 2: changes to existing tests, r=jfkthame.
☠☠ backed out by b61c16d3e592 ☠ ☠
authorSimon Montagu <smontagu@smontagu.org>
Wed, 28 Oct 2015 03:46:44 -0700
changeset 305138 ce23fa9ffb16ff88c86be000f1c432fcd7c76e08
parent 305137 533f3277cdbb0a1bc8cbcdb8ed95d860d52e2650
child 305139 80f9778bb787e306cbda07418196534e3820fed0
push id1001
push userraliiev@mozilla.com
push dateMon, 18 Jan 2016 19:06:03 +0000
treeherdermozilla-release@8b89261f3ac4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjfkthame
bugs479520
milestone44.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 479520: Implement IDNA2008 standard for International Domain Names, patch 2: changes to existing tests, r=jfkthame.
netwerk/test/unit/test_bug427957.js
netwerk/test/unit/test_idn_blacklist.js
netwerk/test/unit/test_idn_urls.js
--- a/netwerk/test/unit/test_bug427957.js
+++ b/netwerk/test/unit/test_bug427957.js
@@ -87,14 +87,20 @@ function run_test() {
   /*
    * 3) If a string contains any RandALCat character, a RandALCat
    *    character MUST be the first character of the string, and a
    *    RandALCat character MUST be the last character of the string.
    */
 
   // www.1מיץ.com is invalid
   expected_fail("www.1\u05DE\u05D9\u05E5.com");
-  // www.מיץ1.com is invalid
-  expected_fail("www.\u05DE\u05D9\u05E51.com");
+  // www.!מיץ.com is invalid
+  expected_fail("www.!\u05DE\u05D9\u05E5.com");
+  // www.מיץ!.com is invalid
+  expected_fail("www.\u05DE\u05D9\u05E5!.com");
+
+  // XXX TODO: add a test for an RTL label ending with a digit. This was
+  //           invalid in IDNA2003 but became valid in IDNA2008
+
   // But www.מיץ1פטל.com is fine
   expected_pass("www.\u05DE\u05D9\u05E51\u05E4\u05D8\u05DC.com");
 }
   
--- a/netwerk/test/unit/test_idn_blacklist.js
+++ b/netwerk/test/unit/test_idn_blacklist.js
@@ -139,26 +139,32 @@ function run_test() {
         var isASCII = {};
 
 	var result;
 	try {
 	    result = idnService.convertToDisplayIDN(URL, isASCII);
 	} catch(e) {
 	    result = ".com";
 	}
-        if (punycodeURL.substr(0, 4) == "xn--") {
-            // test convertToDisplayIDN with a Unicode URL and with a
-            //  Punycode URL if we have one
-            do_check_eq(escape(result), escape(punycodeURL));
+        // If the punycode URL is equivalent to \ufffd.com (i.e. the
+        // blacklisted character has been replaced by a unicode
+        // REPLACEMENT CHARACTER, skip the test
+        if (result != "xn--zn7c.com") {
+
+            if (punycodeURL.substr(0, 4) == "xn--") {
+                // test convertToDisplayIDN with a Unicode URL and with a
+                //  Punycode URL if we have one
+                equal(escape(result), escape(punycodeURL));
 
-            result = idnService.convertToDisplayIDN(punycodeURL, isASCII);
-            do_check_eq(escape(result), escape(punycodeURL));
-        } else {
-            // The "punycode" URL isn't punycode. This happens in testcases
-            // where the Unicode URL has become normalized to an ASCII URL,
-            // so, even though expectedUnicode is true, the expected result
-            // is equal to punycodeURL
-            do_check_eq(escape(result), escape(punycodeURL));
+                result = idnService.convertToDisplayIDN(punycodeURL, isASCII);
+                equal(escape(result), escape(punycodeURL));
+            } else {
+                // The "punycode" URL isn't punycode. This happens in testcases
+                // where the Unicode URL has become normalized to an ASCII URL,
+                // so, even though expectedUnicode is true, the expected result
+                // is equal to punycodeURL
+                equal(escape(result), escape(punycodeURL));
+            }
         }
     }
     pbi.setBoolPref("network.IDN.whitelist.com", oldWhitelistCom);
     pbi.setCharPref("network.IDN.restriction_profile", oldProfile);
 }
--- a/netwerk/test/unit/test_idn_urls.js
+++ b/netwerk/test/unit/test_idn_urls.js
@@ -7,18 +7,25 @@ const testcases = [
     ["cuillère", "xn--cuillre-6xa",                  false, true,  true],
 
     // repeated non-spacing marks
     ["gruz̀̀ere",  "xn--gruzere-ogea",                 false, false, false],
 
     // non-XID character
     ["I♥NY",     "xn--iny-zx5a",                     false, false, false],
 
+/*
+  Behaviour of this test changed in IDNA2008, replacing the non-XID
+  character with U+FFFD replacement character - when all platforms use
+  IDNA2008 it can be uncommented and the punycode URL changed to
+   "xn--mgbl3eb85703a"
+
     // new non-XID character in Unicode 6.3
     ["حلا\u061cل", "xn--bgbvr6gc",                    false, false, false],
+*/
 
     // U+30FB KATAKANA MIDDLE DOT is excluded from non-XID characters (bug 857490)
     ["乾燥肌・石けん", "xn--08j4gylj12hz80b0uhfup",     false, true,  true],
 
     // Cyrillic alone
     ["толсто́й",  "xn--lsa83dealbred",                false, true,  true],
 
     // Mixed script Cyrillic/Latin