зеркало из https://github.com/mozilla/pjs.git
Bug #334993 --> don't use brandShortName for the Thunderbird user-agent string as some locales are translating Thunderbird. Use the value from nsIXULAppInfo instead. r=axel
This commit is contained in:
Родитель
23736e55d2
Коммит
138feb64db
|
@ -83,6 +83,7 @@ REQUIRES = xpcom \
|
|||
nkcache \
|
||||
mimetype \
|
||||
windowwatcher \
|
||||
xulapp \
|
||||
$(NULL)
|
||||
|
||||
#ifdef XP_WIN32
|
||||
|
|
|
@ -64,6 +64,11 @@
|
|||
#include "nsIMsgCompUtils.h"
|
||||
#include "nsIMsgMdnGenerator.h"
|
||||
|
||||
#ifdef MOZ_THUNDERBIRD
|
||||
#include "nsIXULAppInfo.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
#endif
|
||||
|
||||
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
|
||||
static NS_DEFINE_CID(kHTTPHandlerCID, NS_HTTPPROTOCOLHANDLER_CID);
|
||||
|
||||
|
@ -470,7 +475,7 @@ RRT_HEADER:
|
|||
nsCOMPtr<nsIHttpProtocolHandler> pHTTPHandler = do_GetService(kHTTPHandlerCID, &rv);
|
||||
if (NS_SUCCEEDED(rv) && pHTTPHandler)
|
||||
{
|
||||
nsCAutoString userAgentString;
|
||||
nsCAutoString userAgentString;
|
||||
#ifdef MOZ_THUNDERBIRD
|
||||
|
||||
nsXPIDLCString userAgentOverride;
|
||||
|
@ -479,36 +484,26 @@ RRT_HEADER:
|
|||
// allow a user to override the default UA
|
||||
if (!userAgentOverride)
|
||||
{
|
||||
nsCOMPtr<nsIStringBundleService> stringService = do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv);
|
||||
nsCOMPtr<nsIXULAppInfo> xulAppInfo (do_GetService(XULAPPINFO_SERVICE_CONTRACTID, &rv));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsCOMPtr<nsIStringBundle> brandSringBundle;
|
||||
rv = stringService->CreateBundle("chrome://branding/locale/brand.properties", getter_AddRefs(brandSringBundle));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsXPIDLString brandName;
|
||||
rv = brandSringBundle->GetStringFromName(NS_LITERAL_STRING("brandShortName").get(), getter_Copies(brandName));
|
||||
{
|
||||
xulAppInfo->GetName(userAgentString);
|
||||
|
||||
nsCAutoString productSub;
|
||||
pHTTPHandler->GetProductSub(productSub);
|
||||
nsCAutoString productSub;
|
||||
pHTTPHandler->GetProductSub(productSub);
|
||||
|
||||
nsCAutoString platform;
|
||||
pHTTPHandler->GetPlatform(platform);
|
||||
nsCAutoString platform;
|
||||
pHTTPHandler->GetPlatform(platform);
|
||||
|
||||
// XXX: This may leave characters with the 8th bit set in the string, which
|
||||
// aren't allowed in header values. this should use some kind of encoding
|
||||
// for them
|
||||
LossyCopyUTF16toASCII(brandName, userAgentString);
|
||||
userAgentString += ' ';
|
||||
userAgentString += NS_STRINGIFY(MOZ_APP_VERSION);
|
||||
userAgentString += " (";
|
||||
userAgentString += platform;
|
||||
userAgentString += "/";
|
||||
userAgentString += productSub;
|
||||
userAgentString += ")";
|
||||
}
|
||||
}
|
||||
}
|
||||
userAgentString += ' ';
|
||||
userAgentString += NS_STRINGIFY(MOZ_APP_VERSION);
|
||||
userAgentString += " (";
|
||||
userAgentString += platform;
|
||||
userAgentString += "/";
|
||||
userAgentString += productSub;
|
||||
userAgentString += ")";
|
||||
}
|
||||
}
|
||||
else
|
||||
userAgentString = userAgentOverride;
|
||||
#else
|
||||
|
|
Загрузка…
Ссылка в новой задаче