Bug 1311864 - Reject MediaKeySession::Load() for non temporary session types. r=kikuo

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

MozReview-Commit-ID: FnIEFgVId1z

--HG--
extra : rebase_source : 23042d3acda6cfcb379db457224d648dc955f688
This commit is contained in:
Chris Pearce 2016-10-21 11:43:05 +13:00
parent d2f9598859
commit 22b1ca7b53

View File

@ -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()));