Bug 1778463: Firefox is pinned to the taskbar even though the "On my taskbar" checkbox is unchecked r=mhowell

The problem here ended up being that we lose the value of `AddTaskBarSC` once ExecCodeSegement is called -- which we do anytime we try to set ourselves as the default if the installer was run elevated.

Differential Revision: https://phabricator.services.mozilla.com/D151291
This commit is contained in:
Ben Hearsum 2022-07-11 12:09:06 +00:00
Родитель 06b74d6d77
Коммит 17a20bb87e
2 изменённых файлов: 23 добавлений и 13 удалений

Просмотреть файл

@ -813,6 +813,11 @@ Section "-InstallEndCleanup"
${EndIf} ${EndIf}
${LogHeader} "Setting as the default browser" ${LogHeader} "Setting as the default browser"
; AddTaskbarSC is needed by MigrateTaskBarShortcut, which is called by
; SetAsDefaultAppUserHKCU. If this is called via ExecCodeSegment,
; MigrateTaskBarShortcut will not see the value of AddTaskbarSC, so we
; send it via a register instead.
StrCpy $R0 $AddTaskbarSC
ClearErrors ClearErrors
${GetParameters} $0 ${GetParameters} $0
${GetOptions} "$0" "/UAC:" $0 ${GetOptions} "$0" "/UAC:" $0
@ -834,7 +839,7 @@ Section "-InstallEndCleanup"
${EndUnless} ${EndUnless}
; Adds a pinned Task Bar shortcut (see MigrateTaskBarShortcut for details). ; Adds a pinned Task Bar shortcut (see MigrateTaskBarShortcut for details).
${MigrateTaskBarShortcut} ${MigrateTaskBarShortcut} "$AddTaskbarSC"
; Add the Firewall entries during install ; Add the Firewall entries during install
Call AddFirewallEntries Call AddFirewallEntries

Просмотреть файл

@ -48,7 +48,7 @@
; not have experienced the onboarding offer to pin to taskbar, so we're ; not have experienced the onboarding offer to pin to taskbar, so we're
; leaving it enabled there. ; leaving it enabled there.
${If} ${AtMostWin2012R2} ${If} ${AtMostWin2012R2}
${MigrateTaskBarShortcut} ${MigrateTaskBarShortcut} "$AddTaskbarSC"
${EndIf} ${EndIf}
; Update the name/icon/AppModelID of our shortcuts as needed, then update the ; Update the name/icon/AppModelID of our shortcuts as needed, then update the
@ -1261,14 +1261,14 @@ ${RemoveDefaultBrowserAgentShortcut}
!macroend !macroend
!define FixDistributionsINI "!insertmacro FixDistributionsINI" !define FixDistributionsINI "!insertmacro FixDistributionsINI"
; Adds a pinned shortcut to Task Bar on update for Windows 7 and above if this ; For updates, adds a pinned shortcut to Task Bar on update for Windows 7
; macro has never been called before and the application is default (see ; and 8 if this macro has never been called before and the application
; PinToTaskBar for more details). ; is default (see PinToTaskBar for more details). This doesn't get called
; Since defaults handling is handled by Windows in Win8 and later, we always ; for Windows 10 and 11 on updates, so we will never pin on update there.
; attempt to pin a taskbar on that OS. If Windows sets the defaults at ;
; installation time, then we don't get the opportunity to run this code at ; For installs, adds a taskbar pin if SHOULD_PIN is 1. (Defaults to 1,
; that time. ; but is controllable through the UI, ini file, and command line flags.)
!macro MigrateTaskBarShortcut !macro MigrateTaskBarShortcut SHOULD_PIN
${GetShortcutsLogPath} $0 ${GetShortcutsLogPath} $0
${If} ${FileExists} "$0" ${If} ${FileExists} "$0"
ClearErrors ClearErrors
@ -1283,7 +1283,7 @@ ${RemoveDefaultBrowserAgentShortcut}
; If we didn't run the stub installer, AddTaskbarSC will be empty. ; If we didn't run the stub installer, AddTaskbarSC will be empty.
; We determine whether to pin based on whether we're the default ; We determine whether to pin based on whether we're the default
; browser, or if we're on win8 or later, we always pin. ; browser, or if we're on win8 or later, we always pin.
${If} $AddTaskbarSC == "" ${If} "${SHOULD_PIN}" == ""
; No need to check the default on Win8 and later ; No need to check the default on Win8 and later
${If} ${AtMostWin2008R2} ${If} ${AtMostWin2008R2}
; Check if the Firefox is the http handler for this user ; Check if the Firefox is the http handler for this user
@ -1297,7 +1297,7 @@ ${RemoveDefaultBrowserAgentShortcut}
${OrIf} ${AtLeastWin8} ${OrIf} ${AtLeastWin8}
${PinToTaskBar} ${PinToTaskBar}
${EndIf} ${EndIf}
${ElseIf} $AddTaskbarSC == "1" ${ElseIf} "${SHOULD_PIN}" == "1"
${PinToTaskBar} ${PinToTaskBar}
${EndIf} ${EndIf}
${EndIf} ${EndIf}
@ -1649,7 +1649,7 @@ Function SetAsDefaultAppUserHKCU
Pop $0 Pop $0
${EndUnless} ${EndUnless}
${RemoveDeprecatedKeys} ${RemoveDeprecatedKeys}
${MigrateTaskBarShortcut} ${MigrateTaskBarShortcut} "$R0"
FunctionEnd FunctionEnd
; Helper for updating the shortcut application model IDs. ; Helper for updating the shortcut application model IDs.
@ -1674,6 +1674,11 @@ FunctionEnd
!ifdef NO_LOG !ifdef NO_LOG
Function SetAsDefaultAppUser Function SetAsDefaultAppUser
; AddTaskbarSC is needed by MigrateTaskBarShortcut, which is called by
; SetAsDefaultAppUserHKCU. If this is called via ExecCodeSegment,
; MigrateTaskBarShortcut will not see the value of AddTaskbarSC, so we
; send it via a register instead.
StrCpy $R0 $AddTaskbarSC
; On Win8, we want to avoid having a UAC prompt since we'll already have ; On Win8, we want to avoid having a UAC prompt since we'll already have
; another action for control panel default browser selection popping up ; another action for control panel default browser selection popping up
; to the user. Win8 is the first OS where the start menu keys can be ; to the user. Win8 is the first OS where the start menu keys can be