Bug 1349456 part 2 - mark elemet as tainted while captured via MozCaptureStream(); r=jwwang

MozReview-Commit-ID: 1V776bLuH43
This commit is contained in:
Kaku Kuo
2017-03-22 14:46:09 +08:00
parent 4fc101bd6a
commit a3f27b5b0d
2 changed files with 16 additions and 6 deletions

View File

@@ -1532,12 +1532,7 @@ HTMLMediaElement::SetVisible(bool aVisible)
already_AddRefed<layers::Image>
HTMLMediaElement::GetCurrentImage()
{
// Mark the decoder owned by the element as tainted so that the
// suspend-video-decoder is disabled.
mHasSuspendTaint = true;
if (mDecoder) {
mDecoder->SetSuspendTaint(true);
}
MarkAsTainted();
// TODO: In bug 1345404, handle case when video decoder is already suspended.
ImageContainer* container = GetImageContainer();
@@ -3335,6 +3330,7 @@ HTMLMediaElement::CaptureStreamInternal(bool aFinishWhenEnded,
MOZ_RELEASE_ASSERT(aGraph);
MarkAsContentSource(CallerAPI::CAPTURE_STREAM);
MarkAsTainted();
nsPIDOMWindowInner* window = OwnerDoc()->GetInnerWindow();
if (!window) {
@@ -7484,6 +7480,16 @@ HTMLMediaElement::CreateGMPCrashHelper()
return MakeAndAddRef<MediaElementGMPCrashHelper>(this);
}
void
HTMLMediaElement::MarkAsTainted()
{
mHasSuspendTaint = true;
if (mDecoder) {
mDecoder->SetSuspendTaint(true);
}
}
bool HasDebuggerPrivilege(JSContext* aCx, JSObject* aObj)
{
return nsContentUtils::CallerHasPermission(aCx,