Commit 18ec25dd authored by Michael Chang's avatar Michael Chang Committed by Commit Bot

Omaha v4 Mac - Reorder Uninstall to remove control plist last

In testing it was observed that when the control plist and the
corresponding job was removed first, uninstall did not proceed
afterwards. This change reorders the control plist to be
deleted last and for the plist to be deleted before the job.

Bug: 1122201
Change-Id: I658e0599005d26ee5dfa4d4ec19a70124af9366f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2378002
Commit-Queue: Joshua Pawlicki <waffles@chromium.org>
Reviewed-by: default avatarJoshua Pawlicki <waffles@chromium.org>
Cr-Commit-Position: refs/heads/master@{#802661}
parent b25c25af
...@@ -237,8 +237,15 @@ bool RemoveJobFromLaunchd(Launchd::Domain domain, ...@@ -237,8 +237,15 @@ bool RemoveJobFromLaunchd(Launchd::Domain domain,
// This may block while deleting the launchd plist file. // This may block while deleting the launchd plist file.
base::ScopedBlockingCall scoped_blocking_call(FROM_HERE, base::ScopedBlockingCall scoped_blocking_call(FROM_HERE,
base::BlockingType::MAY_BLOCK); base::BlockingType::MAY_BLOCK);
Launchd::GetInstance()->RemoveJob(base::SysCFStringRefToUTF8(name));
return Launchd::GetInstance()->DeletePlist(domain, type, name); // If the job doesn't exist return true.
if (!Launchd::GetInstance()->PlistExists(domain, type, name))
return true;
if (!Launchd::GetInstance()->DeletePlist(domain, type, name))
return false;
return Launchd::GetInstance()->RemoveJob(base::SysCFStringRefToUTF8(name));
} }
bool RemoveClientJobFromLaunchd(base::ScopedCFTypeRef<CFStringRef> name) { bool RemoveClientJobFromLaunchd(base::ScopedCFTypeRef<CFStringRef> name) {
...@@ -263,7 +270,7 @@ bool RemoveUpdateWakeJobFromLaunchd() { ...@@ -263,7 +270,7 @@ bool RemoveUpdateWakeJobFromLaunchd() {
} }
bool RemoveUpdateControlJobFromLaunchd() { bool RemoveUpdateControlJobFromLaunchd() {
return RemoveClientJobFromLaunchd(CopyControlLaunchdName()); return RemoveServiceJobFromLaunchd(CopyControlLaunchdName());
} }
bool DeleteInstallFolder(const base::FilePath& installed_path) { bool DeleteInstallFolder(const base::FilePath& installed_path) {
...@@ -313,9 +320,15 @@ int InstallCandidate() { ...@@ -313,9 +320,15 @@ int InstallCandidate() {
} }
int UninstallCandidate() { int UninstallCandidate() {
RemoveUpdateControlJobFromLaunchd(); if (!RemoveUpdateWakeJobFromLaunchd())
RemoveUpdateWakeJobFromLaunchd(); return setup_exit_codes::kFailedToRemoveWakeJobFromLaunchd;
DeleteInstallFolder(GetVersionedUpdaterFolderPath());
if (!DeleteInstallFolder(GetVersionedUpdaterFolderPath()))
return setup_exit_codes::kFailedToDeleteFolder;
if (!RemoveUpdateControlJobFromLaunchd())
return setup_exit_codes::kFailedToRemoveControlJobFromLaunchd;
return setup_exit_codes::kSuccess; return setup_exit_codes::kSuccess;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment