mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-20 00:35:44 +00:00
Backed out 2 changesets (bug 1308615) for failures in browser_devices_get_user_media.js
CLOSED TREE Backed out changeset 85689c52301c (bug 1308615) Backed out changeset ec8e67234efb (bug 1308615)
This commit is contained in:
parent
46dddfc99b
commit
e6f43c4543
@ -261,8 +261,8 @@ function forgetPendingListsEventually(aContentWindow) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function updateIndicators() {
|
function updateIndicators() {
|
||||||
let contentWindowArray = MediaManagerService.activeMediaCaptureWindows;
|
let contentWindowSupportsArray = MediaManagerService.activeMediaCaptureWindows;
|
||||||
let count = contentWindowArray.length;
|
let count = contentWindowSupportsArray.Count();
|
||||||
|
|
||||||
let state = {
|
let state = {
|
||||||
showGlobalIndicator: count > 0,
|
showGlobalIndicator: count > 0,
|
||||||
@ -280,7 +280,7 @@ function updateIndicators() {
|
|||||||
// sending duplicate notifications.
|
// sending duplicate notifications.
|
||||||
let contentWindows = new Set();
|
let contentWindows = new Set();
|
||||||
for (let i = 0; i < count; ++i) {
|
for (let i = 0; i < count; ++i) {
|
||||||
contentWindows.add(contentWindowArray.queryElementAt(i, Ci.nsISupports).top);
|
contentWindows.add(contentWindowSupportsArray.GetElementAt(i).top);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let contentWindow of contentWindows) {
|
for (let contentWindow of contentWindows) {
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
#include "mozilla/dom/MediaStreamTrack.h"
|
#include "mozilla/dom/MediaStreamTrack.h"
|
||||||
#include "GetUserMediaRequest.h"
|
#include "GetUserMediaRequest.h"
|
||||||
#include "MediaStreamListener.h"
|
#include "MediaStreamListener.h"
|
||||||
#include "nsArray.h"
|
|
||||||
#include "nsContentUtils.h"
|
#include "nsContentUtils.h"
|
||||||
#include "nsHashPropertyBag.h"
|
#include "nsHashPropertyBag.h"
|
||||||
#ifdef MOZ_WIDGET_GONK
|
#ifdef MOZ_WIDGET_GONK
|
||||||
@ -21,6 +20,7 @@
|
|||||||
#include "nsIScriptGlobalObject.h"
|
#include "nsIScriptGlobalObject.h"
|
||||||
#include "nsIPermissionManager.h"
|
#include "nsIPermissionManager.h"
|
||||||
#include "nsIPopupWindowManager.h"
|
#include "nsIPopupWindowManager.h"
|
||||||
|
#include "nsISupportsArray.h"
|
||||||
#include "nsIDocShell.h"
|
#include "nsIDocShell.h"
|
||||||
#include "nsIDocument.h"
|
#include "nsIDocument.h"
|
||||||
#include "nsISupportsPrimitives.h"
|
#include "nsISupportsPrimitives.h"
|
||||||
@ -2411,10 +2411,14 @@ if (privileged) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsIMutableArray> devicesCopy = nsArray::Create(); // before we give up devices below
|
nsCOMPtr<nsISupportsArray> devicesCopy; // before we give up devices below
|
||||||
if (!askPermission) {
|
if (!askPermission) {
|
||||||
|
nsresult rv = NS_NewISupportsArray(getter_AddRefs(devicesCopy));
|
||||||
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
for (auto& device : **devices) {
|
for (auto& device : **devices) {
|
||||||
nsresult rv = devicesCopy->AppendElement(device, /*weak =*/ false);
|
rv = devicesCopy->AppendElement(device);
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -3032,15 +3036,15 @@ MediaManager::Observe(nsISupports* aSubject, const char* aTopic,
|
|||||||
if (aSubject) {
|
if (aSubject) {
|
||||||
// A particular device or devices were chosen by the user.
|
// A particular device or devices were chosen by the user.
|
||||||
// NOTE: does not allow setting a device to null; assumes nullptr
|
// NOTE: does not allow setting a device to null; assumes nullptr
|
||||||
nsCOMPtr<nsIArray> array(do_QueryInterface(aSubject));
|
nsCOMPtr<nsISupportsArray> array(do_QueryInterface(aSubject));
|
||||||
MOZ_ASSERT(array);
|
MOZ_ASSERT(array);
|
||||||
uint32_t len = 0;
|
uint32_t len = 0;
|
||||||
array->GetLength(&len);
|
array->Count(&len);
|
||||||
bool videoFound = false, audioFound = false;
|
bool videoFound = false, audioFound = false;
|
||||||
for (uint32_t i = 0; i < len; i++) {
|
for (uint32_t i = 0; i < len; i++) {
|
||||||
nsCOMPtr<nsIMediaDevice> device;
|
nsCOMPtr<nsISupports> supports;
|
||||||
array->QueryElementAt(i, NS_GET_IID(nsIMediaDevice),
|
array->GetElementAt(i,getter_AddRefs(supports));
|
||||||
getter_AddRefs(device));
|
nsCOMPtr<nsIMediaDevice> device(do_QueryInterface(supports));
|
||||||
MOZ_ASSERT(device); // shouldn't be returning anything else...
|
MOZ_ASSERT(device); // shouldn't be returning anything else...
|
||||||
if (device) {
|
if (device) {
|
||||||
nsString type;
|
nsString type;
|
||||||
@ -3134,11 +3138,14 @@ MediaManager::Observe(nsISupports* aSubject, const char* aTopic,
|
|||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
MediaManager::GetActiveMediaCaptureWindows(nsIArray** aArray)
|
MediaManager::GetActiveMediaCaptureWindows(nsISupportsArray** aArray)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(aArray);
|
MOZ_ASSERT(aArray);
|
||||||
|
nsISupportsArray* array;
|
||||||
nsCOMPtr<nsIMutableArray> array = nsArray::Create();
|
nsresult rv = NS_NewISupportsArray(&array); // AddRefs
|
||||||
|
if (NS_FAILED(rv)) {
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
for (auto iter = mActiveWindows.Iter(); !iter.Done(); iter.Next()) {
|
for (auto iter = mActiveWindows.Iter(); !iter.Done(); iter.Next()) {
|
||||||
const uint64_t& id = iter.Key();
|
const uint64_t& id = iter.Key();
|
||||||
@ -3169,11 +3176,11 @@ MediaManager::GetActiveMediaCaptureWindows(nsIArray** aArray)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (capturing) {
|
if (capturing) {
|
||||||
array->AppendElement(window, /*weak =*/ false);
|
array->AppendElement(window);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
array.forget(aArray);
|
*aArray = array;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3332,14 +3339,14 @@ MediaManager::IterateWindowListeners(nsPIDOMWindowInner* aWindow,
|
|||||||
void
|
void
|
||||||
MediaManager::StopMediaStreams()
|
MediaManager::StopMediaStreams()
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIArray> array;
|
nsCOMPtr<nsISupportsArray> array;
|
||||||
GetActiveMediaCaptureWindows(getter_AddRefs(array));
|
GetActiveMediaCaptureWindows(getter_AddRefs(array));
|
||||||
uint32_t len;
|
uint32_t len;
|
||||||
array->GetLength(&len);
|
array->Count(&len);
|
||||||
for (uint32_t i = 0; i < len; i++) {
|
for (uint32_t i = 0; i < len; i++) {
|
||||||
nsCOMPtr<nsPIDOMWindowInner> win;
|
nsCOMPtr<nsISupports> window;
|
||||||
array->QueryElementAt(i, NS_GET_IID(nsPIDOMWindowInner),
|
array->GetElementAt(i, getter_AddRefs(window));
|
||||||
getter_AddRefs(win));
|
nsCOMPtr<nsPIDOMWindowInner> win(do_QueryInterface(window));
|
||||||
if (win) {
|
if (win) {
|
||||||
OnNavigation(win->WindowID());
|
OnNavigation(win->WindowID());
|
||||||
}
|
}
|
||||||
@ -3351,14 +3358,14 @@ MediaManager::IsActivelyCapturingOrHasAPermission(uint64_t aWindowId)
|
|||||||
{
|
{
|
||||||
// Does page currently have a gUM stream active?
|
// Does page currently have a gUM stream active?
|
||||||
|
|
||||||
nsCOMPtr<nsIArray> array;
|
nsCOMPtr<nsISupportsArray> array;
|
||||||
GetActiveMediaCaptureWindows(getter_AddRefs(array));
|
GetActiveMediaCaptureWindows(getter_AddRefs(array));
|
||||||
uint32_t len;
|
uint32_t len;
|
||||||
array->GetLength(&len);
|
array->Count(&len);
|
||||||
for (uint32_t i = 0; i < len; i++) {
|
for (uint32_t i = 0; i < len; i++) {
|
||||||
nsCOMPtr<nsPIDOMWindowInner> win;
|
nsCOMPtr<nsISupports> window;
|
||||||
array->QueryElementAt(i, NS_GET_IID(nsPIDOMWindowInner),
|
array->GetElementAt(i, getter_AddRefs(window));
|
||||||
getter_AddRefs(win));
|
nsCOMPtr<nsPIDOMWindowInner> win(do_QueryInterface(window));
|
||||||
if (win && win->WindowID() == aWindowId) {
|
if (win && win->WindowID() == aWindowId) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
#include "nsISupports.idl"
|
#include "nsISupports.idl"
|
||||||
|
|
||||||
interface nsIArray;
|
interface nsISupportsArray;
|
||||||
interface nsIDOMWindow;
|
interface nsIDOMWindow;
|
||||||
|
|
||||||
%{C++
|
%{C++
|
||||||
@ -16,7 +16,7 @@ interface nsIDOMWindow;
|
|||||||
interface nsIMediaManagerService : nsISupports
|
interface nsIMediaManagerService : nsISupports
|
||||||
{
|
{
|
||||||
/* return a array of inner windows that have active captures */
|
/* return a array of inner windows that have active captures */
|
||||||
readonly attribute nsIArray activeMediaCaptureWindows;
|
readonly attribute nsISupportsArray activeMediaCaptureWindows;
|
||||||
|
|
||||||
/* Get the capture state for the given window and all descendant windows (iframes, etc) */
|
/* Get the capture state for the given window and all descendant windows (iframes, etc) */
|
||||||
void mediaCaptureWindowState(in nsIDOMWindow aWindow, out boolean aVideo, out boolean aAudio,
|
void mediaCaptureWindowState(in nsIDOMWindow aWindow, out boolean aVideo, out boolean aAudio,
|
||||||
|
@ -58,7 +58,7 @@ var WebrtcUI = {
|
|||||||
|
|
||||||
notify: function() {
|
notify: function() {
|
||||||
let windows = MediaManagerService.activeMediaCaptureWindows;
|
let windows = MediaManagerService.activeMediaCaptureWindows;
|
||||||
let count = windows.length;
|
let count = windows.Count();
|
||||||
let msg = {};
|
let msg = {};
|
||||||
if (count == 0) {
|
if (count == 0) {
|
||||||
if (this._notificationId) {
|
if (this._notificationId) {
|
||||||
@ -76,7 +76,7 @@ var WebrtcUI = {
|
|||||||
let cameraActive = false;
|
let cameraActive = false;
|
||||||
let audioActive = false;
|
let audioActive = false;
|
||||||
for (let i = 0; i < count; i++) {
|
for (let i = 0; i < count; i++) {
|
||||||
let win = windows.queryElementAt(i, Ci.nsIDOMWindow);
|
let win = windows.GetElementAt(i);
|
||||||
let hasAudio = {};
|
let hasAudio = {};
|
||||||
let hasVideo = {};
|
let hasVideo = {};
|
||||||
MediaManagerService.mediaCaptureWindowState(win, hasVideo, hasAudio);
|
MediaManagerService.mediaCaptureWindowState(win, hasVideo, hasAudio);
|
||||||
|
Loading…
Reference in New Issue
Block a user