- Scenario We delegated [webView:requestMediaCapturePermissionForOrigin:initiatedByFrame:type:decisionHandler:] only and called navigator.mediaDevices.getDisplayMedia() on JavaScript. It will not show the ScreenCapture picker (SCContentSharingPicker) and deny the request. * Reproducible example: https://gist.github.com/pewsheen/9685c2a3a77c1303d5026b7a8dd9e893 * Test page: https://webrtc.github.io/samples/src/content/getusermedia/getdisplaymedia/ * Console: default 11:48:25.720336+0800 aa UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame(AD3DE9E20BF5B109) 116 default 11:48:25.720458+0800 aa UserMediaPermissionRequestManagerProxy::processUserMediaPermissionRequest(AD3DE9E20BF5B109) 116, persistent access: false default 11:48:25.720537+0800 aa UserMediaPermissionRequestManagerProxy::processUserMediaPermissionValidRequest(AD3DE9E20BF5B109) 116, video: 0 audio: 0 default 11:48:25.720561+0800 aa UserMediaPermissionRequestManagerProxy::processUserMediaPermissionValidRequest(AD3DE9E20BF5B109) 116, action: Prompt default 11:48:25.720608+0800 aa UserMediaPermissionRequestManagerProxy::denyRequest(AD3DE9E20BF5B109) 116, reason: PermissionDenied - Expected behavior Even if we delegated requestMediaCapturePermissionForOrigin, it should show SCContentSharingPicker when calling getDisplayMedia(). The following is my guess... The condition here: https://github.com/WebKit/WebKit/blob/a0b7f7faeffb5ec679ddd471a0f7c68a91a37715/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm#L1273 shows that if any one of request methods delegated, then it will not perform the default action for all the request methods. When we delegate requestMediaCapturePermissionForOrigin and call getDisplayMedia(), it will go to the line: https://github.com/WebKit/WebKit/blob/a0b7f7faeffb5ec679ddd471a0f7c68a91a37715/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm#L1281 to prompt for display capture permission, and somehow https://github.com/WebKit/WebKit/blob/a0b7f7faeffb5ec679ddd471a0f7c68a91a37715/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm#L1212 canRequestDisplayCapturePermission returns false? So that if we didn't delegate [_webView:requestDisplayCapturePermissionForOrigin:initiatedByFrame:withSystemAudio:decisionHandler:] as well, it will deny the request https://github.com/WebKit/WebKit/blob/a0b7f7faeffb5ec679ddd471a0f7c68a91a37715/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm#L1218-L1221 Also, requestDisplayCapturePermissionForOrigin isn't listed on the developer document. Is is a private API?
<rdar://problem/125601197>