Bug 771833: Assign an nsIPrincipal to media streams returned by gUM; r=roc

This commit is contained in:
Anant Narayanan 2012-07-11 21:24:34 -07:00
parent e83f8d1868
commit fd62daa46c
2 changed files with 9 additions and 1 deletions

View File

@ -112,6 +112,13 @@ public:
// Create a media stream.
nsCOMPtr<nsDOMMediaStream> stream = nsDOMMediaStream::CreateInputStream();
nsPIDOMWindow *window = static_cast<nsPIDOMWindow*>
(nsGlobalWindow::GetOuterWindowWithId(mWindowID));
if (window && window->GetExtantDoc()) {
stream->CombineWithPrincipal(window->GetExtantDoc()->NodePrincipal());
}
// Add our listener. We'll call Start() on the source when get a callback
// that the MediaStream has started consuming. The listener is freed
// when the page is invalidated (on navigation or close).
@ -350,7 +357,7 @@ MediaManager::GetUserMedia(nsPIDOMWindow* aWindow, nsIMediaStreamOptions* aParam
nsresult rv = aParams->GetPicture(&picture);
NS_ENSURE_SUCCESS(rv, rv);
/**
* If we were asked to get a picture, before getting a snapshot, we check if
* the calling page is allowed to open a popup. We do this because

View File

@ -6,6 +6,7 @@
#include "mozilla/Services.h"
#include "nsHashKeys.h"
#include "nsGlobalWindow.h"
#include "nsClassHashtable.h"
#include "nsObserverService.h"