Skip to content

Commit 0499c7b

Browse files
committed
Bug 1978428 - part1 : implement MediaKeySessionClosedReason and return closed-by-application for closed. r=media-playback-reviewers,webidl,padenot,emilio
The default is returning `closed-by-application` for `closed` per the spec [1]. We will implement returning other reasons in bug 1978434. [1] https://w3c.github.io/encrypted-media/#ref-for-dom-mediakeysessionclosedreason-closed-by-application-3 Differential Revision: https://phabricator.services.mozilla.com/D258313
1 parent 624777b commit 0499c7b

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

dom/media/eme/MediaKeySession.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ void MediaKeySession::OnClosed() {
518518
mIsClosed = true;
519519
mKeys->OnSessionClosed(this);
520520
mKeys = nullptr;
521-
mClosed->MaybeResolveWithUndefined();
521+
mClosed->MaybeResolve(MediaKeySessionClosedReason::Closed_by_application);
522522
}
523523

524524
bool MediaKeySession::IsClosed() const { return mIsClosed; }

dom/webidl/MediaKeySession.webidl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@
1010
* W3C liability, trademark and document use rules apply.
1111
*/
1212

13+
enum MediaKeySessionClosedReason {
14+
"internal-error",
15+
"closed-by-application",
16+
"release-acknowledged",
17+
"hardware-context-reset",
18+
"resource-evicted"
19+
};
20+
1321
[Exposed=Window]
1422
interface MediaKeySession : EventTarget {
1523
// error state
@@ -20,7 +28,7 @@ interface MediaKeySession : EventTarget {
2028

2129
readonly attribute unrestricted double expiration;
2230

23-
readonly attribute Promise<undefined> closed;
31+
readonly attribute Promise<MediaKeySessionClosedReason> closed;
2432

2533
readonly attribute MediaKeyStatusMap keyStatuses;
2634

0 commit comments

Comments
 (0)