Bug 174580 - WKHTTPCookieStore observing only works on the default cookie store
Summary: WKHTTPCookieStore observing only works on the default cookie store
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Brady Eidson
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-07-17 06:19 PDT by Brady Eidson
Modified: 2017-07-17 12:12 PDT (History)
6 users (show)

See Also:


Attachments
Patch (25.53 KB, patch)
2017-07-17 06:25 PDT, Brady Eidson
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews112 for mac-elcapitan (1.82 MB, application/zip)
2017-07-17 07:47 PDT, Build Bot
no flags Details
Patch (25.47 KB, patch)
2017-07-17 11:27 PDT, Brady Eidson
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Brady Eidson 2017-07-17 06:19:30 PDT
WKHTTPCookieStore observing only works on the default cookie store

Whoops.

<rdar://problem/33330724>
Comment 1 Brady Eidson 2017-07-17 06:25:51 PDT
Created attachment 315660 [details]
Patch
Comment 2 Build Bot 2017-07-17 07:47:41 PDT
Comment on attachment 315660 [details]
Patch

Attachment 315660 [details] did not pass mac-debug-ews (mac):
Output: http://webkit-queues.webkit.org/results/4135622

New failing tests:
security/contentSecurityPolicy/video-with-data-url-allowed-by-media-src-star.html
Comment 3 Build Bot 2017-07-17 07:47:42 PDT
Created attachment 315663 [details]
Archive of layout-test-results from ews112 for mac-elcapitan

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews112  Port: mac-elcapitan  Platform: Mac OS X 10.11.6
Comment 4 Brady Eidson 2017-07-17 09:15:17 PDT
(In reply to Build Bot from comment #3)
> Created attachment 315663 [details]
> Archive of layout-test-results from ews112 for mac-elcapitan
> 
> The attached test failures were seen while running run-webkit-tests on the
> mac-debug-ews.
> Bot: ews112  Port: mac-elcapitan  Platform: Mac OS X 10.11.6

Not caused by this patch.
Comment 5 Sam Weinig 2017-07-17 11:06:29 PDT
Comment on attachment 315660 [details]
Patch

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

r=me but please consider the changes proposed.

> Source/WebCore/platform/network/NetworkStorageSession.h:153
> +
> +#if PLATFORM(COCOA)
> +public:
> +    CookieStorageObserver& cookieStorageObserver() const;
> +
> +private:
> +    mutable RefPtr<CookieStorageObserver> m_cookieStorageObserver;
> +#endif

It makes me sad how this ostensibly cross-platform file, NetworkStorageSession, has so much that is platform dependent.  Something like CookieStorageObserver seems like it could be a cross-platform abstraction that everyone would want (see cookiesDidChange in the SOUP section above).  Can we make it that way, and just stub things out for SOUP for now?

> Source/WebCore/platform/network/cocoa/CookieStorageObserver.h:25
> + */
> +#pragma once

Missing newline above pragma.

> Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WKHTTPCookieStore.mm:203
> +    NSURL *cookieStorageFile = [NSURL fileURLWithPath:[@"~/Library/WebKit/TestWebKitAPI/CustomWebsiteData/CookieStorage/Cookie.File" stringByExpandingTildeInPath] isDirectory:NO];
> +    NSURL *idbPath = [NSURL fileURLWithPath:[@"~/Library/WebKit/TestWebKitAPI/CustomWebsiteData/IndexedDB/" stringByExpandingTildeInPath] isDirectory:YES];

Do we really need to use ~/Library/ for this stuff? Can we make it point to something in the temp directory (_CS_DARWIN_USER_TEMP_DIR and all that jazz)?
Comment 6 Brady Eidson 2017-07-17 11:23:14 PDT
(In reply to Sam Weinig from comment #5)
> Comment on attachment 315660 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=315660&action=review
> 
> r=me but please consider the changes proposed.
> 
> > Source/WebCore/platform/network/NetworkStorageSession.h:153
> > +
> > +#if PLATFORM(COCOA)
> > +public:
> > +    CookieStorageObserver& cookieStorageObserver() const;
> > +
> > +private:
> > +    mutable RefPtr<CookieStorageObserver> m_cookieStorageObserver;
> > +#endif
> 
> It makes me sad how this ostensibly cross-platform file,
> NetworkStorageSession, has so much that is platform dependent.  Something
> like CookieStorageObserver seems like it could be a cross-platform
> abstraction that everyone would want (see cookiesDidChange in the SOUP
> section above).  Can we make it that way, and just stub things out for SOUP
> for now?

I agree this class could be cross platform, but I'm not sure the value of splitting it up now with no commitment to adopt from another port.

> > Source/WebCore/platform/network/cocoa/CookieStorageObserver.h:25
> > + */
> > +#pragma once
> 
> Missing newline above pragma.

Whoops!

> > Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WKHTTPCookieStore.mm:203
> > +    NSURL *cookieStorageFile = [NSURL fileURLWithPath:[@"~/Library/WebKit/TestWebKitAPI/CustomWebsiteData/CookieStorage/Cookie.File" stringByExpandingTildeInPath] isDirectory:NO];
> > +    NSURL *idbPath = [NSURL fileURLWithPath:[@"~/Library/WebKit/TestWebKitAPI/CustomWebsiteData/IndexedDB/" stringByExpandingTildeInPath] isDirectory:YES];
> 
> Do we really need to use ~/Library/ for this stuff? Can we make it point to
> something in the temp directory (_CS_DARWIN_USER_TEMP_DIR and all that jazz)?

The default paths for the default WebsiteDataStore are already in ~/Library/WebKit/TestWebKitAPI
Comment 7 Brady Eidson 2017-07-17 11:27:54 PDT
Created attachment 315683 [details]
Patch
Comment 8 WebKit Commit Bot 2017-07-17 12:10:09 PDT
Comment on attachment 315683 [details]
Patch

Clearing flags on attachment: 315683

Committed r219567: <http://trac.webkit.org/changeset/219567>
Comment 9 WebKit Commit Bot 2017-07-17 12:10:11 PDT
All reviewed patches have been landed.  Closing bug.
Comment 10 Sam Weinig 2017-07-17 12:12:23 PDT
(In reply to Brady Eidson from comment #6)
> (In reply to Sam Weinig from comment #5)
> > Comment on attachment 315660 [details]
> > Patch
> > 
> > View in context:
> > https://bugs.webkit.org/attachment.cgi?id=315660&action=review
> > 
> > r=me but please consider the changes proposed.
> > 
> > > Source/WebCore/platform/network/NetworkStorageSession.h:153
> > > +
> > > +#if PLATFORM(COCOA)
> > > +public:
> > > +    CookieStorageObserver& cookieStorageObserver() const;
> > > +
> > > +private:
> > > +    mutable RefPtr<CookieStorageObserver> m_cookieStorageObserver;
> > > +#endif
> > 
> > It makes me sad how this ostensibly cross-platform file,
> > NetworkStorageSession, has so much that is platform dependent.  Something
> > like CookieStorageObserver seems like it could be a cross-platform
> > abstraction that everyone would want (see cookiesDidChange in the SOUP
> > section above).  Can we make it that way, and just stub things out for SOUP
> > for now?
> 
> I agree this class could be cross platform, but I'm not sure the value of
> splitting it up now with no commitment to adopt from another port.

There is inherent value in providing proper abstractions. Our model has historically been to build the abstraction, add stubs, and others tend to follow.