Bug 1845552 - patch 2 - Don't return a malformed-URL error if the label is empty in StringPrepForDNS processing; just let the caller deal with that. r=necko-reviewers,valentin

Depends on D186866

Differential Revision: https://phabricator.services.mozilla.com/D186867
This commit is contained in:
Jonathan Kew 2023-08-29 09:20:05 +00:00
Родитель 74bf676eba
Коммит 4507c87b9e
2 изменённых файлов: 12 добавлений и 26 удалений

Просмотреть файл

@ -197,15 +197,19 @@ nsresult nsIDNService::IDNA2008StringPrep(const nsAString& input,
return NS_OK;
}
bool hasError = flag == eStringPrepForDNS
? info.HasErrorsIgnoringInvalidHyphen()
: info.HasErrors();
if (hasError) {
if (flag == eStringPrepForDNS) {
output.Truncate();
if (flag == eStringPrepForDNS) {
// We ignore errors if the result is empty, or if the errors were just
// invalid hyphens (not punycode-decoding failure or invalid chars).
if (!output.IsEmpty()) {
if (info.HasErrorsIgnoringInvalidHyphen()) {
output.Truncate();
rv = NS_ERROR_MALFORMED_URI;
}
}
} else {
if (info.HasErrors()) {
rv = NS_ERROR_MALFORMED_URI;
}
rv = NS_ERROR_MALFORMED_URI;
}
return rv;

Просмотреть файл

@ -1,18 +0,0 @@
[IdnaTestV2.window.html]
[ToASCII("ä.­.c") A4_2 (ignored)]
expected: FAIL
[ToASCII("ä.­.c") A4_2 (ignored)]
expected: FAIL
[ToASCII("Ä.­.C") A4_2 (ignored)]
expected: FAIL
[ToASCII("Ä.­.C") A4_2 (ignored)]
expected: FAIL
[ToASCII("-𐋷𖾑。󠆬") V3 (ignored)]
expected: FAIL
[ToASCII("︅。。𦀾᳠") A4_2 (ignored)]
expected: FAIL