Backed out changeset 5b0aa267bc53 (bug 1324617) for Windows build bustage (warning in CityHash.h). r=backout on a CLOSED TREE

This commit is contained in:
Sebastian Hengst
2017-01-30 23:20:01 +01:00
parent f050b5647d
commit d4e7bbfbf9
7 changed files with 217 additions and 239 deletions

View File

@@ -30,12 +30,8 @@ XPIDL_MODULE = 'shellservice'
if CONFIG['OS_ARCH'] == 'WINNT':
SOURCES += [
'../../../other-licenses/nsis/Contrib/CityHash/cityhash/city.cpp',
'nsWindowsShellService.cpp',
]
LOCAL_INCLUDES += [
'../../../other-licenses/nsis/Contrib/CityHash/cityhash',
]
elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
SOURCES += [
'nsMacShellService.cpp',

View File

@@ -5,7 +5,6 @@
#include "nsWindowsShellService.h"
#include "city.h"
#include "imgIContainer.h"
#include "imgIRequest.h"
#include "mozilla/gfx/2D.h"
@@ -97,29 +96,24 @@ OpenKeyForReading(HKEY aKeyRoot, const nsAString& aKeyName, HKEY* aKey)
// The setting of these values are made by an external binary since writing
// these values may require elevation.
//
// To allow multiple installations to coexist, identifiers written to the
// registry include a hash of the installation path. This is referred to as
// <PathHash> in the tables below.
//
// - File Extension Mappings
// -----------------------
// The following file extensions:
// .htm .html .shtml .xht .xhtml
// are mapped like so:
//
// HKCU\SOFTWARE\Classes\.<ext>\ (default) REG_SZ FirefoxHTML-<PathHash>
// HKCU\SOFTWARE\Classes\.<ext>\ (default) REG_SZ FirefoxHTML
//
// as aliases to the class:
//
// HKCU\SOFTWARE\Classes\FirefoxHTML-<PathHash>\
// HKCU\SOFTWARE\Classes\FirefoxHTML\
// DefaultIcon (default) REG_SZ <apppath>,1
// shell\open\command (default) REG_SZ <apppath> -osint -url "%1"
// shell\open\ddeexec (default) REG_SZ <empty string>
//
// - Windows Vista and above Protocol Handler
//
// HKCU\SOFTWARE\Classes\FirefoxURL-<PathHash>\
// (default) REG_SZ <appname> URL
// HKCU\SOFTWARE\Classes\FirefoxURL\ (default) REG_SZ <appname> URL
// EditFlags REG_DWORD 2
// FriendlyTypeName REG_SZ <appname> URL
// DefaultIcon (default) REG_SZ <apppath>,1
@@ -142,7 +136,7 @@ OpenKeyForReading(HKEY aKeyRoot, const nsAString& aKeyName, HKEY* aKey)
// The following keys are set to make Firefox appear in the Start Menu as the
// browser:
//
// HKCU\SOFTWARE\Clients\StartMenuInternet\<appname>-<PathHash>\
// HKCU\SOFTWARE\Clients\StartMenuInternet\FIREFOX.EXE\
// (default) REG_SZ <appname>
// DefaultIcon (default) REG_SZ <apppath>,0
// InstallInfo HideIconsCommand REG_SZ <uninstpath> /HideShortcuts
@@ -155,26 +149,6 @@ OpenKeyForReading(HKEY aKeyRoot, const nsAString& aKeyName, HKEY* aKey)
// shell\safemode (default) REG_SZ <appname> &Safe Mode
// shell\safemode\command (default) REG_SZ <apppath> -safe-mode
//
// - RegisteredApplications
// -------------------------------------------------
// This entry creates the listing in Default Apps for Windows 8 and up and in
// Set Program Access and Defaults (SPAD) on older versions.
//
// HKCU\Software\RegisteredApplications\
// Firefox-<PathHash> REG_SZ "Software\Clients\StartMenuInternet\<appname>-<PathHash>\Capabilities"
// HKCU\Software\Clients\StartMenuInternet\<appname>-<PathHash>\Capabilities\
// ApplicationDescription REG_SZ <branding description>
// ApplicationIcon REG_SZ <apppath>,0
// ApplicationName REG_SZ <appname>
// FileAssociations .htm REG_SZ FirefoxHTML-<PathHash>
// FileAssociations .html REG_SZ FirefoxHTML-<PathHash>
// FileAssociations .shtml REG_SZ FirefoxHTML-<PathHash>
// FileAssociations .xht REG_SZ FirefoxHTML-<PathHash>
// FileAssociations .xhtml REG_SZ FirefoxHTML-<PathHash>
// StartMenu StartMenuInternet REG_SZ <appname>-<PathHash>
// URLAssociations ftp REG_SZ FirefoxURL-<PathHash>
// URLAssociations http REG_SZ FirefoxURL-<PathHash>
// URLAssociations https REG_SZ FirefoxURL-<PathHash>
// The values checked are all default values so the value name is not needed.
typedef struct {
@@ -183,7 +157,7 @@ typedef struct {
const char* oldValueData;
} SETTING;
#define APP_REG_NAME_BASE L"Firefox-"
#define APP_REG_NAME L"Firefox"
#define VAL_FILE_ICON "%APPPATH%,1"
#define VAL_OPEN "\"%APPPATH%\" -osint -url \"%1\""
#define OLD_VAL_OPEN "\"%APPPATH%\" -requestPending -osint -url \"%1\""
@@ -367,7 +341,7 @@ IsAARDefault(const RefPtr<IApplicationAssociationRegistration>& pAAR,
}
LPCWSTR progID = isProtocol ? L"FirefoxURL" : L"FirefoxHTML";
bool isDefault = !wcsnicmp(registeredApp, progID, wcslen(progID));
bool isDefault = !wcsicmp(registeredApp, progID);
CoTaskMemFree(registeredApp);
return isDefault;
@@ -396,38 +370,6 @@ IsDefaultBrowserWin8(bool aCheckAllTypes, bool* aIsDefaultBrowser)
}
}
static nsresult
GetAppRegName(nsAutoString &aAppRegName)
{
nsresult rv;
nsCOMPtr<nsIProperties> dirSvc =
do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIFile> exeFile;
rv = dirSvc->Get(XRE_EXECUTABLE_FILE,
NS_GET_IID(nsIFile),
getter_AddRefs(exeFile));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIFile> appDir;
rv = exeFile->GetParent(getter_AddRefs(appDir));
NS_ENSURE_SUCCESS(rv, rv);
nsAutoString path;
rv = appDir->GetPath(path);
NS_ENSURE_SUCCESS(rv, rv);
uint64_t hash = CityHash64(static_cast<const char *>(path.get()),
path.Length() * sizeof(nsAutoString::char_type));
aAppRegName = APP_REG_NAME_BASE;
aAppRegName.AppendInt((int)hash, 16);
aAppRegName.AppendInt((int)(hash >> 32), 16);
return rv;
}
/*
* Query's the AAR for the default status.
* This only checks for FirefoxURL and if aCheckAllTypes is set, then
@@ -450,10 +392,8 @@ nsWindowsShellService::IsDefaultBrowserVista(bool aCheckAllTypes,
if (aCheckAllTypes) {
BOOL res;
nsAutoString appRegName;
GetAppRegName(appRegName);
hr = pAAR->QueryAppIsDefaultAll(AL_EFFECTIVE,
appRegName.get(),
APP_REG_NAME,
&res);
*aIsDefaultBrowser = res;
} else if (!IsWin8OrLater()) {
@@ -697,9 +637,7 @@ nsWindowsShellService::LaunchControlPanelDefaultsSelectionUI()
IID_IApplicationAssociationRegistrationUI,
(void**)&pAARUI);
if (SUCCEEDED(hr)) {
nsAutoString appRegName;
GetAppRegName(appRegName);
hr = pAARUI->LaunchAdvancedAssociationUI(appRegName.get());
hr = pAARUI->LaunchAdvancedAssociationUI(APP_REG_NAME);
pAARUI->Release();
}
return SUCCEEDED(hr) ? NS_OK : NS_ERROR_FAILURE;
@@ -721,17 +659,14 @@ nsWindowsShellService::LaunchControlPanelDefaultPrograms()
return NS_ERROR_FAILURE;
}
nsAutoString params(NS_LITERAL_STRING("control.exe /name Microsoft.DefaultPrograms "
"/page pageDefaultProgram\\pageAdvancedSettings?pszAppName="));
nsAutoString appRegName;
GetAppRegName(appRegName);
params.Append(appRegName);
WCHAR params[] = L"control.exe /name Microsoft.DefaultPrograms /page "
"pageDefaultProgram\\pageAdvancedSettings?pszAppName=" APP_REG_NAME;
STARTUPINFOW si = {sizeof(si), 0};
si.dwFlags = STARTF_USESHOWWINDOW;
si.wShowWindow = SW_SHOWDEFAULT;
PROCESS_INFORMATION pi = {0};
if (!CreateProcessW(controlEXEPath, static_cast<LPWSTR>(params.get()), nullptr,
nullptr, FALSE, 0, nullptr, nullptr, &si, &pi)) {
if (!CreateProcessW(controlEXEPath, params, nullptr, nullptr, FALSE,
0, nullptr, nullptr, &si, &pi)) {
return NS_ERROR_FAILURE;
}
CloseHandle(pi.hProcess);

View File

@@ -382,28 +382,23 @@ Section "-Application" APP_IDX
; In Win8, the delegate execute handler picks up the value in FirefoxURL and
; FirefoxHTML to launch the desktop browser when it needs to.
${AddDisabledDDEHandlerValues} "FirefoxHTML-$AppUserModelID" "$2" "$8,1" \
${AddDisabledDDEHandlerValues} "FirefoxHTML" "$2" "$8,1" \
"${AppRegName} Document" ""
${AddDisabledDDEHandlerValues} "FirefoxURL-$AppUserModelID" "$2" "$8,1" \
"${AppRegName} URL" "true"
${AddDisabledDDEHandlerValues} "FirefoxURL" "$2" "$8,1" "${AppRegName} URL" \
"true"
; For pre win8, the following keys should only be set if we can write to HKLM.
; For post win8, the keys below can be set in HKCU if needed.
; For post win8, the keys below get set in both HKLM and HKCU.
${If} $TmpVal == "HKLM"
; Set the Start Menu Internet and Vista Registered App HKLM registry keys.
; If we're upgrading an existing install, replacing the old registry entries
; (without a path hash) would cause the default browser to be reset.
ReadRegStr $0 HKLM "Software\Clients\StartMenuInternet\FIREFOX.EXE\DefaultIcon" ""
StrCpy $0 $0 -2
${If} $0 != "$INSTDIR\${FileMainEXE}"
${SetStartMenuInternet} "HKLM"
${FixShellIconHandler} "HKLM"
${EndIf}
; If we are writing to HKLM and create either the desktop or start menu
; shortcuts set IconsVisible to 1 otherwise to 0.
; Taskbar shortcuts imply having a start menu shortcut.
StrCpy $0 "Software\Clients\StartMenuInternet\${AppRegName}-$AppUserModelID\InstallInfo"
${StrFilter} "${FileMainEXE}" "+" "" "" $R9
StrCpy $0 "Software\Clients\StartMenuInternet\$R9\InstallInfo"
${If} $AddDesktopSC == 1
${OrIf} $AddStartMenuSC == 1
${OrIf} $AddTaskbarSC == 1
@@ -411,21 +406,18 @@ Section "-Application" APP_IDX
${Else}
WriteRegDWORD HKLM "$0" "IconsVisible" 0
${EndIf}
${ElseIf} ${AtLeastWin8}
${EndIf}
${If} ${AtLeastWin8}
; Set the Start Menu Internet and Vista Registered App HKCU registry keys.
; If we're upgrading an existing install, replacing the old registry entries
; (without a path hash) would cause the default browser to be reset.
ReadRegStr $0 HKCU "Software\Clients\StartMenuInternet\FIREFOX.EXE\DefaultIcon" ""
StrCpy $0 $0 -2
${If} $0 != "$INSTDIR\${FileMainEXE}"
${SetStartMenuInternet} "HKCU"
${FixShellIconHandler} "HKCU"
${EndIf}
; If we create either the desktop or start menu shortcuts, then
; set IconsVisible to 1 otherwise to 0.
; Taskbar shortcuts imply having a start menu shortcut.
StrCpy $0 "Software\Clients\StartMenuInternet\${AppRegName}-$AppUserModelID\InstallInfo"
${StrFilter} "${FileMainEXE}" "+" "" "" $R9
StrCpy $0 "Software\Clients\StartMenuInternet\$R9\InstallInfo"
${If} $AddDesktopSC == 1
${OrIf} $AddStartMenuSC == 1
${OrIf} $AddTaskbarSC == 1

View File

@@ -13,7 +13,6 @@
; start menu tile. In case there are 2 Firefox installations, we only do
; this if the application being updated is the default.
ReadRegStr $0 HKCU "Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice" "ProgId"
${WordFind} "$0" "-" "+1{" $0
${If} $0 == "FirefoxURL"
${AndIf} $9 != 0 ; We're not running in session 0
ReadRegStr $0 HKCU "Software\Classes\FirefoxURL\shell\open\command" ""
@@ -60,6 +59,35 @@
; Add the Firewall entries after an update
Call AddFirewallEntries
; Only update the Clients\StartMenuInternet registry key values in HKLM if
; they don't exist or this installation is the same as the one set in those
; keys.
${StrFilter} "${FileMainEXE}" "+" "" "" $1
ReadRegStr $0 HKLM "Software\Clients\StartMenuInternet\$1\DefaultIcon" ""
${GetPathFromString} "$0" $0
${GetParent} "$0" $0
${If} ${FileExists} "$0"
${GetLongPath} "$0" $0
${EndIf}
${If} "$0" == "$INSTDIR"
${SetStartMenuInternet} "HKLM"
${EndIf}
; Only update the Clients\StartMenuInternet registry key values in HKCU if
; they don't exist or this installation is the same as the one set in those
; keys. This is only done in Windows 8 to avoid a UAC prompt.
${If} ${AtLeastWin8}
ReadRegStr $0 HKCU "Software\Clients\StartMenuInternet\$1\DefaultIcon" ""
${GetPathFromString} "$0" $0
${GetParent} "$0" $0
${If} ${FileExists} "$0"
${GetLongPath} "$0" $0
${EndIf}
${If} "$0" == "$INSTDIR"
${SetStartMenuInternet} "HKCU"
${EndIf}
${EndIf}
ReadRegStr $0 HKLM "Software\mozilla.org\Mozilla" "CurrentVersion"
${If} "$0" != "${GREVersion}"
WriteRegStr HKLM "Software\mozilla.org\Mozilla" "CurrentVersion" "${GREVersion}"
@@ -153,7 +181,7 @@
${FixShellIconHandler} "HKLM"
${ShowShortcuts}
${StrFilter} "${FileMainEXE}" "+" "" "" $R9
WriteRegStr HKLM "Software\Clients\StartMenuInternet" "" "$R9-$AppUserModelID"
WriteRegStr HKLM "Software\Clients\StartMenuInternet" "" "$R9"
!macroend
!define SetAsDefaultAppGlobal "!insertmacro SetAsDefaultAppGlobal"
@@ -223,7 +251,8 @@
; Adds shortcuts for this installation. This should also add the application
; to Open With for the file types the application handles (bug 370480).
!macro ShowShortcuts
StrCpy $R1 "Software\Clients\StartMenuInternet\${AppRegName}-$AppUserModelID\InstallInfo"
${StrFilter} "${FileMainEXE}" "+" "" "" $0
StrCpy $R1 "Software\Clients\StartMenuInternet\$0\InstallInfo"
WriteRegDWORD HKLM "$R1" "IconsVisible" 1
${If} ${AtLeastWin8}
WriteRegDWORD HKCU "$R1" "IconsVisible" 1
@@ -298,9 +327,9 @@
ClearErrors
EnumRegKey $7 HKCR "${FILE_TYPE}" 0
${If} ${Errors}
WriteRegStr SHCTX "SOFTWARE\Classes\${FILE_TYPE}" "" "FirefoxHTML-$AppUserModelID"
WriteRegStr SHCTX "SOFTWARE\Classes\${FILE_TYPE}" "" "FirefoxHTML"
${EndIf}
WriteRegStr SHCTX "SOFTWARE\Classes\${FILE_TYPE}\OpenWithProgids" "FirefoxHTML-$AppUserModelID" ""
WriteRegStr SHCTX "SOFTWARE\Classes\${FILE_TYPE}\OpenWithProgids" "FirefoxHTML" ""
!macroend
!define AddAssociationIfNoneExist "!insertmacro AddAssociationIfNoneExist"
@@ -312,35 +341,30 @@
StrCpy $0 "SOFTWARE\Classes"
StrCpy $2 "$\"$8$\" -osint -url $\"%1$\""
; Associate the file handlers with FirefoxHTML, if they aren't already.
; Associate the file handlers with FirefoxHTML
ReadRegStr $6 SHCTX "$0\.htm" ""
${WordFind} "$6" "-" "+1{" $6
${If} "$6" != "FirefoxHTML"
WriteRegStr SHCTX "$0\.htm" "" "FirefoxHTML-$AppUserModelID"
WriteRegStr SHCTX "$0\.htm" "" "FirefoxHTML"
${EndIf}
ReadRegStr $6 SHCTX "$0\.html" ""
${WordFind} "$6" "-" "+1{" $6
${If} "$6" != "FirefoxHTML"
WriteRegStr SHCTX "$0\.html" "" "FirefoxHTML-$AppUserModelID"
WriteRegStr SHCTX "$0\.html" "" "FirefoxHTML"
${EndIf}
ReadRegStr $6 SHCTX "$0\.shtml" ""
${WordFind} "$6" "-" "+1{" $6
${If} "$6" != "FirefoxHTML"
WriteRegStr SHCTX "$0\.shtml" "" "FirefoxHTML-$AppUserModelID"
WriteRegStr SHCTX "$0\.shtml" "" "FirefoxHTML"
${EndIf}
ReadRegStr $6 SHCTX "$0\.xht" ""
${WordFind} "$6" "-" "+1{" $6
${If} "$6" != "FirefoxHTML"
WriteRegStr SHCTX "$0\.xht" "" "FirefoxHTML-$AppUserModelID"
WriteRegStr SHCTX "$0\.xht" "" "FirefoxHTML"
${EndIf}
ReadRegStr $6 SHCTX "$0\.xhtml" ""
${WordFind} "$6" "-" "+1{" $6
${If} "$6" != "FirefoxHTML"
WriteRegStr SHCTX "$0\.xhtml" "" "FirefoxHTML-$AppUserModelID"
WriteRegStr SHCTX "$0\.xhtml" "" "FirefoxHTML"
${EndIf}
${AddAssociationIfNoneExist} ".pdf"
@@ -352,10 +376,10 @@
; An empty string is used for the 5th param because FirefoxHTML is not a
; protocol handler
${AddDisabledDDEHandlerValues} "FirefoxHTML-$AppUserModelID" "$2" "$8,1" \
${AddDisabledDDEHandlerValues} "FirefoxHTML" "$2" "$8,1" \
"${AppRegName} HTML Document" ""
${AddDisabledDDEHandlerValues} "FirefoxURL-$AppUserModelID" "$2" "$8,1" "${AppRegName} URL" \
${AddDisabledDDEHandlerValues} "FirefoxURL" "$2" "$8,1" "${AppRegName} URL" \
"true"
; An empty string is used for the 4th & 5th params because the following
; protocol handlers already have a display name and the additional keys
@@ -366,29 +390,29 @@
!macroend
!define SetHandlers "!insertmacro SetHandlers"
; Adds the HKLM\Software\Clients\StartMenuInternet\Firefox-[pathhash] registry
; Adds the HKLM\Software\Clients\StartMenuInternet\FIREFOX.EXE registry
; entries (does not use SHCTX).
;
; The values for StartMenuInternet are only valid under HKLM and there can only
; be one installation registerred under StartMenuInternet per application since
; the key name is derived from the main application executable.
; http://support.microsoft.com/kb/297878
;
; In Windows 8 this changes slightly, you can store StartMenuInternet entries in
; HKCU. The icon in start menu for StartMenuInternet is deprecated as of Win7,
; but the subkeys are what's important. Control panel default programs looks
; for them only in HKLM pre win8.
;
; The StartMenuInternet key and friends are documented at
; https://msdn.microsoft.com/en-us/library/windows/desktop/cc144109(v=vs.85).aspx
;
; This function also writes our RegisteredApplications entry, which gets us
; listed in the Settings app's default browser options on Windows 8+, and in
; Set Program Access and Defaults on earlier versions.
; Note: we might be able to get away with using the full path to the
; application executable for the key name in order to support multiple
; installations.
!macro SetStartMenuInternet RegKey
${GetLongPath} "$INSTDIR\${FileMainEXE}" $8
${GetLongPath} "$INSTDIR\uninstall\helper.exe" $7
StrCpy $0 "Software\Clients\StartMenuInternet\${AppRegName}-$AppUserModelID"
${StrFilter} "${FileMainEXE}" "+" "" "" $R9
StrCpy $0 "Software\Clients\StartMenuInternet\$R9"
WriteRegStr ${RegKey} "$0" "" "${BrandFullName}"
@@ -425,20 +449,20 @@
WriteRegStr ${RegKey} "$0\Capabilities" "ApplicationIcon" "$8,0"
WriteRegStr ${RegKey} "$0\Capabilities" "ApplicationName" "${BrandShortName}"
WriteRegStr ${RegKey} "$0\Capabilities\FileAssociations" ".htm" "FirefoxHTML-$AppUserModelID"
WriteRegStr ${RegKey} "$0\Capabilities\FileAssociations" ".html" "FirefoxHTML-$AppUserModelID"
WriteRegStr ${RegKey} "$0\Capabilities\FileAssociations" ".shtml" "FirefoxHTML-$AppUserModelID"
WriteRegStr ${RegKey} "$0\Capabilities\FileAssociations" ".xht" "FirefoxHTML-$AppUserModelID"
WriteRegStr ${RegKey} "$0\Capabilities\FileAssociations" ".xhtml" "FirefoxHTML-$AppUserModelID"
WriteRegStr ${RegKey} "$0\Capabilities\FileAssociations" ".htm" "FirefoxHTML"
WriteRegStr ${RegKey} "$0\Capabilities\FileAssociations" ".html" "FirefoxHTML"
WriteRegStr ${RegKey} "$0\Capabilities\FileAssociations" ".shtml" "FirefoxHTML"
WriteRegStr ${RegKey} "$0\Capabilities\FileAssociations" ".xht" "FirefoxHTML"
WriteRegStr ${RegKey} "$0\Capabilities\FileAssociations" ".xhtml" "FirefoxHTML"
WriteRegStr ${RegKey} "$0\Capabilities\StartMenu" "StartMenuInternet" "${AppRegName}-$AppUserModelID"
WriteRegStr ${RegKey} "$0\Capabilities\StartMenu" "StartMenuInternet" "$R9"
WriteRegStr ${RegKey} "$0\Capabilities\URLAssociations" "ftp" "FirefoxURL-$AppUserModelID"
WriteRegStr ${RegKey} "$0\Capabilities\URLAssociations" "http" "FirefoxURL-$AppUserModelID"
WriteRegStr ${RegKey} "$0\Capabilities\URLAssociations" "https" "FirefoxURL-$AppUserModelID"
WriteRegStr ${RegKey} "$0\Capabilities\URLAssociations" "ftp" "FirefoxURL"
WriteRegStr ${RegKey} "$0\Capabilities\URLAssociations" "http" "FirefoxURL"
WriteRegStr ${RegKey} "$0\Capabilities\URLAssociations" "https" "FirefoxURL"
; Vista Registered Application
WriteRegStr ${RegKey} "Software\RegisteredApplications" "${AppRegName}-$AppUserModelID" "$0\Capabilities"
WriteRegStr ${RegKey} "Software\RegisteredApplications" "${AppRegName}" "$0\Capabilities"
!macroend
!define SetStartMenuInternet "!insertmacro SetStartMenuInternet"
@@ -448,12 +472,12 @@
; icon being displayed for files associated with Firefox (does not use SHCTX).
!macro FixShellIconHandler RegKey
ClearErrors
ReadRegStr $1 ${RegKey} "Software\Classes\FirefoxHTML-$AppUserModelID\ShellEx\IconHandler" ""
ReadRegStr $1 ${RegKey} "Software\Classes\FirefoxHTML\ShellEx\IconHandler" ""
${Unless} ${Errors}
ReadRegStr $1 ${RegKey} "Software\Classes\FirefoxHTML-$AppUserModelID\DefaultIcon" ""
ReadRegStr $1 ${RegKey} "Software\Classes\FirefoxHTML\DefaultIcon" ""
${GetLongPath} "$INSTDIR\${FileMainEXE}" $2
${If} "$1" != "$2,1"
WriteRegStr ${RegKey} "Software\Classes\FirefoxHTML-$AppUserModelID\DefaultIcon" "" "$2,1"
WriteRegStr ${RegKey} "Software\Classes\FirefoxHTML\DefaultIcon" "" "$2,1"
${EndIf}
${EndUnless}
!macroend
@@ -594,9 +618,7 @@
; Only delete the default value in case the key has values for OpenWithList,
; OpenWithProgids, PersistentHandler, etc.
ReadRegStr $0 HKCU "Software\Classes\${FILE_TYPE}" ""
${WordFind} "$0" "-" "+1{" $0
ReadRegStr $1 HKLM "Software\Classes\${FILE_TYPE}" ""
${WordFind} "$1" "-" "+1{" $1
ReadRegStr $2 HKCR "${FILE_TYPE}\PersistentHandler" ""
${If} "$2" != ""
; Since there is a persistent handler remove FirefoxHTML as the default
@@ -664,17 +686,17 @@
; Only set the file and protocol handlers if the existing one under HKCR is
; for this install location.
${IsHandlerForInstallDir} "FirefoxHTML-$AppUserModelID" $R9
${IsHandlerForInstallDir} "FirefoxHTML" $R9
${If} "$R9" == "true"
; An empty string is used for the 5th param because FirefoxHTML is not a
; protocol handler.
${AddDisabledDDEHandlerValues} "FirefoxHTML-$AppUserModelID" "$2" "$8,1" \
${AddDisabledDDEHandlerValues} "FirefoxHTML" "$2" "$8,1" \
"${AppRegName} HTML Document" ""
${EndIf}
${IsHandlerForInstallDir} "FirefoxURL-$AppUserModelID" $R9
${IsHandlerForInstallDir} "FirefoxURL" $R9
${If} "$R9" == "true"
${AddDisabledDDEHandlerValues} "FirefoxURL-$AppUserModelID" "$2" "$8,1" \
${AddDisabledDDEHandlerValues} "FirefoxURL" "$2" "$8,1" \
"${AppRegName} URL" "true"
${EndIf}
@@ -749,6 +771,10 @@
; Removes various registry entries for reasons noted below (does not use SHCTX).
!macro RemoveDeprecatedKeys
StrCpy $0 "SOFTWARE\Classes"
; Remove support for launching gopher urls from the shell during install or
; update if the DefaultIcon is from firefox.exe.
${RegCleanAppHandler} "gopher"
; Remove support for launching chrome urls from the shell during install or
; update if the DefaultIcon is from firefox.exe (Bug 301073).
${RegCleanAppHandler} "chrome"
@@ -756,6 +782,22 @@
; Remove protocol handler registry keys added by the MS shim
DeleteRegKey HKLM "Software\Classes\Firefox.URL"
DeleteRegKey HKCU "Software\Classes\Firefox.URL"
; Delete gopher from Capabilities\URLAssociations if it is present.
${StrFilter} "${FileMainEXE}" "+" "" "" $R9
StrCpy $0 "Software\Clients\StartMenuInternet\$R9"
ClearErrors
ReadRegStr $2 HKLM "$0\Capabilities\URLAssociations" "gopher"
${Unless} ${Errors}
DeleteRegValue HKLM "$0\Capabilities\URLAssociations" "gopher"
${EndUnless}
; Delete gopher from the user's UrlAssociations if it points to FirefoxURL.
StrCpy $0 "Software\Microsoft\Windows\Shell\Associations\UrlAssociations\gopher"
ReadRegStr $2 HKCU "$0\UserChoice" "Progid"
${If} "$2" == "FirefoxURL"
DeleteRegKey HKCU "$0"
${EndIf}
!macroend
!define RemoveDeprecatedKeys "!insertmacro RemoveDeprecatedKeys"
@@ -1218,11 +1260,11 @@ Function SetAsDefaultAppUserHKCU
; registry keys are for this install.
${StrFilter} "${FileMainEXE}" "+" "" "" $R9
ClearErrors
ReadRegStr $0 HKCU "Software\Clients\StartMenuInternet\$R9-$AppUserModelID\DefaultIcon" ""
ReadRegStr $0 HKCU "Software\Clients\StartMenuInternet\$R9\DefaultIcon" ""
${If} ${Errors}
${OrIf} ${AtMostWin2008R2}
ClearErrors
ReadRegStr $0 HKLM "Software\Clients\StartMenuInternet\$R9-$AppUserModelID\DefaultIcon" ""
ReadRegStr $0 HKLM "Software\Clients\StartMenuInternet\$R9\DefaultIcon" ""
${EndIf}
${Unless} ${Errors}
${GetPathFromString} "$0" $0
@@ -1230,7 +1272,7 @@ Function SetAsDefaultAppUserHKCU
${If} ${FileExists} "$0"
${GetLongPath} "$0" $0
${If} "$0" == "$INSTDIR"
WriteRegStr HKCU "Software\Clients\StartMenuInternet" "" "$R9-$AppUserModelID"
WriteRegStr HKCU "Software\Clients\StartMenuInternet" "" "$R9"
${EndIf}
${EndIf}
${EndUnless}
@@ -1251,11 +1293,11 @@ Function SetAsDefaultAppUserHKCU
; file handlers set previously at the user level will associate this install
; as the default browser.
ClearErrors
ReadRegStr $0 HKLM "Software\RegisteredApplications" "${AppRegName}-$AppUserModelID"
ReadRegStr $0 HKLM "Software\RegisteredApplications" "${AppRegName}"
${Unless} ${Errors}
; This is all protected by a user choice hash in Windows 8 so it won't
; help, but it also won't hurt.
AppAssocReg::SetAppAsDefaultAll "${AppRegName}-$AppUserModelID"
AppAssocReg::SetAppAsDefaultAll "${AppRegName}"
${EndUnless}
${EndIf}
${RemoveDeprecatedKeys}
@@ -1309,12 +1351,13 @@ Function SetAsDefaultAppUser
; http://support.microsoft.com/kb/297878
; Check if this install location registered as the StartMenuInternet client
${StrFilter} "${FileMainEXE}" "+" "" "" $R9
ClearErrors
ReadRegStr $0 HKCU "Software\Clients\StartMenuInternet\${AppRegName}-$AppUserModelID\DefaultIcon" ""
ReadRegStr $0 HKCU "Software\Clients\StartMenuInternet\$R9\DefaultIcon" ""
${If} ${Errors}
${OrIf} ${AtMostWin2008R2}
ClearErrors
ReadRegStr $0 HKLM "Software\Clients\StartMenuInternet\${AppRegName}-$AppUserModelID\DefaultIcon" ""
ReadRegStr $0 HKLM "Software\Clients\StartMenuInternet\$R9\DefaultIcon" ""
${EndIf}
${Unless} ${Errors}

View File

@@ -685,6 +685,15 @@ Function SendPing
${EndIf}
${If} "$R2" == "0"
${AndIf} ${AtLeastWinVista}
; Check to see if this install location is currently set as the default
; browser by Default Programs which is only available on Vista and above.
ClearErrors
ReadRegStr $R3 HKLM "Software\RegisteredApplications" "${AppRegName}"
${Unless} ${Errors}
AppAssocReg::QueryAppIsDefaultAll "${AppRegName}" "effective"
Pop $R3
${If} $R3 == "1"
StrCpy $R3 ""
ReadRegStr $R2 HKLM "Software\Classes\http\shell\open\command" ""
${If} $R2 != ""
@@ -705,6 +714,8 @@ Function SendPing
StrCpy $R2 "0" ; Firefox is not set as default.
${EndIf}
${EndIf}
${EndUnless}
${EndIf}
${If} $CanSetAsDefault == "true"
${If} $CheckboxSetAsDefault == "1"

View File

@@ -199,7 +199,6 @@ Function un.UninstallServiceIfNotUsed
${If} ${RunningX64}
SetRegView lastUsed
${EndIf}
${If} $0 == 0
; Get the path of the maintenance service uninstaller
ReadRegStr $1 HKLM ${MaintUninstallKey} "UninstallString"
@@ -279,21 +278,28 @@ Section "Uninstall"
${un.SetAppLSPCategories}
${EndIf}
${un.RegCleanAppHandler} "FirefoxURL-$AppUserModelID"
${un.RegCleanAppHandler} "FirefoxHTML-$AppUserModelID"
${un.RegCleanAppHandler} "FirefoxURL"
${un.RegCleanAppHandler} "FirefoxHTML"
${un.RegCleanProtocolHandler} "ftp"
${un.RegCleanProtocolHandler} "http"
${un.RegCleanProtocolHandler} "https"
${un.RegCleanFileHandler} ".htm" "FirefoxHTML-$AppUserModelID"
${un.RegCleanFileHandler} ".html" "FirefoxHTML-$AppUserModelID"
${un.RegCleanFileHandler} ".shtml" "FirefoxHTML-$AppUserModelID"
${un.RegCleanFileHandler} ".xht" "FirefoxHTML-$AppUserModelID"
${un.RegCleanFileHandler} ".xhtml" "FirefoxHTML-$AppUserModelID"
${un.RegCleanFileHandler} ".oga" "FirefoxHTML-$AppUserModelID"
${un.RegCleanFileHandler} ".ogg" "FirefoxHTML-$AppUserModelID"
${un.RegCleanFileHandler} ".ogv" "FirefoxHTML-$AppUserModelID"
${un.RegCleanFileHandler} ".pdf" "FirefoxHTML-$AppUserModelID"
${un.RegCleanFileHandler} ".webm" "FirefoxHTML-$AppUserModelID"
ClearErrors
ReadRegStr $R9 HKCR "FirefoxHTML" ""
; Don't clean up the file handlers if the FirefoxHTML key still exists since
; there should be a second installation that may be the default file handler
${If} ${Errors}
${un.RegCleanFileHandler} ".htm" "FirefoxHTML"
${un.RegCleanFileHandler} ".html" "FirefoxHTML"
${un.RegCleanFileHandler} ".shtml" "FirefoxHTML"
${un.RegCleanFileHandler} ".xht" "FirefoxHTML"
${un.RegCleanFileHandler} ".xhtml" "FirefoxHTML"
${un.RegCleanFileHandler} ".oga" "FirefoxHTML"
${un.RegCleanFileHandler} ".ogg" "FirefoxHTML"
${un.RegCleanFileHandler} ".ogv" "FirefoxHTML"
${un.RegCleanFileHandler} ".pdf" "FirefoxHTML"
${un.RegCleanFileHandler} ".webm" "FirefoxHTML"
${EndIf}
SetShellVarContext all ; Set SHCTX to HKLM
${un.GetSecondInstallPath} "Software\Mozilla" $R9
@@ -302,30 +308,36 @@ Section "Uninstall"
${un.GetSecondInstallPath} "Software\Mozilla" $R9
${EndIf}
DeleteRegKey HKLM "Software\Clients\StartMenuInternet\${AppRegName}-$AppUserModelID"
DeleteRegValue HKLM "Software\RegisteredApplications" "${AppRegName}-$AppUserModelID"
StrCpy $0 "Software\Clients\StartMenuInternet\${FileMainEXE}\shell\open\command"
ReadRegStr $R1 HKLM "$0" ""
${un.RemoveQuotesFromPath} "$R1" $R1
${un.GetParent} "$R1" $R1
DeleteRegKey HKCU "Software\Clients\StartMenuInternet\${AppRegName}-$AppUserModelID"
DeleteRegValue HKCU "Software\RegisteredApplications" "${AppRegName}-$AppUserModelID"
; Remove old protocol handler and StartMenuInternet keys without install path
; hashes, but only if they're for this installation.
ReadRegStr $0 HKLM "Software\Classes\FirefoxHTML\DefaultIcon" ""
StrCpy $0 $0 -2
${If} $0 == "$INSTDIR\${FileMainEXE}"
DeleteRegKey HKLM "Software\Classes\FirefoxHTML"
DeleteRegKey HKLM "Software\Classes\FirefoxURL"
${StrFilter} "${FileMainEXE}" "+" "" "" $R9
DeleteRegKey HKLM "Software\Clients\StartMenuInternet\$R9"
; Only remove the StartMenuInternet key if it refers to this install location.
; The StartMenuInternet registry key is independent of the default browser
; settings. The XPInstall base un-installer always removes this key if it is
; uninstalling the default browser and it will always replace the keys when
; installing even if there is another install of Firefox that is set as the
; default browser. Now the key is always updated on install but it is only
; removed if it refers to this install location.
${If} "$INSTDIR" == "$R1"
DeleteRegKey HKLM "Software\Clients\StartMenuInternet\${FileMainEXE}"
DeleteRegValue HKLM "Software\RegisteredApplications" "${AppRegName}"
${EndIf}
ReadRegStr $0 HKCU "Software\Classes\FirefoxHTML\DefaultIcon" ""
StrCpy $0 $0 -2
${If} $0 == "$INSTDIR\${FileMainEXE}"
DeleteRegKey HKCU "Software\Classes\FirefoxHTML"
DeleteRegKey HKCU "Software\Classes\FirefoxURL"
${StrFilter} "${FileMainEXE}" "+" "" "" $R9
DeleteRegKey HKCU "Software\Clients\StartMenuInternet\$R9"
ReadRegStr $R1 HKCU "$0" ""
${un.RemoveQuotesFromPath} "$R1" $R1
${un.GetParent} "$R1" $R1
; Only remove the StartMenuInternet key if it refers to this install location.
; The StartMenuInternet registry key is independent of the default browser
; settings. The XPInstall base un-installer always removes this key if it is
; uninstalling the default browser and it will always replace the keys when
; installing even if there is another install of Firefox that is set as the
; default browser. Now the key is always updated on install but it is only
; removed if it refers to this install location.
${If} "$INSTDIR" == "$R1"
DeleteRegKey HKCU "Software\Clients\StartMenuInternet\${FileMainEXE}"
DeleteRegValue HKCU "Software\RegisteredApplications" "${AppRegName}"
${EndIf}

View File

@@ -46,26 +46,15 @@
#include "../CityHash.h" // added by moz, specific to nsis project
#include <stdlib.h> // for size_t.
#include <utility>
typedef unsigned __int8 uint8;
typedef unsigned __int32 uint32;
typedef unsigned __int64 uint64;
// The standard <utility> header doesn't compile, apparently it conflicts
// with... some Mozilla something or other. But all that's used from it
// is std::pair, so we can just replace that with mozilla::Pair.
#ifndef MOZILLA_CLIENT
#include <utility>
typedef std::pair<uint64, uint64> uint128;
inline uint64 Uint128Low64(const uint128& x) { return x.first; }
inline uint64 Uint128High64(const uint128& x) { return x.second; }
#else
#include "mozilla/Pair.h"
typedef mozilla::Pair<uint64, uint64> uint128;
inline uint64 Uint128Low64(const uint128& x) { return x.first(); }
inline uint64 Uint128High64(const uint128& x) { return x.second(); }
#endif
// Hash function for a byte array.
uint64 CityHash64(const char *buf, size_t len);