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

Unified Diff: media/blink/webcontentdecryptionmodulesession_impl.cc

Issue 897133002: Check InitDateType is supported by key system when creating session (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 | « media/blink/cdm_session_adapter.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/blink/webcontentdecryptionmodulesession_impl.cc
diff --git a/media/blink/webcontentdecryptionmodulesession_impl.cc b/media/blink/webcontentdecryptionmodulesession_impl.cc
index 2fba8d09c1e7448b1e73cbc63ffd783ae281266e..02d9f5e9cb17e3151a63ae17f9a202da61246451 100644
--- a/media/blink/webcontentdecryptionmodulesession_impl.cc
+++ b/media/blink/webcontentdecryptionmodulesession_impl.cc
@@ -12,6 +12,7 @@
#include "base/strings/utf_string_conversions.h"
#include "media/base/cdm_key_information.h"
#include "media/base/cdm_promise.h"
+#include "media/base/key_systems.h"
#include "media/base/media_keys.h"
#include "media/blink/cdm_result_promise.h"
#include "media/blink/cdm_session_adapter.h"
@@ -137,6 +138,22 @@ void WebContentDecryptionModuleSessionImpl::initializeNewSession(
<< "init_data_type '" << init_data_type_as_ascii
<< "' may be a MIME type";
+ // Step 5 from https://w3c.github.io/encrypted-media/#generateRequest.
+ // 5. If the Key System implementation represented by this object's cdm
+ // implementation value does not support initDataType as an Initialization
+ // Data Type, return a promise rejected with a new DOMException whose name
+ // is NotSupportedError. String comparison is case-sensitive.
+ if (!IsSupportedKeySystemWithInitDataType(adapter_->GetKeySystem(),
+ init_data_type_as_ascii)) {
+ std::string message = "The initialization data type " +
+ init_data_type_as_ascii +
+ " is not supported by the key system.";
+ result.completeWithError(
+ blink::WebContentDecryptionModuleExceptionNotSupportedError, 0,
+ blink::WebString::fromUTF8(message));
+ return;
+ }
+
MediaKeys::SessionType session_type_enum;
if (session_type == kPersistentLicenseSessionType) {
session_type_enum = MediaKeys::PERSISTENT_LICENSE_SESSION;
« no previous file with comments | « media/blink/cdm_session_adapter.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698