forked from mirrors/gecko-dev
Backed out 5 changesets (bug 1790163, bug 1473911) for causing build bustage at nsIDNService.cpp. CLOSED TREE
Backed out changeset 7b91b96b9f37 (bug 1473911) Backed out changeset e33697d1250c (bug 1790163) Backed out changeset ac5db69fee7a (bug 1790163) Backed out changeset b2ae8efefc8c (bug 1790163) Backed out changeset 51d20d84a0ea (bug 1790163)
This commit is contained in:
parent
205017e2b5
commit
d5517a6ff7
4 changed files with 47 additions and 1110 deletions
|
|
@ -623,24 +623,6 @@ nsresult nsIDNService::decodeACE(const nsACString& in, nsACString& out,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
enum nsIDNService::ScriptCombo : int32_t {
|
||||
UNSET = -1,
|
||||
BOPO = 0,
|
||||
CYRL = 1,
|
||||
GREK = 2,
|
||||
HANG = 3,
|
||||
HANI = 4,
|
||||
HIRA = 5,
|
||||
KATA = 6,
|
||||
LATN = 7,
|
||||
OTHR = 8,
|
||||
JPAN = 9, // Latin + Han + Hiragana + Katakana
|
||||
CHNA = 10, // Latin + Han + Bopomofo
|
||||
KORE = 11, // Latin + Han + Hangul
|
||||
HNLT = 12, // Latin + Han (could be any of the above combinations)
|
||||
FAIL = 13,
|
||||
};
|
||||
|
||||
bool nsIDNService::isLabelSafe(const nsAString& label) {
|
||||
AutoReadLock lock(mLock);
|
||||
|
||||
|
|
@ -667,7 +649,7 @@ bool nsIDNService::isLabelSafe(const nsAString& label) {
|
|||
HanVariantType savedHanVariant = HVT_NotHan;
|
||||
#endif
|
||||
|
||||
ScriptCombo savedScript = ScriptCombo::UNSET;
|
||||
int32_t savedScript = -1;
|
||||
|
||||
while (current != end) {
|
||||
uint32_t ch = *current++;
|
||||
|
|
@ -691,17 +673,6 @@ bool nsIDNService::isLabelSafe(const nsAString& label) {
|
|||
}
|
||||
}
|
||||
|
||||
// U+30FC should be preceded by a Hiragana/Katakana.
|
||||
if (ch == 0x30fc && lastScript != Script::HIRAGANA &&
|
||||
lastScript != Script::KATAKANA) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ch == 0x307 &&
|
||||
(previousChar == 'i' || previousChar == 'j' || previousChar == 'l')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check for mixed numbering systems
|
||||
auto genCat = GetGeneralCategory(ch);
|
||||
if (genCat == HB_UNICODE_GENERAL_CATEGORY_DECIMAL_NUMBER) {
|
||||
|
|
@ -783,30 +754,36 @@ bool nsIDNService::isLabelSafe(const nsAString& label) {
|
|||
}
|
||||
|
||||
// Scripts that we care about in illegalScriptCombo
|
||||
static inline nsIDNService::ScriptCombo findScriptIndex(Script aScript) {
|
||||
switch (aScript) {
|
||||
case Script::BOPOMOFO:
|
||||
return BOPO;
|
||||
case Script::CYRILLIC:
|
||||
return CYRL;
|
||||
case Script::GREEK:
|
||||
return GREK;
|
||||
case Script::HANGUL:
|
||||
return HANG;
|
||||
case Script::HAN:
|
||||
return HANI;
|
||||
case Script::HIRAGANA:
|
||||
return HIRA;
|
||||
case Script::KATAKANA:
|
||||
return KATA;
|
||||
case Script::LATIN:
|
||||
return LATN;
|
||||
default:
|
||||
return OTHR;
|
||||
static const Script scriptTable[] = {
|
||||
Script::BOPOMOFO, Script::CYRILLIC, Script::GREEK, Script::HANGUL,
|
||||
Script::HAN, Script::HIRAGANA, Script::KATAKANA, Script::LATIN};
|
||||
|
||||
#define BOPO 0
|
||||
#define CYRL 1
|
||||
#define GREK 2
|
||||
#define HANG 3
|
||||
#define HANI 4
|
||||
#define HIRA 5
|
||||
#define KATA 6
|
||||
#define LATN 7
|
||||
#define OTHR 8
|
||||
#define JPAN 9 // Latin + Han + Hiragana + Katakana
|
||||
#define CHNA 10 // Latin + Han + Bopomofo
|
||||
#define KORE 11 // Latin + Han + Hangul
|
||||
#define HNLT 12 // Latin + Han (could be any of the above combinations)
|
||||
#define FAIL 13
|
||||
|
||||
static inline int32_t findScriptIndex(Script aScript) {
|
||||
int32_t tableLength = mozilla::ArrayLength(scriptTable);
|
||||
for (int32_t index = 0; index < tableLength; ++index) {
|
||||
if (aScript == scriptTable[index]) {
|
||||
return index;
|
||||
}
|
||||
}
|
||||
return OTHR;
|
||||
}
|
||||
|
||||
static const nsIDNService::ScriptCombo scriptComboTable[13][9] = {
|
||||
static const int32_t scriptComboTable[13][9] = {
|
||||
/* thisScript: BOPO CYRL GREK HANG HANI HIRA KATA LATN OTHR
|
||||
* savedScript */
|
||||
/* BOPO */ {BOPO, FAIL, FAIL, FAIL, CHNA, FAIL, FAIL, CHNA, FAIL},
|
||||
|
|
@ -823,8 +800,8 @@ static const nsIDNService::ScriptCombo scriptComboTable[13][9] = {
|
|||
/* KORE */ {FAIL, FAIL, FAIL, KORE, KORE, FAIL, FAIL, KORE, FAIL},
|
||||
/* HNLT */ {CHNA, FAIL, FAIL, KORE, HNLT, JPAN, JPAN, HNLT, FAIL}};
|
||||
|
||||
bool nsIDNService::illegalScriptCombo(Script script, ScriptCombo& savedScript) {
|
||||
if (savedScript == ScriptCombo::UNSET) {
|
||||
bool nsIDNService::illegalScriptCombo(Script script, int32_t& savedScript) {
|
||||
if (savedScript == -1) {
|
||||
savedScript = findScriptIndex(script);
|
||||
return false;
|
||||
}
|
||||
|
|
@ -842,3 +819,18 @@ bool nsIDNService::illegalScriptCombo(Script script, ScriptCombo& savedScript) {
|
|||
mRestrictionProfile == eHighlyRestrictiveProfile) ||
|
||||
savedScript == FAIL);
|
||||
}
|
||||
|
||||
#undef BOPO
|
||||
#undef CYRL
|
||||
#undef GREK
|
||||
#undef HANG
|
||||
#undef HANI
|
||||
#undef HIRA
|
||||
#undef KATA
|
||||
#undef LATN
|
||||
#undef OTHR
|
||||
#undef JPAN
|
||||
#undef CHNA
|
||||
#undef KORE
|
||||
#undef HNLT
|
||||
#undef FAIL
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@ class nsIDNService final : public nsIIDNService {
|
|||
nsIDNService();
|
||||
|
||||
nsresult Init();
|
||||
enum ScriptCombo : int32_t;
|
||||
|
||||
protected:
|
||||
virtual ~nsIDNService();
|
||||
|
|
@ -145,8 +144,8 @@ class nsIDNService final : public nsIIDNService {
|
|||
* For the "Moderately restrictive" profile, Latin is also allowed
|
||||
* with other scripts except Cyrillic and Greek
|
||||
*/
|
||||
bool illegalScriptCombo(mozilla::intl::Script script,
|
||||
ScriptCombo& savedScript) MOZ_REQUIRES_SHARED(mLock);
|
||||
bool illegalScriptCombo(mozilla::intl::Script script, int32_t& savedScript)
|
||||
MOZ_REQUIRES_SHARED(mLock);
|
||||
|
||||
/**
|
||||
* Convert a DNS label from ASCII to Unicode using IDNA2008
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -248,7 +248,6 @@ skip-if = (os == "win" && socketprocess_networking)
|
|||
[test_idn_blacklist.js]
|
||||
[test_idn_urls.js]
|
||||
[test_idna2008.js]
|
||||
[test_idn_spoof.js]
|
||||
[test_immutable.js]
|
||||
run-sequentially = node server exceptions dont replay well
|
||||
[test_localhost_offline.js]
|
||||
|
|
|
|||
Loading…
Reference in a new issue