Title: [267425] branches/safari-610.2.5.1-branch/Source/WebCore
Revision
267425
Author
[email protected]
Date
2020-09-22 11:43:01 -0700 (Tue, 22 Sep 2020)

Log Message

Revert "Cherry-pick r267106. rdar://problem/69375000"

Modified Paths

Diff

Modified: branches/safari-610.2.5.1-branch/Source/WebCore/ChangeLog (267424 => 267425)


--- branches/safari-610.2.5.1-branch/Source/WebCore/ChangeLog	2020-09-22 18:37:51 UTC (rev 267424)
+++ branches/safari-610.2.5.1-branch/Source/WebCore/ChangeLog	2020-09-22 18:43:01 UTC (rev 267425)
@@ -1,40 +1,3 @@
-2020-09-22  Russell Epstein  <[email protected]>
-
-        Cherry-pick r267106. rdar://problem/69375000
-
-    CRASH: Exception thrown from -[AVContentKeyRequest makeStreamingContentKeyRequestDataForApp:contentIdentifier:options:completionHandler:]
-    https://bugs.webkit.org/show_bug.cgi?id=216580
-    <rdar://problem/68866834>
-    
-    Reviewed by Eric Carlson.
-    
-    Protect against undocumented exceptions thrown from AVContentKeySession (and related) APIs by wrapping in @try/@catch blocks and firing
-    the correct failure callbacks if an exception is encountered.
-    
-    * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
-    (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::didProvideRequest):
-    (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::didProvideRequests):
-    (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::didProvideRenewingRequest):
-    
-    
-    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267106 268f45cc-cd09-0410-ab3c-d52691b4dbfc
-
-    2020-09-15  Jer Noble  <[email protected]>
-
-            CRASH: Exception thrown from -[AVContentKeyRequest makeStreamingContentKeyRequestDataForApp:contentIdentifier:options:completionHandler:]
-            https://bugs.webkit.org/show_bug.cgi?id=216580
-            <rdar://problem/68866834>
-
-            Reviewed by Eric Carlson.
-
-            Protect against undocumented exceptions thrown from AVContentKeySession (and related) APIs by wrapping in @try/@catch blocks and firing
-            the correct failure callbacks if an exception is encountered.
-
-            * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
-            (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::didProvideRequest):
-            (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::didProvideRequests):
-            (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::didProvideRenewingRequest):
-
 2020-09-11  Alan Coon  <[email protected]>
 
         Cherry-pick r266901. rdar://problem/68740506

Modified: branches/safari-610.2.5.1-branch/Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm (267424 => 267425)


--- branches/safari-610.2.5.1-branch/Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm	2020-09-22 18:37:51 UTC (rev 267424)
+++ branches/safari-610.2.5.1-branch/Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm	2020-09-22 18:43:01 UTC (rev 267425)
@@ -1044,32 +1044,25 @@
     }
 
     RetainPtr<NSData> contentIdentifier = keyIDs.first()->createNSData();
-    @try {
-        [request makeStreamingContentKeyRequestDataForApp:appIdentifier.get() contentIdentifier:contentIdentifier.get() options:nil completionHandler:[this, weakThis = makeWeakPtr(*this)] (NSData *contentKeyRequestData, NSError *error) mutable {
-            callOnMainThread([this, weakThis = WTFMove(weakThis), error = retainPtr(error), contentKeyRequestData = retainPtr(contentKeyRequestData)] {
-                if (!weakThis)
-                    return;
+    [request makeStreamingContentKeyRequestDataForApp:appIdentifier.get() contentIdentifier:contentIdentifier.get() options:nil completionHandler:[this, weakThis = makeWeakPtr(*this)] (NSData *contentKeyRequestData, NSError *error) mutable {
+        callOnMainThread([this, weakThis = WTFMove(weakThis), error = retainPtr(error), contentKeyRequestData = retainPtr(contentKeyRequestData)] {
+            if (!weakThis)
+                return;
 
-                if (m_sessionId.isEmpty()) {
-                    auto sessionID = m_group ? m_group.get().contentProtectionSessionIdentifier : m_session.get().contentProtectionSessionIdentifier;
-                    sessionIdentifierChanged(sessionID);
-                }
+            if (m_sessionId.isEmpty()) {
+                auto sessionID = m_group ? m_group.get().contentProtectionSessionIdentifier : m_session.get().contentProtectionSessionIdentifier;
+                sessionIdentifierChanged(sessionID);
+            }
 
-                if (error && m_requestLicenseCallback)
-                    m_requestLicenseCallback(SharedBuffer::create(), m_sessionId, false, Failed);
-                else if (m_requestLicenseCallback)
-                    m_requestLicenseCallback(SharedBuffer::create(contentKeyRequestData.get()), m_sessionId, false, Succeeded);
-                else if (m_client)
-                    m_client->sendMessage(CDMMessageType::LicenseRequest, SharedBuffer::create(contentKeyRequestData.get()));
-                ASSERT(!m_requestLicenseCallback);
-            });
-        }];
-    } @catch(NSException *exception) {
-        ERROR_LOG_IF_POSSIBLE(LOGIDENTIFIER, "exception thrown from -makeStreamingContentKeyRequestDataForApp:contentIdentifier:options:completionHandler: ", [[exception name] UTF8String], ", reason : ", [[exception reason] UTF8String]);
-        if (m_updateLicenseCallback)
-            m_updateLicenseCallback(false, WTF::nullopt, WTF::nullopt, WTF::nullopt, Failed);
-        ASSERT(!m_updateLicenseCallback);
-    }
+            if (error && m_requestLicenseCallback)
+                m_requestLicenseCallback(SharedBuffer::create(), m_sessionId, false, Failed);
+            else if (m_requestLicenseCallback)
+                m_requestLicenseCallback(SharedBuffer::create(contentKeyRequestData.get()), m_sessionId, false, Succeeded);
+            else if (m_client)
+                m_client->sendMessage(CDMMessageType::LicenseRequest, SharedBuffer::create(contentKeyRequestData.get()));
+            ASSERT(!m_requestLicenseCallback);
+        });
+    }];
 }
 
 void CDMInstanceSessionFairPlayStreamingAVFObjC::didProvideRequests(Vector<RetainPtr<AVContentKeyRequest>>&& requests)
@@ -1154,23 +1147,16 @@
         m_requestLicenseCallback(requestBuffer.releaseNonNull(), m_sessionId, false, Succeeded);
     });
 
-    @try {
-        for (auto request : m_currentRequest.value().requests) {
-            auto keyIDs = keyIDsForRequest(request.get());
-            RefPtr<SharedBuffer> keyID = WTFMove(keyIDs.first());
-            auto contentIdentifier = keyID->createNSData();
-            [request makeStreamingContentKeyRequestDataForApp:appIdentifier.get() contentIdentifier:contentIdentifier.get() options:nil completionHandler:[keyID = WTFMove(keyID), aggregator] (NSData *contentKeyRequestData, NSError *error) mutable {
-                UNUSED_PARAM(error);
-                callOnMainThread([keyID = WTFMove(keyID), aggregator = WTFMove(aggregator), contentKeyRequestData = retainPtr(contentKeyRequestData)] () mutable {
-                    aggregator->requestsData.append({ WTFMove(keyID), WTFMove(contentKeyRequestData) });
-                });
-            }];
-        }
-    } @catch(NSException *exception) {
-        ERROR_LOG_IF_POSSIBLE(LOGIDENTIFIER, "exception thrown from -makeStreamingContentKeyRequestDataForApp:contentIdentifier:options:completionHandler: ", [[exception name] UTF8String], ", reason : ", [[exception reason] UTF8String]);
-        if (m_requestLicenseCallback)
-            m_requestLicenseCallback(SharedBuffer::create(), m_sessionId, false, Failed);
-        ASSERT(!m_requestLicenseCallback);
+    for (auto request : m_currentRequest.value().requests) {
+        auto keyIDs = keyIDsForRequest(request.get());
+        RefPtr<SharedBuffer> keyID = WTFMove(keyIDs.first());
+        auto contentIdentifier = keyID->createNSData();
+        [request makeStreamingContentKeyRequestDataForApp:appIdentifier.get() contentIdentifier:contentIdentifier.get() options:nil completionHandler:[keyID = WTFMove(keyID), aggregator] (NSData *contentKeyRequestData, NSError *error) mutable {
+            UNUSED_PARAM(error);
+            callOnMainThread([keyID = WTFMove(keyID), aggregator = WTFMove(aggregator), contentKeyRequestData = retainPtr(contentKeyRequestData)] () mutable {
+                aggregator->requestsData.append({ WTFMove(keyID), WTFMove(contentKeyRequestData) });
+            });
+        }];
     }
 }
 
@@ -1199,27 +1185,20 @@
     auto keyIDs = keyIDsForRequest(m_currentRequest.value());
 
     RetainPtr<NSData> contentIdentifier = keyIDs.first()->createNSData();
-    @try {
-        [request makeStreamingContentKeyRequestDataForApp:appIdentifier.get() contentIdentifier:contentIdentifier.get() options:nil completionHandler:[this, weakThis = makeWeakPtr(*this)] (NSData *contentKeyRequestData, NSError *error) mutable {
-            callOnMainThread([this, weakThis = WTFMove(weakThis), error = retainPtr(error), contentKeyRequestData = retainPtr(contentKeyRequestData)] {
-                if (!weakThis || !m_client || error)
-                    return;
+    [request makeStreamingContentKeyRequestDataForApp:appIdentifier.get() contentIdentifier:contentIdentifier.get() options:nil completionHandler:[this, weakThis = makeWeakPtr(*this)] (NSData *contentKeyRequestData, NSError *error) mutable {
+        callOnMainThread([this, weakThis = WTFMove(weakThis), error = retainPtr(error), contentKeyRequestData = retainPtr(contentKeyRequestData)] {
+            if (!weakThis || !m_client || error)
+                return;
 
-                if (error && m_updateLicenseCallback)
-                    m_updateLicenseCallback(false, WTF::nullopt, WTF::nullopt, WTF::nullopt, Failed);
-                else if (m_updateLicenseCallback)
-                    m_updateLicenseCallback(false, WTF::nullopt, WTF::nullopt, Message(MessageType::LicenseRenewal, SharedBuffer::create(contentKeyRequestData.get())), Succeeded);
-                else if (m_client)
-                    m_client->sendMessage(CDMMessageType::LicenseRenewal, SharedBuffer::create(contentKeyRequestData.get()));
-                ASSERT(!m_updateLicenseCallback);
-            });
-        }];
-    } @catch(NSException *exception) {
-        ERROR_LOG_IF_POSSIBLE(LOGIDENTIFIER, "exception thrown from -makeStreamingContentKeyRequestDataForApp:contentIdentifier:options:completionHandler: ", [[exception name] UTF8String], ", reason : ", [[exception reason] UTF8String]);
-        if (m_updateLicenseCallback)
-            m_updateLicenseCallback(false, WTF::nullopt, WTF::nullopt, WTF::nullopt, Failed);
-        ASSERT(!m_updateLicenseCallback);
-    }
+            if (error && m_updateLicenseCallback)
+                m_updateLicenseCallback(false, WTF::nullopt, WTF::nullopt, WTF::nullopt, Failed);
+            else if (m_updateLicenseCallback)
+                m_updateLicenseCallback(false, WTF::nullopt, WTF::nullopt, Message(MessageType::LicenseRenewal, SharedBuffer::create(contentKeyRequestData.get())), Succeeded);
+            else if (m_client)
+                m_client->sendMessage(CDMMessageType::LicenseRenewal, SharedBuffer::create(contentKeyRequestData.get()));
+            ASSERT(!m_updateLicenseCallback);
+        });
+    }];
 }
 
 void CDMInstanceSessionFairPlayStreamingAVFObjC::didProvidePersistableRequest(AVContentKeyRequest *request)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to