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 226253 510ef39ea5ffec090e48be3d1be94ab01be3f367
parent 226252 af9b9ed74be4ce391172a4fff5b487d84d417397
child 226254 2db42ec3505500973ee7447a9f5402fe3a01ce44
push id7309
push userryanvm@gmail.com
push dateTue, 25 Nov 2014 20:37:06 +0000
treeherdermozilla-aurora@4af988d1770f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbbondy, lsblakk
Bug 1098677 - During install use the precomplete file to determine files to uninstall instead of the uninstall.log. r=bbondy, a=lsblakk
--- 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
+!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"
+  ; 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.
   ${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"
+  StrCpy $R2 "false"
+  StrCpy $R3 "false"
+  ${RemovePrecompleteEntries} "$R2" "$R3"
+  ${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"
 Section "-Application" APP_IDX
   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"
   ${If} ${FileExists} "$INSTDIR\defaults\shortcuts"
     RmDir /r /REBOOTOK "$INSTDIR\defaults\shortcuts"
   ${If} ${FileExists} "$INSTDIR\distribution"
     RmDir /r /REBOOTOK "$INSTDIR\distribution"
-  ${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.
   ; 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"