Bug 1353955 - Fix making ourselves the default browser on Windows 7. r?agashlin
This fixes a regression from
bug 1324617. We were setting all our file and
protocol associations correctly, but failing to invoke SetAppAsDefaultAll,
meaning we act like the default browser (as in, links and files opened from
external applications go to us), but we don't detect ourselves as the default
browser, and the previous default browser still thinks it's the default.
This only applies to Windows 7 because later versions don't allow us to make
ourselves the default browser anyway.
MozReview-Commit-ID: 29iWvzicce9
--- a/browser/installer/windows/nsis/shared.nsh
+++ b/browser/installer/windows/nsis/shared.nsh
@@ -1244,30 +1244,46 @@
!define un.IsFirewallSvcRunning "!insertmacro IsFirewallSvcRunning"
; Sets this installation as the default browser by setting the registry keys
; under HKEY_CURRENT_USER via registry calls and using the AppAssocReg NSIS
; plugin. This is a function instead of a macro so it is
; easily called from an elevated instance of the binary. Since this can be
; called by an elevated instance logging is not performed in this function.
Function SetAsDefaultAppUserHKCU
+ ; See if we're using path hash suffixed registry keys for this install
+ ${GetLongPath} "$INSTDIR\${FileMainEXE}" $8
+ ${StrFilter} "${FileMainEXE}" "+" "" "" $R9
+ ClearErrors
+ ReadRegStr $0 HKCU "Software\Clients\StartMenuInternet\$R9\DefaultIcon" ""
+ ${If} ${Errors}
+ ${OrIf} ${AtMostWin2008R2}
+ ClearErrors
+ ReadRegStr $0 HKLM "Software\Clients\StartMenuInternet\$R9\DefaultIcon" ""
+ ${EndIf}
+ StrCpy $0 $0 -2
+ ${If} $0 != $8
+ ${If} $AppUserModelID == ""
+ ${InitHashAppModelId} "$INSTDIR" "Software\Mozilla\${AppName}\TaskBarIDs"
+ ${EndIf}
+ StrCpy $R9 "${AppRegName}-$AppUserModelID"
+ ${EndIf}
+
; Only set as the user's StartMenuInternet browser if the StartMenuInternet
; registry keys are for this install.
- StrCpy $R9 "${AppRegName}-$AppUserModelID"
ClearErrors
ReadRegStr $0 HKCU "Software\Clients\StartMenuInternet\$R9\DefaultIcon" ""
${If} ${Errors}
${OrIf} ${AtMostWin2008R2}
ClearErrors
ReadRegStr $0 HKLM "Software\Clients\StartMenuInternet\$R9\DefaultIcon" ""
${EndIf}
${Unless} ${Errors}
WriteRegStr HKCU "Software\Clients\StartMenuInternet" "" "$R9"
${Else}
- ${StrFilter} "${FileMainEXE}" "+" "" "" $R9
ClearErrors
ReadRegStr $0 HKCU "Software\Clients\StartMenuInternet\$R9\DefaultIcon" ""
${If} ${Errors}
${OrIf} ${AtMostWin2008R2}
ClearErrors
ReadRegStr $0 HKLM "Software\Clients\StartMenuInternet\$R9\DefaultIcon" ""
${EndIf}
${Unless} ${Errors}