Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Unified Diff: Source/modules/encryptedmedia/HTMLMediaElementEncryptedMedia.cpp

Issue 893123004: Check origin before providing initData in encrypted event (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: nits Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/html/HTMLVideoElement.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/encryptedmedia/HTMLMediaElementEncryptedMedia.cpp
diff --git a/Source/modules/encryptedmedia/HTMLMediaElementEncryptedMedia.cpp b/Source/modules/encryptedmedia/HTMLMediaElementEncryptedMedia.cpp
index 491969d5945e038c1bf6f200b75de05e885efb29..4bf8eab1268fdbbe30feddd961c7c9f090cfb7f1 100644
--- a/Source/modules/encryptedmedia/HTMLMediaElementEncryptedMedia.cpp
+++ b/Source/modules/encryptedmedia/HTMLMediaElementEncryptedMedia.cpp
@@ -515,8 +515,15 @@ void HTMLMediaElementEncryptedMedia::encrypted(HTMLMediaElement& element, const
if (RuntimeEnabledFeatures::encryptedMediaEnabled()) {
// Send event for WD EME.
- // FIXME: Check origin before providing initData. http://crbug.com/418233.
- RefPtrWillBeRawPtr<Event> event = createEncryptedEvent(initDataType, initData, initDataLength);
+ RefPtrWillBeRawPtr<Event> event;
+ if (element.isMediaDataCORSSameOrigin(element.executionContext()->securityOrigin())) {
+ event = createEncryptedEvent(initDataType, initData, initDataLength);
+ } else {
+ // Current page is not allowed to see content from the media file,
+ // so don't return the initData. However, they still get an event.
+ event = createEncryptedEvent(emptyString(), nullptr, 0);
+ }
+
event->setTarget(&element);
element.scheduleEvent(event.release());
}
« no previous file with comments | « Source/core/html/HTMLVideoElement.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698