зеркало из https://github.com/mozilla/gecko-dev.git
Backing out tao's bug 44070 to see if it is the mega pageload regression culprit.
This commit is contained in:
Родитель
80bb49fd90
Коммит
1842d4cc10
|
@ -92,8 +92,6 @@ interface nsIChromeRegistry : nsISupports
|
|||
// Special additional APIs for locales only.
|
||||
void selectLocaleForProfile(in wstring localeName, in wstring profilePath);
|
||||
wstring getSelectedLocale(in wstring packageName);
|
||||
/* runtimeProvider == true: don't assert the runtime change */
|
||||
void setRuntimeProvider(in boolean runtimeProvider);
|
||||
|
||||
/* Installation APIs */
|
||||
void installSkin(in string baseURL, in boolean useProfile, in boolean allowScripts);
|
||||
|
|
|
@ -249,7 +249,6 @@ nsChromeRegistry::nsChromeRegistry()
|
|||
|
||||
mUseXBLForms = PR_FALSE;
|
||||
mBatchInstallFlushes = PR_FALSE;
|
||||
mRuntimeProvider = PR_FALSE;
|
||||
|
||||
nsCOMPtr<nsIPref> prefService(do_GetService(kPrefServiceCID));
|
||||
if (prefService)
|
||||
|
@ -1522,15 +1521,6 @@ NS_IMETHODIMP nsChromeRegistry::SelectLocaleForProfile(const PRUnichar *aLocale,
|
|||
return SetProvider(nsCAutoString("locale"), mSelectedLocale, aLocale, PR_TRUE, NS_ConvertUCS2toUTF8(aProfilePath).get(), PR_TRUE);
|
||||
}
|
||||
|
||||
/* void setRuntimeProvider (in boolean runtimeProvider); */
|
||||
// should we inline this one?
|
||||
NS_IMETHODIMP nsChromeRegistry::SetRuntimeProvider(PRBool runtimeProvider)
|
||||
{
|
||||
mRuntimeProvider = runtimeProvider;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
/* wstring getSelectedLocale (); */
|
||||
NS_IMETHODIMP nsChromeRegistry::GetSelectedLocale(const PRUnichar *aPackageName,
|
||||
PRUnichar **_retval)
|
||||
|
@ -1731,14 +1721,8 @@ nsChromeRegistry::SetProviderForPackage(const nsCString& aProvider,
|
|||
nsCOMPtr<nsIRDFRemoteDataSource> remote = do_QueryInterface(dataSource, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// add one more check:
|
||||
// assert the data source only when we are not setting runtime-only provider
|
||||
if (!mBatchInstallFlushes && !mRuntimeProvider)
|
||||
if (!mBatchInstallFlushes)
|
||||
rv = remote->Flush();
|
||||
|
||||
// always reset the flag
|
||||
mRuntimeProvider = PR_FALSE;
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
|
@ -188,7 +188,6 @@ protected:
|
|||
PRBool mProfileInitialized;
|
||||
|
||||
PRBool mUseXBLForms;
|
||||
PRBool mRuntimeProvider;
|
||||
|
||||
nsCString mProfileRoot;
|
||||
nsCString mInstallRoot;
|
||||
|
|
|
@ -547,7 +547,6 @@ pref("intl.charsetmenu.browser.cache.size", 5);
|
|||
pref("intl.charset.detector", "chrome://navigator/locale/navigator.properties");
|
||||
pref("intl.charset.default", "chrome://navigator-platform/locale/navigator.properties");
|
||||
pref("intl.content.langcode", "chrome://communicator-region/locale/region.properties");
|
||||
pref("intl.locale.matchOS", true);
|
||||
pref("font.language.group", "chrome://navigator/locale/navigator.properties");
|
||||
|
||||
// -- folders (Mac: these are binary aliases.)
|
||||
|
|
|
@ -92,8 +92,6 @@ interface nsIChromeRegistry : nsISupports
|
|||
// Special additional APIs for locales only.
|
||||
void selectLocaleForProfile(in wstring localeName, in wstring profilePath);
|
||||
wstring getSelectedLocale(in wstring packageName);
|
||||
/* runtimeProvider == true: don't assert the runtime change */
|
||||
void setRuntimeProvider(in boolean runtimeProvider);
|
||||
|
||||
/* Installation APIs */
|
||||
void installSkin(in string baseURL, in boolean useProfile, in boolean allowScripts);
|
||||
|
|
|
@ -249,7 +249,6 @@ nsChromeRegistry::nsChromeRegistry()
|
|||
|
||||
mUseXBLForms = PR_FALSE;
|
||||
mBatchInstallFlushes = PR_FALSE;
|
||||
mRuntimeProvider = PR_FALSE;
|
||||
|
||||
nsCOMPtr<nsIPref> prefService(do_GetService(kPrefServiceCID));
|
||||
if (prefService)
|
||||
|
@ -1522,15 +1521,6 @@ NS_IMETHODIMP nsChromeRegistry::SelectLocaleForProfile(const PRUnichar *aLocale,
|
|||
return SetProvider(nsCAutoString("locale"), mSelectedLocale, aLocale, PR_TRUE, NS_ConvertUCS2toUTF8(aProfilePath).get(), PR_TRUE);
|
||||
}
|
||||
|
||||
/* void setRuntimeProvider (in boolean runtimeProvider); */
|
||||
// should we inline this one?
|
||||
NS_IMETHODIMP nsChromeRegistry::SetRuntimeProvider(PRBool runtimeProvider)
|
||||
{
|
||||
mRuntimeProvider = runtimeProvider;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
/* wstring getSelectedLocale (); */
|
||||
NS_IMETHODIMP nsChromeRegistry::GetSelectedLocale(const PRUnichar *aPackageName,
|
||||
PRUnichar **_retval)
|
||||
|
@ -1731,14 +1721,8 @@ nsChromeRegistry::SetProviderForPackage(const nsCString& aProvider,
|
|||
nsCOMPtr<nsIRDFRemoteDataSource> remote = do_QueryInterface(dataSource, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// add one more check:
|
||||
// assert the data source only when we are not setting runtime-only provider
|
||||
if (!mBatchInstallFlushes && !mRuntimeProvider)
|
||||
if (!mBatchInstallFlushes)
|
||||
rv = remote->Flush();
|
||||
|
||||
// always reset the flag
|
||||
mRuntimeProvider = PR_FALSE;
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
|
@ -188,7 +188,6 @@ protected:
|
|||
PRBool mProfileInitialized;
|
||||
|
||||
PRBool mUseXBLForms;
|
||||
PRBool mRuntimeProvider;
|
||||
|
||||
nsCString mProfileRoot;
|
||||
nsCString mInstallRoot;
|
||||
|
|
|
@ -50,7 +50,6 @@ REQUIRES = xpcom \
|
|||
browser \
|
||||
docshell \
|
||||
uconv \
|
||||
locale \
|
||||
xremoteservice \
|
||||
$(NULL)
|
||||
# for jprof
|
||||
|
|
|
@ -43,7 +43,6 @@ REQUIRES = xpcom \
|
|||
gfx \
|
||||
intl \
|
||||
uconv \
|
||||
locale \
|
||||
profile \
|
||||
xpconnect \
|
||||
$(NULL)
|
||||
|
|
|
@ -43,7 +43,6 @@
|
|||
#include "nsIURI.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsIPref.h"
|
||||
#include "nsILocaleService.h"
|
||||
#include "plevent.h"
|
||||
#include "prmem.h"
|
||||
#include "prnetdb.h"
|
||||
|
@ -235,7 +234,6 @@ static nsresult InitializeProfileService(nsICmdLineService *cmdLineArgs);
|
|||
|
||||
// Install global locale if possible
|
||||
static nsresult InstallGlobalLocale(nsICmdLineService *cmdLineArgs);
|
||||
static nsresult getUILangCountry(nsAString& aUILang, nsAString& aCountry);
|
||||
|
||||
class stTSMCloser
|
||||
{
|
||||
|
@ -961,59 +959,11 @@ static nsresult Ensure1Window( nsICmdLineService* cmdLineArgs)
|
|||
return rv;
|
||||
}
|
||||
|
||||
// match OS locale
|
||||
static char kMatchOSLocalePref[] = "intl.locale.matchOS";
|
||||
|
||||
nsresult
|
||||
getCountry(const nsAString& lc_name, nsAString& aCountry)
|
||||
{
|
||||
|
||||
nsresult result = NS_OK;
|
||||
|
||||
PRInt32 dash = lc_name.FindChar('-');
|
||||
if (dash > 0)
|
||||
aCountry = Substring(lc_name, dash+1, lc_name.Length()-dash);
|
||||
else
|
||||
result = NS_ERROR_FAILURE;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static nsresult
|
||||
getUILangCountry(nsAString& aUILang, nsAString& aCountry)
|
||||
{
|
||||
nsresult result;
|
||||
// get a locale service
|
||||
nsCOMPtr<nsILocaleService> localeService = do_GetService(NS_LOCALESERVICE_CONTRACTID, &result);
|
||||
NS_ASSERTION(NS_SUCCEEDED(result),"getUILangCountry: get locale service failed");
|
||||
|
||||
nsXPIDLString uiLang;
|
||||
result = localeService->GetLocaleComponentForUserAgent(getter_Copies(uiLang));
|
||||
aUILang = uiLang;
|
||||
result = getCountry(aUILang, aCountry);
|
||||
return result;
|
||||
}
|
||||
|
||||
// update global locale if possible (in case when user-*.rdf can be updated)
|
||||
// so that any apps after this can be invoked in the UILocale and contentLocale
|
||||
static nsresult InstallGlobalLocale(nsICmdLineService *cmdLineArgs)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
// check the pref first
|
||||
nsCOMPtr<nsIPref> prefService(do_GetService("@mozilla.org/preferences;1"));
|
||||
PRBool matchOS = PR_FALSE;
|
||||
if (prefService)
|
||||
prefService->GetBoolPref(kMatchOSLocalePref, &matchOS);
|
||||
|
||||
// match os locale
|
||||
nsAutoString uiLang;
|
||||
nsAutoString country;
|
||||
if (matchOS) {
|
||||
// compute lang and region code only when needed!
|
||||
rv = getUILangCountry(uiLang, country);
|
||||
}
|
||||
|
||||
nsXPIDLCString cmdUI;
|
||||
rv = cmdLineArgs->GetCmdLineValue(UILOCALE_CMD_LINE_ARG, getter_Copies(cmdUI));
|
||||
if (NS_SUCCEEDED(rv)){
|
||||
|
@ -1025,15 +975,6 @@ static nsresult InstallGlobalLocale(nsICmdLineService *cmdLineArgs)
|
|||
rv = chromeRegistry->SelectLocale(UILocaleName.get(), PR_FALSE);
|
||||
}
|
||||
}
|
||||
// match OS when no cmdline override
|
||||
if (!cmdUI && matchOS) {
|
||||
nsCOMPtr<nsIChromeRegistry> chromeRegistry = do_GetService(kChromeRegistryCID, &rv);
|
||||
if (chromeRegistry) {
|
||||
chromeRegistry->SetRuntimeProvider(PR_TRUE);
|
||||
rv = chromeRegistry->SelectLocale(uiLang.get(), PR_FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
nsXPIDLCString cmdContent;
|
||||
rv = cmdLineArgs->GetCmdLineValue(CONTENTLOCALE_CMD_LINE_ARG, getter_Copies(cmdContent));
|
||||
if (NS_SUCCEEDED(rv)){
|
||||
|
@ -1045,15 +986,6 @@ static nsresult InstallGlobalLocale(nsICmdLineService *cmdLineArgs)
|
|||
rv = chromeRegistry->SelectLocale(ContentLocaleName.get(), PR_FALSE);
|
||||
}
|
||||
}
|
||||
// match OS when no cmdline override
|
||||
if (!cmdContent && matchOS) {
|
||||
nsCOMPtr<nsIChromeRegistry> chromeRegistry = do_GetService(kChromeRegistryCID, &rv);
|
||||
if (chromeRegistry) {
|
||||
chromeRegistry->SetRuntimeProvider(PR_TRUE);
|
||||
rv = chromeRegistry->SelectLocale(country.get(), PR_FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче