Bug 1098677 - During install use the precomplete file to determine files to uninstall instead of the uninstall.log. r=bbondy, a=lsblakk
authorRobert Strong <robert.bugzilla@gmail.com>
Tue, 18 Nov 2014 14:03:42 -0800
changeset 234028 510ef39ea5ffec090e48be3d1be94ab01be3f367
parent 234027 af9b9ed74be4ce391172a4fff5b487d84d417397
child 234029 2db42ec3505500973ee7447a9f5402fe3a01ce44
push id4187
push userbhearsum@mozilla.com
push dateFri, 28 Nov 2014 15:29:12 +0000
treeherdermozilla-beta@f23cc6a30c11 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbbondy, lsblakk
bugs1098677
milestone35.0a2
Bug 1098677 - During install use the precomplete file to determine files to uninstall instead of the uninstall.log. r=bbondy, a=lsblakk
browser/installer/windows/nsis/installer.nsi
browser/installer/windows/nsis/uninstaller.nsi
toolkit/mozapps/installer/windows/nsis/common.nsh
--- a/browser/installer/windows/nsis/installer.nsi
+++ b/browser/installer/windows/nsis/installer.nsi
@@ -91,31 +91,30 @@ VIAddVersionKey "OriginalFilename" "setu
 !insertmacro InitHashAppModelId
 !insertmacro IsHandlerForInstallDir
 !insertmacro IsPinnedToTaskBar
 !insertmacro IsUserAdmin
 !insertmacro LogDesktopShortcut
 !insertmacro LogQuickLaunchShortcut
 !insertmacro LogStartMenuShortcut
 !insertmacro ManualCloseAppPrompt
-!insertmacro OnStubInstallUninstall
 !insertmacro PinnedToStartMenuLnkCount
 !insertmacro RegCleanAppHandler
 !insertmacro RegCleanMain
 !insertmacro RegCleanUninstall
 !ifdef MOZ_METRO
 !insertmacro RemoveDEHRegistrationIfMatching
 !endif
+!insertmacro RemovePrecompleteEntries
 !insertmacro SetAppLSPCategories
 !insertmacro SetBrandNameVars
 !insertmacro UpdateShortcutAppModelIDs
 !insertmacro UnloadUAC
 !insertmacro WriteRegStr2
 !insertmacro WriteRegDWORD2
-!insertmacro CheckIfRegistryKeyExists
 
 !include shared.nsh
 
 ; Helper macros for ui callbacks. Insert these after shared.nsh
 !insertmacro CheckCustomCommon
 !insertmacro InstallEndCleanupCommon
 !insertmacro InstallOnInitCommon
 !insertmacro InstallStartCleanupCommon
@@ -206,26 +205,43 @@ Section "-InstallStartCleanup"
   ${StartInstallLog} "${BrandFullName}" "${AB_CD}" "${AppVersion}" "${GREVersion}"
 
   StrCpy $PreventRebootRequired "false"
   ${GetParameters} $R8
   ${GetOptions} "$R8" "/INI=" $R7
   ${Unless} ${Errors}
     ; The configuration file must also exist
     ${If} ${FileExists} "$R7"
+      ReadINIStr $R9 $R7 "Install" "RemoveDistributionDir"
       ReadINIStr $R8 $R7 "Install" "PreventRebootRequired"
       ${If} $R8 == "true"
         StrCpy $PreventRebootRequired "true"
-        StrCpy $R2 "false"
-        StrCpy $R3 "false"
-        ${OnStubInstallUninstall} "$R2" "$R3"
       ${EndIf}
     ${EndIf}
   ${EndUnless}
 
+  ; Remove directories and files we always control before parsing the uninstall
+  ; log so empty directories can be removed.
+  ${If} ${FileExists} "$INSTDIR\updates"
+    RmDir /r "$INSTDIR\updates"
+  ${EndIf}
+  ${If} ${FileExists} "$INSTDIR\updated"
+    RmDir /r "$INSTDIR\updated"
+  ${EndIf}
+  ${If} ${FileExists} "$INSTDIR\defaults\shortcuts"
+    RmDir /r "$INSTDIR\defaults\shortcuts"
+  ${EndIf}
+  ; Only remove the distribution directory if it exists and if the installer
+  ; isn't launched with an ini file that has RemoveDistributionDir=false in the
+  ; install section.
+  ${If} ${FileExists} "$INSTDIR\distribution"
+  ${AndIf} $R9 != "false"
+    RmDir /r "$INSTDIR\distribution"
+  ${EndIf}
+
   ; Delete the app exe if present to prevent launching the app while we are
   ; installing.
   ClearErrors
   ${DeleteFile} "$INSTDIR\${FileMainEXE}"
   ${If} ${Errors}
     ; If the user closed the application it can take several seconds for it to
     ; shut down completely. If the application is being used by another user we
     ; can rename the file and then delete is when the system is restarted.
@@ -237,16 +253,43 @@ Section "-InstallStartCleanup"
   ; setup the application model id registration value
   ${InitHashAppModelId} "$INSTDIR" "Software\Mozilla\${AppName}\TaskBarIDs"
 
   ; Remove the updates directory for Vista and above
   ${CleanUpdateDirectories} "Mozilla\Firefox" "Mozilla\updates"
 
   ${RemoveDeprecatedFiles}
 
+  StrCpy $R2 "false"
+  StrCpy $R3 "false"
+  ${RemovePrecompleteEntries} "$R2" "$R3"
+
+  RmDir /r /REBOOTOK "$INSTDIR\${TO_BE_DELETED}"
+
+  ${If} ${FileExists} "$INSTDIR\defaults\pref\channel-prefs.js"
+    Delete "$INSTDIR\defaults\pref\channel-prefs.js"
+  ${EndIf}
+  ${If} ${FileExists} "$INSTDIR\defaults\pref"
+    RmDir "$INSTDIR\defaults\pref"
+  ${EndIf}
+  ${If} ${FileExists} "$INSTDIR\defaults"
+    RmDir "$INSTDIR\defaults"
+  ${EndIf}
+  ${If} ${FileExists} "$INSTDIR\uninstall"
+    ; Remove the uninstall directory that we control
+    RmDir /r "$INSTDIR\uninstall"
+  ${EndIf}
+  ${If} ${FileExists} "$INSTDIR\update-settings.ini"
+    Delete "$INSTDIR\update-settings.ini"
+  ${EndIf}
+
+  ; Explictly remove empty webapprt dir in case it exists (bug 757978).
+  RmDir "$INSTDIR\webapprt\components"
+  RmDir "$INSTDIR\webapprt"
+
   ${InstallStartCleanupCommon}
 SectionEnd
 
 Section "-Application" APP_IDX
   ${StartUninstallLog}
 
   SetDetailsPrint both
   DetailPrint $(STATUS_INSTALL_APP)
--- a/browser/installer/windows/nsis/uninstaller.nsi
+++ b/browser/installer/windows/nsis/uninstaller.nsi
@@ -398,19 +398,16 @@ Section "Uninstall"
     RmDir /r /REBOOTOK "$INSTDIR\updated"
   ${EndIf}
   ${If} ${FileExists} "$INSTDIR\defaults\shortcuts"
     RmDir /r /REBOOTOK "$INSTDIR\defaults\shortcuts"
   ${EndIf}
   ${If} ${FileExists} "$INSTDIR\distribution"
     RmDir /r /REBOOTOK "$INSTDIR\distribution"
   ${EndIf}
-  ${If} ${FileExists} "$INSTDIR\removed-files"
-    Delete /REBOOTOK "$INSTDIR\removed-files"
-  ${EndIf}
 
   ; Remove files that may be left behind by the application in the
   ; VirtualStore directory.
   ${un.CleanVirtualStore}
 
   ; Only unregister the dll if the registration points to this installation
   ReadRegStr $R1 HKCR "CLSID\{0D68D6D0-D93D-4D08-A30D-F00DD1F45B24}\InProcServer32" ""
   ${If} "$INSTDIR\AccessibleMarshal.dll" == "$R1"
--- a/toolkit/mozapps/installer/windows/nsis/common.nsh
+++ b/toolkit/mozapps/installer/windows/nsis/common.nsh
@@ -5826,18 +5826,16 @@
       ; Remove files not removed by parsing the uninstall.log
       Delete "$INSTDIR\install_wizard.log"
       Delete "$INSTDIR\install_status.log"
 
       RmDir /r "$INSTDIR\updates"
       Delete "$INSTDIR\updates.xml"
       Delete "$INSTDIR\active-update.xml"
 
-      RmDir /r "$INSTDIR\distribution"
-
       ; Remove files from the uninstall directory.
       ${If} ${FileExists} "$INSTDIR\uninstall"
         Delete "$INSTDIR\uninstall\*wizard*"
         Delete "$INSTDIR\uninstall\uninstall.ini"
         Delete "$INSTDIR\uninstall\cleanup.log"
         Delete "$INSTDIR\uninstall\uninstall.update"
         ${OnInstallUninstall}
       ${EndIf}