WebKit Bugzilla
Attachment 339803 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-20180507230629.patch (text/plain), 5.58 KB, created by
Sihui Liu
on 2018-05-07 23:06:30 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Sihui Liu
Created:
2018-05-07 23:06:30 PDT
Size:
5.58 KB
patch
obsolete
>Subversion Revision: 231470 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 54339d5db74009ceafa8e61ec2fd1e71b128d3e2..525c6f64c9f9de2a3f37bac923a47e199d224d36 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,18 @@ >+2018-05-07 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!). >+ >+ Set creationtime property when creating Cookie object to keep consistency after conversion. >+ >+ New API test: WebKit.WKHTTPCookieStoreCreationTime. >+ >+ * platform/network/cocoa/CookieCocoa.mm: >+ (WebCore::Cookie::operator NSHTTPCookie * const): >+ > 2018-05-07 Daniel Bates <dabates@apple.com> > > CSP status-code incorrect for document blocked due to violation of its frame-ancestors directive >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 4f76c86eafcb079b3eac7095909817e59b004e88..64b1323fa01a5fdf460c7fb8578e70f117fb6968 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,16 @@ >+2018-05-07 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!). >+ >+ Add API test Coverage. >+ >+ * TestWebKitAPI/Tests/WebKitCocoa/WKHTTPCookieStore.mm: >+ (TEST): >+ > 2018-05-06 Filip Pizlo <fpizlo@apple.com> > > InPlaceAbstractState::beginBasicBlock shouldn't have to clear any abstract values >diff --git a/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKHTTPCookieStore.mm b/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKHTTPCookieStore.mm >index 9d5d7ecd6dc2a4719cd7d49fcc0a254ecd619798..48350f641d3d0ec17d47ecdafc6dc23532dbad16 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,59 @@ 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; >+ >+ RetainPtr<NSHTTPCookie> cookie = [NSHTTPCookie cookieWithProperties:@{ >+ NSHTTPCookiePath: @"/path", >+ NSHTTPCookieName: @"CookieName", >+ NSHTTPCookieValue: @"CookieValue", >+ NSHTTPCookieDomain: @".www.webkit.org", >+ }]; >+ >+ [globalCookieStore setCookie:cookie.get() completionHandler:[]() { >+ gotFlag = true; >+ }]; >+ TestWebKitAPI::Util::run(&gotFlag); >+ gotFlag = false; >+ >+ RetainPtr<NSNumber> creationTime = nil; >+ [globalCookieStore getAllCookies:[&](NSArray<NSHTTPCookie *> *cookies) { >+ ASSERT_EQ(1u, cookies.count); >+ creationTime = [cookies objectAtIndex:0].properties[@"Created"]; >+ gotFlag = true; >+ }]; >+ TestWebKitAPI::Util::run(&gotFlag); >+ gotFlag = false; >+ >+ sleep(1_s); >+ >+ [globalCookieStore getAllCookies:^(NSArray<NSHTTPCookie *> *cookies) { >+ ASSERT_EQ(1u, cookies.count); >+ NSNumber* creationTime2 = [cookies objectAtIndex:0].properties[@"Created"]; >+ EXPECT_TRUE([creationTime.get() isEqual:creationTime2]); >+ gotFlag = true; >+ }]; >+ TestWebKitAPI::Util::run(&gotFlag); >+ gotFlag = false; >+} >+ > // 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