Bug 1039666: Disable screen/windowsharing for OSX 10.6 and WinXP r=cpearce

This commit is contained in:
Randell Jesup 2014-08-02 00:30:50 -04:00
parent 56659bf892
commit ff6054e58b

View File

@ -54,6 +54,13 @@
#include "MediaPermissionGonk.h"
#endif
#if defined(XP_MACOSX)
#include "nsCocoaFeatures.h"
#endif
#if defined (XP_WIN)
#include "mozilla/WindowsVersion.h"
#endif
// GetCurrentTime is defined in winbase.h as zero argument macro forwarding to
// GetTickCount() and conflicts with MediaStream::GetCurrentTime.
#ifdef GetCurrentTime
@ -1548,12 +1555,17 @@ MediaManager::GetUserMedia(bool aPrivileged,
auto& tc = c.mVideo.GetAsMediaTrackConstraints();
// deny screensharing request if support is disabled
if (tc.mMediaSource != dom::MediaSourceEnum::Camera) {
if (!Preferences::GetBool("media.getusermedia.screensharing.enabled", false)) {
return runnable->Denied(NS_LITERAL_STRING("PERMISSION_DENIED"));
}
/* Deny screensharing if the requesting document is not from a host
on the whitelist. */
if (!HostHasPermission(*docURI)) {
if (!Preferences::GetBool("media.getusermedia.screensharing.enabled", false) ||
// Block screen/window sharing on Mac OSX 10.6 and WinXP until proved that they work
#if defined(XP_MACOSX)
!nsCocoaFeatures::OnLionOrLater() ||
#endif
#if defined (XP_WIN)
!IsVistaOrLater() ||
#endif
/* Deny screensharing if the requesting document is not from a host
on the whitelist. */
!HostHasPermission(*docURI)) {
return runnable->Denied(NS_LITERAL_STRING("PERMISSION_DENIED"));
}
}