Title: [254608] branches/safari-609-branch/Source/WebCore
Revision
254608
Author
alanc...@apple.com
Date
2020-01-15 11:15:37 -0800 (Wed, 15 Jan 2020)

Log Message

Cherry-pick r254288. rdar://problem/58548984

    [Cocoa] persistent-usage-record message fails first time; succeeds subsequent times
    https://bugs.webkit.org/show_bug.cgi?id=205970
    <rdar://problem/57785647>

    Reviewed by Eric Carlson.

    The AVContentKeySession is created too early; before the CDM has a chance to provide the storage path
    for persistent usage records. Delay creation of the AVCKS until it's actually needed during the first
    license request.

    Drive-by fix: fix the exceptional case where a PUR session is closed but PUR data isn't available; send
    a null message rather than an empty array.

    * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h:
    * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
    (WebCore::CDMInstanceFairPlayStreamingAVFObjC::contentKeySession):
    (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::removeSessionData):
    (WebCore::CDMInstanceFairPlayStreamingAVFObjC::CDMInstanceFairPlayStreamingAVFObjC): Deleted.
    (WebCore::CDMInstanceFairPlayStreamingAVFObjC::ensureSession): Deleted.

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254288 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-609-branch/Source/WebCore/ChangeLog (254607 => 254608)


--- branches/safari-609-branch/Source/WebCore/ChangeLog	2020-01-15 19:15:34 UTC (rev 254607)
+++ branches/safari-609-branch/Source/WebCore/ChangeLog	2020-01-15 19:15:37 UTC (rev 254608)
@@ -1,5 +1,54 @@
 2020-01-14  Alan Coon  <alanc...@apple.com>
 
+        Cherry-pick r254288. rdar://problem/58548984
+
+    [Cocoa] persistent-usage-record message fails first time; succeeds subsequent times
+    https://bugs.webkit.org/show_bug.cgi?id=205970
+    <rdar://problem/57785647>
+    
+    Reviewed by Eric Carlson.
+    
+    The AVContentKeySession is created too early; before the CDM has a chance to provide the storage path
+    for persistent usage records. Delay creation of the AVCKS until it's actually needed during the first
+    license request.
+    
+    Drive-by fix: fix the exceptional case where a PUR session is closed but PUR data isn't available; send
+    a null message rather than an empty array.
+    
+    * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h:
+    * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
+    (WebCore::CDMInstanceFairPlayStreamingAVFObjC::contentKeySession):
+    (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::removeSessionData):
+    (WebCore::CDMInstanceFairPlayStreamingAVFObjC::CDMInstanceFairPlayStreamingAVFObjC): Deleted.
+    (WebCore::CDMInstanceFairPlayStreamingAVFObjC::ensureSession): Deleted.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254288 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-01-09  Jer Noble  <jer.no...@apple.com>
+
+            [Cocoa] persistent-usage-record message fails first time; succeeds subsequent times
+            https://bugs.webkit.org/show_bug.cgi?id=205970
+            <rdar://problem/57785647>
+
+            Reviewed by Eric Carlson.
+
+            The AVContentKeySession is created too early; before the CDM has a chance to provide the storage path
+            for persistent usage records. Delay creation of the AVCKS until it's actually needed during the first
+            license request.
+
+            Drive-by fix: fix the exceptional case where a PUR session is closed but PUR data isn't available; send
+            a null message rather than an empty array.
+
+            * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h:
+            * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
+            (WebCore::CDMInstanceFairPlayStreamingAVFObjC::contentKeySession):
+            (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::removeSessionData):
+            (WebCore::CDMInstanceFairPlayStreamingAVFObjC::CDMInstanceFairPlayStreamingAVFObjC): Deleted.
+            (WebCore::CDMInstanceFairPlayStreamingAVFObjC::ensureSession): Deleted.
+
+2020-01-14  Alan Coon  <alanc...@apple.com>
+
         Cherry-pick r254239. rdar://problem/58549100
 
     Resource Load Statistics: Flip experimental cookie blocking setting from an enable to a disable

Modified: branches/safari-609-branch/Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h (254607 => 254608)


--- branches/safari-609-branch/Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h	2020-01-15 19:15:34 UTC (rev 254607)
+++ branches/safari-609-branch/Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h	2020-01-15 19:15:37 UTC (rev 254608)
@@ -87,7 +87,7 @@
     NSURL *storageURL() const { return m_storageURL.get(); }
     bool persistentStateAllowed() const { return m_persistentStateAllowed; }
     SharedBuffer* serverCertificate() const { return m_serverCertificate.get(); }
-    AVContentKeySession* contentKeySession() { return m_session.get(); }
+    AVContentKeySession* contentKeySession();
 
     // AVContentKeySessionDelegateClient
     void didProvideRequest(AVContentKeyRequest*) final;
@@ -106,8 +106,6 @@
     CDMInstanceSessionFairPlayStreamingAVFObjC* sessionForGroup(AVContentKeyReportGroup*) const;
 
 private:
-    void ensureSession();
-
     RetainPtr<AVContentKeySession> m_session;
     RetainPtr<WebCoreFPSContentKeySessionDelegate> m_delegate;
     RefPtr<SharedBuffer> m_serverCertificate;

Modified: branches/safari-609-branch/Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm (254607 => 254608)


--- branches/safari-609-branch/Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm	2020-01-15 19:15:34 UTC (rev 254607)
+++ branches/safari-609-branch/Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm	2020-01-15 19:15:37 UTC (rev 254608)
@@ -159,20 +159,19 @@
 
 namespace WebCore {
 
-CDMInstanceFairPlayStreamingAVFObjC::CDMInstanceFairPlayStreamingAVFObjC()
-{
-    if (PAL::getAVContentKeyReportGroupClass())
-        ensureSession();
-}
+CDMInstanceFairPlayStreamingAVFObjC::CDMInstanceFairPlayStreamingAVFObjC() = default;
 
-void CDMInstanceFairPlayStreamingAVFObjC::ensureSession()
+AVContentKeySession* CDMInstanceFairPlayStreamingAVFObjC::contentKeySession()
 {
     if (m_session)
-        return;
+        return m_session.get();
 
     if (!PAL::canLoad_AVFoundation_AVContentKeySystemFairPlayStreaming())
-        return;
+        return nullptr;
 
+    if (!PAL::getAVContentKeyReportGroupClass())
+        return nullptr;
+
     auto storageURL = this->storageURL();
     if (!persistentStateAllowed() || !storageURL)
         m_session = [PAL::getAVContentKeySessionClass() contentKeySessionWithKeySystem:AVContentKeySystemFairPlayStreaming];
@@ -180,12 +179,13 @@
         m_session = [PAL::getAVContentKeySessionClass() contentKeySessionWithKeySystem:AVContentKeySystemFairPlayStreaming storageDirectoryAtURL:storageURL];
 
     if (!m_session)
-        return;
+        return nullptr;
 
     if (!m_delegate)
         m_delegate = adoptNS([[WebCoreFPSContentKeySessionDelegate alloc] initWithParent:this]);
 
     [m_session setDelegate:m_delegate.get() queue:dispatch_get_main_queue()];
+    return m_session.get();
 }
 
 class CDMInstanceSessionFairPlayStreamingAVFObjC::UpdateResponseCollector {
@@ -816,6 +816,11 @@
             }
         }
 
+        if (!expiredSessionsArray.get().count) {
+            callback(WTFMove(changedKeys), WTF::nullopt, Succeeded);
+            return;
+        }
+
         RetainPtr<NSData> expiredSessionsData = [NSPropertyListSerialization dataWithPropertyList:expiredSessionsArray.get() format:NSPropertyListBinaryFormat_v1_0 options:kCFPropertyListImmutable error:nullptr];
 
         callback(WTFMove(changedKeys), SharedBuffer::create(expiredSessionsData.get()), Succeeded);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to