Skip to content

Commit

Permalink
Bug 1311864 - Reject MediaKeySession::Load() for non temporary sessio…
Browse files Browse the repository at this point in the history
…n types. r=kikuo

We are required to do this by the draft EME spec.

MozReview-Commit-ID: FnIEFgVId1z
  • Loading branch information
Chris Pearce committed Oct 20, 2016
1 parent 608570e commit 9f580d9
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions dom/media/eme/MediaKeySession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,20 @@ MediaKeySession::Load(const nsAString& aSessionId, ErrorResult& aRv)
return promise.forget();
}

// 5. If the result of running the Is persistent session type? algorithm
// on this object's session type is false, return a promise rejected with
// a newly created TypeError.
if (mSessionType == MediaKeySessionType::Temporary) {
promise->MaybeReject(NS_ERROR_DOM_TYPE_ERR,
NS_LITERAL_CSTRING("Trying to load() into a non-persistent session"));
EME_LOG("MediaKeySession[%p,''] Load() failed, can't load in a non-persistent session", this);
return promise.forget();
}

// Note: We don't support persistent sessions in any keysystem, so all calls
// to Load() should reject with a TypeError in the preceding check. Omitting
// implementing the rest of the specified MediaKeySession::Load() algorithm.

// We now know the sessionId being loaded into this session. Remove the
// session from its owning MediaKey's set of sessions awaiting a sessionId.
RefPtr<MediaKeySession> session(mKeys->GetPendingSession(Token()));
Expand Down

0 comments on commit 9f580d9

Please sign in to comment.