summaryrefslogtreecommitdiffstats
path: root/dom/html/HTMLMediaElement.cpp
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@wolfbeast.com>2019-08-13 22:45:09 +0200
committerwolfbeast <mcwerewolf@wolfbeast.com>2020-02-03 23:42:52 +0100
commit99118e38e1a9f2ba3b48ed61ab7cc85610c9712f (patch)
tree6b7ef33a5b1546a82689437e33ff95e9cf8ff79f /dom/html/HTMLMediaElement.cpp
parenta595451104a9ea155703899ab8fbc9f37547bcd9 (diff)
downloadUXP-99118e38e1a9f2ba3b48ed61ab7cc85610c9712f.tar
UXP-99118e38e1a9f2ba3b48ed61ab7cc85610c9712f.tar.gz
UXP-99118e38e1a9f2ba3b48ed61ab7cc85610c9712f.tar.lz
UXP-99118e38e1a9f2ba3b48ed61ab7cc85610c9712f.tar.xz
UXP-99118e38e1a9f2ba3b48ed61ab7cc85610c9712f.zip
Issue #26 Part 2a: make more EME code conditional.
- Exclude missed MediaKey functions and CDMProxy code. - Exclude EME APIs frm being built (webidl change) - Fix tests in --disable-eme state
Diffstat (limited to 'dom/html/HTMLMediaElement.cpp')
-rw-r--r--dom/html/HTMLMediaElement.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/dom/html/HTMLMediaElement.cpp b/dom/html/HTMLMediaElement.cpp
index f3ef20bfc..bc63eab51 100644
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -1871,6 +1871,20 @@ nsresult HTMLMediaElement::LoadResource()
// Set the media element's CORS mode only when loading a resource
mCORSMode = AttrValueToCORSMode(GetParsedAttr(nsGkAtoms::crossorigin));
+#ifdef MOZ_EME
+ bool isBlob = false;
+ if (mMediaKeys &&
+ Preferences::GetBool("media.eme.mse-only", true) &&
+ // We only want mediaSource URLs, but they are BlobURL, so we have to
+ // check the schema and abort if they are not MediaStream or real Blob.
+ (NS_FAILED(mLoadingSrc->SchemeIs(BLOBURI_SCHEME, &isBlob)) ||
+ !isBlob ||
+ IsMediaStreamURI(mLoadingSrc) ||
+ IsBlobURI(mLoadingSrc))) {
+ return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
+ }
+#endif
+
HTMLMediaElement* other = LookupMediaElementURITable(mLoadingSrc);
if (other && other->mDecoder) {
// Clone it.
@@ -4000,7 +4014,6 @@ nsresult HTMLMediaElement::FinishDecoderSetup(MediaDecoder* aDecoder,
return NS_ERROR_FAILURE;
}
}
-#endif
MediaEventSource<void>* waitingForKeyProducer = mDecoder->WaitingForKeyEvent();
// Not every decoder will produce waitingForKey events, only add ones that can
@@ -4008,6 +4021,7 @@ nsresult HTMLMediaElement::FinishDecoderSetup(MediaDecoder* aDecoder,
mWaitingForKeyListener = waitingForKeyProducer->Connect(
AbstractThread::MainThread(), this, &HTMLMediaElement::CannotDecryptWaitingForKey);
}
+#endif
if (mChannelLoader) {
mChannelLoader->Done();
@@ -6476,7 +6490,6 @@ HTMLMediaElement::GetTopLevelPrincipal()
principal = doc->NodePrincipal();
return principal.forget();
}
-#endif //MOZ_EME
void
HTMLMediaElement::CannotDecryptWaitingForKey()
@@ -6495,6 +6508,7 @@ HTMLMediaElement::CannotDecryptWaitingForKey()
UpdateReadyStateInternal();
}
}
+#endif //MOZ_EME
NS_IMETHODIMP HTMLMediaElement::WindowAudioCaptureChanged(bool aCapture)
{