Bug 1697964 - Remove GetQuarantinePropKey(). r=mac-reviewers,tnikkel

GetQuarantinePropKey() used to contain a version check for pre-10.10, which
was removed in bug 1673051.

Depends on D108134

Differential Revision: https://phabricator.services.mozilla.com/D108135
This commit is contained in:
Markus Stange 2021-03-12 01:46:24 +00:00
parent 4959b893e1
commit a25fa13fd4

View File

@ -186,20 +186,16 @@ void AddOriginMetadataToFile(const CFStringRef filePath, const CFURLRef sourceUR
::CFRelease(mdItem);
}
// Can be called off of the main thread.
static CFStringRef GetQuarantinePropKey() { return kCFURLQuarantinePropertiesKey; }
// Can be called off of the main thread.
static CFMutableDictionaryRef CreateQuarantineDictionary(const CFURLRef aFileURL,
const bool aCreateProps) {
// The properties key changed in 10.10:
CFDictionaryRef quarantineProps = NULL;
if (aCreateProps) {
quarantineProps = ::CFDictionaryCreate(NULL, NULL, NULL, 0, &kCFTypeDictionaryKeyCallBacks,
&kCFTypeDictionaryValueCallBacks);
} else {
Boolean success =
::CFURLCopyResourcePropertyForKey(aFileURL, GetQuarantinePropKey(), &quarantineProps, NULL);
Boolean success = ::CFURLCopyResourcePropertyForKey(aFileURL, kCFURLQuarantinePropertiesKey,
&quarantineProps, NULL);
// If there aren't any quarantine properties then the user probably
// set up an exclusion and we don't need to add metadata.
if (!success || !quarantineProps) {
@ -250,7 +246,8 @@ void AddQuarantineMetadataToFile(const CFStringRef filePath, const CFURLRef sour
}
// Set quarantine properties on file.
::CFURLSetResourcePropertyForKey(fileURL, GetQuarantinePropKey(), mutQuarantineProps, NULL);
::CFURLSetResourcePropertyForKey(fileURL, kCFURLQuarantinePropertiesKey, mutQuarantineProps,
NULL);
::CFRelease(fileURL);
::CFRelease(mutQuarantineProps);