Bug 577867 - Update installer to use new city hash taskbar registration ids. r=rstrong

This commit is contained in:
Jim Mathies
2011-11-03 09:39:51 -05:00
parent 589e26d08f
commit 6975059ebf
7 changed files with 184 additions and 32 deletions

View File

@@ -1,19 +1,8 @@
#filter substitution
# Win7: AppVendor, AppName, and AppVersion must match the application.ini values
# of Vendor, Name, and Version. These values are used in registering shortcuts
# with the taskbar. ExplicitAppUserModelID registration when the app launches is
# handled in widget/src/windows/WinTaskbar.cpp.
!define AppVendor "Mozilla"
# These defines should match application.ini settings
!define AppName "Firefox"
!define AppVersion "@APP_VERSION@"
#ifdef HAVE_64BIT_OS
; differentiate 64-bit builds, we do the same in widget.
!define AppUserModelID "${AppVendor}.${AppName}.${AppVersion}.Win64"
#else
!define AppUserModelID "${AppVendor}.${AppName}.${AppVersion}"
#endif
!define GREVersion @MOZILLA_VERSION@
!define AB_CD "@AB_CD@"

View File

@@ -37,6 +37,7 @@
# Required Plugins:
# AppAssocReg http://nsis.sourceforge.net/Application_Association_Registration_plug-in
# ApplicationID http://nsis.sourceforge.net/ApplicationID_plug-in
# CityHash http://mxr.mozilla.org/mozilla-central/source/other-licenses/nsis/Contrib/CityHash
# ShellLink http://nsis.sourceforge.net/ShellLink_plug-in
# UAC http://nsis.sourceforge.net/UAC_plug-in
@@ -107,6 +108,7 @@ VIAddVersionKey "OriginalFilename" "setup.exe"
!insertmacro CreateRegKey
!insertmacro GetPathFromString
!insertmacro GetParent
!insertmacro InitHashAppModelId
!insertmacro IsHandlerForInstallDir
!insertmacro IsPinnedToTaskBar
!insertmacro LogDesktopShortcut
@@ -319,6 +321,9 @@ Section "-Application" APP_IDX
${EndIf}
${EndIf}
; setup the application model id registration value
${InitHashAppModelId} "$INSTDIR" "Software\Mozilla\${AppName}\TaskBarIDs"
${RemoveDeprecatedKeys}
; The previous installer adds several regsitry values to both HKLM and HKCU.
@@ -433,7 +438,8 @@ Section "-Application" APP_IDX
ShellLink::SetShortCutWorkingDirectory "$SMPROGRAMS\${BrandFullName}.lnk" \
"$INSTDIR"
${If} ${AtLeastWin7}
ApplicationID::Set "$SMPROGRAMS\${BrandFullName}.lnk" "${AppUserModelID}"
${AndIf} "$AppUserModelID" != ""
ApplicationID::Set "$SMPROGRAMS\${BrandFullName}.lnk" "$AppUserModelID"
${EndIf}
${LogMsg} "Added Shortcut: $SMPROGRAMS\${BrandFullName}.lnk"
${Else}
@@ -447,7 +453,8 @@ Section "-Application" APP_IDX
ShellLink::SetShortCutWorkingDirectory "$DESKTOP\${BrandFullName}.lnk" \
"$INSTDIR"
${If} ${AtLeastWin7}
ApplicationID::Set "$DESKTOP\${BrandFullName}.lnk" "${AppUserModelID}"
${AndIf} "$AppUserModelID" != ""
ApplicationID::Set "$DESKTOP\${BrandFullName}.lnk" "$AppUserModelID"
${EndIf}
${LogMsg} "Added Shortcut: $DESKTOP\${BrandFullName}.lnk"
${Else}

View File

@@ -44,6 +44,10 @@
${RegCleanMain} "Software\Mozilla"
${RegCleanUninstall}
${UpdateProtocolHandlers}
; setup the application model id registration value
${InitHashAppModelId} "$INSTDIR" "Software\Mozilla\${AppName}\TaskBarIDs"
; Win7 taskbar and start menu link maintenance
Call FixShortcutAppModelIDs
@@ -190,7 +194,8 @@
${If} ${FileExists} "$DESKTOP\${BrandFullName}.lnk"
ShellLink::SetShortCutWorkingDirectory "$DESKTOP\${BrandFullName}.lnk" "$INSTDIR"
${If} ${AtLeastWin7}
ApplicationID::Set "$DESKTOP\${BrandFullName}.lnk" "${AppUserModelID}"
${AndIf} "$AppUserModelID" != ""
ApplicationID::Set "$DESKTOP\${BrandFullName}.lnk" "$AppUserModelID"
${EndIf}
${Else}
SetShellVarContext current ; Set $DESKTOP to the current user's desktop
@@ -200,7 +205,8 @@
ShellLink::SetShortCutWorkingDirectory "$DESKTOP\${BrandFullName}.lnk" \
"$INSTDIR"
${If} ${AtLeastWin7}
ApplicationID::Set "$DESKTOP\${BrandFullName}.lnk" "${AppUserModelID}"
${AndIf} "$AppUserModelID" != ""
ApplicationID::Set "$DESKTOP\${BrandFullName}.lnk" "$AppUserModelID"
${EndIf}
${EndIf}
${EndUnless}
@@ -214,7 +220,8 @@
ShellLink::SetShortCutWorkingDirectory "$SMPROGRAMS\${BrandFullName}.lnk" \
"$INSTDIR"
${If} ${AtLeastWin7}
ApplicationID::Set "$SMPROGRAMS\${BrandFullName}.lnk" "${AppUserModelID}"
${AndIf} "$AppUserModelID" != ""
ApplicationID::Set "$SMPROGRAMS\${BrandFullName}.lnk" "$AppUserModelID"
${EndIf}
${Else}
SetShellVarContext current ; Set $SMPROGRAMS to the current user's Start
@@ -225,7 +232,8 @@
ShellLink::SetShortCutWorkingDirectory "$SMPROGRAMS\${BrandFullName}.lnk" \
"$INSTDIR"
${If} ${AtLeastWin7}
ApplicationID::Set "$SMPROGRAMS\${BrandFullName}.lnk" "${AppUserModelID}"
${AndIf} "$AppUserModelID" != ""
ApplicationID::Set "$SMPROGRAMS\${BrandFullName}.lnk" "$AppUserModelID"
${EndIf}
${EndIf}
${EndUnless}
@@ -753,7 +761,9 @@
${If} ${FileExists} "$SMPROGRAMS\$1"
ShellLink::SetShortCutWorkingDirectory "$SMPROGRAMS\$1" \
"$INSTDIR"
ApplicationID::Set "$SMPROGRAMS\$1" "${AppUserModelID}"
${If} "$AppUserModelID" != ""
ApplicationID::Set "$SMPROGRAMS\$1" "$AppUserModelID"
${EndIf}
${EndIf}
${EndUnless}
${EndUnless}
@@ -835,8 +845,9 @@
ShellLink::SetShortCutWorkingDirectory "$SMPROGRAMS\${BrandFullName}.lnk" \
"$INSTDIR"
${If} ${AtLeastWin7}
${AndIf} "$AppUserModelID" != ""
ApplicationID::Set "$SMPROGRAMS\${BrandFullName}.lnk" \
"${AppUserModelID}"
"$AppUserModelID"
${EndIf}
${EndIf}
${EndIf}
@@ -942,7 +953,6 @@
!macroend
!define PushFilesToCheck "!insertmacro PushFilesToCheck"
; Sets this installation as the default browser by setting the registry keys
; under HKEY_CURRENT_USER via registry calls and using the AppAssocReg NSIS
; plugin for Vista and above. This is a function instead of a macro so it is
@@ -986,7 +996,10 @@ FunctionEnd
; Helper for updating the shortcut application model IDs.
Function FixShortcutAppModelIDs
${UpdateShortcutAppModelIDs} "$INSTDIR\${FileMainEXE}" "${AppUserModelID}" $0
${If} ${AtLeastWin7}
${AndIf} "$AppUserModelID" != ""
${UpdateShortcutAppModelIDs} "$INSTDIR\${FileMainEXE}" "$AppUserModelID" $0
${EndIf}
FunctionEnd
; The !ifdef NO_LOG prevents warnings when compiling the installer.nsi due to

View File

@@ -36,6 +36,7 @@
# Required Plugins:
# AppAssocReg http://nsis.sourceforge.net/Application_Association_Registration_plug-in
# CityHash http://mxr.mozilla.org/mozilla-central/source/other-licenses/nsis/Contrib/CityHash
# ShellLink http://nsis.sourceforge.net/ShellLink_plug-in
# UAC http://nsis.sourceforge.net/UAC_plug-in
@@ -92,6 +93,7 @@ VIAddVersionKey "OriginalFilename" "helper.exe"
!insertmacro ElevateUAC
!insertmacro GetLongPath
!insertmacro GetPathFromString
!insertmacro InitHashAppModelId
!insertmacro IsHandlerForInstallDir
!insertmacro IsPinnedToTaskBar
!insertmacro LogDesktopShortcut
@@ -117,6 +119,7 @@ VIAddVersionKey "OriginalFilename" "helper.exe"
!insertmacro un.DeleteShortcuts
!insertmacro un.GetLongPath
!insertmacro un.GetSecondInstallPath
!insertmacro un.InitHashAppModelId
!insertmacro un.ManualCloseAppPrompt
!insertmacro un.ParseUninstallLog
!insertmacro un.RegCleanAppHandler
@@ -229,13 +232,23 @@ Section "Uninstall"
RmDir "$APPDATA\Mozilla"
${EndIf}
; setup the application model id registration value
${un.InitHashAppModelId} "$INSTDIR" "Software\Mozilla\${AppName}\TaskBarIDs"
SetShellVarContext current ; Set SHCTX to HKCU
${un.RegCleanMain} "Software\Mozilla"
${un.RegCleanUninstall}
${un.DeleteShortcuts}
; Unregister resources associated with Win7 taskbar jump lists.
ApplicationID::UninstallJumpLists "${AppUserModelID}"
${If} ${AtLeastWin7}
${AndIf} "$AppUserModelID" != ""
ApplicationID::UninstallJumpLists "$AppUserModelID"
${EndIf}
; Remove any app model id's stored in the registry for this install path
DeleteRegValue HKCU "Software\Mozilla\${AppName}\TaskBarIDs" "$INSTDIR"
DeleteRegValue HKLM "Software\Mozilla\${AppName}\TaskBarIDs" "$INSTDIR"
ClearErrors
WriteRegStr HKLM "Software\Mozilla" "${BrandShortName}InstallerTest" "Write Test"
@@ -577,6 +590,10 @@ FunctionEnd
# Initialization Functions
Function .onInit
; We need this set up for most of the helper.exe operations.
!ifdef AppName
${InitHashAppModelId} "$INSTDIR" "Software\Mozilla\${AppName}\TaskBarIDs"
!endif
${UninstallOnInitCommon}
FunctionEnd