From ff6054e58be5ec5fd6923cdb6ef3bf99356fb24d Mon Sep 17 00:00:00 2001 From: Randell Jesup Date: Sat, 2 Aug 2014 00:30:50 -0400 Subject: [PATCH] Bug 1039666: Disable screen/windowsharing for OSX 10.6 and WinXP r=cpearce --- dom/media/MediaManager.cpp | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/dom/media/MediaManager.cpp b/dom/media/MediaManager.cpp index abe5fbb2267..7ef24dd8307 100644 --- a/dom/media/MediaManager.cpp +++ b/dom/media/MediaManager.cpp @@ -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")); } }