Title: [262365] trunk/Source/WebCore
- Revision
- 262365
- Author
- [email protected]
- Date
- 2020-05-31 12:52:53 -0700 (Sun, 31 May 2020)
Log Message
[Cocoa] EME should return more helpful error code during key exchange
https://bugs.webkit.org/show_bug.cgi?id=212535
<rdar://problem/60439979>
Reviewed by Eric Carlson.
Clients have requested that the EME API provide more helpful information when the FairPlay CDM is unable
to provide the requested level of key security. Currently, we reject the update() promise with a generic
"failed" error code. Instead, resolve the promise, but mark the key as "output-restricted" in the key
status map, indicating that the key cannot be used with required level of security.
Drive-by fix: We currently ASSERT() that the callback from removeSessionData() isn't called if the session
is not a PUR session. When calling removeSessionData() on a non-PUR session, call the callback with a generic
"failed" error.
* platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
(WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::removeSessionData):
(WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::didFailToProvideRequest):
(WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::keyStatuses const):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (262364 => 262365)
--- trunk/Source/WebCore/ChangeLog 2020-05-31 18:51:35 UTC (rev 262364)
+++ trunk/Source/WebCore/ChangeLog 2020-05-31 19:52:53 UTC (rev 262365)
@@ -1,5 +1,27 @@
2020-05-31 Jer Noble <[email protected]>
+ [Cocoa] EME should return more helpful error code during key exchange
+ https://bugs.webkit.org/show_bug.cgi?id=212535
+ <rdar://problem/60439979>
+
+ Reviewed by Eric Carlson.
+
+ Clients have requested that the EME API provide more helpful information when the FairPlay CDM is unable
+ to provide the requested level of key security. Currently, we reject the update() promise with a generic
+ "failed" error code. Instead, resolve the promise, but mark the key as "output-restricted" in the key
+ status map, indicating that the key cannot be used with required level of security.
+
+ Drive-by fix: We currently ASSERT() that the callback from removeSessionData() isn't called if the session
+ is not a PUR session. When calling removeSessionData() on a non-PUR session, call the callback with a generic
+ "failed" error.
+
+ * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
+ (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::removeSessionData):
+ (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::didFailToProvideRequest):
+ (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::keyStatuses const):
+
+2020-05-31 Jer Noble <[email protected]>
+
[Cocoa] Transition between encrypted and clear codecs throws error from SourceBuffer.appendBuffer()
https://bugs.webkit.org/show_bug.cgi?id=212550
<rdar://problem/62207260>
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm (262364 => 262365)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm 2020-05-31 18:51:35 UTC (rev 262364)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm 2020-05-31 19:52:53 UTC (rev 262365)
@@ -52,6 +52,7 @@
static const NSString *PlaybackSessionIdKey = @"PlaybackSessionID";
static NSString * const InitializationDataTypeKey = @"InitializationDataType";
static NSString * const ContentKeyReportGroupKey = @"ContentKeyReportGroup";
+static const NSInteger SecurityLevelError = -42811;
@interface WebCoreFPSContentKeySessionDelegate : NSObject<AVContentKeySessionDelegate> {
WebCore::AVContentKeySessionDelegateClient* _parent;
@@ -969,7 +970,10 @@
DEBUG_LOG_IF_POSSIBLE(LOGIDENTIFIER, " Succeeded");
callback(WTFMove(changedKeys), SharedBuffer::create(expiredSessionsData.get()), Succeeded);
+ return;
}
+
+ callback({ }, WTF::nullopt, Failed);
}
void CDMInstanceSessionFairPlayStreamingAVFObjC::storeRecordOfKeyUsage(const String&)
@@ -1182,8 +1186,17 @@
void CDMInstanceSessionFairPlayStreamingAVFObjC::didFailToProvideRequest(AVContentKeyRequest *request, NSError *error)
{
UNUSED_PARAM(request);
- UNUSED_PARAM(error);
+ // Rather than reject the update() promise when the CDM indicates that
+ // the key requires a higher level of security than it is currently able
+ // to provide, signal this state by "succeeding", but set the key status
+ // to "output-restricted".
+
+ if (error.code == SecurityLevelError) {
+ requestDidSucceed(request);
+ return;
+ }
+
if (m_updateResponseCollector) {
m_updateResponseCollector->addErrorResponse(request, error);
return;
@@ -1312,7 +1325,7 @@
for (auto& oneRequest : request.requests) {
auto keyIDs = keyIDsForRequest(oneRequest.get());
auto status = requestStatusToCDMStatus(oneRequest.get().status);
- if (m_outputObscured)
+ if (m_outputObscured || oneRequest.get().error.code == SecurityLevelError)
status = CDMKeyStatus::OutputRestricted;
for (auto& keyID : keyIDs)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes