зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1024110 - Change Aurora's default profile behavior to use channel-specific profiles. r=bsmedberg f=gavin,markh
This commit is contained in:
Родитель
9cb926f013
Коммит
a770ad057a
|
@ -23,7 +23,7 @@ def main(file):
|
|||
appdata = dict(("%s:%s" % (s, o), config.get(s, o)) for s in config.sections() for o in config.options(s))
|
||||
appdata['flags'] = ' | '.join(flags) if flags else '0'
|
||||
appdata['App:profile'] = '"%s"' % appdata['App:profile'] if 'App:profile' in appdata else 'NULL'
|
||||
expected = ('App:vendor', 'App:name', 'App:version', 'App:buildid',
|
||||
expected = ('App:vendor', 'App:name', 'App:remotingname', 'App:version', 'App:buildid',
|
||||
'App:id', 'Gecko:minversion', 'Gecko:maxversion')
|
||||
missing = [var for var in expected if var not in appdata]
|
||||
if missing:
|
||||
|
@ -40,6 +40,7 @@ def main(file):
|
|||
NULL, // directory
|
||||
"%(App:vendor)s",
|
||||
"%(App:name)s",
|
||||
"%(App:remotingname)s",
|
||||
"%(App:version)s",
|
||||
"%(App:buildid)s",
|
||||
"%(App:id)s",
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
[App]
|
||||
Vendor=@MOZ_APP_VENDOR@
|
||||
Name=@MOZ_APP_BASENAME@
|
||||
RemotingName=@MOZ_APP_REMOTINGNAME@
|
||||
#ifdef MOZ_APP_DISPLAYNAME
|
||||
CodeName=@MOZ_APP_DISPLAYNAME@
|
||||
#endif
|
||||
|
|
|
@ -27,7 +27,7 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
|
|||
|
||||
for var in ('GRE_MILESTONE', 'MOZ_APP_VERSION', 'MOZ_APP_BASENAME',
|
||||
'MOZ_APP_VENDOR', 'MOZ_APP_ID', 'MAR_CHANNEL_ID',
|
||||
'ACCEPTED_MAR_CHANNEL_IDS'):
|
||||
'ACCEPTED_MAR_CHANNEL_IDS', 'MOZ_APP_REMOTINGNAME'):
|
||||
DEFINES[var] = CONFIG[var]
|
||||
|
||||
if CONFIG['MOZ_APP_DISPLAYNAME'] != CONFIG['MOZ_APP_BASENAME']:
|
||||
|
|
12
configure.in
12
configure.in
|
@ -8683,6 +8683,8 @@ AC_SUBST(MOZ_CHILD_PROCESS_BUNDLE)
|
|||
# - MOZ_APP_VERSION: Defines the application version number.
|
||||
# - MOZ_APP_NAME: Used for e.g. the binary program file name. If not set,
|
||||
# defaults to a lowercase form of MOZ_APP_BASENAME.
|
||||
# - MOZ_APP_REMOTINGNAME: Used for the internal program name, which affects
|
||||
# profile name and remoting. If not set, defaults to MOZ_APP_NAME.
|
||||
# - MOZ_APP_PROFILE: When set, used for application.ini's
|
||||
# "Profile" field, which controls profile location.
|
||||
# - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
|
||||
|
@ -8693,6 +8695,10 @@ if test -z "$MOZ_APP_NAME"; then
|
|||
MOZ_APP_NAME=`echo $MOZ_APP_BASENAME | tr A-Z a-z`
|
||||
fi
|
||||
|
||||
if test -z "$MOZ_APP_REMOTINGNAME"; then
|
||||
MOZ_APP_REMOTINGNAME=$MOZ_APP_NAME
|
||||
fi
|
||||
|
||||
# For extensions and langpacks, we require a max version that is compatible
|
||||
# across security releases. MOZ_APP_MAXVERSION is our method for doing that.
|
||||
# 24.0a1 and 24.0a2 aren't affected
|
||||
|
@ -8712,6 +8718,7 @@ AC_DEFINE_UNQUOTED(MOZ_B2G_VERSION,"$MOZ_B2G_VERSION")
|
|||
AC_DEFINE_UNQUOTED(MOZ_B2G_OS_NAME,"$MOZ_B2G_OS_NAME")
|
||||
|
||||
AC_SUBST(MOZ_APP_NAME)
|
||||
AC_SUBST(MOZ_APP_REMOTINGNAME)
|
||||
AC_SUBST(MOZ_APP_DISPLAYNAME)
|
||||
AC_SUBST(MOZ_APP_BASENAME)
|
||||
AC_SUBST(MOZ_APP_VENDOR)
|
||||
|
@ -9004,6 +9011,10 @@ if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK" ; then
|
|||
AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
|
||||
fi
|
||||
|
||||
if test "$MOZ_UPDATE_CHANNEL" = "aurora"; then
|
||||
AC_DEFINE(MOZ_DEV_EDITION)
|
||||
fi
|
||||
|
||||
if test "$MOZ_DEBUG"; then
|
||||
A11Y_LOG=1
|
||||
fi
|
||||
|
@ -9308,6 +9319,7 @@ export MOZ_NATIVE_ZLIB
|
|||
export MOZ_ZLIB_CFLAGS
|
||||
export MOZ_ZLIB_LIBS
|
||||
export MOZ_APP_NAME
|
||||
export MOZ_APP_REMOTINGNAME
|
||||
export DONT_POPULATE_VIRTUALENV=1
|
||||
export PYTHON
|
||||
export MOZILLA_CENTRAL_PATH=$_topsrcdir
|
||||
|
|
|
@ -18,8 +18,20 @@ interface nsIToolkitProfileService : nsISupports
|
|||
|
||||
readonly attribute nsISimpleEnumerator /*nsIToolkitProfile*/ profiles;
|
||||
|
||||
/**
|
||||
* The currently selected profile (the one used or about to be used by the
|
||||
* browser).
|
||||
*/
|
||||
attribute nsIToolkitProfile selectedProfile;
|
||||
|
||||
/**
|
||||
* The default profile (the one used or about to be used by the
|
||||
* browser if no other profile is specified at runtime). This is the profile
|
||||
* marked with Default=1 in profiles.ini and is usually the same as
|
||||
* selectedProfile, except on Developer Edition.
|
||||
*/
|
||||
attribute nsIToolkitProfile defaultProfile;
|
||||
|
||||
/**
|
||||
* Get a profile by name. This is mainly for use by the -P
|
||||
* commandline flag.
|
||||
|
|
|
@ -139,6 +139,7 @@ private:
|
|||
|
||||
nsRefPtr<nsToolkitProfile> mFirst;
|
||||
nsCOMPtr<nsIToolkitProfile> mChosen;
|
||||
nsCOMPtr<nsIToolkitProfile> mDefault;
|
||||
nsCOMPtr<nsIFile> mAppData;
|
||||
nsCOMPtr<nsIFile> mTempData;
|
||||
nsCOMPtr<nsIFile> mListFile;
|
||||
|
@ -424,6 +425,7 @@ nsToolkitProfileService::Init()
|
|||
nsToolkitProfile* currentProfile = nullptr;
|
||||
|
||||
unsigned int c = 0;
|
||||
bool foundAuroraDefault = false;
|
||||
for (c = 0; true; ++c) {
|
||||
nsAutoCString profileID("Profile");
|
||||
profileID.AppendInt(c);
|
||||
|
@ -441,7 +443,9 @@ nsToolkitProfileService::Init()
|
|||
continue;
|
||||
}
|
||||
|
||||
rv = parser.GetString(profileID.get(), "Name", buffer);
|
||||
nsAutoCString name;
|
||||
|
||||
rv = parser.GetString(profileID.get(), "Name", name);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_ERROR("Malformed profiles.ini: Name= not found");
|
||||
continue;
|
||||
|
@ -470,15 +474,48 @@ nsToolkitProfileService::Init()
|
|||
localDir = rootDir;
|
||||
}
|
||||
|
||||
currentProfile = new nsToolkitProfile(buffer,
|
||||
currentProfile = new nsToolkitProfile(name,
|
||||
rootDir, localDir,
|
||||
currentProfile, false);
|
||||
NS_ENSURE_TRUE(currentProfile, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
rv = parser.GetString(profileID.get(), "Default", buffer);
|
||||
if (NS_SUCCEEDED(rv) && buffer.EqualsLiteral("1"))
|
||||
if (NS_SUCCEEDED(rv) && buffer.EqualsLiteral("1") && !foundAuroraDefault) {
|
||||
mChosen = currentProfile;
|
||||
this->SetDefaultProfile(currentProfile);
|
||||
}
|
||||
#ifdef MOZ_DEV_EDITION
|
||||
// Use the dev-edition-default profile if this is an Aurora build.
|
||||
if (name.EqualsLiteral("dev-edition-default")) {
|
||||
mChosen = currentProfile;
|
||||
foundAuroraDefault = true;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef MOZ_DEV_EDITION
|
||||
// Check if we are running Firefox, as we don't want to create a profile
|
||||
// on webapprt.
|
||||
bool isFirefox = strcmp(gAppData->ID,
|
||||
"{ec8030f7-c20a-464f-9b0e-13a3a9e97384}") == 0;
|
||||
if (!foundAuroraDefault && isFirefox) {
|
||||
// If a single profile exists, it may not be already marked as default.
|
||||
// Do it now to avoid problems when we create the dev-edition-default profile.
|
||||
if (!mChosen && mFirst && !mFirst->mNext)
|
||||
this->SetDefaultProfile(mFirst);
|
||||
|
||||
// Create a default profile for aurora, if none was found.
|
||||
nsCOMPtr<nsIToolkitProfile> profile;
|
||||
rv = CreateProfile(nullptr,
|
||||
NS_LITERAL_CSTRING("dev-edition-default"),
|
||||
getter_AddRefs(profile));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
mChosen = profile;
|
||||
rv = Flush();
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!mChosen && mFirst && !mFirst->mNext) // only one profile
|
||||
mChosen = mFirst;
|
||||
return NS_OK;
|
||||
|
@ -569,6 +606,25 @@ nsToolkitProfileService::SetSelectedProfile(nsIToolkitProfile* aProfile)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsToolkitProfileService::GetDefaultProfile(nsIToolkitProfile* *aResult)
|
||||
{
|
||||
if (!mDefault) return NS_ERROR_FAILURE;
|
||||
|
||||
NS_ADDREF(*aResult = mDefault);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsToolkitProfileService::SetDefaultProfile(nsIToolkitProfile* aProfile)
|
||||
{
|
||||
if (mDefault != aProfile) {
|
||||
mDefault = aProfile;
|
||||
mDirty = true;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsToolkitProfileService::GetProfileByName(const nsACString& aName,
|
||||
nsIToolkitProfile* *aResult)
|
||||
|
@ -932,7 +988,9 @@ nsToolkitProfileService::Flush()
|
|||
pCount, cur->mName.get(),
|
||||
isRelative ? "1" : "0", path.get());
|
||||
|
||||
if (mChosen == cur) {
|
||||
nsCOMPtr<nsIToolkitProfile> profile;
|
||||
rv = this->GetDefaultProfile(getter_AddRefs(profile));
|
||||
if (NS_SUCCEEDED(rv) && profile == cur) {
|
||||
end += sprintf(end, "Default=1\n");
|
||||
}
|
||||
|
||||
|
|
|
@ -101,13 +101,14 @@ XRE_ParseAppData(nsIFile* aINIFile, nsXREAppData *aAppData)
|
|||
nsCString str;
|
||||
|
||||
ReadString strings[] = {
|
||||
{ "App", "Vendor", &aAppData->vendor },
|
||||
{ "App", "Name", &aAppData->name },
|
||||
{ "App", "Version", &aAppData->version },
|
||||
{ "App", "BuildID", &aAppData->buildID },
|
||||
{ "App", "ID", &aAppData->ID },
|
||||
{ "App", "Copyright", &aAppData->copyright },
|
||||
{ "App", "Profile", &aAppData->profile },
|
||||
{ "App", "Vendor", &aAppData->vendor },
|
||||
{ "App", "Name", &aAppData->name },
|
||||
{ "App", "RemotingName", &aAppData->remotingName },
|
||||
{ "App", "Version", &aAppData->version },
|
||||
{ "App", "BuildID", &aAppData->buildID },
|
||||
{ "App", "ID", &aAppData->ID },
|
||||
{ "App", "Copyright", &aAppData->copyright },
|
||||
{ "App", "Profile", &aAppData->profile },
|
||||
{ nullptr }
|
||||
};
|
||||
ReadStrings(parser, strings);
|
||||
|
|
|
@ -1594,7 +1594,7 @@ RemoteCommandLine(const char* aDesktopStartupID)
|
|||
nsresult rv;
|
||||
ArgResult ar;
|
||||
|
||||
nsAutoCString program(gAppData->name);
|
||||
nsAutoCString program(gAppData->remotingName);
|
||||
ToLowerCase(program);
|
||||
const char *username = getenv("LOGNAME");
|
||||
|
||||
|
@ -4078,7 +4078,7 @@ XREMain::XRE_mainRun()
|
|||
if (!mDisableRemote)
|
||||
mRemoteService = do_GetService("@mozilla.org/toolkit/remote-service;1");
|
||||
if (mRemoteService)
|
||||
mRemoteService->Startup(mAppData->name, mProfileName.get());
|
||||
mRemoteService->Startup(mAppData->remotingName, mProfileName.get());
|
||||
#endif /* MOZ_ENABLE_XREMOTE */
|
||||
|
||||
mNativeApp->Enable();
|
||||
|
@ -4126,6 +4126,9 @@ XREMain::XRE_main(int argc, char* argv[], const nsXREAppData* aAppData)
|
|||
mAppData = new ScopedAppData(aAppData);
|
||||
if (!mAppData)
|
||||
return 1;
|
||||
if (!mAppData->remotingName) {
|
||||
SetAllocatedString(mAppData->remotingName, mAppData->name);
|
||||
}
|
||||
// used throughout this file
|
||||
gAppData = mAppData;
|
||||
|
||||
|
|
|
@ -484,7 +484,7 @@ struct MessageWindow {
|
|||
::_snwprintf(classNameBuffer,
|
||||
128, // size of classNameBuffer in PRUnichars
|
||||
L"%s%s",
|
||||
NS_ConvertUTF8toUTF16(gAppData->name).get(),
|
||||
NS_ConvertUTF8toUTF16(gAppData->remotingName).get(),
|
||||
L"MessageWindow" );
|
||||
mClassName = classNameBuffer;
|
||||
}
|
||||
|
|
|
@ -46,6 +46,13 @@ struct nsXREAppData
|
|||
*/
|
||||
const char* name;
|
||||
|
||||
/**
|
||||
* The internal name of the application for remoting purposes. When left
|
||||
* unspecified, "name" is used instead. This must be ASCII, and is normally
|
||||
* lowercase, e.g. "firefox". Optional (may be null but not an empty string).
|
||||
*/
|
||||
const char* remotingName;
|
||||
|
||||
/**
|
||||
* The major version, e.g. "0.8.0+". Optional (may be null), but
|
||||
* required for advanced application features such as the extension
|
||||
|
|
|
@ -43,6 +43,7 @@ ScopedAppData::ScopedAppData(const nsXREAppData* aAppData)
|
|||
|
||||
SetAllocatedString(this->vendor, aAppData->vendor);
|
||||
SetAllocatedString(this->name, aAppData->name);
|
||||
SetAllocatedString(this->remotingName, aAppData->remotingName);
|
||||
SetAllocatedString(this->version, aAppData->version);
|
||||
SetAllocatedString(this->buildID, aAppData->buildID);
|
||||
SetAllocatedString(this->ID, aAppData->ID);
|
||||
|
@ -70,6 +71,7 @@ ScopedAppData::~ScopedAppData()
|
|||
{
|
||||
SetAllocatedString(this->vendor, nullptr);
|
||||
SetAllocatedString(this->name, nullptr);
|
||||
SetAllocatedString(this->remotingName, nullptr);
|
||||
SetAllocatedString(this->version, nullptr);
|
||||
SetAllocatedString(this->buildID, nullptr);
|
||||
SetAllocatedString(this->ID, nullptr);
|
||||
|
|
Загрузка…
Ссылка в новой задаче