зеркало из https://github.com/mozilla/gecko-dev.git
Bug #116159 --> don't create the prefs service on the imap thread in order to read out the language accept
pref. Read it ahead of time while we are on the UI thread and remember it for later. r=bienvenu rs=sspitzer
This commit is contained in:
Родитель
4e37323693
Коммит
cf1f250fc9
|
@ -214,6 +214,7 @@ nsresult nsImapProtocol::GlobalInitialization()
|
||||||
prefs->GetIntPref("mail.imap.noop_check_count", &gPromoteNoopToCheckCount);
|
prefs->GetIntPref("mail.imap.noop_check_count", &gPromoteNoopToCheckCount);
|
||||||
prefs->GetBoolPref("mail.imap.use_envelope_cmd",
|
prefs->GetBoolPref("mail.imap.use_envelope_cmd",
|
||||||
&gUseEnvelopeCmd);
|
&gUseEnvelopeCmd);
|
||||||
|
prefs->GetLocalizedUnicharPref("intl.accept_languages", getter_Copies(mAcceptLanguages));
|
||||||
}
|
}
|
||||||
gInitialized = PR_TRUE;
|
gInitialized = PR_TRUE;
|
||||||
return rv;
|
return rv;
|
||||||
|
@ -4369,17 +4370,13 @@ void nsImapProtocol::Language()
|
||||||
|
|
||||||
// extract the desired language attribute from prefs
|
// extract the desired language attribute from prefs
|
||||||
nsresult rv = NS_OK;
|
nsresult rv = NS_OK;
|
||||||
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefCID, &rv));
|
|
||||||
nsXPIDLString acceptLanguages;
|
|
||||||
if (NS_SUCCEEDED(rv) && prefs)
|
|
||||||
prefs->GetLocalizedUnicharPref("intl.accept_languages", getter_Copies(acceptLanguages));
|
|
||||||
|
|
||||||
// we need to parse out the first language out of this comma separated list....
|
// we need to parse out the first language out of this comma separated list....
|
||||||
// i.e if we have en,ja we only want to send en to the server.
|
// i.e if we have en,ja we only want to send en to the server.
|
||||||
if (acceptLanguages)
|
if (mAcceptLanguages.get())
|
||||||
{
|
{
|
||||||
nsCAutoString extractedLanguage;
|
nsCAutoString extractedLanguage;
|
||||||
extractedLanguage.AssignWithConversion(acceptLanguages);
|
extractedLanguage.AssignWithConversion(mAcceptLanguages.get());
|
||||||
PRInt32 pos = extractedLanguage.FindChar(',', PR_TRUE);
|
PRInt32 pos = extractedLanguage.FindChar(',', PR_TRUE);
|
||||||
if (pos > 0) // we have a comma separated list of languages...
|
if (pos > 0) // we have a comma separated list of languages...
|
||||||
extractedLanguage.Truncate(pos); // truncate everything after the first comma (including the comma)
|
extractedLanguage.Truncate(pos); // truncate everything after the first comma (including the comma)
|
||||||
|
|
|
@ -554,6 +554,8 @@ private:
|
||||||
nsCString m_logonCookie;
|
nsCString m_logonCookie;
|
||||||
PRInt16 m_logonPort;
|
PRInt16 m_logonPort;
|
||||||
|
|
||||||
|
nsXPIDLString mAcceptLanguages;
|
||||||
|
|
||||||
// progress stuff
|
// progress stuff
|
||||||
void SetProgressString(PRInt32 stringId);
|
void SetProgressString(PRInt32 stringId);
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче