Changeset 220389 in webkit


Ignore:
Timestamp:
Aug 8, 2017 12:29:22 AM (7 years ago)
Author:
jmarcell@apple.com
Message:

Cherry-pick r220247. rdar://problem/33754443

Location:
branches/safari-604-branch/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-604-branch/Source/WebCore/ChangeLog

    r220339 r220389  
     12017-08-08  Jason Marcell  <jmarcell@apple.com>
     2
     3        Cherry-pick r220247. rdar://problem/33754443
     4
     5    2017-08-03  Jer Noble  <jer.noble@apple.com>
     6
     7            [EME][Mac] SecureStop left on disk in Private Browsing mode.
     8            https://bugs.webkit.org/show_bug.cgi?id=175162
     9
     10            Reviewed by Eric Carlson.
     11
     12            Return an empty string from mediaKeysStorageDirectory() when the page indicates that storage should
     13            be ephemeral(). Previously, an empty string in this case would be treated as an error. Instead, treat
     14            an empty string as valid, and do not try to store or retrieve session information to disk in that case.
     15
     16            * Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp:
     17            (WebCore::WebKitMediaKeySession::mediaKeysStorageDirectory const):
     18            * platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm:
     19            (WebCore::CDMSessionAVContentKeySession::releaseKeys):
     20            (WebCore::CDMSessionAVContentKeySession::update):
     21            (WebCore::CDMSessionAVContentKeySession::generateKeyReleaseMessage):
     22            (WebCore::CDMSessionAVContentKeySession::contentKeySession):
     23            * platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.mm:
     24            (WebCore::CDMSessionMediaSourceAVFObjC::storagePath const):
     25
    1262017-08-07  Jason Marcell  <jmarcell@apple.com>
    227
  • branches/safari-604-branch/Source/WebCore/Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp

    r215160 r220389  
    3333#include "ExceptionCode.h"
    3434#include "FileSystem.h"
     35#include "Page.h"
    3536#include "SecurityOriginData.h"
    3637#include "Settings.h"
     
    224225        return emptyString();
    225226
     227    auto* page = document->page();
     228    if (!page || page->usesEphemeralSession())
     229        return emptyString();
     230
    226231    auto storageDirectory = document->settings().mediaKeysStorageDirectory();
    227232    if (storageDirectory.isEmpty())
  • branches/safari-604-branch/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm

    r219191 r220389  
    4646SOFT_LINK_CLASS_OPTIONAL(AVFoundation, AVContentKeySession);
    4747SOFT_LINK_CONSTANT_MAY_FAIL(AVFoundation, AVContentKeyRequestProtocolVersionsKey, NSString *)
     48SOFT_LINK_CONSTANT_MAY_FAIL(AVFoundation, AVContentKeySystemFairPlayStreaming, NSString *)
     49
     50typedef NSString *AVContentKeySystem;
    4851
    4952@interface AVContentKeySession : NSObject
     53+ (instancetype)contentKeySessionWithKeySystem:(AVContentKeySystem)keySystem;
    5054- (instancetype)initWithStorageDirectoryAtURL:(NSURL *)storageURL;
    5155@property (assign) id delegate;
     
    192196            return;
    193197
     198        auto storagePath = this->storagePath();
     199        if (storagePath.isEmpty())
     200            return;
     201
    194202        RetainPtr<NSData> certificateData = adoptNS([[NSData alloc] initWithBytes:m_certificate->data() length:m_certificate->length()]);
    195         NSArray* expiredSessions = [getAVContentKeySessionClass() pendingExpiredSessionReportsWithAppIdentifier:certificateData.get() storageDirectoryAtURL:[NSURL fileURLWithPath:storagePath()]];
     203        NSArray* expiredSessions = [getAVContentKeySessionClass() pendingExpiredSessionReportsWithAppIdentifier:certificateData.get() storageDirectoryAtURL:[NSURL fileURLWithPath:storagePath]];
    196204        for (NSData* expiredSessionData in expiredSessions) {
    197205            NSDictionary *expiredSession = [NSPropertyListSerialization propertyListWithData:expiredSessionData options:kCFPropertyListImmutable format:nullptr error:nullptr];
     
    240248        LOG(Media, "CDMSessionAVContentKeySession::update(%p) - acknowleding secure stop message", this);
    241249
    242         if (!m_expiredSession) {
     250        String storagePath = this->storagePath();
     251        if (!m_expiredSession || storagePath.isEmpty()) {
    243252            errorCode = MediaPlayer::InvalidPlayerState;
    244253            return false;
     
    248257
    249258        if ([getAVContentKeySessionClass() respondsToSelector:@selector(removePendingExpiredSessionReports:withAppIdentifier:storageDirectoryAtURL:)])
    250             [getAVContentKeySessionClass() removePendingExpiredSessionReports:@[m_expiredSession.get()] withAppIdentifier:certificateData.get() storageDirectoryAtURL:[NSURL fileURLWithPath:storagePath()]];
     259            [getAVContentKeySessionClass() removePendingExpiredSessionReports:@[m_expiredSession.get()] withAppIdentifier:certificateData.get() storageDirectoryAtURL:[NSURL fileURLWithPath:storagePath]];
    251260        m_expiredSession = nullptr;
    252261        return true;
     
    316325    RetainPtr<NSData> certificateData = adoptNS([[NSData alloc] initWithBytes:m_certificate->data() length:m_certificate->length()]);
    317326
    318     if (![getAVContentKeySessionClass() respondsToSelector:@selector(pendingExpiredSessionReportsWithAppIdentifier:storageDirectoryAtURL:)]) {
     327    String storagePath = this->storagePath();
     328    if (storagePath.isEmpty() || ![getAVContentKeySessionClass() respondsToSelector:@selector(pendingExpiredSessionReportsWithAppIdentifier:storageDirectoryAtURL:)]) {
    319329        errorCode = MediaPlayer::KeySystemNotSupported;
    320330        systemCode = '!mor';
     
    322332    }
    323333
    324     NSArray* expiredSessions = [getAVContentKeySessionClass() pendingExpiredSessionReportsWithAppIdentifier:certificateData.get() storageDirectoryAtURL:[NSURL fileURLWithPath:storagePath()]];
     334    NSArray* expiredSessions = [getAVContentKeySessionClass() pendingExpiredSessionReportsWithAppIdentifier:certificateData.get() storageDirectoryAtURL:[NSURL fileURLWithPath:storagePath]];
    325335    if (![expiredSessions count]) {
    326336        LOG(Media, "CDMSessionAVContentKeySession::generateKeyReleaseMessage(%p) - no expired sessions found", this);
     
    346356AVContentKeySession* CDMSessionAVContentKeySession::contentKeySession()
    347357{
    348     if (!m_contentKeySession) {
    349 
    350         String storagePath = this->storagePath();
    351         if (storagePath.isEmpty())
     358    if (m_contentKeySession)
     359        return m_contentKeySession.get();
     360
     361    String storagePath = this->storagePath();
     362    if (storagePath.isEmpty()) {
     363        if (![getAVContentKeySessionClass() respondsToSelector:@selector(contentKeySessionWithKeySystem:)] || !canLoadAVContentKeySystemFairPlayStreaming())
    352364            return nil;
    353365
     366        m_contentKeySession = [getAVContentKeySessionClass() contentKeySessionWithKeySystem:getAVContentKeySystemFairPlayStreaming()];
     367    } else {
    354368        String storageDirectory = directoryName(storagePath);
    355369
     
    360374
    361375        m_contentKeySession = adoptNS([allocAVContentKeySessionInstance() initWithStorageDirectoryAtURL:[NSURL fileURLWithPath:storagePath]]);
    362         m_contentKeySession.get().delegate = m_contentKeySessionDelegate.get();
    363     }
    364 
     376    }
     377
     378    m_contentKeySession.get().delegate = m_contentKeySessionDelegate.get();
    365379    return m_contentKeySession.get();
    366380}
  • branches/safari-604-branch/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.mm

    r206811 r220389  
    9999String CDMSessionMediaSourceAVFObjC::storagePath() const
    100100{
    101     return m_client ? pathByAppendingComponent(m_client->mediaKeysStorageDirectory(), "SecureStop.plist") : emptyString();
     101    if (!m_client)
     102        return emptyString();
     103
     104    String storageDirectory = m_client->mediaKeysStorageDirectory();
     105    if (storageDirectory.isEmpty())
     106        return emptyString();
     107
     108    return pathByAppendingComponent(storageDirectory, "SecureStop.plist");
    102109}
    103110
Note: See TracChangeset for help on using the changeset viewer.