Bug 1498044 - Don't ask to reboot when a directory we try to uninstall isn't empty. r=agashlin

Our uninstaller currently calls the NSIS RMDir instruction on the `defaults`
directory with the /REBOOTOK flag set, which means that NSIS will register
the directory for deletion during the next reboot if it can't be removed
immediately for any reason. The problem here is that "any reason" includes
"the directory wasn't empty", and setting the reboot flag is not at all
the right thing to do in that situation. It won't help resolve the problem,
and those directories are expected to be empty at that point in the uninstall,
because we've already removed all the files that we know we put there, so
anything left is something we don't know about and shouldn't try to delete.
So the right thing to do here is just to remove the /REBOOTOK and allow the
RMDir to fail, so that any user files are never touched and we don't show
an unnecessary reboot prompt at the end of the wizard.

I also removed the FileExists checks, because the RMDir instruction does that.

Differential Revision: https://phabricator.services.mozilla.com/D34938

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Matt Howell 2019-06-25 00:59:13 +00:00
Родитель dd3ab6fb65
Коммит cf4aff1109
1 изменённых файлов: 2 добавлений и 6 удалений

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

@ -428,12 +428,8 @@ Section "Uninstall"
${If} ${FileExists} "$INSTDIR\defaults\pref\channel-prefs.js" ${If} ${FileExists} "$INSTDIR\defaults\pref\channel-prefs.js"
Delete /REBOOTOK "$INSTDIR\defaults\pref\channel-prefs.js" Delete /REBOOTOK "$INSTDIR\defaults\pref\channel-prefs.js"
${EndIf} ${EndIf}
${If} ${FileExists} "$INSTDIR\defaults\pref" RmDir "$INSTDIR\defaults\pref"
RmDir /REBOOTOK "$INSTDIR\defaults\pref" RmDir "$INSTDIR\defaults"
${EndIf}
${If} ${FileExists} "$INSTDIR\defaults"
RmDir /REBOOTOK "$INSTDIR\defaults"
${EndIf}
${If} ${FileExists} "$INSTDIR\uninstall" ${If} ${FileExists} "$INSTDIR\uninstall"
; Remove the uninstall directory that we control ; Remove the uninstall directory that we control
RmDir /r /REBOOTOK "$INSTDIR\uninstall" RmDir /r /REBOOTOK "$INSTDIR\uninstall"