Bug 843248 - Metro tiles sometimes not working because of session 0 detection. r=jimm
authorBrian R. Bondy <netzen@gmail.com>
Thu, 21 Feb 2013 13:17:13 -0500
changeset 122565 7f95f7e035424a43bbffd9390edadcf92f05306d
parent 122564 702d2814efbf33eea652d5bfcc658aba75331014
child 122566 201b64ad48d8899812cd6cf9a3ffcce36c653bf3
push id23376
push useremorley@mozilla.com
push dateThu, 21 Feb 2013 19:56:09 +0000
treeherdermozilla-inbound@57b4ba1a0018 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjimm
bugs843248
milestone22.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 843248 - Metro tiles sometimes not working because of session 0 detection. r=jimm
browser/installer/windows/nsis/shared.nsh
--- a/browser/installer/windows/nsis/shared.nsh
+++ b/browser/installer/windows/nsis/shared.nsh
@@ -33,41 +33,38 @@ Function RegisterStartMenuTile
         ApplicationID::Set "$SMPROGRAMS\${BrandFullName}.lnk" "$AppUserModelID" "true"
       ${EndIf}
     ${EndIf}
   ${EndIf}
 !endif
 FunctionEnd
 
 !macro PostUpdate
+
+  ; PostUpdate is called from both session 0 and from the user session
+  ; for service updates, make sure that we only register with the user session
+  ; Otherwise ApplicationID::Set can fail intermittently with a file in use error.
+  System::Call "kernel32::GetCurrentProcessId() i.r0"
+  System::Call "kernel32::ProcessIdToSessionId(i $0, *i ${NSIS_MAX_STRLEN} r9)"
+
   ; Determine if we're the protected UserChoice default or not. If so fix the
   ; start menu tile.  In case there are 2 Firefox installations, we only do
   ; this if the application being updated is the default.
   ReadRegStr $0 HKCU "Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice" "ProgId"
   ${If} $0 == "FirefoxURL"
+  ${AndIf} $9 != 0 ; We're not running in session 0
     ReadRegStr $0 HKCU "Software\Classes\FirefoxURL\shell\open\command" ""
     ${GetPathFromString} "$0" $0
     ${GetParent} "$0" $0
     ${If} ${FileExists} "$0"
       ${GetLongPath} "$0" $0
     ${EndIf}
     ${If} "$0" == "$INSTDIR"
-
-      ; PostUpdate is called from both session 0 and from the user session
-      ; for service updates, make sure that we only register with the user session
-      ; Otherwise ApplicationID::Set can fail intermittently with a file in use error.
-      System::Call "kernel32::GetCurrentProcessId() i.r0"
-      System::Call "kernel32::ProcessIdToSessionId(i $0, *i ${NSIS_MAX_STRLEN} r9)"
-      
-      ${If} $9 != 0 ; We're not running in session 0
-        ; Win8 specific registration
-        Call RegisterStartMenuTile
-      ${EndIf}
-
-
+      ; Win8 specific registration
+      Call RegisterStartMenuTile
     ${EndIf}
   ${EndIf}
 
   ${CreateShortcutsLog}
 
   ; Remove registry entries for non-existent apps and for apps that point to our
   ; install location in the Software\Mozilla key and uninstall registry entries
   ; that point to our install location for both HKCU and HKLM.