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 557486 201ff5101cb6d548492321f53815c045aab295fa
parent 557485 fdd53f7d454d15a0b0d82d6bdae2c4fed837d048
child 623081 82c8cdae429c983da2f68abe46589c127196ed3c
push id52747
push usermhowell@mozilla.com
push dateThu, 06 Apr 2017 22:58:14 +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
@@ -1243,30 +1243,48 @@
 !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}" "+" "" "" $0
+  ClearErrors
+  ReadRegStr $0 HKCU "Software\Clients\StartMenuInternet\$0\DefaultIcon" ""
+  ${If} ${Errors}
+  ${OrIf} ${AtMostWin2008R2}
+    ClearErrors
+    ReadRegStr $0 HKLM "Software\Clients\StartMenuInternet\$0\DefaultIcon" ""
+  ${EndIf}
+  StrCpy $0 $0 -2
+  ${If} $0 == $8
+    ${StrFilter} "${FileMainEXE}" "+" "" "" $R9
+  ${Else}
+    ${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}