Bug 734628 - Always regenerate AppuserModelID. r=rstrong
authorBrian R. Bondy <netzen@gmail.com>
Wed, 24 Oct 2012 11:45:15 -0400
changeset 111387 8fd0d9938697428c24b85ba750e3023dcb3cadb6
parent 111386 8aa98d89341f5dfc95623502e29b27c511eccd3b
child 111388 cec97050764dbd046de53a51eafb67bda204185d
push id93
push usernmatsakis@mozilla.com
push dateWed, 31 Oct 2012 21:26:57 +0000
reviewersrstrong
bugs734628
milestone19.0a1
Bug 734628 - Always regenerate AppuserModelID. r=rstrong
toolkit/mozapps/installer/windows/nsis/common.nsh
--- a/toolkit/mozapps/installer/windows/nsis/common.nsh
+++ b/toolkit/mozapps/installer/windows/nsis/common.nsh
@@ -6982,42 +6982,31 @@
       ; stack: apppath, regpath
       Exch $R9 ; stack: $R9, regpath | $R9 = apppath
       Exch 1   ; stack: regpath, $R9
       Exch $R8 ; stack: $R8, $R9   | $R8 = regpath
       Push $R7
 
       ${If} ${AtLeastWin7}
         ${${_MOZFUNC_UN}GetLongPath} "$R9" $R9
+        ; Always create a new AppUserModelID and overwrite the existing one
+        ; for the current installation path.
+        CityHash::GetCityHash64 "$R9"
+        Pop $AppUserModelID
+        ${If} $AppUserModelID == "error"
+          GoTo end
+        ${EndIf}
         ClearErrors
-        ReadRegStr $R7 HKLM "$R8" "$R9"
+        WriteRegStr HKLM "$R8" "$R9" "$AppUserModelID"
         ${If} ${Errors}
           ClearErrors
-          ReadRegStr $R7 HKCU "$R8" "$R9"
+          WriteRegStr HKCU "$R8" "$R9" "$AppUserModelID"
           ${If} ${Errors}
-            ; If it doesn't exist, create a new one and store it
-            CityHash::GetCityHash64 "$R9"
-            Pop $AppUserModelID
-            ${If} $AppUserModelID == "error"
-              GoTo end
-            ${EndIf}
-            ClearErrors
-            WriteRegStr HKLM "$R8" "$R9" "$AppUserModelID"
-            ${If} ${Errors}
-              ClearErrors
-              WriteRegStr HKCU "$R8" "$R9" "$AppUserModelID"
-              ${If} ${Errors}
-                StrCpy $AppUserModelID "error"
-              ${EndIf}
-            ${EndIf}
-          ${Else}
-            StrCpy $AppUserModelID $R7
+            StrCpy $AppUserModelID "error"
           ${EndIf}
-        ${Else}
-          StrCpy $AppUserModelID $R7
         ${EndIf}
       ${EndIf}
 
       end:
       ${If} "$AppUserModelID" == "error"
         StrCpy $AppUserModelID ""
       ${EndIf}