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

MozReview-Commit-ID: 1V776bLuH43

--HG--
extra : rebase_source : 546587dc77dba4931788359a0a80507892594a7d
This commit is contained in:
Kaku Kuo 2017-03-22 14:46:09 +08:00
parent 1cf3c62747
commit c4629a637d
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,

View File

@ -1310,6 +1310,10 @@ protected:
// Pass information for deciding the video decode mode to decoder.
void NotifyDecoderActivityChanges() const;
// Mark the decoder owned by the element as tainted so that the
// suspend-video-decoder is disabled.
void MarkAsTainted();
// The current decoder. Load() has been called on this decoder.
// At most one of mDecoder and mSrcStream can be non-null.
RefPtr<MediaDecoder> mDecoder;