bug 163998: URL-unescape the image URL for rendering in the title bar
(r=nhotta,jst, sr=darin, a=asa)
This commit is contained in:
Родитель
449d35d64e
Коммит
d17b8d5ad8
|
@ -59,6 +59,7 @@
|
|||
#include "nsIViewManager.h"
|
||||
#include "nsIStringBundle.h"
|
||||
#include "nsIPrefService.h"
|
||||
#include "nsITextToSubURI.h"
|
||||
|
||||
#define NSIMAGEDOCUMENT_PROPERTIES_URI "chrome://communicator/locale/layout/ImageDocument.properties"
|
||||
#define AUTOMATIC_IMAGE_RESIZING_PREF "browser.enable_automatic_image_resizing"
|
||||
|
@ -673,9 +674,19 @@ nsresult nsImageDocument::UpdateTitle()
|
|||
|
||||
nsCOMPtr<nsIURL> url = do_QueryInterface(mDocumentURL);
|
||||
if (url) {
|
||||
nsresult rv;
|
||||
nsCAutoString fileName;
|
||||
url->GetFileName(fileName);
|
||||
fileStr.Assign(NS_ConvertUTF8toUCS2(fileName));
|
||||
nsCOMPtr<nsITextToSubURI> textToSubURI = do_GetService(NS_ITEXTTOSUBURI_CONTRACTID, &rv);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsCAutoString originCharset;
|
||||
rv = url->GetOriginCharset(originCharset);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
rv = textToSubURI->UnEscapeURIForUI(originCharset, fileName, fileStr);
|
||||
}
|
||||
if (NS_FAILED(rv))
|
||||
fileStr.Assign(NS_ConvertUTF8toUCS2(fileName));
|
||||
}
|
||||
|
||||
widthStr.AppendInt(mImageWidth);
|
||||
|
|
|
@ -198,6 +198,9 @@ nsresult nsTextToSubURI::convertURItoUnicode(const nsAFlatCString &aCharset,
|
|||
}
|
||||
}
|
||||
|
||||
// empty charset could indicate UTF-8, but aURI turns out not to be UTF-8.
|
||||
NS_ENSURE_FALSE(aCharset.IsEmpty(), NS_ERROR_INVALID_ARG);
|
||||
|
||||
nsCOMPtr<nsICharsetConverterManager2> charsetConverterManager;
|
||||
|
||||
charsetConverterManager = do_GetService(NS_CHARSETCONVERTERMANAGER_CONTRACTID, &rv);
|
||||
|
|
Загрузка…
Ссылка в новой задаче