commit be35232bf3477b276e00244a1177f4f190716eeb
parent e3b8b6e474b869bc232ae49f3d9866910c198272
Author: Josh Aas <jaas@kflag.net>
Date: Fri, 24 Oct 2025 00:13:58 +0000
Bug 1995830 - Use non-deprecated API to determine if something is an application on macOS. r=spohl
Differential Revision: https://phabricator.services.mozilla.com/D269796
Diffstat:
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/xpcom/io/nsLocalFileUnix.cpp b/xpcom/io/nsLocalFileUnix.cpp
@@ -1985,7 +1985,6 @@ nsLocalFile::IsExecutable(bool* aResult) {
}
}
- // On OS X, then query Launch Services.
#ifdef MOZ_WIDGET_COCOA
// Certain Mac applications, such as Classic applications, which
// run under Rosetta, might not have the +x mode bit but are still
@@ -1995,15 +1994,16 @@ nsLocalFile::IsExecutable(bool* aResult) {
return NS_ERROR_FAILURE;
}
- LSRequestedInfo theInfoRequest = kLSRequestAllInfo;
- LSItemInfoRecord theInfo;
- OSStatus result = ::LSCopyItemInfoForURL(url, theInfoRequest, &theInfo);
+ CFBooleanRef isApp = NULL;
+ *aResult = ::CFURLCopyResourcePropertyForKey(url, kCFURLIsApplicationKey,
+ &isApp, NULL) &&
+ (isApp == kCFBooleanTrue);
::CFRelease(url);
- if (result == noErr) {
- if ((theInfo.flags & kLSItemInfoIsApplication) != 0) {
- *aResult = true;
- return NS_OK;
- }
+ if (isApp) {
+ ::CFRelease(isApp);
+ }
+ if (*aResult) {
+ return NS_OK;
}
#endif