RESOLVED FIXED 169514
Add full NSHTTPCookie fidelity to WebCore::Cookie
https://bugs.webkit.org/show_bug.cgi?id=169514
Summary Add full NSHTTPCookie fidelity to WebCore::Cookie
Brady Eidson
Reported 2017-03-11 16:04:22 PST
Add full NSHTTPCookie fidelity to WebCore::Cookie
Attachments
Current patch (7.81 KB, patch)
2017-03-11 16:07 PST, Brady Eidson
no flags
Patch (7.87 KB, patch)
2017-03-12 17:08 PDT, Brady Eidson
no flags
Patch (8.06 KB, patch)
2017-03-12 17:51 PDT, Brady Eidson
no flags
Brady Eidson
Comment 1 2017-03-11 16:07:09 PST
Created attachment 304180 [details] Current patch I'm breaking this off from larger work and don't expect it to build quite yet. Will iterate later after EWS tells me.
Sam Weinig
Comment 2 2017-03-12 11:52:54 PDT
Comment on attachment 304180 [details] Current patch View in context: https://bugs.webkit.org/attachment.cgi?id=304180&action=review > Source/WebCore/platform/network/cocoa/CookieCocoa.mm:56 > + StringBuilder builder; > + for (size_t i = 0; i < ports.size() - 1; ++i) { > + builder.append(String::number(ports[i])); > + builder.append(", "); > + } > + builder.append(String::number(ports.last())); > + > + return builder.toString(); Is it really more efficient to build a WTF::String than convert it to an NSString vs just using an NSMutableString to build it? > Source/WebCore/platform/network/cocoa/CookieCocoa.mm:99 > + [properties setObject:@"YES" forKey:NSHTTPCookieSecure]; The old code was doing a boxed bool value here, not a string (@"YES" vs. @(secure)). Is the change intentional? > Source/WebCore/platform/network/cocoa/CookieCocoa.mm:101 > + [properties setObject:session ? @"TRUE" : @"FALSE" forKey:NSHTTPCookieDiscard]; Again, the old code was doing a boxed bool value here? @(session). Why is this now using @"TRUE" / @"FALSE"? > Source/WebCore/platform/network/mac/CookieJarMac.mm:230 > NSHTTPCookie *cookie = (NSHTTPCookie *)[cookies objectAtIndex:i]; You could probably make cookiesForURL return an NSArray<NSHTTPCookie *> *, and then just use cookies[I] here (or actually, this should just be a for (NSHTTPCookie *cookie in cookies) loop). Also, and unrelated, this function should return a Vector, not us an out parameter.
Brady Eidson
Comment 3 2017-03-12 17:08:04 PDT
Brady Eidson
Comment 4 2017-03-12 17:36:45 PDT
Completely didn't notice that anybody had taken a look at this, sorry - Wasn't purposefully ignoring your feedback.
Dean Jackson
Comment 5 2017-03-12 17:36:45 PDT
Comment on attachment 304210 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=304210&action=review > Source/WebCore/platform/network/cocoa/CookieCocoa.mm:56 > + StringBuilder builder; > + for (size_t i = 0; i < ports.size() - 1; ++i) { > + builder.append(String::number(ports[i])); > + builder.append(", "); > + } > + builder.append(String::number(ports.last())); > + > + return builder.toString(); Didn't Sam suggest using NSMutableString over StringBuilder? He also made two other suggestions. > Source/WebCore/platform/network/cocoa/CookieCocoa.mm:101 > + [properties setObject:session ? @"TRUE" : @"FALSE" forKey:NSHTTPCookieDiscard]; My opinion is that it reads better as (session ? @"TRUE" : @"FALSE")
Brady Eidson
Comment 6 2017-03-12 17:40:34 PDT
(In reply to comment #2) > Comment on attachment 304180 [details] > Current patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=304180&action=review > > > Source/WebCore/platform/network/cocoa/CookieCocoa.mm:56 > > + StringBuilder builder; > > + for (size_t i = 0; i < ports.size() - 1; ++i) { > > + builder.append(String::number(ports[i])); > > + builder.append(", "); > > + } > > + builder.append(String::number(ports.last())); > > + > > + return builder.toString(); > > Is it really more efficient to build a WTF::String than convert it to an > NSString vs just using an NSMutableString to build it? Probably not. > > Source/WebCore/platform/network/cocoa/CookieCocoa.mm:99 > > + [properties setObject:@"YES" forKey:NSHTTPCookieSecure]; > > The old code was doing a boxed bool value here, not a string (@"YES" vs. > @(secure)). Is the change intentional? Not really. > > Source/WebCore/platform/network/cocoa/CookieCocoa.mm:101 > > + [properties setObject:session ? @"TRUE" : @"FALSE" forKey:NSHTTPCookieDiscard]; > > Again, the old code was doing a boxed bool value here? @(session). Why is > this now using @"TRUE" / @"FALSE"? This one is actually correct, per the documentation for NSHTTPCookieDiscard - It expects the strings TRUE and FALSE, not YES/NO. > > > Source/WebCore/platform/network/mac/CookieJarMac.mm:230 > > NSHTTPCookie *cookie = (NSHTTPCookie *)[cookies objectAtIndex:i]; > > You could probably make cookiesForURL return an NSArray<NSHTTPCookie *> *, > and then just use cookies[I] here (or actually, this should just be a for > (NSHTTPCookie *cookie in cookies) loop). > > Also, and unrelated, this function should return a Vector, not us an out > parameter. Probably yup.
Brady Eidson
Comment 7 2017-03-12 17:51:27 PDT
WebKit Commit Bot
Comment 8 2017-03-12 18:54:20 PDT
Comment on attachment 304211 [details] Patch Clearing flags on attachment: 304211 Committed r213778: <http://trac.webkit.org/changeset/213778>
WebKit Commit Bot
Comment 9 2017-03-12 18:54:23 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.