Bug 174580

Summary: WKHTTPCookieStore observing only works on the default cookie store
Product: WebKit Reporter: Brady Eidson <beidson>
Component: WebKit Misc.Assignee: Brady Eidson <beidson>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, aestes, buildbot, commit-queue, sam, thorton
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Archive of layout-test-results from ews112 for mac-elcapitan
none
Patch none

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.