зеркало из https://github.com/mozilla/pjs.git
bug 244754 : URL is not shown in the status bar when hovering over a url-escaped URL in an encoding different from the document enecoding (r=darin, sr=bzbarsky)
This commit is contained in:
Родитель
66cf00a756
Коммит
fd66f970be
|
@ -322,10 +322,11 @@ nsMediaDocument::UpdateTitleAndCharset(const nsACString& aTypeStr,
|
||||||
nsCOMPtr<nsITextToSubURI> textToSubURI =
|
nsCOMPtr<nsITextToSubURI> textToSubURI =
|
||||||
do_GetService(NS_ITEXTTOSUBURI_CONTRACTID, &rv);
|
do_GetService(NS_ITEXTTOSUBURI_CONTRACTID, &rv);
|
||||||
if (NS_SUCCEEDED(rv))
|
if (NS_SUCCEEDED(rv))
|
||||||
rv = textToSubURI->UnEscapeURIForUI(docCharset, fileName, fileStr);
|
// UnEscapeURIForUI always succeeds
|
||||||
|
textToSubURI->UnEscapeURIForUI(docCharset, fileName, fileStr);
|
||||||
|
else
|
||||||
|
CopyUTF8toUTF16(fileName, fileStr);
|
||||||
}
|
}
|
||||||
if (fileStr.IsEmpty())
|
|
||||||
CopyUTF8toUTF16(fileName, fileStr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2835,11 +2835,11 @@ nsDocShell::DisplayLoadError(nsresult aError, nsIURI *aURI,
|
||||||
nsCOMPtr<nsITextToSubURI> textToSubURI(
|
nsCOMPtr<nsITextToSubURI> textToSubURI(
|
||||||
do_GetService(NS_ITEXTTOSUBURI_CONTRACTID, &rv));
|
do_GetService(NS_ITEXTTOSUBURI_CONTRACTID, &rv));
|
||||||
if (NS_SUCCEEDED(rv))
|
if (NS_SUCCEEDED(rv))
|
||||||
rv = textToSubURI->UnEscapeURIForUI(charset, spec, formatStrs[0]);
|
// UnEscapeURIForUI always succeeds
|
||||||
if (NS_FAILED(rv)) {
|
textToSubURI->UnEscapeURIForUI(charset, spec, formatStrs[0]);
|
||||||
CopyASCIItoUCS2(spec, formatStrs[0]);
|
else
|
||||||
rv = NS_OK;
|
CopyUTF8toUTF16(spec, formatStrs[0]);
|
||||||
}
|
rv = NS_OK;
|
||||||
formatStrCount = 1;
|
formatStrCount = 1;
|
||||||
error.AssignLiteral("fileNotFound");
|
error.AssignLiteral("fileNotFound");
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,14 +52,18 @@ interface nsITextToSubURI : nsISupports
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unescapes the given URI fragment (for UI purpose only)
|
* Unescapes the given URI fragment (for UI purpose only)
|
||||||
* note: escaping back the result unescaped string is not guaranteed to be
|
* Note:
|
||||||
* identical to the original escaped string
|
* <ul>
|
||||||
|
* <li> escaping back the result (unescaped string) is not guaranteed to
|
||||||
|
* give the original escaped string
|
||||||
|
* <li> In case of a conversion error, the URI fragment (escaped) is
|
||||||
|
* assumed to be in UTF-8 and converted to AString (UTF-16)
|
||||||
|
* <li> Always succeeeds (callers don't need to do error checking)
|
||||||
|
* </ul>
|
||||||
*
|
*
|
||||||
* @param aCharset the charset to convert from
|
* @param aCharset the charset to convert from
|
||||||
* @param aURIFragment the URI (or URI fragment) to unescape
|
* @param aURIFragment the URI (or URI fragment) to unescape
|
||||||
* @return Unescaped aURIFragment converted to unicode
|
* @return Unescaped aURIFragment converted to unicode
|
||||||
* @throws NS_ERROR_UCONV_NOCONV when there is no decoder for aCharset
|
|
||||||
* or error code of nsIUnicodeDecoder in case of covnersion failure
|
|
||||||
*/
|
*/
|
||||||
AString unEscapeURIForUI(in ACString aCharset, in AUTF8String aURIFragment);
|
AString unEscapeURIForUI(in ACString aCharset, in AUTF8String aURIFragment);
|
||||||
|
|
||||||
|
|
|
@ -230,7 +230,12 @@ NS_IMETHODIMP nsTextToSubURI::UnEscapeURIForUI(const nsACString & aCharset,
|
||||||
NS_UnescapeURL(PromiseFlatCString(aURIFragment),
|
NS_UnescapeURL(PromiseFlatCString(aURIFragment),
|
||||||
esc_SkipControl | esc_AlwaysCopy, unescapedSpec);
|
esc_SkipControl | esc_AlwaysCopy, unescapedSpec);
|
||||||
|
|
||||||
return convertURItoUnicode(PromiseFlatCString(aCharset), unescapedSpec, PR_TRUE, _retval);
|
// in case of failure, return escaped URI
|
||||||
|
if (NS_FAILED(convertURItoUnicode(
|
||||||
|
PromiseFlatCString(aCharset), unescapedSpec, PR_TRUE, _retval)))
|
||||||
|
// assume UTF-8 instead of ASCII because hostname (IDN) may be in UTF-8
|
||||||
|
CopyUTF8toUTF16(aURIFragment, _retval);
|
||||||
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsTextToSubURI::UnEscapeNonAsciiURI(const nsACString & aCharset,
|
NS_IMETHODIMP nsTextToSubURI::UnEscapeNonAsciiURI(const nsACString & aCharset,
|
||||||
|
|
Загрузка…
Ссылка в новой задаче