Bug 1177793 - Pass principal instead of forcing black when capturing cross-origin media resource. r=jya,jib

Differential Revision: https://phabricator.services.mozilla.com/D36896
This commit is contained in:
Andreas Pehrson
2019-07-08 21:15:10 +00:00
parent 87429a9ed3
commit 8a4cb5f9a3
14 changed files with 42 additions and 126 deletions

View File

@@ -456,15 +456,6 @@ class HTMLMediaElement::StreamCaptureTrackSource
return MediaSourceEnum::Other;
}
CORSMode GetCORSMode() const override {
if (!mCapturedTrackSource) {
// This could happen during shutdown.
return CORS_NONE;
}
return mCapturedTrackSource->GetCORSMode();
}
void Stop() override {
if (mElement && mElement->mSrcStream) {
// Only notify if we're still playing the source stream. GC might have
@@ -4527,9 +4518,6 @@ nsresult HTMLMediaElement::FinishDecoderSetup(MediaDecoder* aDecoder) {
#endif
}
// Set CORSMode now before any streams are added. It won't change over time.
mDecoder->SetOutputStreamCORSMode(mCORSMode);
if (!mOutputStreams.IsEmpty()) {
mDecoder->SetNextOutputStreamTrackID(
mNextAvailableMediaDecoderOutputTrackID);
@@ -5912,8 +5900,10 @@ already_AddRefed<nsIPrincipal> HTMLMediaElement::GetCurrentVideoPrincipal() {
void HTMLMediaElement::NotifyDecoderPrincipalChanged() {
RefPtr<nsIPrincipal> principal = GetCurrentPrincipal();
mDecoder->UpdateSameOriginStatus(!principal || IsCORSSameOrigin());
bool isSameOrigin = !principal || IsCORSSameOrigin();
mDecoder->UpdateSameOriginStatus(isSameOrigin);
mDecoder->SetOutputStreamPrincipal(isSameOrigin ? NodePrincipal()
: principal.get());
}
void HTMLMediaElement::Invalidate(bool aImageSizeChanged,