Bug 889687 - Nightly doesn't show default browser prompt when release is default. r=jimm

This commit is contained in:
Brian R. Bondy 2013-09-13 11:30:20 -07:00
parent 7c054b34d0
commit 0e576aa0ee

View File

@ -160,8 +160,12 @@ typedef struct {
// more info. The FTP protocol is not checked so advanced users can set the FTP
// handler to another application and still have Firefox check if it is the
// default HTTP and HTTPS handler.
// *** Do not add additional checks here unless you skip them when aForAllTypes
// is false below***.
static SETTING gSettings[] = {
// File Handler Class
// ***keep this as the first entry because when aForAllTypes is not set below
// it will skip over this check.***
{ MAKE_KEY_NAME1("FirefoxHTML", SOC), VAL_OPEN, OLD_VAL_OPEN },
// Protocol Handler Class - for Vista and above
@ -355,6 +359,12 @@ IsAARDefaultHTML(IApplicationAssociationRegistration* pAAR,
return SUCCEEDED(hr);
}
/*
* Query's the AAR for the default status.
* This only checks for FirefoxURL and if aCheckAllTypes is set, then
* it also checks for FirefoxHTML. Note that those ProgIDs are shared
* by all Firefox browsers.
*/
bool
nsWindowsShellService::IsDefaultBrowserVista(bool aCheckAllTypes,
bool* aIsDefaultBrowser)
@ -403,13 +413,6 @@ nsWindowsShellService::IsDefaultBrowser(bool aStartupCheck,
if (aStartupCheck)
mCheckedThisSession = true;
// Check if we only care about a lightweight check, and make sure this
// only has an effect on Win8 and later.
if (!aForAllTypes && IsWin8OrLater()) {
return IsDefaultBrowserVista(false,
aIsDefaultBrowser) ? NS_OK : NS_ERROR_FAILURE;
}
// Assume we're the default unless one of the several checks below tell us
// otherwise.
*aIsDefaultBrowser = true;
@ -430,10 +433,15 @@ nsWindowsShellService::IsDefaultBrowser(bool aStartupCheck,
nsresult rv;
PRUnichar currValue[MAX_BUF];
SETTING* settings;
SETTING* settings = gSettings;
if (!aForAllTypes && IsWin8OrLater()) {
// Skip over the file handler check
settings++;
}
SETTING* end = gSettings + sizeof(gSettings) / sizeof(SETTING);
for (settings = gSettings; settings < end; ++settings) {
for (; settings < end; ++settings) {
NS_ConvertUTF8toUTF16 keyName(settings->keyName);
NS_ConvertUTF8toUTF16 valueData(settings->valueData);
int32_t offset = valueData.Find("%APPPATH%");
@ -490,7 +498,7 @@ nsWindowsShellService::IsDefaultBrowser(bool aStartupCheck,
// Only check if Firefox is the default browser on Vista and above if the
// previous checks show that Firefox is the default browser.
if (*aIsDefaultBrowser) {
IsDefaultBrowserVista(true, aIsDefaultBrowser);
IsDefaultBrowserVista(aForAllTypes, aIsDefaultBrowser);
}
// To handle the case where DDE isn't disabled due for a user because there
@ -498,7 +506,7 @@ nsWindowsShellService::IsDefaultBrowser(bool aStartupCheck,
// default browser and if dde is disabled for each handler
// and if it isn't disable it. When Firefox is not the default browser the
// helper application will disable dde for each handler.
if (*aIsDefaultBrowser) {
if (*aIsDefaultBrowser && aForAllTypes) {
// Check ftp settings
end = gDDESettings + sizeof(gDDESettings) / sizeof(SETTING);
@ -607,27 +615,27 @@ DynSHOpenWithDialog(HWND hwndParent, const OPENASINFO *poainfo)
{
typedef HRESULT (WINAPI * SHOpenWithDialogPtr)(HWND hwndParent,
const OPENASINFO *poainfo);
static SHOpenWithDialogPtr SHOpenWithDialogFn = nullptr;
if (!SHOpenWithDialogFn) {
// shell32.dll is in the knownDLLs list so will always be loaded from the
// system32 directory.
static const PRUnichar kSehllLibraryName[] = L"shell32.dll";
HMODULE shellDLL = ::LoadLibraryW(kSehllLibraryName);
if (!shellDLL) {
return NS_ERROR_FAILURE;
}
SHOpenWithDialogFn =
(SHOpenWithDialogPtr)GetProcAddress(shellDLL, "SHOpenWithDialog");
FreeLibrary(shellDLL);
if (!SHOpenWithDialogFn) {
return NS_ERROR_FAILURE;
}
// shell32.dll is in the knownDLLs list so will always be loaded from the
// system32 directory.
static const PRUnichar kSehllLibraryName[] = L"shell32.dll";
HMODULE shellDLL = ::LoadLibraryW(kSehllLibraryName);
if (!shellDLL) {
return NS_ERROR_FAILURE;
}
return SUCCEEDED(SHOpenWithDialogFn(hwndParent, poainfo)) ? NS_OK :
NS_ERROR_FAILURE;
SHOpenWithDialogPtr SHOpenWithDialogFn =
(SHOpenWithDialogPtr)GetProcAddress(shellDLL, "SHOpenWithDialog");
if (!SHOpenWithDialogFn) {
return NS_ERROR_FAILURE;
}
nsresult rv =
SUCCEEDED(SHOpenWithDialogFn(hwndParent, poainfo)) ? NS_OK :
NS_ERROR_FAILURE;
FreeLibrary(shellDLL);
return rv;
}
nsresult