Bug 1627414 - getDisplayMedia does not work when firefox is full screen on macOS r=spohl

Change the GetScreenCapturePermissionState() heuristic to use the full window list instead of just on-screen windows to allow it it to work in full screen mode.

Differential Revision: https://phabricator.services.mozilla.com/D70931

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Haik Aftandilian 2020-04-14 20:27:55 +00:00
Родитель 97fcffa123
Коммит a4a88a4380
1 изменённых файлов: 2 добавлений и 1 удалений

Просмотреть файл

@ -1254,7 +1254,7 @@ nsresult nsCocoaUtils::GetScreenCapturePermissionState(uint16_t& aPermissionStat
// screen. We use the window name, window level, and owning PID as
// heuristics to determine if we have screen recording permission.
AutoCFRelease<CFArrayRef> windowArray =
CGWindowListCopyWindowInfo(kCGWindowListOptionOnScreenOnly, kCGNullWindowID);
CGWindowListCopyWindowInfo(kCGWindowListOptionAll, kCGNullWindowID);
if (!windowArray) {
LOG("GetScreenCapturePermissionState() ERROR: got NULL window info list");
return NS_ERROR_UNEXPECTED;
@ -1449,6 +1449,7 @@ void nsCocoaUtils::ResolveAudioCapturePromises(bool aGranted) {
// in which case macOS does not display the dialog again.
//
nsresult nsCocoaUtils::MaybeRequestScreenCapturePermission() {
LOG("MaybeRequestScreenCapturePermission()");
AutoCFRelease<CGImageRef> image =
CGDisplayCreateImageForRect(kCGDirectMainDisplay, CGRectMake(0, 0, 1, 1));
return NS_OK;