mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-08 12:22:34 +00:00
Bug 796038 - Default browser prompt shows even after setting defaults for Firefox from control panel. r=jimm
This commit is contained in:
parent
d8fd0ebc3f
commit
bc54f19d39
@ -319,6 +319,41 @@ IsWin8OrLater()
|
||||
osInfo.dwMajorVersion >= 6 && osInfo.dwMinorVersion >= 2;
|
||||
}
|
||||
|
||||
static bool
|
||||
IsAARDefaultHTTP(IApplicationAssociationRegistration* pAAR,
|
||||
bool* aIsDefaultBrowser)
|
||||
{
|
||||
// Make sure the Prog ID matches what we have
|
||||
LPWSTR registeredApp;
|
||||
HRESULT hr = pAAR->QueryCurrentDefault(L"http", AT_URLPROTOCOL, AL_EFFECTIVE,
|
||||
®isteredApp);
|
||||
if (SUCCEEDED(hr)) {
|
||||
LPCWSTR firefoxHTTPProgID = L"FirefoxURL";
|
||||
*aIsDefaultBrowser = !wcsicmp(registeredApp, firefoxHTTPProgID);
|
||||
CoTaskMemFree(registeredApp);
|
||||
} else {
|
||||
*aIsDefaultBrowser = false;
|
||||
}
|
||||
return SUCCEEDED(hr);
|
||||
}
|
||||
|
||||
static bool
|
||||
IsAARDefaultHTML(IApplicationAssociationRegistration* pAAR,
|
||||
bool* aIsDefaultBrowser)
|
||||
{
|
||||
LPWSTR registeredApp;
|
||||
HRESULT hr = pAAR->QueryCurrentDefault(L".html", AT_FILEEXTENSION, AL_EFFECTIVE,
|
||||
®isteredApp);
|
||||
if (SUCCEEDED(hr)) {
|
||||
LPCWSTR firefoxHTMLProgID = L"FirefoxHTML";
|
||||
*aIsDefaultBrowser = !wcsicmp(registeredApp, firefoxHTMLProgID);
|
||||
CoTaskMemFree(registeredApp);
|
||||
} else {
|
||||
*aIsDefaultBrowser = false;
|
||||
}
|
||||
return SUCCEEDED(hr);
|
||||
}
|
||||
|
||||
bool
|
||||
nsWindowsShellService::IsDefaultBrowserVista(bool aCheckAllTypes,
|
||||
bool* aIsDefaultBrowser)
|
||||
@ -331,40 +366,23 @@ nsWindowsShellService::IsDefaultBrowserVista(bool aCheckAllTypes,
|
||||
(void**)&pAAR);
|
||||
|
||||
if (SUCCEEDED(hr)) {
|
||||
BOOL res;
|
||||
hr = pAAR->QueryAppIsDefaultAll(AL_EFFECTIVE,
|
||||
APP_REG_NAME,
|
||||
&res);
|
||||
*aIsDefaultBrowser = res;
|
||||
if (aCheckAllTypes) {
|
||||
BOOL res;
|
||||
hr = pAAR->QueryAppIsDefaultAll(AL_EFFECTIVE,
|
||||
APP_REG_NAME,
|
||||
&res);
|
||||
*aIsDefaultBrowser = res;
|
||||
|
||||
if (*aIsDefaultBrowser && IsWin8OrLater()) {
|
||||
// Make sure the Prog ID matches what we have
|
||||
LPWSTR registeredApp;
|
||||
hr = pAAR->QueryCurrentDefault(L"http", AT_URLPROTOCOL, AL_EFFECTIVE,
|
||||
®isteredApp);
|
||||
if (SUCCEEDED(hr)) {
|
||||
LPCWSTR firefoxHTTPProgID = L"FirefoxURL";
|
||||
*aIsDefaultBrowser = !wcsicmp(registeredApp, firefoxHTTPProgID);
|
||||
CoTaskMemFree(registeredApp);
|
||||
} else {
|
||||
*aIsDefaultBrowser = false;
|
||||
}
|
||||
// If this is a startup check, then we don't check file type
|
||||
// associations. This is because the win8 UI for file type
|
||||
// association has to be done through the control panel. If this
|
||||
// is not a startup check, then we're checking through the control
|
||||
// panel and we should also check for file type association.
|
||||
if (aCheckAllTypes && *aIsDefaultBrowser) {
|
||||
hr = pAAR->QueryCurrentDefault(L".html", AT_FILEEXTENSION, AL_EFFECTIVE,
|
||||
®isteredApp);
|
||||
if (SUCCEEDED(hr)) {
|
||||
LPCWSTR firefoxHTMLProgID = L"FirefoxHTML";
|
||||
*aIsDefaultBrowser = !wcsicmp(registeredApp, firefoxHTMLProgID);
|
||||
CoTaskMemFree(registeredApp);
|
||||
} else {
|
||||
*aIsDefaultBrowser = false;
|
||||
// If we have all defaults, let's make sure that our ProgID
|
||||
// is explicitly returned as well. Needed only for Windows 8.
|
||||
if (*aIsDefaultBrowser && IsWin8OrLater()) {
|
||||
IsAARDefaultHTTP(pAAR, aIsDefaultBrowser);
|
||||
if (*aIsDefaultBrowser) {
|
||||
IsAARDefaultHTML(pAAR, aIsDefaultBrowser);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
IsAARDefaultHTTP(pAAR, aIsDefaultBrowser);
|
||||
}
|
||||
|
||||
pAAR->Release();
|
||||
@ -384,6 +402,13 @@ 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;
|
||||
@ -463,7 +488,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(aForAllTypes, aIsDefaultBrowser);
|
||||
IsDefaultBrowserVista(true, aIsDefaultBrowser);
|
||||
}
|
||||
|
||||
// To handle the case where DDE isn't disabled due for a user because there
|
||||
|
Loading…
Reference in New Issue
Block a user