Title: [220247] trunk/Source/WebCore
- Revision
- 220247
- Author
- [email protected]
- Date
- 2017-08-03 18:13:03 -0700 (Thu, 03 Aug 2017)
Log Message
[EME][Mac] SecureStop left on disk in Private Browsing mode.
https://bugs.webkit.org/show_bug.cgi?id=175162
Reviewed by Eric Carlson.
Return an empty string from mediaKeysStorageDirectory() when the page indicates that storage should
be ephemeral(). Previously, an empty string in this case would be treated as an error. Instead, treat
an empty string as valid, and do not try to store or retrieve session information to disk in that case.
* Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp:
(WebCore::WebKitMediaKeySession::mediaKeysStorageDirectory const):
* platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm:
(WebCore::CDMSessionAVContentKeySession::releaseKeys):
(WebCore::CDMSessionAVContentKeySession::update):
(WebCore::CDMSessionAVContentKeySession::generateKeyReleaseMessage):
(WebCore::CDMSessionAVContentKeySession::contentKeySession):
* platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.mm:
(WebCore::CDMSessionMediaSourceAVFObjC::storagePath const):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (220246 => 220247)
--- trunk/Source/WebCore/ChangeLog 2017-08-04 01:12:52 UTC (rev 220246)
+++ trunk/Source/WebCore/ChangeLog 2017-08-04 01:13:03 UTC (rev 220247)
@@ -1,3 +1,24 @@
+2017-08-03 Jer Noble <[email protected]>
+
+ [EME][Mac] SecureStop left on disk in Private Browsing mode.
+ https://bugs.webkit.org/show_bug.cgi?id=175162
+
+ Reviewed by Eric Carlson.
+
+ Return an empty string from mediaKeysStorageDirectory() when the page indicates that storage should
+ be ephemeral(). Previously, an empty string in this case would be treated as an error. Instead, treat
+ an empty string as valid, and do not try to store or retrieve session information to disk in that case.
+
+ * Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp:
+ (WebCore::WebKitMediaKeySession::mediaKeysStorageDirectory const):
+ * platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm:
+ (WebCore::CDMSessionAVContentKeySession::releaseKeys):
+ (WebCore::CDMSessionAVContentKeySession::update):
+ (WebCore::CDMSessionAVContentKeySession::generateKeyReleaseMessage):
+ (WebCore::CDMSessionAVContentKeySession::contentKeySession):
+ * platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.mm:
+ (WebCore::CDMSessionMediaSourceAVFObjC::storagePath const):
+
2017-08-03 Youenn Fablet <[email protected]>
[Fetch API] Add support for Request keepalive getter
Modified: trunk/Source/WebCore/Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp (220246 => 220247)
--- trunk/Source/WebCore/Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp 2017-08-04 01:12:52 UTC (rev 220246)
+++ trunk/Source/WebCore/Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp 2017-08-04 01:13:03 UTC (rev 220247)
@@ -31,6 +31,7 @@
#include "Document.h"
#include "EventNames.h"
#include "FileSystem.h"
+#include "Page.h"
#include "SecurityOriginData.h"
#include "Settings.h"
#include "WebKitMediaKeyError.h"
@@ -222,6 +223,10 @@
if (!document)
return emptyString();
+ auto* page = document->page();
+ if (!page || page->usesEphemeralSession())
+ return emptyString();
+
auto storageDirectory = document->settings().mediaKeysStorageDirectory();
if (storageDirectory.isEmpty())
return emptyString();
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm (220246 => 220247)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm 2017-08-04 01:12:52 UTC (rev 220246)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm 2017-08-04 01:13:03 UTC (rev 220247)
@@ -45,8 +45,12 @@
SOFT_LINK_CLASS(AVFoundation, AVStreamDataParser);
SOFT_LINK_CLASS_OPTIONAL(AVFoundation, AVContentKeySession);
SOFT_LINK_CONSTANT_MAY_FAIL(AVFoundation, AVContentKeyRequestProtocolVersionsKey, NSString *)
+SOFT_LINK_CONSTANT_MAY_FAIL(AVFoundation, AVContentKeySystemFairPlayStreaming, NSString *)
+typedef NSString *AVContentKeySystem;
+
@interface AVContentKeySession : NSObject
++ (instancetype)contentKeySessionWithKeySystem:(AVContentKeySystem)keySystem;
- (instancetype)initWithStorageDirectoryAtURL:(NSURL *)storageURL;
@property (assign) id delegate;
- (void)addStreamDataParser:(AVStreamDataParser *)streamDataParser;
@@ -191,8 +195,12 @@
if (![getAVContentKeySessionClass() respondsToSelector:@selector(pendingExpiredSessionReportsWithAppIdentifier:storageDirectoryAtURL:)])
return;
+ auto storagePath = this->storagePath();
+ if (storagePath.isEmpty())
+ return;
+
RetainPtr<NSData> certificateData = adoptNS([[NSData alloc] initWithBytes:m_certificate->data() length:m_certificate->length()]);
- NSArray* expiredSessions = [getAVContentKeySessionClass() pendingExpiredSessionReportsWithAppIdentifier:certificateData.get() storageDirectoryAtURL:[NSURL fileURLWithPath:storagePath()]];
+ NSArray* expiredSessions = [getAVContentKeySessionClass() 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];
@@ -239,7 +247,8 @@
if (isEqual(key, "acknowledged")) {
LOG(Media, "CDMSessionAVContentKeySession::update(%p) - acknowleding secure stop message", this);
- if (!m_expiredSession) {
+ String storagePath = this->storagePath();
+ if (!m_expiredSession || storagePath.isEmpty()) {
errorCode = MediaPlayer::InvalidPlayerState;
return false;
}
@@ -247,7 +256,7 @@
RetainPtr<NSData> certificateData = adoptNS([[NSData alloc] initWithBytes:m_certificate->data() length:m_certificate->length()]);
if ([getAVContentKeySessionClass() respondsToSelector:@selector(removePendingExpiredSessionReports:withAppIdentifier:storageDirectoryAtURL:)])
- [getAVContentKeySessionClass() removePendingExpiredSessionReports:@[m_expiredSession.get()] withAppIdentifier:certificateData.get() storageDirectoryAtURL:[NSURL fileURLWithPath:storagePath()]];
+ [getAVContentKeySessionClass() removePendingExpiredSessionReports:@[m_expiredSession.get()] withAppIdentifier:certificateData.get() storageDirectoryAtURL:[NSURL fileURLWithPath:storagePath]];
m_expiredSession = nullptr;
return true;
}
@@ -315,13 +324,14 @@
m_certificate = m_initData;
RetainPtr<NSData> certificateData = adoptNS([[NSData alloc] initWithBytes:m_certificate->data() length:m_certificate->length()]);
- if (![getAVContentKeySessionClass() respondsToSelector:@selector(pendingExpiredSessionReportsWithAppIdentifier:storageDirectoryAtURL:)]) {
+ String storagePath = this->storagePath();
+ if (storagePath.isEmpty() || ![getAVContentKeySessionClass() respondsToSelector:@selector(pendingExpiredSessionReportsWithAppIdentifier:storageDirectoryAtURL:)]) {
errorCode = MediaPlayer::KeySystemNotSupported;
systemCode = '!mor';
return nullptr;
}
- NSArray* expiredSessions = [getAVContentKeySessionClass() pendingExpiredSessionReportsWithAppIdentifier:certificateData.get() storageDirectoryAtURL:[NSURL fileURLWithPath:storagePath()]];
+ NSArray* expiredSessions = [getAVContentKeySessionClass() pendingExpiredSessionReportsWithAppIdentifier:certificateData.get() storageDirectoryAtURL:[NSURL fileURLWithPath:storagePath]];
if (![expiredSessions count]) {
LOG(Media, "CDMSessionAVContentKeySession::generateKeyReleaseMessage(%p) - no expired sessions found", this);
@@ -345,12 +355,16 @@
AVContentKeySession* CDMSessionAVContentKeySession::contentKeySession()
{
- if (!m_contentKeySession) {
+ if (m_contentKeySession)
+ return m_contentKeySession.get();
- String storagePath = this->storagePath();
- if (storagePath.isEmpty())
+ String storagePath = this->storagePath();
+ if (storagePath.isEmpty()) {
+ if (![getAVContentKeySessionClass() respondsToSelector:@selector(contentKeySessionWithKeySystem:)] || !canLoadAVContentKeySystemFairPlayStreaming())
return nil;
+ m_contentKeySession = [getAVContentKeySessionClass() contentKeySessionWithKeySystem:getAVContentKeySystemFairPlayStreaming()];
+ } else {
String storageDirectory = directoryName(storagePath);
if (!fileExists(storageDirectory)) {
@@ -359,9 +373,9 @@
}
m_contentKeySession = adoptNS([allocAVContentKeySessionInstance() initWithStorageDirectoryAtURL:[NSURL fileURLWithPath:storagePath]]);
- m_contentKeySession.get().delegate = m_contentKeySessionDelegate.get();
}
+ m_contentKeySession.get().delegate = m_contentKeySessionDelegate.get();
return m_contentKeySession.get();
}
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.mm (220246 => 220247)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.mm 2017-08-04 01:12:52 UTC (rev 220246)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.mm 2017-08-04 01:13:03 UTC (rev 220247)
@@ -98,7 +98,14 @@
String CDMSessionMediaSourceAVFObjC::storagePath() const
{
- return m_client ? pathByAppendingComponent(m_client->mediaKeysStorageDirectory(), "SecureStop.plist") : emptyString();
+ if (!m_client)
+ return emptyString();
+
+ String storageDirectory = m_client->mediaKeysStorageDirectory();
+ if (storageDirectory.isEmpty())
+ return emptyString();
+
+ return pathByAppendingComponent(storageDirectory, "SecureStop.plist");
}
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes