Bug 1592968 Followup - Write the pinned to taskbar flag in a place the unelevated helper can write to. r=agashlin
authorMolly Howell <mhowell@mozilla.com>
Fri, 15 Nov 2019 00:31:07 +0000
changeset 502099 a16c535b92e66101c5db5aa4e6a63c42476b018b
parent 502098 e04f7fc87005084851805cc6f78a2b277cb77a46
child 502100 40546d0aab39bc49cd3505aedf46ce4ed67595e6
push id114172
push userdluca@mozilla.com
push dateTue, 19 Nov 2019 11:31:10 +0000
treeherdermozilla-inbound@b5c5ba07d3db [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersagashlin
bugs1592968
milestone72.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
Bug 1592968 Followup - Write the pinned to taskbar flag in a place the unelevated helper can write to. r=agashlin The previous patch didn't work because the helper running as the unelevated user is the only one that can read the pref out of its user registry hive, which is where Firefox has to write it, but then since it's limited it can't write to either the shortcut log or to HKLM. So everything has to happen in HKCU so that the unelevated helper can both read and write where it needs to read and write to. Differential Revision: https://phabricator.services.mozilla.com/D53113
browser/installer/windows/nsis/shared.nsh
--- a/browser/installer/windows/nsis/shared.nsh
+++ b/browser/installer/windows/nsis/shared.nsh
@@ -1090,35 +1090,25 @@
 ; Adds a pinned shortcut to Task Bar on update for Windows 7 and above if this
 ; macro has never been called before and the application is default (see
 ; PinToTaskBar for more details).
 ; Since defaults handling is handled by Windows in Win8 and later, we always
 ; 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
 ; that time.
 !macro MigrateTaskBarShortcut
-  ; Find out if this is an ESR build or not, because it affects what we've
-  ; named some of our application registry keys.
-  ClearErrors
-  ${WordFind} "${UpdateChannel}" "esr" "E#" $3
-  ${If} ${Errors}
-    StrCpy $3 ""
-  ${Else}
-    StrCpy $3 " ESR"
-  ${EndIf}
-
   ${GetShortcutsLogPath} $0
   ${If} ${FileExists} "$0"
     ClearErrors
     ReadINIStr $1 "$0" "TASKBAR" "Migrated"
     ${If} ${Errors}
       ClearErrors
       WriteIniStr "$0" "TASKBAR" "Migrated" "true"
-      WriteRegDWORD SHCTX \
-        "Software\Mozilla\${BrandFullNameInternal}\${AppVersion}$3 (${ARCH} ${AB_CD})\Main" \
+      WriteRegDWORD HKCU \
+        "Software\Mozilla\${AppName}\Installer\$AppUserModelID" \
         "WasPinnedToTaskbar" 1
       ${If} ${AtLeastWin7}
         ; If we didn't run the stub installer, AddTaskbarSC will be empty.
         ; We determine whether to pin based on whether we're the default
         ; browser, or if we're on win8 or later, we always pin.
         ${If} $AddTaskbarSC == ""
           ; No need to check the default on Win8 and later
           ${If} ${AtMostWin2008R2}
@@ -1142,22 +1132,22 @@
         "installer.taskbarpin.win10.enabled" $2
       ${If} $2 == "true"
         ; On Windows 10, we may have previously tried to make a taskbar pin
         ; and failed because the API we tried to use was blocked by the OS.
         ; We have an option that works in more cases now, so we're going to try
         ; again, but also record that we've done so by writing a particular
         ; registry value, so that we don't continue to do this repeatedly.
         ClearErrors
-        ReadRegDWORD $2 SHCTX \
-            "Software\Mozilla\${BrandFullNameInternal}\${AppVersion}$3 (${ARCH} ${AB_CD})\Main" \
+        ReadRegDWORD $2 HKCU \
+            "Software\Mozilla\${AppName}\Installer\$AppUserModelID" \
             "WasPinnedToTaskbar"
         ${If} ${Errors}
-          WriteRegDWORD SHCTX \
-            "Software\Mozilla\${BrandFullNameInternal}\${AppVersion}$3 (${ARCH} ${AB_CD})\Main" \
+          WriteRegDWORD HKCU \
+            "Software\Mozilla\${AppName}\Installer\$AppUserModelID" \
             "WasPinnedToTaskbar" 1
           ${If} $AddTaskbarSC != "0"
             ${PinToTaskBar}
           ${EndIf}
         ${EndIf}
       ${EndIf}
     ${EndIf}
   ${EndIf}