Commit e681d675 authored by Mike Jackson's avatar Mike Jackson Committed by Chromium LUCI CQ

Clean up unnecessary variable 'error' in GetLoginItemForApp

LSSharedFileListItemCopyResolvedURL can operate with nullptr as its
CFErrorRef* argument. We can just check if it returned a non-null
CFURLRef, and simplify this code.

Tested: Manually on MacOS 11.0
 - Install extension from chrome/test/data/extensions/background_app/
 - Chromium should be set to run at login for user
 - Remove extension - chromium should no longer be set to run at login

Bug: 897302
Change-Id: If673ec9a53e99fcebe910e34ec50d88594debd39
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2561032
Commit-Queue: Mike Jackson <mjackson@microsoft.com>
Reviewed-by: default avatarMark Mentovai <mark@chromium.org>
Reviewed-by: default avatarVictor Costan <pwnall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#832601}
parent 3857b3d3
......@@ -67,20 +67,12 @@ class LoginItemsFileList {
for (id login_item in login_items_array.get()) {
LSSharedFileListItemRef item =
reinterpret_cast<LSSharedFileListItemRef>(login_item);
base::ScopedCFTypeRef<CFErrorRef> error;
ScopedCFTypeRef<CFURLRef> item_url(
LSSharedFileListItemCopyResolvedURL(item, 0, error.InitializeInto()));
// This function previously used LSSharedFileListItemResolve(), which
// could return a NULL URL even when returning no error. This caused
// <https://crbug.com/760989>. It's not clear one way or the other whether
// LSSharedFileListItemCopyResolvedURL() shares this behavior, so this
// check remains in place.
if (!error && item_url) {
if (CFEqual(item_url, url)) {
return ScopedCFTypeRef<LSSharedFileListItemRef>(
item, base::scoped_policy::RETAIN);
}
LSSharedFileListItemCopyResolvedURL(item, 0, nullptr));
if (item_url && CFEqual(item_url, url)) {
return ScopedCFTypeRef<LSSharedFileListItemRef>(
item, base::scoped_policy::RETAIN);
}
}
......
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