Title: [220757] branches/safari-604.1.38.1-branch/Source/WebCore

Diff

Modified: branches/safari-604.1.38.1-branch/Source/WebCore/ChangeLog (220756 => 220757)


--- branches/safari-604.1.38.1-branch/Source/WebCore/ChangeLog	2017-08-15 20:41:46 UTC (rev 220756)
+++ branches/safari-604.1.38.1-branch/Source/WebCore/ChangeLog	2017-08-15 20:45:37 UTC (rev 220757)
@@ -1,3 +1,27 @@
+2017-08-15  Jason Marcell  <[email protected]>
+
+        Cherry-pick r220723. rdar://problem/33901117
+
+    2017-08-14  Jer Noble  <[email protected]>
+
+            Obj-C exception crash in AVStreamSession when using EME in Private Browsing mode
+            https://bugs.webkit.org/show_bug.cgi?id=175547
+
+            Reviewed by Eric Carlson.
+
+            When the storagePath() is empty, do not use those AVStreamSession APIs which require a valid file path to stored
+            proof-of-key-release data.
+
+            Drive-by fix: return emptyString() from HTMLMediaElement::mediaPlayerMediaKeysStorageDirectory() when in Private
+            Browsing mode, to match the behavior of WebKitMediaKeySession.
+
+            * html/HTMLMediaElement.cpp:
+            (WebCore::HTMLMediaElement::mediaPlayerMediaKeysStorageDirectory const):
+            * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm:
+            (WebCore::CDMSessionAVStreamSession::releaseKeys):
+            (WebCore::CDMSessionAVStreamSession::update):
+            (WebCore::CDMSessionAVStreamSession::generateKeyReleaseMessage):
+
 2017-08-11  Jason Marcell  <[email protected]>
 
         Cherry-pick r220551. rdar://problem/33843387

Modified: branches/safari-604.1.38.1-branch/Source/WebCore/html/HTMLMediaElement.cpp (220756 => 220757)


--- branches/safari-604.1.38.1-branch/Source/WebCore/html/HTMLMediaElement.cpp	2017-08-15 20:41:46 UTC (rev 220756)
+++ branches/safari-604.1.38.1-branch/Source/WebCore/html/HTMLMediaElement.cpp	2017-08-15 20:45:37 UTC (rev 220757)
@@ -2502,6 +2502,10 @@
 
 String HTMLMediaElement::mediaPlayerMediaKeysStorageDirectory() const
 {
+    auto* page = document().page();
+    if (!page || page->usesEphemeralSession())
+        return emptyString();
+
     String storageDirectory = document().settings().mediaKeysStorageDirectory();
     if (storageDirectory.isEmpty())
         return emptyString();

Modified: branches/safari-604.1.38.1-branch/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm (220756 => 220757)


--- branches/safari-604.1.38.1-branch/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm	2017-08-15 20:41:46 UTC (rev 220756)
+++ branches/safari-604.1.38.1-branch/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm	2017-08-15 20:45:37 UTC (rev 220757)
@@ -142,11 +142,12 @@
         if (!m_certificate)
             return;
 
-        if (![getAVStreamSessionClass() respondsToSelector:@selector(pendingExpiredSessionReportsWithAppIdentifier:storageDirectoryAtURL:)])
+        String storagePath = this->storagePath();
+        if (storagePath.isEmpty() || ![getAVStreamSessionClass() respondsToSelector:@selector(pendingExpiredSessionReportsWithAppIdentifier:storageDirectoryAtURL:)])
             return;
 
         RetainPtr<NSData> certificateData = adoptNS([[NSData alloc] initWithBytes:m_certificate->data() length:m_certificate->length()]);
-        NSArray* expiredSessions = [getAVStreamSessionClass() pendingExpiredSessionReportsWithAppIdentifier:certificateData.get() storageDirectoryAtURL:[NSURL fileURLWithPath:storagePath()]];
+        NSArray* expiredSessions = [getAVStreamSessionClass() pendingExpiredSessionReportsWithAppIdentifier:certificateData.get() storageDirectoryAtURL:[NSURL fileURLWithPath:storagePath]];
         for (NSData* expiredSessionData in expiredSessions) {
             NSDictionary *expiredSession = [NSPropertyListSerialization propertyListWithData:expiredSessionData options:kCFPropertyListImmutable format:nullptr error:nullptr];
             NSString *playbackSessionIdValue = (NSString *)[expiredSession objectForKey:PlaybackSessionIdKey];
@@ -198,8 +199,9 @@
 
         RetainPtr<NSData> certificateData = adoptNS([[NSData alloc] initWithBytes:m_certificate->data() length:m_certificate->length()]);
 
-        if ([getAVStreamSessionClass() respondsToSelector:@selector(removePendingExpiredSessionReports:withAppIdentifier:storageDirectoryAtURL:)])
-            [getAVStreamSessionClass() removePendingExpiredSessionReports:@[m_expiredSession.get()] withAppIdentifier:certificateData.get() storageDirectoryAtURL:[NSURL fileURLWithPath:storagePath()]];
+        String storagePath = this->storagePath();
+        if (!storagePath.isEmpty() && [getAVStreamSessionClass() respondsToSelector:@selector(removePendingExpiredSessionReports:withAppIdentifier:storageDirectoryAtURL:)])
+            [getAVStreamSessionClass() removePendingExpiredSessionReports:@[m_expiredSession.get()] withAppIdentifier:certificateData.get() storageDirectoryAtURL:[NSURL fileURLWithPath:storagePath]];
         m_expiredSession = nullptr;
         return true;
     }
@@ -313,13 +315,14 @@
     m_certificate = m_initData;
     RetainPtr<NSData> certificateData = adoptNS([[NSData alloc] initWithBytes:m_certificate->data() length:m_certificate->length()]);
 
-    if (![getAVStreamSessionClass() respondsToSelector:@selector(pendingExpiredSessionReportsWithAppIdentifier:storageDirectoryAtURL:)]) {
+    String storagePath = this->storagePath();
+    if (storagePath.isEmpty() || ![getAVStreamSessionClass() respondsToSelector:@selector(pendingExpiredSessionReportsWithAppIdentifier:storageDirectoryAtURL:)]) {
         errorCode = MediaPlayer::KeySystemNotSupported;
         systemCode = '!mor';
         return nullptr;
     }
 
-    NSArray* expiredSessions = [getAVStreamSessionClass() pendingExpiredSessionReportsWithAppIdentifier:certificateData.get() storageDirectoryAtURL:[NSURL fileURLWithPath:storagePath()]];
+    NSArray* expiredSessions = [getAVStreamSessionClass() pendingExpiredSessionReportsWithAppIdentifier:certificateData.get() storageDirectoryAtURL:[NSURL fileURLWithPath:storagePath]];
     if (![expiredSessions count]) {
         LOG(Media, "CDMSessionAVStreamSession::generateKeyReleaseMessage(%p) - no expired sessions found", this);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to