// Characters from the IDN blacklist that normalize to ASCII // If we start using STD3ASCIIRules these will be blocked (bug 316444)
["\u00A0", " "],
["\u2000", " "],
["\u2001", " "],
["\u2002", " "],
["\u2003", " "],
["\u2004", " "],
["\u2005", " "],
["\u2006", " "],
["\u2007", " "],
["\u2008", " "],
["\u2009", " "],
["\u200A", " "],
["\u2024", "."],
["\u202F", " "],
["\u205F", " "],
["\u3000", " "],
["\u3002", "."],
["\uFE14", ";"],
["\uFE15", "!"],
["\uFF0E", "."],
["\uFF0F", "/"],
["\uFF61", "."],
// Characters from the IDN blacklist that are stripped by Nameprep
["\u200B", ""],
["\uFEFF", ""],
];
function run_test() { var idnService = Cc["@mozilla.org/network/idn-service;1"].getService(
Ci.nsIIDNService
); for (var j = 0; j < testcases.length; ++j) { var test = testcases[j]; var URL = test[0] + ".com"; var punycodeURL = test[1] + ".com"; var isASCII = {};
var result; try {
result = idnService.convertToDisplayIDN(URL, isASCII);
} catch (e) { continue;
} 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);
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));
}
}
}
Messung V0.5
¤ Dauer der Verarbeitung: 0.10 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.