Bug 1546694 - Support install-specific profiles in the stub installer profile refresh check. r=agashlin
authorMatt Howell <mhowell@mozilla.com>
Mon, 29 Apr 2019 15:46:58 +0000
changeset 530582 adde7e56d8f62e30b9d7c6d2a6e15c3d1d37e233
parent 530581 8f2db95f0610ed8c51419bb94ed97ab25a2e3c8c
child 530583 4b11fe46132ced08322ca986ec9c56c15e862c06
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersagashlin
bugs1546694
milestone68.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
Bug 1546694 - Support install-specific profiles in the stub installer profile refresh check. r=agashlin Differential Revision: https://phabricator.services.mozilla.com/D28750
browser/installer/windows/nsis/stub.nsi
--- a/browser/installer/windows/nsis/stub.nsi
+++ b/browser/installer/windows/nsis/stub.nsi
@@ -264,16 +264,17 @@ Var ArchToInstall
 !include "common.nsh"
 
 !insertmacro ElevateUAC
 !insertmacro GetLongPath
 !insertmacro GetPathFromString
 !insertmacro GetParent
 !insertmacro GetSingleInstallPath
 !insertmacro GetTextWidthHeight
+!insertmacro InitHashAppModelId
 !insertmacro IsUserAdmin
 !insertmacro RemovePrecompleteEntries
 !insertmacro SetBrandNameVars
 !insertmacro ITBL3Create
 !insertmacro UnloadUAC
 
 VIAddVersionKey "FileDescription" "${BrandShortName} Installer"
 VIAddVersionKey "OriginalFilename" "setup-stub.exe"
@@ -525,16 +526,18 @@ Function .onInit
     Quit
   ${EndIf}
 
   Call CheckSpace
   ${If} "$HasRequiredSpaceAvailable" == "false"
     MessageBox MB_OK|MB_ICONEXCLAMATION "$(WARN_DISK_SPACE_QUIT)"
     Quit
   ${EndIf}
+
+  ${InitHashAppModelId} "$INSTDIR" "Software\Mozilla\${AppName}\TaskBarIDs"
 FunctionEnd
 
 ; .onGUIInit isn't needed except for RTL locales
 !ifdef ${AB_CD}_rtl
 Function .onGUIInit
   ; Since NSIS RTL support doesn't mirror progress bars use Windows mirroring.
   ${NSD_AddExStyle} $HWNDPARENT ${WS_EX_LAYOUTRTL}
   ${RemoveExStyle} $HWNDPARENT ${WS_EX_RTLREADING}
@@ -1768,49 +1771,60 @@ Function ShouldPromptForProfileCleanup
   ${Else}
     SetRegView 32
   ${EndIf}
 
   ; Make sure $APPDATA is the user's AppData and not ProgramData.
   ; We'll set this back to all at the end of the function.
   SetShellVarContext current
 
-  ; Check each Profile section in profiles.ini until we find the default profile.
   StrCpy $R0 ""
   ${If} ${FileExists} "$APPDATA\Mozilla\Firefox\profiles.ini"
-    StrCpy $0 0
-    ${Do}
-      ClearErrors
-      ; Check if the section exists by reading a value that must be present.
-      ReadINIStr $1 "$APPDATA\Mozilla\Firefox\profiles.ini" "Profile$0" "Path"
-      ${If} ${Errors}
-        ; We've run out of profile sections.
-        ${Break}
-      ${EndIf}
+    ; See if there's an installation-specific profile for our INSTDIR.
+    ClearErrors
+    ReadINIStr $1 "$APPDATA\Mozilla\Firefox\profiles.ini" "Install$AppUserModelID" "Default"
+    ${IfNot} ${Errors}
+      ; We found an installation-specific profile, let's use that one.
+      ; These don't set IsRelative but they're always relative paths.
+      StrCpy $R0 "$APPDATA\Mozilla\Firefox\$1"
+    ${Else}
+      ; We don't have an install-specific profile, so look for an old-style
+      ; default profile instead by checking each numbered Profile section.
+      StrCpy $0 0
+      ${Do}
+        ClearErrors
+        ; Check if the section exists by reading a value that must be present.
+        ReadINIStr $1 "$APPDATA\Mozilla\Firefox\profiles.ini" "Profile$0" "Path"
+        ${If} ${Errors}
+          ; We've run out of profile sections.
+          ${Break}
+        ${EndIf}
 
-      ClearErrors
-      ReadINIStr $1 "$APPDATA\Mozilla\Firefox\profiles.ini" "Profile$0" "Default"
-      ${IfNot} ${Errors}
-      ${AndIf} $1 == "1"
-        ; We've found the default profile
-        ReadINIStr $1 "$APPDATA\Mozilla\Firefox\profiles.ini" "Profile$0" "Path"
-        ReadINIStr $2 "$APPDATA\Mozilla\Firefox\profiles.ini" "Profile$0" "IsRelative"
-        ${If} $2 == "1"
-          StrCpy $R0 "$APPDATA\Mozilla\Firefox\$1"
-        ${Else}
-          StrCpy $R0 "$1"
+        ClearErrors
+        ReadINIStr $1 "$APPDATA\Mozilla\Firefox\profiles.ini" "Profile$0" "Default"
+        ${IfNot} ${Errors}
+        ${AndIf} $1 == "1"
+          ; We've found the default profile
+          ReadINIStr $1 "$APPDATA\Mozilla\Firefox\profiles.ini" "Profile$0" "Path"
+          ReadINIStr $2 "$APPDATA\Mozilla\Firefox\profiles.ini" "Profile$0" "IsRelative"
+          ${If} $2 == "1"
+            StrCpy $R0 "$APPDATA\Mozilla\Firefox\$1"
+          ${Else}
+            StrCpy $R0 "$1"
+          ${EndIf}
+          ${Break}
         ${EndIf}
-        GetFullPathName $R0 $R0
-        ${Break}
-      ${EndIf}
 
-      IntOp $0 $0 + 1
-    ${Loop}
+        IntOp $0 $0 + 1
+      ${Loop}
+    ${EndIf}
   ${EndIf}
 
+  GetFullPathName $R0 $R0
+
   ${If} $R0 == ""
     ; No profile to clean up, so don't show the cleanup prompt.
     GoTo end
   ${EndIf}
 
   ; We have at least one profile present. If we don't have any installations,
   ; then we need to show the re-install prompt. We'll say there's an
   ; installation present if HKCR\FirefoxURL* exists and points to a real path.