Merge m-c to inbound.
authorRyan VanderMeulen <ryanvm@gmail.com>
Tue, 19 Feb 2013 18:23:12 -0500
changeset 132780 321ab9290c0637f50b791b6a24e9b6a962636462
parent 132779 b399e0488c098b663b996141f394376f2e11f4be (current diff)
parent 132717 401b967b2dfcc9107d9c3a9c9b45b10c4a67a932 (diff)
child 132781 5a35db95c15f5d2f62eea5fcc3f3ea3d12108ee5
push id2452
push userlsblakk@mozilla.com
push dateMon, 13 May 2013 16:59:38 +0000
treeherdermozilla-beta@d4b152d29d8d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
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
Merge m-c to inbound.
--- a/browser/installer/windows/nsis/shared.nsh
+++ b/browser/installer/windows/nsis/shared.nsh
@@ -15,54 +15,67 @@ Function RegisterCEH
                                     "$INSTDIR\CommandExecuteHandler.exe" \
                                     $AppUserModelID \
                                     "FirefoxURL" \
                                     "FirefoxHTML"
   ${EndIf}
 !endif
 FunctionEnd
 
-; If MOZ_METRO is defined and we're at least win8, then we should re-create
-; the start menu shortcut so that the Metro browser is accessible.
-; This is also for zip builds who won't have a start menu shortcut yet.
-Function CreateStartMenuTile
+; If we're in Win8 make sure we have a start menu shortcut and that it has
+; the correct AppuserModelID so that the Metro browser has a Metro tile.
+Function RegisterStartMenuTile
 !ifdef MOZ_METRO
-    Delete "$SMPROGRAMS\${BrandFullName}.lnk"
+  ${If} ${AtLeastWin8}
     CreateShortCut "$SMPROGRAMS\${BrandFullName}.lnk" "$INSTDIR\${FileMainEXE}"
     ${If} ${FileExists} "$SMPROGRAMS\${BrandFullName}.lnk"
       ShellLink::SetShortCutWorkingDirectory "$SMPROGRAMS\${BrandFullName}.lnk" \
                                              "$INSTDIR"
       ${If} "$AppUserModelID" != ""
         ApplicationID::Set "$SMPROGRAMS\${BrandFullName}.lnk" "$AppUserModelID" "true"
       ${EndIf}
     ${EndIf}
+  ${EndIf}
 !endif
 FunctionEnd
 
 !macro PostUpdate
+  ; 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"
+    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"
+      ; 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.
   SetShellVarContext current  ; Set SHCTX to the current user (e.g. HKCU)
   ${RegCleanMain} "Software\Mozilla"
   ${RegCleanUninstall}
   ${UpdateProtocolHandlers}
 
   ; setup the application model id registration value
   ${InitHashAppModelId} "$INSTDIR" "Software\Mozilla\${AppName}\TaskBarIDs"
 
   ; Win7 taskbar and start menu link maintenance
   Call FixShortcutAppModelIDs
 
-  ; Win8 specific registration
-  Call RegisterCEH
-  Call CreateStartMenuTile
-
   ClearErrors
   WriteRegStr HKLM "Software\Mozilla" "${BrandShortName}InstallerTest" "Write Test"
   ${If} ${Errors}
     StrCpy $TmpVal "HKCU" ; used primarily for logging
   ${Else}
     SetShellVarContext all    ; Set SHCTX to all users (e.g. HKLM)
     DeleteRegValue HKLM "Software\Mozilla" "${BrandShortName}InstallerTest"
     StrCpy $TmpVal "HKLM" ; used primarily for logging
@@ -171,16 +184,30 @@ FunctionEnd
       ; In the worst case, in case there is some edge case with the 
       ; IsAdmin check and the permissions check, the maintenance service
       ; will just fail to be attempted to be installed. 
       nsExec::Exec "$\"$INSTDIR\maintenanceservice_installer.exe$\""
     ${EndIf}
   ${EndIf}
 !endif
 
+; Register the DEH
+!ifdef MOZ_METRO
+  ${If} ${AtLeastWin8}
+    ; If RegisterCEH is called too close to changing the shortcut AppUserModelID
+    ; and if the tile image is not already in cache.  Then Windows won't refresh
+    ; the tile image on the start screen.  So wait before calling RegisterCEH.
+    ; We only need to do this when the DEH doesn't already exist.
+    ReadRegStr $0 HKCU "Software\Classes\FirefoxURL\shell\open\command" "DelegateExecute"
+    ${If} $0 != ${DELEGATE_EXECUTE_HANDLER_ID}
+      Sleep 3000
+    ${EndIf}
+    Call RegisterCEH
+  ${EndIf}
+!endif
 !macroend
 !define PostUpdate "!insertmacro PostUpdate"
 
 !macro SetAsDefaultAppGlobal
   ${RemoveDeprecatedKeys} ; Does not use SHCTX
 
   SetShellVarContext all      ; Set SHCTX to all users (e.g. HKLM)
   ${SetHandlers} ; Uses SHCTX
@@ -1170,17 +1197,17 @@ Function SetAsDefaultAppUserHKCU
   ${EndUnless}
 
   SetShellVarContext current  ; Set SHCTX to the current user (e.g. HKCU)
 
   ${If} ${AtLeastWin8}
     ${SetStartMenuInternet} "HKCU"
     ${FixShellIconHandler} "HKCU"
     ${FixClassKeys} ; Does not use SHCTX
-    Call CreateStartMenuTile
+    Call RegisterStartMenuTile
   ${EndIf}
 
   ${SetHandlers}
 
   ${If} ${AtLeastWinVista}
     ; Only register as the handler on Vista and above if the app registry name
     ; exists under the RegisteredApplications registry key. The protocol and
     ; file handlers set previously at the user level will associate this install