Bug 1353955 - Fix making ourselves the default browser on Windows 7. r?agashlin draft
authorMatt Howell <mhowell@mozilla.com>
Thu, 06 Apr 2017 15:57:32 -0700
changeset 561482 045221bf1001bbc2c7ba6277afe0d35adc41cd3f
parent 560921 f40e24f40b4c4556944c762d4764eace261297f5
child 623985 290e220c9c9a206c49fce0683ffb92047d4f746e
push id53740
push usermhowell@mozilla.com
push dateWed, 12 Apr 2017 18:30:11 +0000
reviewersagashlin
bugs1353955, 1324617
milestone55.0a1
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
browser/installer/windows/nsis/shared.nsh
--- 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}