Bug 1853144 - Fix registry cleanup for the Default Agent during uninstall. r=bytesized

This change makes the Default Agent proxy wait for the Default Agent background task to exit before itself exiting.

Additionally this moves the call to run the Default Agent uninstaller earlier to ensure firefox.exe still exists.

Differential Revision: https://phabricator.services.mozilla.com/D188396
This commit is contained in:
Nicholas Rishel 2023-09-18 16:52:07 +00:00
Родитель 5982a0f3b8
Коммит 38557c8b47
2 изменённых файлов: 13 добавлений и 9 удалений

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

@ -425,6 +425,15 @@ Section "Uninstall"
Var /GLOBAL UnusedExecCatchReturn
ExecWait '"$INSTDIR\${FileMainEXE}" --backgroundtask uninstall' $UnusedExecCatchReturn
; Uninstall the default browser agent scheduled task and all other scheduled
; tasks registered by Firefox.
; This also removes the registry entries that the WDBA creates.
; One of the scheduled tasks that this will remove is the Background Update
; Task. Ideally, this will eventually be changed so that it doesn't rely on
; the WDBA. See Bug 1710143.
ExecWait '"$INSTDIR\default-browser-agent.exe" uninstall $AppUserModelID'
${RemoveDefaultBrowserAgentShortcut}
; Delete the app exe to prevent launching the app while we are uninstalling.
ClearErrors
${DeleteFile} "$INSTDIR\${FileMainEXE}"
@ -644,15 +653,6 @@ Section "Uninstall"
DeleteRegKey HKCU "Software\Classes\CLSID\$0"
${EndIf}
; Uninstall the default browser agent scheduled task and all other scheduled
; tasks registered by Firefox.
; This also removes the registry entries that the WDBA creates.
; One of the scheduled tasks that this will remove is the Background Update
; Task. Ideally, this will eventually be changed so that it doesn't rely on
; the WDBA. See Bug 1710143.
ExecWait '"$INSTDIR\default-browser-agent.exe" uninstall $AppUserModelID'
${RemoveDefaultBrowserAgentShortcut}
${un.RemovePrecompleteEntries} "false"
${If} ${FileExists} "$INSTDIR\defaults\pref\channel-prefs.js"

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

@ -75,4 +75,8 @@ int wmain(int argc, wchar_t** argv) {
CreateProcessW(programPath.c_str(), cmdLine.get(), nullptr, nullptr, false,
DETACHED_PROCESS | NORMAL_PRIORITY_CLASS, nullptr, nullptr,
&si, &pi);
// Wait until process exists so uninstalling doesn't interrupt the background
// task cleaning registry entries.
WaitForSingleObject(pi.hProcess, INFINITE);
}