Bug 1554141 - Use installs.ini to find per-install profiles. r=agashlin a=jcristau
authorMatt Howell <mhowell@mozilla.com>
Tue, 28 May 2019 20:52:23 +0000
changeset 536596 e26b8629b145879a5a5949e799f9dc02bf7a3f3e
parent 536595 8536ebb1c16ffc0ae48a1efb51770744db176fe5
child 536597 607ce840d7977d086a69f5937db83522b47f1270
push id2082
push userffxbld-merge
push dateMon, 01 Jul 2019 08:34:18 +0000
treeherdermozilla-release@2fb19d0466d2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersagashlin, jcristau
bugs1554141
milestone68.0
Bug 1554141 - Use installs.ini to find per-install profiles. r=agashlin a=jcristau This should be more reliable than exclusively using profiles.ini, which doesn't always get rewritten to include path hashes for the per-install profiles. Differential Revision: https://phabricator.services.mozilla.com/D32884
browser/installer/windows/nsis/stub.nsi
--- a/browser/installer/windows/nsis/stub.nsi
+++ b/browser/installer/windows/nsis/stub.nsi
@@ -1917,55 +1917,64 @@ Function ShouldPromptForProfileCleanup
     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
 
   StrCpy $R0 ""
-  ${If} ${FileExists} "$APPDATA\Mozilla\Firefox\profiles.ini"
-    ; See if there's an installation-specific profile for our INSTDIR.
+  ; First look for an install-specific profile, which might be listed as
+  ; either a relative or an absolute path (installs.ini doesn't say which).
+  ${If} ${FileExists} "$APPDATA\Mozilla\Firefox\installs.ini"
     ClearErrors
-    ReadINIStr $1 "$APPDATA\Mozilla\Firefox\profiles.ini" "Install$AppUserModelID" "Default"
+    ReadINIStr $1 "$APPDATA\Mozilla\Firefox\installs.ini" "$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}
+      ${GetLongPath} "$APPDATA\Mozilla\Firefox\$1" $2
+      ${If} ${FileExists} $2
+        StrCpy $R0 $2
+      ${Else}
+        ${GetLongPath} "$1" $2
+        ${If} ${FileExists} $2
+          StrCpy $R0 $2
         ${EndIf}
+      ${EndIf}
+    ${EndIf}
+  ${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"
-          ${EndIf}
-          ${Break}
+  ${If} $R0 == ""
+    ; 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"
         ${EndIf}
+        ${Break}
+      ${EndIf}
 
-        IntOp $0 $0 + 1
-      ${Loop}
-    ${EndIf}
+      IntOp $0 $0 + 1
+    ${Loop}
   ${EndIf}
 
   GetFullPathName $R0 $R0
 
   ${If} $R0 == ""
     ; No profile to clean up, so don't show the cleanup prompt.
     GoTo end
   ${EndIf}