WebKit Bugzilla
Attachment 339171 Details for
Bug 185041
: [WKHTTPCookieStore getAllCookies] returns inconsistent creation time
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-185041-20180430200129.patch (text/plain), 5.81 KB, created by
Sihui Liu
on 2018-04-30 20:01:30 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Sihui Liu
Created:
2018-04-30 20:01:30 PDT
Size:
5.81 KB
patch
obsolete
>Subversion Revision: 231178 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 2612b06ae8f6c0aa0fc774fe4baf3cada756058d..9bafae42122576cbed494baca1e8e40e2e3409fe 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,18 @@ >+2018-04-30 Sihui Liu <sihui_liu@apple.com> >+ >+ [WKHTTPCookieStore getAllCookies] returns inconsistent creation time >+ https://bugs.webkit.org/show_bug.cgi?id=185041 >+ <rdar://problem/34684214> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Should be committed after <rdar://39829640>. >+ >+ New API test: WebKit.WKHTTPCookieStoreCreationTime >+ >+ * platform/network/cocoa/CookieCocoa.mm: >+ (WebCore::Cookie::operator NSHTTPCookie * const): >+ > 2018-04-30 Zalan Bujtas <zalan@apple.com> > > REGRESSION(r230914) Selecting text on this apple.com page makes it vanish >diff --git a/Source/WebCore/platform/network/cocoa/CookieCocoa.mm b/Source/WebCore/platform/network/cocoa/CookieCocoa.mm >index 575579dbbbdc3a104f9f461a14cb8380fa9c6abd..1b69e7b35094cba7992f50c9258a221788101b5c 100644 >--- a/Source/WebCore/platform/network/cocoa/CookieCocoa.mm >+++ b/Source/WebCore/platform/network/cocoa/CookieCocoa.mm >@@ -82,7 +82,7 @@ Cookie::operator NSHTTPCookie *() const > if (isNull()) > return nil; > >- NSMutableDictionary *properties = [NSMutableDictionary dictionaryWithCapacity:12]; >+ NSMutableDictionary *properties = [NSMutableDictionary dictionaryWithCapacity:13]; > > if (!comment.isNull()) > [properties setObject:(NSString *)comment forKey:NSHTTPCookieComment]; >@@ -106,6 +106,8 @@ Cookie::operator NSHTTPCookie *() const > auto maxAge = ceil([expirationDate timeIntervalSinceNow]); > if (maxAge > 0) > [properties setObject:[NSString stringWithFormat:@"%f", maxAge] forKey:NSHTTPCookieMaximumAge]; >+ >+ [properties setObject:[NSNumber numberWithDouble:created / 1000.0] forKey:@"Created"]; > > auto* portString = portStringFromVector(ports); > if (portString) >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index cba905e6179e4a78f79a07354fd7a9e518740329..594eb27f4274b3640be60440d49ecf93dbde7726 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,14 @@ >+2018-04-30 Sihui Liu <sihui_liu@apple.com> >+ >+ [WKHTTPCookieStore getAllCookies] returns inconsistent creation time >+ https://bugs.webkit.org/show_bug.cgi?id=185041 >+ <rdar://problem/34684214> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * TestWebKitAPI/Tests/WebKitCocoa/WKHTTPCookieStore.mm: >+ (TEST): >+ > 2018-04-30 Mark Lam <mark.lam@apple.com> > > Apply PtrTags to the MetaAllocator and friends. >diff --git a/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKHTTPCookieStore.mm b/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKHTTPCookieStore.mm >index 9d5d7ecd6dc2a4719cd7d49fcc0a254ecd619798..9ee4d43958f0960d80d8f585cc0a1f8c5d793158 100644 >--- a/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKHTTPCookieStore.mm >+++ b/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKHTTPCookieStore.mm >@@ -33,6 +33,7 @@ > #import <WebKit/WKWebsiteDataStorePrivate.h> > #import <WebKit/_WKWebsiteDataStoreConfiguration.h> > #import <wtf/RetainPtr.h> >+#import <wtf/Seconds.h> > > #if WK_API_ENABLED > >@@ -310,6 +311,66 @@ TEST(WebKit, WKHTTPCookieStoreHttpOnly) > [cookies release]; > } > >+TEST(WebKit, WKHTTPCookieStoreCreationTime) >+{ >+ WKWebsiteDataStore* dataStore = [WKWebsiteDataStore defaultDataStore]; >+ >+ auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]); >+ configuration.get().websiteDataStore = dataStore; >+ auto webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]); >+ >+ [webView loadHTMLString:@"WebKit Test" baseURL:[NSURL URLWithString:@"http://webkit.org"]]; >+ [webView _test_waitForDidFinishNavigation]; >+ >+ [dataStore removeDataOfTypes:[WKWebsiteDataStore allWebsiteDataTypes] modifiedSince:[NSDate distantPast] completionHandler:[] { >+ gotFlag = true; >+ }]; >+ TestWebKitAPI::Util::run(&gotFlag); >+ gotFlag = false; >+ >+ globalCookieStore = dataStore.httpCookieStore; >+ >+ NSArray<NSHTTPCookie *> *cookies = nil; >+ >+ NSMutableDictionary *cookieProperties = [[NSMutableDictionary alloc] init]; >+ [cookieProperties setObject:@"cookieName" forKey:NSHTTPCookieName]; >+ [cookieProperties setObject:@"cookieValue" forKey:NSHTTPCookieValue]; >+ [cookieProperties setObject:@".www.webkit.org" forKey:NSHTTPCookieDomain]; >+ [cookieProperties setObject:@"/path" forKey:NSHTTPCookiePath]; >+ >+ RetainPtr<NSHTTPCookie> cookie = [NSHTTPCookie cookieWithProperties:cookieProperties]; >+ >+ [globalCookieStore setCookie:cookie.get() completionHandler:[]() { >+ gotFlag = true; >+ }]; >+ TestWebKitAPI::Util::run(&gotFlag); >+ gotFlag = false; >+ >+ [globalCookieStore getAllCookies:[cookiesPtr = &cookies](NSArray<NSHTTPCookie *> *nsCookies) { >+ *cookiesPtr = [nsCookies retain]; >+ gotFlag = true; >+ }]; >+ TestWebKitAPI::Util::run(&gotFlag); >+ gotFlag = false; >+ ASSERT_EQ(cookies.count, 1u); >+ NSNumber *creationTime = [cookies objectAtIndex:0].properties[@"Created"]; >+ [cookies release]; >+ >+ sleep(5_s); >+ >+ [globalCookieStore getAllCookies:[cookiesPtr = &cookies](NSArray<NSHTTPCookie *> *nsCookies) { >+ *cookiesPtr = [nsCookies retain]; >+ gotFlag = true; >+ }]; >+ TestWebKitAPI::Util::run(&gotFlag); >+ gotFlag = false; >+ ASSERT_EQ(cookies.count, 1u); >+ NSNumber *creationTime2 = [cookies objectAtIndex:0].properties[@"Created"]; >+ >+ EXPECT_TRUE([creationTime isEqual:creationTime2]); >+ [cookies release]; >+} >+ > // FIXME: This should be removed once <rdar://problem/35344202> is resolved and bots are updated. > #if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MAX_ALLOWED <= 101301) || (PLATFORM(IOS) && __IPHONE_OS_VERSION_MAX_ALLOWED <= 110102) > TEST(WebKit, WKHTTPCookieStoreNonPersistent)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 185041
:
339171
|
339212
|
339240
|
339803
|
341302