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;
|
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) {
|
bool nsIDNService::isLabelSafe(const nsAString& label) {
|
||||||
AutoReadLock lock(mLock);
|
AutoReadLock lock(mLock);
|
||||||
|
|
||||||
|
|
@ -667,7 +649,7 @@ bool nsIDNService::isLabelSafe(const nsAString& label) {
|
||||||
HanVariantType savedHanVariant = HVT_NotHan;
|
HanVariantType savedHanVariant = HVT_NotHan;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ScriptCombo savedScript = ScriptCombo::UNSET;
|
int32_t savedScript = -1;
|
||||||
|
|
||||||
while (current != end) {
|
while (current != end) {
|
||||||
uint32_t ch = *current++;
|
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
|
// Check for mixed numbering systems
|
||||||
auto genCat = GetGeneralCategory(ch);
|
auto genCat = GetGeneralCategory(ch);
|
||||||
if (genCat == HB_UNICODE_GENERAL_CATEGORY_DECIMAL_NUMBER) {
|
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
|
// Scripts that we care about in illegalScriptCombo
|
||||||
static inline nsIDNService::ScriptCombo findScriptIndex(Script aScript) {
|
static const Script scriptTable[] = {
|
||||||
switch (aScript) {
|
Script::BOPOMOFO, Script::CYRILLIC, Script::GREEK, Script::HANGUL,
|
||||||
case Script::BOPOMOFO:
|
Script::HAN, Script::HIRAGANA, Script::KATAKANA, Script::LATIN};
|
||||||
return BOPO;
|
|
||||||
case Script::CYRILLIC:
|
#define BOPO 0
|
||||||
return CYRL;
|
#define CYRL 1
|
||||||
case Script::GREEK:
|
#define GREK 2
|
||||||
return GREK;
|
#define HANG 3
|
||||||
case Script::HANGUL:
|
#define HANI 4
|
||||||
return HANG;
|
#define HIRA 5
|
||||||
case Script::HAN:
|
#define KATA 6
|
||||||
return HANI;
|
#define LATN 7
|
||||||
case Script::HIRAGANA:
|
#define OTHR 8
|
||||||
return HIRA;
|
#define JPAN 9 // Latin + Han + Hiragana + Katakana
|
||||||
case Script::KATAKANA:
|
#define CHNA 10 // Latin + Han + Bopomofo
|
||||||
return KATA;
|
#define KORE 11 // Latin + Han + Hangul
|
||||||
case Script::LATIN:
|
#define HNLT 12 // Latin + Han (could be any of the above combinations)
|
||||||
return LATN;
|
#define FAIL 13
|
||||||
default:
|
|
||||||
return OTHR;
|
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
|
/* thisScript: BOPO CYRL GREK HANG HANI HIRA KATA LATN OTHR
|
||||||
* savedScript */
|
* savedScript */
|
||||||
/* BOPO */ {BOPO, FAIL, FAIL, FAIL, CHNA, FAIL, FAIL, CHNA, FAIL},
|
/* 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},
|
/* KORE */ {FAIL, FAIL, FAIL, KORE, KORE, FAIL, FAIL, KORE, FAIL},
|
||||||
/* HNLT */ {CHNA, FAIL, FAIL, KORE, HNLT, JPAN, JPAN, HNLT, FAIL}};
|
/* HNLT */ {CHNA, FAIL, FAIL, KORE, HNLT, JPAN, JPAN, HNLT, FAIL}};
|
||||||
|
|
||||||
bool nsIDNService::illegalScriptCombo(Script script, ScriptCombo& savedScript) {
|
bool nsIDNService::illegalScriptCombo(Script script, int32_t& savedScript) {
|
||||||
if (savedScript == ScriptCombo::UNSET) {
|
if (savedScript == -1) {
|
||||||
savedScript = findScriptIndex(script);
|
savedScript = findScriptIndex(script);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -842,3 +819,18 @@ bool nsIDNService::illegalScriptCombo(Script script, ScriptCombo& savedScript) {
|
||||||
mRestrictionProfile == eHighlyRestrictiveProfile) ||
|
mRestrictionProfile == eHighlyRestrictiveProfile) ||
|
||||||
savedScript == FAIL);
|
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();
|
nsIDNService();
|
||||||
|
|
||||||
nsresult Init();
|
nsresult Init();
|
||||||
enum ScriptCombo : int32_t;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual ~nsIDNService();
|
virtual ~nsIDNService();
|
||||||
|
|
@ -145,8 +144,8 @@ class nsIDNService final : public nsIIDNService {
|
||||||
* For the "Moderately restrictive" profile, Latin is also allowed
|
* For the "Moderately restrictive" profile, Latin is also allowed
|
||||||
* with other scripts except Cyrillic and Greek
|
* with other scripts except Cyrillic and Greek
|
||||||
*/
|
*/
|
||||||
bool illegalScriptCombo(mozilla::intl::Script script,
|
bool illegalScriptCombo(mozilla::intl::Script script, int32_t& savedScript)
|
||||||
ScriptCombo& savedScript) MOZ_REQUIRES_SHARED(mLock);
|
MOZ_REQUIRES_SHARED(mLock);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert a DNS label from ASCII to Unicode using IDNA2008
|
* 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_blacklist.js]
|
||||||
[test_idn_urls.js]
|
[test_idn_urls.js]
|
||||||
[test_idna2008.js]
|
[test_idna2008.js]
|
||||||
[test_idn_spoof.js]
|
|
||||||
[test_immutable.js]
|
[test_immutable.js]
|
||||||
run-sequentially = node server exceptions dont replay well
|
run-sequentially = node server exceptions dont replay well
|
||||||
[test_localhost_offline.js]
|
[test_localhost_offline.js]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue