Bug 145394

Summary: WKWebsiteDataStore should handle media keys
Product: WebKit Reporter: Anders Carlsson <andersca>
Component: New BugsAssignee: Anders Carlsson <andersca>
Status: RESOLVED FIXED    
Severity: Normal    
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch darin: review+

Description Anders Carlsson 2015-05-26 15:44:05 PDT
WKWebsiteDataStore should handle media keys
Comment 1 Anders Carlsson 2015-05-26 16:09:38 PDT
Created attachment 253754 [details]
Patch
Comment 2 Darin Adler 2015-05-27 11:35:43 PDT
Comment on attachment 253754 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=253754&action=review

Looks good. Nits only.

> Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.cpp:145
> +    struct CallbackAggregator final : public ThreadSafeRefCounted<CallbackAggregator> {

Not sure we need “public” here since struct derivation is public by default. Style question, I guess.

> Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.cpp:349
> +        WTF::StringCapture mediaKeysStorageDirectory { m_mediaKeysStorageDirectory };

Should just be StringCapture, right? Why the WTF prefix?

> Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.cpp:818
> +    for (const auto& originPath : WebCore::listDirectory(mediaKeysStorageDirectory, "*")) {

Not sure the const here is needed or helpful.

> Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.cpp:837
> +    for (const auto& mediaKeyDirectory : WebCore::listDirectory(mediaKeysStorageDirectory, "*")) {

Not sure the const here is needed or helpful.

> Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.cpp:859
> +    for (const auto& origin : origins) {

Not sure the const here is needed or helpful.

> Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.cpp:862
> +        auto mediaKeyDirectory = WebCore::pathByAppendingComponent(mediaKeysStorageDirectory, origin->databaseIdentifier());
> +
> +        auto mediaKeyFile = WebCore::pathByAppendingComponent(mediaKeyDirectory, "SecureStop.plist");

I’d omit this blank line.
Comment 3 Anders Carlsson 2015-05-27 11:50:11 PDT
(In reply to comment #2)
> Comment on attachment 253754 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=253754&action=review
> 
> Looks good. Nits only.
> 
> > Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.cpp:145
> > +    struct CallbackAggregator final : public ThreadSafeRefCounted<CallbackAggregator> {
> 
> Not sure we need “public” here since struct derivation is public by default.
> Style question, I guess.

I got rid of it.

> 
> > Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.cpp:349
> > +        WTF::StringCapture mediaKeysStorageDirectory { m_mediaKeysStorageDirectory };
> 
> Should just be StringCapture, right? Why the WTF prefix?

I blame autocomplete!

> 
> > Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.cpp:818
> > +    for (const auto& originPath : WebCore::listDirectory(mediaKeysStorageDirectory, "*")) {
> 
> Not sure the const here is needed or helpful.

I think it's helpful because there's no point in allowing mutation of the strings returned.
> > +
> > +        auto mediaKeyFile = WebCore::pathByAppendingComponent(mediaKeyDirectory, "SecureStop.plist");
> 
> I’d omit this blank line.
Comment 4 Anders Carlsson 2015-05-27 11:54:10 PDT
Committed r184912: <http://trac.webkit.org/changeset/184912>
Comment 5 Darin Adler 2015-05-27 11:56:49 PDT
Comment on attachment 253754 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=253754&action=review

> Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.cpp:841
> +        if (!WebCore::fileExists(mediaKeyFile))
> +            continue;

Wait, why do we need this? Won’t getFileModificationTime fail if the file doesn’t exist? I suggest deleting this code.