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

Side by Side Diff: Source/modules/encryptedmedia/MediaKeySession.cpp

Issue 950813005: Change initDataType and sessionType to be enums (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Apple Inc. All rights reserved. 2 * Copyright (C) 2013 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 #include "public/platform/WebContentDecryptionModuleSession.h" 48 #include "public/platform/WebContentDecryptionModuleSession.h"
49 #include "public/platform/WebEncryptedMediaKeyInformation.h" 49 #include "public/platform/WebEncryptedMediaKeyInformation.h"
50 #include "public/platform/WebString.h" 50 #include "public/platform/WebString.h"
51 #include "public/platform/WebURL.h" 51 #include "public/platform/WebURL.h"
52 #include "wtf/ASCIICType.h" 52 #include "wtf/ASCIICType.h"
53 #include <cmath> 53 #include <cmath>
54 #include <limits> 54 #include <limits>
55 55
56 namespace { 56 namespace {
57 57
58 // The list of possible values for |initDataType|.
59 const char kCenc[] = "cenc";
60 const char kKeyids[] = "keyids";
61 const char kWebm[] = "webm";
62
58 // The list of possible values for |sessionType|. 63 // The list of possible values for |sessionType|.
59 const char kTemporary[] = "temporary"; 64 const char kTemporary[] = "temporary";
60 const char kPersistentLicense[] = "persistent-license"; 65 const char kPersistentLicense[] = "persistent-license";
61 const char kPersistentReleaseMessage[] = "persistent-release-message"; 66 const char kPersistentReleaseMessage[] = "persistent-release-message";
62 67
63 // The list of possible values for |messageType|. 68 // The list of possible values for |messageType|.
64 const char kLicenseRequest[] = "license-request"; 69 const char kLicenseRequest[] = "license-request";
65 const char kLicenseRenewal[] = "license-renewal"; 70 const char kLicenseRenewal[] = "license-renewal";
66 const char kLicenseRelease[] = "license-release"; 71 const char kLicenseRelease[] = "license-release";
67 72
(...skipping 18 matching lines...) Expand all
86 91
87 // Check that the sessionId only contains alphanumeric characters. 92 // Check that the sessionId only contains alphanumeric characters.
88 for (unsigned i = 0; i < sessionId.length(); ++i) { 93 for (unsigned i = 0; i < sessionId.length(); ++i) {
89 if (!isASCIIAlphanumeric(sessionId[i])) 94 if (!isASCIIAlphanumeric(sessionId[i]))
90 return false; 95 return false;
91 } 96 }
92 97
93 return true; 98 return true;
94 } 99 }
95 100
96 // Checks that |initDataType| is a registered Initialization Data Type.
97 static bool isRegisteredInitDataType(const String& initDataType)
98 {
99 // List from https://w3c.github.io/encrypted-media/initdata-format-registry. html
100 return initDataType == "cenc" || initDataType == "keyids" || initDataType == "webm";
101 }
102
103 static String ConvertKeyStatusToString(const WebEncryptedMediaKeyInformation::Ke yStatus status) 101 static String ConvertKeyStatusToString(const WebEncryptedMediaKeyInformation::Ke yStatus status)
104 { 102 {
105 switch (status) { 103 switch (status) {
106 case WebEncryptedMediaKeyInformation::KeyStatus::Usable: 104 case WebEncryptedMediaKeyInformation::KeyStatus::Usable:
107 return "usable"; 105 return "usable";
108 case WebEncryptedMediaKeyInformation::KeyStatus::Expired: 106 case WebEncryptedMediaKeyInformation::KeyStatus::Expired:
109 return "expired"; 107 return "expired";
110 case WebEncryptedMediaKeyInformation::KeyStatus::OutputNotAllowed: 108 case WebEncryptedMediaKeyInformation::KeyStatus::OutputNotAllowed:
111 return "output-not-allowed"; 109 return "output-not-allowed";
112 case WebEncryptedMediaKeyInformation::KeyStatus::InternalError: 110 case WebEncryptedMediaKeyInformation::KeyStatus::InternalError:
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 { 144 {
147 return m_result; 145 return m_result;
148 } 146 }
149 147
150 const PassRefPtr<DOMArrayBuffer> data() const 148 const PassRefPtr<DOMArrayBuffer> data() const
151 { 149 {
152 ASSERT(m_type == GenerateRequest || m_type == Update); 150 ASSERT(m_type == GenerateRequest || m_type == Update);
153 return m_data; 151 return m_data;
154 } 152 }
155 153
156 const String& initDataType() const 154 WebEncryptedMediaInitDataType initDataType() const
157 { 155 {
158 ASSERT(m_type == GenerateRequest); 156 ASSERT(m_type == GenerateRequest);
159 return m_stringData; 157 return m_initDataType;
160 } 158 }
161 159
162 const String& sessionId() const 160 const String& sessionId() const
163 { 161 {
164 ASSERT(m_type == Load); 162 ASSERT(m_type == Load);
165 return m_stringData; 163 return m_stringData;
166 } 164 }
167 165
168 static PendingAction* CreatePendingGenerateRequest(ContentDecryptionModuleRe sult* result, const String& initDataType, PassRefPtr<DOMArrayBuffer> initData) 166 static PendingAction* CreatePendingGenerateRequest(ContentDecryptionModuleRe sult* result, WebEncryptedMediaInitDataType initDataType, PassRefPtr<DOMArrayBuf fer> initData)
169 { 167 {
170 ASSERT(result); 168 ASSERT(result);
171 ASSERT(initData); 169 ASSERT(initData);
172 return new PendingAction(GenerateRequest, result, initDataType, initData ); 170 return new PendingAction(GenerateRequest, result, initDataType, initData , String());
173 } 171 }
174 172
175 static PendingAction* CreatePendingLoadRequest(ContentDecryptionModuleResult * result, const String& sessionId) 173 static PendingAction* CreatePendingLoadRequest(ContentDecryptionModuleResult * result, const String& sessionId)
176 { 174 {
177 ASSERT(result); 175 ASSERT(result);
178 return new PendingAction(Load, result, sessionId, PassRefPtr<DOMArrayBuf fer>()); 176 return new PendingAction(Load, result, WebEncryptedMediaInitDataType::Un known, PassRefPtr<DOMArrayBuffer>(), sessionId);
179 } 177 }
180 178
181 static PendingAction* CreatePendingUpdate(ContentDecryptionModuleResult* res ult, PassRefPtr<DOMArrayBuffer> data) 179 static PendingAction* CreatePendingUpdate(ContentDecryptionModuleResult* res ult, PassRefPtr<DOMArrayBuffer> data)
182 { 180 {
183 ASSERT(result); 181 ASSERT(result);
184 ASSERT(data); 182 ASSERT(data);
185 return new PendingAction(Update, result, String(), data); 183 return new PendingAction(Update, result, WebEncryptedMediaInitDataType:: Unknown, data, String());
186 } 184 }
187 185
188 static PendingAction* CreatePendingClose(ContentDecryptionModuleResult* resu lt) 186 static PendingAction* CreatePendingClose(ContentDecryptionModuleResult* resu lt)
189 { 187 {
190 ASSERT(result); 188 ASSERT(result);
191 return new PendingAction(Close, result, String(), PassRefPtr<DOMArrayBuf fer>()); 189 return new PendingAction(Close, result, WebEncryptedMediaInitDataType::U nknown, PassRefPtr<DOMArrayBuffer>(), String());
192 } 190 }
193 191
194 static PendingAction* CreatePendingRemove(ContentDecryptionModuleResult* res ult) 192 static PendingAction* CreatePendingRemove(ContentDecryptionModuleResult* res ult)
195 { 193 {
196 ASSERT(result); 194 ASSERT(result);
197 return new PendingAction(Remove, result, String(), PassRefPtr<DOMArrayBu ffer>()); 195 return new PendingAction(Remove, result, WebEncryptedMediaInitDataType:: Unknown, PassRefPtr<DOMArrayBuffer>(), String());
198 } 196 }
199 197
200 ~PendingAction() 198 ~PendingAction()
201 { 199 {
202 } 200 }
203 201
204 DEFINE_INLINE_TRACE() 202 DEFINE_INLINE_TRACE()
205 { 203 {
206 visitor->trace(m_result); 204 visitor->trace(m_result);
207 } 205 }
208 206
209 private: 207 private:
210 PendingAction(Type type, ContentDecryptionModuleResult* result, const String & stringData, PassRefPtr<DOMArrayBuffer> data) 208 PendingAction(Type type, ContentDecryptionModuleResult* result, WebEncrypted MediaInitDataType initDataType, PassRefPtr<DOMArrayBuffer> data, const String& s tringData)
211 : m_type(type) 209 : m_type(type)
212 , m_result(result) 210 , m_result(result)
211 , m_initDataType(initDataType)
212 , m_data(data)
213 , m_stringData(stringData) 213 , m_stringData(stringData)
214 , m_data(data)
215 { 214 {
216 } 215 }
217 216
218 const Type m_type; 217 const Type m_type;
219 const Member<ContentDecryptionModuleResult> m_result; 218 const Member<ContentDecryptionModuleResult> m_result;
219 const WebEncryptedMediaInitDataType m_initDataType;
220 const RefPtr<DOMArrayBuffer> m_data;
220 const String m_stringData; 221 const String m_stringData;
221 const RefPtr<DOMArrayBuffer> m_data;
222 }; 222 };
223 223
224 // This class wraps the promise resolver used when initializing a new session 224 // This class wraps the promise resolver used when initializing a new session
225 // and is passed to Chromium to fullfill the promise. This implementation of 225 // and is passed to Chromium to fullfill the promise. This implementation of
226 // completeWithSession() will resolve the promise with void, while 226 // completeWithSession() will resolve the promise with void, while
227 // completeWithError() will reject the promise with an exception. complete() 227 // completeWithError() will reject the promise with an exception. complete()
228 // is not expected to be called, and will reject the promise. 228 // is not expected to be called, and will reject the promise.
229 class NewSessionResultPromise : public ContentDecryptionModuleResultPromise { 229 class NewSessionResultPromise : public ContentDecryptionModuleResultPromise {
230 public: 230 public:
231 NewSessionResultPromise(ScriptState* scriptState, MediaKeySession* session) 231 NewSessionResultPromise(ScriptState* scriptState, MediaKeySession* session)
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 DEFINE_INLINE_TRACE() 303 DEFINE_INLINE_TRACE()
304 { 304 {
305 visitor->trace(m_session); 305 visitor->trace(m_session);
306 ContentDecryptionModuleResultPromise::trace(visitor); 306 ContentDecryptionModuleResultPromise::trace(visitor);
307 } 307 }
308 308
309 private: 309 private:
310 Member<MediaKeySession> m_session; 310 Member<MediaKeySession> m_session;
311 }; 311 };
312 312
313 MediaKeySession* MediaKeySession::create(ScriptState* scriptState, MediaKeys* me diaKeys, const String& sessionType) 313 MediaKeySession* MediaKeySession::create(ScriptState* scriptState, MediaKeys* me diaKeys, WebEncryptedMediaSessionType sessionType)
314 { 314 {
315 ASSERT(isValidSessionType(sessionType));
316 RefPtrWillBeRawPtr<MediaKeySession> session = new MediaKeySession(scriptStat e, mediaKeys, sessionType); 315 RefPtrWillBeRawPtr<MediaKeySession> session = new MediaKeySession(scriptStat e, mediaKeys, sessionType);
317 session->suspendIfNeeded(); 316 session->suspendIfNeeded();
318 return session.get(); 317 return session.get();
319 } 318 }
320 319
321 bool MediaKeySession::isValidSessionType(const String& sessionType) 320 WebEncryptedMediaInitDataType MediaKeySession::convertInitDataType(const String& initDataType)
322 { 321 {
323 return (sessionType == kTemporary || sessionType == kPersistentLicense || se ssionType == kPersistentReleaseMessage); 322 if (initDataType == kCenc)
323 return WebEncryptedMediaInitDataType::Cenc;
324 if (initDataType == kKeyids)
325 return WebEncryptedMediaInitDataType::Keyids;
326 if (initDataType == kWebm)
327 return WebEncryptedMediaInitDataType::Webm;
328
329 // |initDataType| is not restricted in the idl, so anything is possible.
330 return WebEncryptedMediaInitDataType::Unknown;
324 } 331 }
325 332
326 MediaKeySession::MediaKeySession(ScriptState* scriptState, MediaKeys* mediaKeys, const String& sessionType) 333 WebEncryptedMediaSessionType MediaKeySession::convertSessionType(const String& s essionType)
334 {
335 if (sessionType == kTemporary)
336 return WebEncryptedMediaSessionType::Temporary;
337 if (sessionType == kPersistentLicense)
338 return WebEncryptedMediaSessionType::PersistentLicense;
339 if (sessionType == kPersistentReleaseMessage)
340 return WebEncryptedMediaSessionType::PersistentReleaseMessage;
341
342 ASSERT_NOT_REACHED();
343 return WebEncryptedMediaSessionType::Unknown;
344 }
345
346 MediaKeySession::MediaKeySession(ScriptState* scriptState, MediaKeys* mediaKeys, WebEncryptedMediaSessionType sessionType)
327 : ActiveDOMObject(scriptState->executionContext()) 347 : ActiveDOMObject(scriptState->executionContext())
328 , m_keySystem(mediaKeys->keySystem()) 348 , m_keySystem(mediaKeys->keySystem())
329 , m_asyncEventQueue(GenericEventQueue::create(this)) 349 , m_asyncEventQueue(GenericEventQueue::create(this))
330 , m_mediaKeys(mediaKeys) 350 , m_mediaKeys(mediaKeys)
331 , m_sessionType(sessionType) 351 , m_sessionType(sessionType)
332 , m_expiration(std::numeric_limits<double>::quiet_NaN()) 352 , m_expiration(std::numeric_limits<double>::quiet_NaN())
333 , m_keyStatusesMap(new MediaKeyStatusMap()) 353 , m_keyStatusesMap(new MediaKeyStatusMap())
334 , m_isUninitialized(true) 354 , m_isUninitialized(true)
335 , m_isCallable(false) 355 , m_isCallable(false)
336 , m_isClosed(false) 356 , m_isClosed(false)
(...skipping 17 matching lines...) Expand all
354 // 3.2 Let the expiration attribute be NaN. 374 // 3.2 Let the expiration attribute be NaN.
355 ASSERT(std::isnan(m_expiration)); 375 ASSERT(std::isnan(m_expiration));
356 376
357 // 3.3 Let the closed attribute be a new promise. 377 // 3.3 Let the closed attribute be a new promise.
358 ASSERT(!closed(scriptState).isUndefinedOrNull()); 378 ASSERT(!closed(scriptState).isUndefinedOrNull());
359 379
360 // 3.4 Let the keyStatuses attribute be empty. 380 // 3.4 Let the keyStatuses attribute be empty.
361 ASSERT(m_keyStatusesMap->size() == 0); 381 ASSERT(m_keyStatusesMap->size() == 0);
362 382
363 // 3.5 Let the session type be sessionType. 383 // 3.5 Let the session type be sessionType.
364 ASSERT(isValidSessionType(m_sessionType)); 384 ASSERT(m_sessionType != WebEncryptedMediaSessionType::Unknown);
365 385
366 // 3.6 Let uninitialized be true. 386 // 3.6 Let uninitialized be true.
367 ASSERT(m_isUninitialized); 387 ASSERT(m_isUninitialized);
368 388
369 // 3.7 Let callable be false. 389 // 3.7 Let callable be false.
370 ASSERT(!m_isCallable); 390 ASSERT(!m_isCallable);
371 391
372 // 3.8 Let the use distinctive identifier value be this object's 392 // 3.8 Let the use distinctive identifier value be this object's
373 // use distinctive identifier. 393 // use distinctive identifier.
374 // FIXME: Implement this (http://crbug.com/448922). 394 // FIXME: Implement this (http://crbug.com/448922).
(...skipping 22 matching lines...) Expand all
397 ScriptPromise MediaKeySession::closed(ScriptState* scriptState) 417 ScriptPromise MediaKeySession::closed(ScriptState* scriptState)
398 { 418 {
399 return m_closedPromise->promise(scriptState->world()); 419 return m_closedPromise->promise(scriptState->world());
400 } 420 }
401 421
402 MediaKeyStatusMap* MediaKeySession::keyStatuses() 422 MediaKeyStatusMap* MediaKeySession::keyStatuses()
403 { 423 {
404 return m_keyStatusesMap; 424 return m_keyStatusesMap;
405 } 425 }
406 426
407 ScriptPromise MediaKeySession::generateRequest(ScriptState* scriptState, const S tring& initDataType, const DOMArrayPiece& initData) 427 ScriptPromise MediaKeySession::generateRequest(ScriptState* scriptState, const S tring& initDataTypeString, const DOMArrayPiece& initData)
408 { 428 {
409 WTF_LOG(Media, "MediaKeySession(%p)::generateRequest %s", this, initDataType .ascii().data()); 429 WTF_LOG(Media, "MediaKeySession(%p)::generateRequest %s", this, initDataType String.ascii().data());
410 430
411 // From https://w3c.github.io/encrypted-media/#generateRequest: 431 // From https://w3c.github.io/encrypted-media/#generateRequest:
412 // Generates a request based on the initData. When this method is invoked, 432 // Generates a request based on the initData. When this method is invoked,
413 // the user agent must run the following steps: 433 // the user agent must run the following steps:
414 434
415 // 1. If this object's uninitialized value is false, return a promise 435 // 1. If this object's uninitialized value is false, return a promise
416 // rejected with a new DOMException whose name is "InvalidStateError". 436 // rejected with a new DOMException whose name is "InvalidStateError".
417 if (!m_isUninitialized) 437 if (!m_isUninitialized)
418 return CreateRejectedPromiseAlreadyInitialized(scriptState); 438 return CreateRejectedPromiseAlreadyInitialized(scriptState);
419 439
420 // 2. Let this object's uninitialized be false. 440 // 2. Let this object's uninitialized be false.
421 m_isUninitialized = false; 441 m_isUninitialized = false;
422 442
423 // 3. If initDataType is an empty string, return a promise rejected with a 443 // 3. If initDataType is an empty string, return a promise rejected with a
424 // new DOMException whose name is "InvalidAccessError". 444 // new DOMException whose name is "InvalidAccessError".
425 if (initDataType.isEmpty()) { 445 if (initDataTypeString.isEmpty()) {
426 return ScriptPromise::rejectWithDOMException( 446 return ScriptPromise::rejectWithDOMException(
427 scriptState, DOMException::create(InvalidAccessError, "The initDataT ype parameter is empty.")); 447 scriptState, DOMException::create(InvalidAccessError, "The initDataT ype parameter is empty."));
428 } 448 }
429 449
430 // 4. If initData is an empty array, return a promise rejected with a new 450 // 4. If initData is an empty array, return a promise rejected with a new
431 // DOMException whose name is"InvalidAccessError". 451 // DOMException whose name is"InvalidAccessError".
432 if (!initData.byteLength()) { 452 if (!initData.byteLength()) {
433 return ScriptPromise::rejectWithDOMException( 453 return ScriptPromise::rejectWithDOMException(
434 scriptState, DOMException::create(InvalidAccessError, "The initData parameter is empty.")); 454 scriptState, DOMException::create(InvalidAccessError, "The initData parameter is empty."));
435 } 455 }
436 456
437 // 5. If the Key System implementation represented by this object's cdm 457 // 5. If the Key System implementation represented by this object's cdm
438 // implementation value does not support initDataType as an 458 // implementation value does not support initDataType as an
439 // Initialization Data Type, return a promise rejected with a new 459 // Initialization Data Type, return a promise rejected with a new
440 // DOMException whose name is NotSupportedError. String comparison 460 // DOMException whose name is NotSupportedError. String comparison
441 // is case-sensitive. 461 // is case-sensitive.
442 // (blink side doesn't know what the CDM supports, so the proper check 462 // (blink side doesn't know what the CDM supports, so the proper check
443 // will be done on the Chromium side. However, we can verify that 463 // will be done on the Chromium side. However, we can verify that
444 // |initDataType| is one of the registered values.) 464 // |initDataType| is one of the registered values.)
445 if (!isRegisteredInitDataType(initDataType)) { 465 WebEncryptedMediaInitDataType initDataType = convertInitDataType(initDataTyp eString);
466 if (initDataType == WebEncryptedMediaInitDataType::Unknown) {
446 return ScriptPromise::rejectWithDOMException( 467 return ScriptPromise::rejectWithDOMException(
447 scriptState, DOMException::create(NotSupportedError, "The initializa tion data type '" + initDataType + "' is not a registered Initialization Data Ty pe.")); 468 scriptState, DOMException::create(NotSupportedError, "The initializa tion data type '" + initDataTypeString + "' is not a registered Initialization D ata Type."));
sandersd (OOO until July 31) 2015/02/25 00:35:54 I don't think that 'registered' has meaning to dev
jrummell 2015/02/25 20:52:42 Done.
448 } 469 }
449 470
450 // 6. Let init data be a copy of the contents of the initData parameter. 471 // 6. Let init data be a copy of the contents of the initData parameter.
451 RefPtr<DOMArrayBuffer> initDataBuffer = DOMArrayBuffer::create(initData.data (), initData.byteLength()); 472 RefPtr<DOMArrayBuffer> initDataBuffer = DOMArrayBuffer::create(initData.data (), initData.byteLength());
452 473
453 // 7. Let session type be this object's session type. 474 // 7. Let session type be this object's session type.
454 // (Done in constructor.) 475 // (Done in constructor.)
455 476
456 // 8. Let promise be a new promise. 477 // 8. Let promise be a new promise.
457 NewSessionResultPromise* result = new NewSessionResultPromise(scriptState, t his); 478 NewSessionResultPromise* result = new NewSessionResultPromise(scriptState, t his);
(...skipping 28 matching lines...) Expand all
486 // 3. If sessionId is an empty string, return a promise rejected with a 507 // 3. If sessionId is an empty string, return a promise rejected with a
487 // new DOMException whose name is "InvalidAccessError". 508 // new DOMException whose name is "InvalidAccessError".
488 if (sessionId.isEmpty()) { 509 if (sessionId.isEmpty()) {
489 return ScriptPromise::rejectWithDOMException( 510 return ScriptPromise::rejectWithDOMException(
490 scriptState, DOMException::create(InvalidAccessError, "The sessionId parameter is empty.")); 511 scriptState, DOMException::create(InvalidAccessError, "The sessionId parameter is empty."));
491 } 512 }
492 513
493 // 4. If this object's session type is not "persistent-license" or 514 // 4. If this object's session type is not "persistent-license" or
494 // "persistent-release-message", return a promise rejected with a 515 // "persistent-release-message", return a promise rejected with a
495 // new DOMException whose name is InvalidAccessError. 516 // new DOMException whose name is InvalidAccessError.
496 if (m_sessionType != kPersistentLicense && m_sessionType != kPersistentRelea seMessage) { 517 if (m_sessionType != WebEncryptedMediaSessionType::PersistentLicense && m_se ssionType != WebEncryptedMediaSessionType::PersistentReleaseMessage) {
497 return ScriptPromise::rejectWithDOMException( 518 return ScriptPromise::rejectWithDOMException(
498 scriptState, DOMException::create(InvalidAccessError, "The session t ype is not persistent.")); 519 scriptState, DOMException::create(InvalidAccessError, "The session t ype is not persistent."));
499 } 520 }
500 521
501 // 5. If the Key System implementation represented by this object's cdm 522 // 5. If the Key System implementation represented by this object's cdm
502 // implementation value does not support loading previous sessions, 523 // implementation value does not support loading previous sessions,
503 // return a promise rejected with a new DOMException whose name is 524 // return a promise rejected with a new DOMException whose name is
504 // NotSupportedError. 525 // NotSupportedError.
505 // FIXME: Implement this (http://crbug.com/448922). 526 // FIXME: Implement this (http://crbug.com/448922).
506 527
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 // method is invoked, the user agent must run the following steps: 622 // method is invoked, the user agent must run the following steps:
602 623
603 // 1. If this object's callable value is false, return a promise rejected 624 // 1. If this object's callable value is false, return a promise rejected
604 // with a new DOMException whose name is "InvalidStateError". 625 // with a new DOMException whose name is "InvalidStateError".
605 if (!m_isCallable) 626 if (!m_isCallable)
606 return CreateRejectedPromiseNotCallable(scriptState); 627 return CreateRejectedPromiseNotCallable(scriptState);
607 628
608 // 2. If this object's session type is not "persistent-license" or 629 // 2. If this object's session type is not "persistent-license" or
609 // "persistent-release-message", return a promise rejected with a 630 // "persistent-release-message", return a promise rejected with a
610 // new DOMException whose name is InvalidAccessError. 631 // new DOMException whose name is InvalidAccessError.
611 if (m_sessionType != kPersistentLicense && m_sessionType != kPersistentRelea seMessage) { 632 if (m_sessionType != WebEncryptedMediaSessionType::PersistentLicense && m_se ssionType != WebEncryptedMediaSessionType::PersistentReleaseMessage) {
612 return ScriptPromise::rejectWithDOMException( 633 return ScriptPromise::rejectWithDOMException(
613 scriptState, DOMException::create(InvalidAccessError, "The session t ype is not persistent.")); 634 scriptState, DOMException::create(InvalidAccessError, "The session t ype is not persistent."));
614 } 635 }
615 636
616 // 3. If the Session Close algorithm has been run on this object, return a 637 // 3. If the Session Close algorithm has been run on this object, return a
617 // promise rejected with a new DOMException whose name is 638 // promise rejected with a new DOMException whose name is
618 // "InvalidStateError". 639 // "InvalidStateError".
619 if (m_isClosed) { 640 if (m_isClosed) {
620 return ScriptPromise::rejectWithDOMException( 641 return ScriptPromise::rejectWithDOMException(
621 scriptState, DOMException::create(InvalidStateError, "The session is already closed.")); 642 scriptState, DOMException::create(InvalidStateError, "The session is already closed."));
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
939 visitor->trace(m_asyncEventQueue); 960 visitor->trace(m_asyncEventQueue);
940 visitor->trace(m_pendingActions); 961 visitor->trace(m_pendingActions);
941 visitor->trace(m_mediaKeys); 962 visitor->trace(m_mediaKeys);
942 visitor->trace(m_keyStatusesMap); 963 visitor->trace(m_keyStatusesMap);
943 visitor->trace(m_closedPromise); 964 visitor->trace(m_closedPromise);
944 RefCountedGarbageCollectedEventTargetWithInlineData<MediaKeySession>::trace( visitor); 965 RefCountedGarbageCollectedEventTargetWithInlineData<MediaKeySession>::trace( visitor);
945 ActiveDOMObject::trace(visitor); 966 ActiveDOMObject::trace(visitor);
946 } 967 }
947 968
948 } // namespace blink 969 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698