Skip to content

Commit

Permalink
Part 5 - Bug 951662 - when determining the update root dir look in SO…
Browse files Browse the repository at this point in the history
…FTWARE\Mozilla registry when APP_VENDOR is not defined. r=bbondy
  • Loading branch information
Robert Strong committed Jan 12, 2014
1 parent 820c1c6 commit a2bbb8f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion toolkit/xre/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ FINAL_LIBRARY = 'xul'
if CONFIG['MOZ_GL_DEFAULT_PROVIDER'] == 'GLX':
DEFINES['USE_GLX_TEST'] = True

for var in ('MOZ_APP_NAME', 'MOZ_APP_VERSION', 'OS_TARGET',
for var in ('MOZ_APP_NAME', 'MOZ_APP_BASENAME', 'MOZ_APP_VERSION', 'OS_TARGET',
'MOZ_WIDGET_TOOLKIT'):
DEFINES[var] = '"%s"' % CONFIG[var]

Expand Down
13 changes: 8 additions & 5 deletions toolkit/xre/nsXREDirProvider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1001,14 +1001,17 @@ nsXREDirProvider::GetUpdateRootDir(nsIFile* *aResult)

nsAutoString pathHash;
bool pathHashResult = false;
bool hasVendor = gAppData->vendor && strlen(gAppData->vendor) != 0;

nsAutoString appDirPath;
if (gAppData->vendor && SUCCEEDED(updRoot->GetPath(appDirPath))) {
if (SUCCEEDED(updRoot->GetPath(appDirPath))) {

// Figure out where we should check for a cached hash value
// Figure out where we should check for a cached hash value. If the
// application doesn't have the nsXREAppData vendor value defined check
// under SOFTWARE\Mozilla.
wchar_t regPath[1024] = { L'\0' };
swprintf_s(regPath, mozilla::ArrayLength(regPath), L"SOFTWARE\\%S\\%S\\TaskBarIDs",
gAppData->vendor, MOZ_APP_NAME);
(hasVendor ? gAppData->vendor : "Mozilla"), MOZ_APP_BASENAME);

// If we pre-computed the hash, grab it from the registry.
pathHashResult = GetCachedHash(HKEY_LOCAL_MACHINE,
Expand All @@ -1027,9 +1030,9 @@ nsXREDirProvider::GetUpdateRootDir(nsIFile* *aResult)
// shared update directory for different apps run from the same path (like
// Metro & Desktop).
nsCOMPtr<nsIFile> localDir;
if (pathHashResult && (gAppData->vendor || gAppData->name) &&
if (pathHashResult && (hasVendor || gAppData->name) &&
NS_SUCCEEDED(GetUserDataDirectoryHome(getter_AddRefs(localDir), true)) &&
NS_SUCCEEDED(localDir->AppendNative(nsDependentCString(gAppData->vendor ?
NS_SUCCEEDED(localDir->AppendNative(nsDependentCString(hasVendor ?
gAppData->vendor : gAppData->name))) &&
NS_SUCCEEDED(localDir->Append(NS_LITERAL_STRING("updates"))) &&
NS_SUCCEEDED(localDir->Append(pathHash))) {
Expand Down

0 comments on commit a2bbb8f

Please sign in to comment.