Bug 145394 - WKWebsiteDataStore should handle media keys
Summary: WKWebsiteDataStore should handle media keys
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Anders Carlsson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-05-26 15:44 PDT by Anders Carlsson
Modified: 2015-05-27 11:56 PDT (History)
0 users

See Also:


Attachments
Patch (21.90 KB, patch)
2015-05-26 16:09 PDT, Anders Carlsson
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.