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

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

Issue 2688263002: EME: close() should return a resolved promise if session already closed (Closed)
Patch Set: Created 3 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 744 matching lines...) Expand 10 before | Expand all | Expand 10 after
755 755
756 // From https://w3c.github.io/encrypted-media/#close: 756 // From https://w3c.github.io/encrypted-media/#close:
757 // Indicates that the application no longer needs the session and the CDM 757 // Indicates that the application no longer needs the session and the CDM
758 // should release any resources associated with the session and close it. 758 // should release any resources associated with the session and close it.
759 // Persisted data should not be released or cleared. 759 // Persisted data should not be released or cleared.
760 // When this method is invoked, the user agent must run the following steps: 760 // When this method is invoked, the user agent must run the following steps:
761 761
762 // 1. Let session be the associated MediaKeySession object. 762 // 1. Let session be the associated MediaKeySession object.
763 // 2. If session is closed, return a resolved promise. 763 // 2. If session is closed, return a resolved promise.
764 if (m_isClosed) 764 if (m_isClosed)
765 return ScriptPromise::cast(scriptState, ScriptValue()); 765 return ScriptPromise::castUndefined(scriptState);
766 766
767 // 3. If session's callable value is false, return a promise rejected with 767 // 3. If session's callable value is false, return a promise rejected with
768 // an InvalidStateError. 768 // an InvalidStateError.
769 if (!m_isCallable) 769 if (!m_isCallable)
770 return CreateRejectedPromiseNotCallable(scriptState); 770 return CreateRejectedPromiseNotCallable(scriptState);
771 771
772 // 4. Let promise be a new promise. 772 // 4. Let promise be a new promise.
773 SimpleResultPromise* result = new SimpleResultPromise(scriptState, this); 773 SimpleResultPromise* result = new SimpleResultPromise(scriptState, this);
774 ScriptPromise promise = result->promise(); 774 ScriptPromise promise = result->promise();
775 775
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
1045 visitor->trace(m_asyncEventQueue); 1045 visitor->trace(m_asyncEventQueue);
1046 visitor->trace(m_pendingActions); 1046 visitor->trace(m_pendingActions);
1047 visitor->trace(m_mediaKeys); 1047 visitor->trace(m_mediaKeys);
1048 visitor->trace(m_keyStatusesMap); 1048 visitor->trace(m_keyStatusesMap);
1049 visitor->trace(m_closedPromise); 1049 visitor->trace(m_closedPromise);
1050 EventTargetWithInlineData::trace(visitor); 1050 EventTargetWithInlineData::trace(visitor);
1051 ContextLifecycleObserver::trace(visitor); 1051 ContextLifecycleObserver::trace(visitor);
1052 } 1052 }
1053 1053
1054 } // namespace blink 1054 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/media/encrypted-media/encrypted-media-session-multiple-close-sequential.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698