зеркало из 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 \
|
nkcache \
|
||||||
mimetype \
|
mimetype \
|
||||||
windowwatcher \
|
windowwatcher \
|
||||||
|
xulapp \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
#ifdef XP_WIN32
|
#ifdef XP_WIN32
|
||||||
|
|
|
@ -64,6 +64,11 @@
|
||||||
#include "nsIMsgCompUtils.h"
|
#include "nsIMsgCompUtils.h"
|
||||||
#include "nsIMsgMdnGenerator.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(kIOServiceCID, NS_IOSERVICE_CID);
|
||||||
static NS_DEFINE_CID(kHTTPHandlerCID, NS_HTTPPROTOCOLHANDLER_CID);
|
static NS_DEFINE_CID(kHTTPHandlerCID, NS_HTTPPROTOCOLHANDLER_CID);
|
||||||
|
|
||||||
|
@ -470,7 +475,7 @@ RRT_HEADER:
|
||||||
nsCOMPtr<nsIHttpProtocolHandler> pHTTPHandler = do_GetService(kHTTPHandlerCID, &rv);
|
nsCOMPtr<nsIHttpProtocolHandler> pHTTPHandler = do_GetService(kHTTPHandlerCID, &rv);
|
||||||
if (NS_SUCCEEDED(rv) && pHTTPHandler)
|
if (NS_SUCCEEDED(rv) && pHTTPHandler)
|
||||||
{
|
{
|
||||||
nsCAutoString userAgentString;
|
nsCAutoString userAgentString;
|
||||||
#ifdef MOZ_THUNDERBIRD
|
#ifdef MOZ_THUNDERBIRD
|
||||||
|
|
||||||
nsXPIDLCString userAgentOverride;
|
nsXPIDLCString userAgentOverride;
|
||||||
|
@ -479,36 +484,26 @@ RRT_HEADER:
|
||||||
// allow a user to override the default UA
|
// allow a user to override the default UA
|
||||||
if (!userAgentOverride)
|
if (!userAgentOverride)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIStringBundleService> stringService = do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv);
|
nsCOMPtr<nsIXULAppInfo> xulAppInfo (do_GetService(XULAPPINFO_SERVICE_CONTRACTID, &rv));
|
||||||
if (NS_SUCCEEDED(rv))
|
if (NS_SUCCEEDED(rv))
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIStringBundle> brandSringBundle;
|
xulAppInfo->GetName(userAgentString);
|
||||||
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));
|
|
||||||
|
|
||||||
nsCAutoString productSub;
|
nsCAutoString productSub;
|
||||||
pHTTPHandler->GetProductSub(productSub);
|
pHTTPHandler->GetProductSub(productSub);
|
||||||
|
|
||||||
nsCAutoString platform;
|
nsCAutoString platform;
|
||||||
pHTTPHandler->GetPlatform(platform);
|
pHTTPHandler->GetPlatform(platform);
|
||||||
|
|
||||||
// XXX: This may leave characters with the 8th bit set in the string, which
|
userAgentString += ' ';
|
||||||
// aren't allowed in header values. this should use some kind of encoding
|
userAgentString += NS_STRINGIFY(MOZ_APP_VERSION);
|
||||||
// for them
|
userAgentString += " (";
|
||||||
LossyCopyUTF16toASCII(brandName, userAgentString);
|
userAgentString += platform;
|
||||||
userAgentString += ' ';
|
userAgentString += "/";
|
||||||
userAgentString += NS_STRINGIFY(MOZ_APP_VERSION);
|
userAgentString += productSub;
|
||||||
userAgentString += " (";
|
userAgentString += ")";
|
||||||
userAgentString += platform;
|
}
|
||||||
userAgentString += "/";
|
}
|
||||||
userAgentString += productSub;
|
|
||||||
userAgentString += ")";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
userAgentString = userAgentOverride;
|
userAgentString = userAgentOverride;
|
||||||
#else
|
#else
|
||||||
|
|
Загрузка…
Ссылка в новой задаче