author | Kirk Steuber <ksteuber@mozilla.com> |
Wed, 08 Dec 2021 19:13:01 +0000 (2021-12-08) | |
changeset 601432 | e1442bbd4a7efa48c5caca6a788ea88afd2a2eef |
parent 601431 | e033669757329332fdb736eb924026434a460d73 |
child 601433 | 8f6cccd15bdd345b948a5f2ba28becdae159c56a |
push id | 39048 |
push user | nfay@mozilla.com |
push date | Thu, 09 Dec 2021 09:32:28 +0000 (2021-12-09) |
treeherder | mozilla-central@3f29a100ee06 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | nalexander |
bugs | 1732435 |
milestone | 97.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/browser/installer/windows/nsis/installer.nsi +++ b/browser/installer/windows/nsis/installer.nsi @@ -405,22 +405,16 @@ Section "-Application" APP_IDX ${EndIf} ${EndIf} ; Default for creating Desktop shortcut (1 = create, 0 = don't create) ${If} $AddDesktopSC == "" StrCpy $AddDesktopSC "1" ${EndIf} - ${CreateUpdateDir} "Mozilla" - ${If} ${Errors} - Pop $0 - ${LogMsg} "** ERROR Failed to create update directory: $0" - ${EndIf} - ${LogHeader} "Adding Registry Entries" SetShellVarContext current ; Set SHCTX to HKCU ${RegCleanMain} "Software\Mozilla" ${RegCleanUninstall} ${UpdateProtocolHandlers} ClearErrors WriteRegStr HKLM "Software\Mozilla" "${BrandShortName}InstallerTest" "Write Test"
--- a/browser/installer/windows/nsis/uninstaller.nsi +++ b/browser/installer/windows/nsis/uninstaller.nsi @@ -322,26 +322,27 @@ Function un.LaunchRefreshHelpPage Pop $1 Pop $0 FunctionEnd Function un.OpenRefreshHelpURL ExecShell "open" "${URLProfileRefreshHelp}" FunctionEnd -; Returns the common directory (typically "C:\ProgramData\Mozilla") on the stack. +; Returns the common directory (typically +; "C:\ProgramData\Mozilla-1de4eec8-1241-4177-a864-e594e8d1fb38") on the stack. Function un.GetCommonDirectory Push $0 ; Save $0 ; This gets C:\ProgramData or the equivalent. ${GetCommonAppDataFolder} $0 ; Add our subdirectory, this is hardcoded as grandparent of the update directory in ; several other places. - StrCpy $0 "$0\Mozilla" + StrCpy $0 "$0\Mozilla-1de4eec8-1241-4177-a864-e594e8d1fb38" Exch $0 ; Restore original $0 and put our $0 on the stack. FunctionEnd Function un.SendUninstallPing ${If} $AppUserModelID == "" Return ${EndIf}
--- a/toolkit/mozapps/installer/windows/nsis/common.nsh +++ b/toolkit/mozapps/installer/windows/nsis/common.nsh @@ -3562,21 +3562,21 @@ ; Concatenate the local AppData path ($R9) to the relative profile path and ; the relative path to $INSTDIR from $PROGRAMFILES StrCpy $R2 "$R9\$R7$R2" ${${_MOZFUNC_UN}GetLongPath} "$R2" $R2 ${If} $R2 != "" ; Backup the old update directory logs and delete the directory ${If} ${FileExists} "$R2\updates\last-update.log" - Rename "$R2\updates\last-update.log" "$TEMP\moz-update-oldest-last-update.log" + Rename "$R2\updates\last-update.log" "$TEMP\moz-update-old-1-last-update.log" ${EndIf} ${If} ${FileExists} "$R2\updates\backup-update.log" - Rename "$R2\updates\backup-update.log" "$TEMP\moz-update-oldest-backup-update.log" + Rename "$R2\updates\backup-update.log" "$TEMP\moz-update-old-1-backup-update.log" ${EndIf} ${If} ${FileExists} "$R2\updates" RmDir /r "$R2" ${EndIf} ${EndIf} ${EndIf} @@ -3587,35 +3587,61 @@ ${EndIf} ; If the taskbar ID hash exists then delete the new update directory ; Backup its logs before deleting it. ${If} $R1 != "" StrCpy $R0 "$R9\$R8\$R1" ${If} ${FileExists} "$R0\updates\last-update.log" - Rename "$R0\updates\last-update.log" "$TEMP\moz-update-older-last-update.log" + Rename "$R0\updates\last-update.log" "$TEMP\moz-update-old-2-last-update.log" ${EndIf} ${If} ${FileExists} "$R0\updates\backup-update.log" - Rename "$R0\updates\backup-update.log" "$TEMP\moz-update-older-backup-update.log" + Rename "$R0\updates\backup-update.log" "$TEMP\moz-update-old-2-backup-update.log" ${EndIf} ; Remove the old updates directory, located in the user's Windows profile directory ${If} ${FileExists} "$R0\updates" RmDir /r "$R0" ${EndIf} - ; Get the new updates directory so we can remove that too - ; The new update directory is in the Program Data directory - ; (currently C:\ProgramData). ${GetCommonAppDataFolder} $R0 StrCpy $R0 "$R0\$R8\$R1" ${If} ${FileExists} "$R0\updates\last-update.log" + Rename "$R0\updates\last-update.log" "$TEMP\moz-update-old-3-last-update.log" + ${EndIf} + + ${If} ${FileExists} "$R0\updates\backup-update.log" + Rename "$R0\updates\backup-update.log" "$TEMP\moz-update-old-3-backup-update.log" + ${EndIf} + + ; Even though this is an old update directory, completely clear it out + ; on uninstall only, not on installation. If this is an installation, + ; it may be a paveover install and there may be un-migrated settings + ; in the update directory that we don't want to lose. + ; On install though, we should still remove pending updates and update + ; metadata since migrating that data could potentially confuse Firefox + ; into thinking that it failed to apply an update. + !if "${_MOZFUNC_UN}" == "un." + ${If} ${FileExists} "$R0" + RmDir /r "$R0" + ${EndIf} + !else + ${If} ${FileExists} "$R0\updates" + RmDir /r "$R0\updates" + ${EndIf} + Delete "$R0\active-update.xml" + !endif + + ${GetCommonAppDataFolder} $R0 + StrCpy $R0 "$R0\Mozilla-1de4eec8-1241-4177-a864-e594e8d1fb38\updates\$R1" + + ${If} ${FileExists} "$R0\updates\last-update.log" Rename "$R0\updates\last-update.log" "$TEMP\moz-update-newest-last-update.log" ${EndIf} ${If} ${FileExists} "$R0\updates\backup-update.log" Rename "$R0\updates\backup-update.log" "$TEMP\moz-update-newest-backup-update.log" ${EndIf} ; The update directory is shared across all users of this @@ -3702,94 +3728,16 @@ !undef _MOZFUNC_UN !define _MOZFUNC_UN !verbose pop !endif !macroend /** - * Create the update directory and sets the permissions correctly - * - * @param ROOT_DIR_NAME - * The name of the update directory to be created in the common - * application directory. For example, if ROOT_DIR_NAME is "Mozilla", - * the created directory will be "C:\ProgramData\Mozilla". - * - * $R0 = Used for checking errors - * $R1 = The common application directory path - * $R9 = An error message to be returned on the stack - */ -!macro CreateUpdateDir ROOT_DIR_NAME - Push $R9 - Push $R0 - Push $R1 - - ; The update directory is in the Program Data directory - ; (currently C:\ProgramData). - ${GetCommonAppDataFolder} $R1 - StrCpy $R1 "$R1\${ROOT_DIR_NAME}" - - ClearErrors - ${IfNot} ${FileExists} "$R1" - CreateDirectory "$R1" - ${If} ${Errors} - StrCpy $R9 "Unable to create directory: $R1" - GoTo end - ${EndIf} - ${EndIf} - - ; Grant Full Access to the Builtin User group - AccessControl::SetOnFile "$R1" "(BU)" "FullAccess" - Pop $R0 - ${If} $R0 == error - Pop $R9 ; Get AccessControl's Error Message - SetErrors - GoTo end - ${EndIf} - - ; Grant Full Access to the Builtin Administrator group - AccessControl::SetOnFile "$R1" "(BA)" "FullAccess" - Pop $R0 - ${If} $R0 == error - Pop $R9 ; Get AccessControl's Error Message - SetErrors - GoTo end - ${EndIf} - - ; Grant Full Access to the SYSTEM user - AccessControl::SetOnFile "$R1" "(SY)" "FullAccess" - Pop $R0 - ${If} $R0 == error - Pop $R9 ; Get AccessControl's Error Message - SetErrors - GoTo end - ${EndIf} - - ; Remove inherited permissions - AccessControl::DisableFileInheritance "$R1" - Pop $R0 - ${If} $R0 == error - Pop $R9 ; Get AccessControl's Error Message - SetErrors - GoTo end - ${EndIf} - -end: - Pop $R1 - Pop $R0 - ${If} ${Errors} - Exch $R9 - ${Else} - Pop $R9 - ${EndIf} -!macroend -!define CreateUpdateDir "!insertmacro CreateUpdateDir" - -/** * Deletes shortcuts and Start Menu directories under Programs as specified by * the shortcuts log ini file and on Windows 7 unpins TaskBar and Start Menu * shortcuts. The shortcuts will not be deleted if the shortcut target isn't for * this install location which is determined by the shortcut having a target of * $INSTDIR\${FileMainEXE}. The context (All Users or Current User) of the * $DESKTOP and $SMPROGRAMS constants depends on the * SetShellVarContext setting and must be set by the caller of this macro. There * is no All Users context for $QUICKLAUNCH but this will not cause a problem