| Index: Source/modules/encryptedmedia/MediaKeys.cpp
|
| diff --git a/Source/modules/encryptedmedia/MediaKeys.cpp b/Source/modules/encryptedmedia/MediaKeys.cpp
|
| index 7e71d765a03d73024357fafa487b6c67fbc8f010..b2d320c7fdd76383a717a6fed3124afcdd53d6c5 100644
|
| --- a/Source/modules/encryptedmedia/MediaKeys.cpp
|
| +++ b/Source/modules/encryptedmedia/MediaKeys.cpp
|
| @@ -78,10 +78,7 @@ MediaKeys::MediaKeys(const String& keySystem, PassOwnPtr<ContentDecryptionModule
|
|
|
| MediaKeys::~MediaKeys()
|
| {
|
| - // From <http://dvcs.w3.org/hg/html-media/raw-file/default/encrypted-media/encrypted-media.html#dom-media-keys-constructor>:
|
| - // When destroying a MediaKeys object, follow the steps in close().
|
| - for (size_t i = 0; i < m_sessions.size(); ++i)
|
| - m_sessions[i]->close();
|
| + // FIXME: Make sure MediaKeySessions are torn down correctly.
|
| }
|
|
|
| PassRefPtr<MediaKeySession> MediaKeys::createSession(ExecutionContext* context, const String& type, Uint8Array* initData, ExceptionState& exceptionState)
|
| @@ -90,35 +87,38 @@ PassRefPtr<MediaKeySession> MediaKeys::createSession(ExecutionContext* context,
|
| // The createSession(type, initData) method must run the following steps:
|
| // Note: The contents of initData are container-specific Initialization Data.
|
|
|
| - // 1. If type is null or an empty string and initData is not null or an empty string, throw an
|
| + // FIXME: Follow the latest spec to check |type| and |initData|.
|
| + // If type is null or an empty string and initData is not null or an empty string, throw an
|
| // InvalidAccessError exception and abort these steps.
|
| if ((type.isEmpty()) && (!initData || initData->length())) {
|
| exceptionState.throwDOMException(InvalidAccessError, "The type provided is empty, but initData is not empty.");
|
| return 0;
|
| }
|
|
|
| - // 2. If type contains a MIME type that is not supported or is not supported by the keySystem, throw
|
| - // a NotSupportedError exception and abort these steps.
|
| + // 1. If type contains a MIME type that is not supported or is not supported by the keySystem,
|
| + // throw a NOT_SUPPORTED_ERR exception and abort these steps.
|
| ASSERT(!type.isEmpty());
|
| if (type.isEmpty() || !m_cdm->supportsMIMEType(type)) {
|
| exceptionState.throwDOMException(NotSupportedError, "The type provided ('" + type + "') is unsupported.");
|
| return 0;
|
| }
|
|
|
| - // 3. Create a new MediaKeySession object.
|
| + // 2. Create a new MediaKeySession object.
|
| RefPtr<MediaKeySession> session = MediaKeySession::create(context, m_cdm.get(), this);
|
| - // 3.1 Let the keySystem attribute be keySystem.
|
| + // 2.1 Let the keySystem attribute be keySystem.
|
| ASSERT(!session->keySystem().isEmpty());
|
| - // 3.2 Let the sessionId attribute be a unique Session ID string. It may be generated by cdm.
|
| - // This is handled by m_cdm and may happen asynchronously.
|
| + // FIXME: 2.2 Let the state of the session be CREATED.
|
|
|
| - // 4. Add the new object to an internal list of session objects.
|
| + // 3. Add the new object to an internal list of session objects.
|
| m_sessions.append(session);
|
|
|
| - // 5. Schedule a task to generate a key request, providing type, initData, and the new object.
|
| - session->generateKeyRequest(type, initData);
|
| + // 4. Schedule a task to initialize the session, providing type, initData, and the new object.
|
| + // FIXME: The spec says "schedule a task". We should move the timer here.
|
| + // FIXME: |initData| may be 0. We need to add more check before we dereference it.
|
| + // Note that this may become obsolete when the FIXME on l.90 is fixed.
|
| + session->initializeNewSession(type, initData);
|
|
|
| - // 6. Return the new object to the caller.
|
| + // 5. Return the new object to the caller.
|
| return session;
|
| }
|
|
|
|
|