[webkit-reviews] review granted: [Bug 217104] Prevent media capture unless the application has correct data for system permission prompt : [Attachment 410050] Patch
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Tue Sep 29 16:13:11 PDT 2020
Darin Adler <darin at apple.com> has granted Eric Carlson
<eric.carlson at apple.com>'s request for review:
Bug 217104: Prevent media capture unless the application has correct data for
system permission prompt
https://bugs.webkit.org/show_bug.cgi?id=217104
Attachment 410050: Patch
https://bugs.webkit.org/attachment.cgi?id=410050&action=review
--- Comment #3 from Darin Adler <darin at apple.com> ---
Comment on attachment 410050
--> https://bugs.webkit.org/attachment.cgi?id=410050
Patch
View in context: https://bugs.webkit.org/attachment.cgi?id=410050&action=review
> Source/WebKit/UIProcess/Cocoa/UIDelegate.mm:988
> + AVAuthorizationStatus microphoneAuthorizationStatus =
usingMockCaptureDevices || !requiresAudioCapture ?
AVAuthorizationStatusAuthorized : [PAL::getAVCaptureDeviceClass()
authorizationStatusForMediaType:AVMediaTypeAudio];
auto
> Source/WebKit/UIProcess/Cocoa/UIDelegate.mm:994
> + AVAuthorizationStatus cameraAuthorizationStatus =
usingMockCaptureDevices || !requiresVideoCapture ?
AVAuthorizationStatusAuthorized : [PAL::getAVCaptureDeviceClass()
authorizationStatusForMediaType:AVMediaTypeVideo];
auto
> Source/WebKit/UIProcess/Cocoa/UserMediaPermissionRequestManagerProxy.mm:41
> + static std::once_flag onceFlag;
> + static bool validUsageString;
> + std::call_once(onceFlag, [] {
> + NSString *usageString =
NSBundle.mainBundle.infoDictionary[@"NSMicrophoneUsageDescription"];
> + validUsageString = usageString.length;
> + });
> +
> + return validUsageString;
Does this need to be thread-safe? If not, it can be a two-liner:
static bool isPermiitted =
NSBundle.mainBundle.infoDictionary[@"NSMicrophoneUsageDescription"].length;
return isPermitted;
> Source/WebKit/UIProcess/Cocoa/UserMediaPermissionRequestManagerProxy.mm:57
> + static std::once_flag onceFlag;
> + static bool validUsageString;
> + std::call_once(onceFlag, [] {
> + NSString *usageString =
NSBundle.mainBundle.infoDictionary[@"NSCameraUsageDescription"];
> + validUsageString = usageString.length;
> + });
> +
> + return validUsageString;
Ditto.
More information about the webkit-reviews
mailing list