Bug 57055 - Add WebCookieManager to WebKit mac port to list hosts with cookies, delete cookies for a host, delete all cookies
Summary: Add WebCookieManager to WebKit mac port to list hosts with cookies, delete co...
Status: RESOLVED WONTFIX
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit API (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC OS X 10.5
: P2 Normal
Assignee: Anton D'Auria
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-24 14:50 PDT by Anton D'Auria
Modified: 2016-03-31 16:39 PDT (History)
5 users (show)

See Also:


Attachments
Patch (37.94 KB, patch)
2011-03-24 16:25 PDT, Anton D'Auria
no flags Details | Formatted Diff | Diff
Patch (38.37 KB, patch)
2011-03-24 18:09 PDT, Anton D'Auria
no flags Details | Formatted Diff | Diff
Patch (39.51 KB, patch)
2011-03-24 23:10 PDT, Anton D'Auria
no flags Details | Formatted Diff | Diff
Patch (39.48 KB, patch)
2011-03-25 16:40 PDT, Anton D'Auria
bweinstein: review+
commit-queue: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Anton D'Auria 2011-03-24 14:50:37 PDT
Mac port's CookieJar.mm provides functions to list hostnames that have cookies, to delete cookies by hostname, and to delete all cookies. This should not be reimplemented by Mac clients, so WebCookieManager provides access to these functions.
Comment 1 Anton D'Auria 2011-03-24 16:25:39 PDT
Created attachment 86854 [details]
Patch
Comment 2 Early Warning System Bot 2011-03-24 16:33:57 PDT
Attachment 86854 [details] did not build on qt:
Build output: http://queues.webkit.org/results/8235654
Comment 3 Brian Weinstein 2011-03-24 17:01:02 PDT
Comment on attachment 86854 [details]
Patch

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

I haven't looked at the testing portion yet, but the code looks good, just some SecurityOrigin stuff that doesn't seem to be needed.

> Source/WebKit/mac/Cookies/WebCookieManager.mm:29
> +#import <WebCore/SecurityOrigin.h>

Is this #import needed?

> Source/WebKit/mac/Cookies/WebCookieManager.mm:31
> +#import <wtf/RetainPtr.h>

Or this one?

> Source/WebKit/mac/Cookies/WebCookieManagerPrivate.h:26
> +@class WebSecurityOrigin;

I'm surprised this is necessary, since you are only using NSStrings and NSArrays here.
Comment 4 Brian Weinstein 2011-03-24 17:14:09 PDT
Comment on attachment 86854 [details]
Patch

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

> Tools/ChangeLog:7
> +

Some comments (especially alongside the functions you implemented) would be nice.

> Tools/DumpRenderTree/LayoutTestController.h:68
> +    void deleteCookiesForHostname(JSStringRef hostname);

Hostname here ("JSStringRef hostname") doesn't add anything.

> Tools/DumpRenderTree/qt/LayoutTestControllerQt.h:197
> +    void deleteCookiesForHostname(const QString& hostname);

Hostname here doesn't add anything.

> LayoutTests/http/tests/cookies/delete-all-cookies.html:7
> +resetCookies();

I feel like this should be done at the start of runTest - to make it clear that it is part of running the test.

> LayoutTests/http/tests/cookies/delete-cookies-for-hostname.html:7
> +resetCookies();

Ditto about putting this at the start of runTest.

> LayoutTests/http/tests/cookies/delete-cookies-for-hostname.html:31
> +    var contains = false;
> +    var i = hostsWithCookies.length;
> +    while (i--) {
> +        if (hostsWithCookies[i] === drtHost) {
> +            contains = true;
> +            break;
> +        }
> +    }

I think you could just use array.indexOf here.

> LayoutTests/http/tests/cookies/hostnames-with-cookies.html:6
> +resetCookies();

Once more about runTest.

> LayoutTests/http/tests/cookies/hostnames-with-cookies.html:31
> +    var contains = false;
> +    var i = hostsWithCookies.length;
> +    while (i--) {
> +        if (hostsWithCookies[i] === drtHost) {
> +            contains = true;
> +            break;
> +        }
> +    }

Ditto about using array.indexOf.
Comment 5 Anton D'Auria 2011-03-24 18:09:20 PDT
Created attachment 86863 [details]
Patch
Comment 6 Brian Weinstein 2011-03-24 20:46:19 PDT
Comment on attachment 86863 [details]
Patch

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

If you could link to https://bugs.webkit.org/show_bug.cgi?id=57055 in the Skipped lists of the platforms you're not implementing this for, that would be great.

> Source/WebKit/WebKit.xcodeproj/project.pbxproj:821
> +				3A1C2D93133A70FB00A420E5 /* Cookies */,

If these are alphabetical, Cookies should be above Default Delegates and DOM.

> Source/WebKit/mac/WebKit.exp:7
> +.objc_class_name_WebCookieManager

Alphabetical again - WebCookieManager < WebCoreScrollView.

> Source/WebKit/mac/Cookies/WebCookieManager.mm:27
> +#import "WebSecurityOriginInternal.h"

Is this include necessary? Also, I think our style dictates a blank like between the import of WebCookieManagerPrivate and the other imports.

> Tools/DumpRenderTree/LayoutTestController.cpp:640
> +    ASSERT(!*exception);

Do you also want to assert exception is non-null here? ASSERT(exception); ASSERT(!*exception). I don't know what our style is, if it's usually just the ASSERT(!*exception), that's fine.

> Tools/DumpRenderTree/mac/LayoutTestControllerMac.mm:180
> +        JSRetainPtr<JSStringRef> jsString(Adopt, JSStringCreateWithCFString((CFStringRef)string));

Can this be a C++ style cast?

> LayoutTests/http/tests/cookies/delete-all-cookies.html:27
> +

You might also want to run logContainsCookies here - to show that we are in a clean state before the test starts.

> LayoutTests/http/tests/cookies/delete-cookies-for-hostname.html:22
> +    var contains = (hostsWithCookies.indexOf(drtHost) != -1);

I'm not wild about this name. Maybe hasDRTCookies? I don't have a strong opinion about this though.

> LayoutTests/http/tests/cookies/hostnames-with-cookies.html:6
> +resetCookies();

Don't forget to put resetCookies in runTest here (unless there's a reason not to).

> LayoutTests/http/tests/cookies/hostnames-with-cookies.html:25
> +    var contains = (hostsWithCookies.indexOf(drtHost) != -1);

Same comment about contains variable name here.
Comment 7 Anton D'Auria 2011-03-24 23:10:38 PDT
Created attachment 86889 [details]
Patch
Comment 8 Anton D'Auria 2011-03-25 16:40:04 PDT
Created attachment 86994 [details]
Patch

WebCookieManagerPrivate.h was not exporteted as private
Comment 9 WebKit Commit Bot 2011-03-26 03:39:27 PDT
Comment on attachment 86994 [details]
Patch

Rejecting attachment 86994 [details] from commit-queue.

Failed to run "['./Tools/Scripts/webkit-patch', '--status-host=queues.webkit.org', '--bot-id=eseidel-cq-sf', 'bu..." exit_code: 2

Last 500 characters of output:
......
webarchive .....................
webarchive/loading ....
http/tests/appcache ...........................................................
http/tests/cache ........
http/tests/canvas/philip/tests ..........
http/tests/canvas/webgl .
http/tests/cookies .
http/tests/cookies/delete-all-cookies.html -> failed

Exiting early after 1 failures. 22065 tests run.
563.74s total testing time

22064 test cases (99%) succeeded
1 test case (<1%) had incorrect layout
14 test cases (<1%) had stderr output

Full output: http://queues.webkit.org/results/8254415
Comment 10 Anton D'Auria 2011-03-26 11:43:17 PDT
(In reply to comment #9)
> (From update of attachment 86994 [details])
> Rejecting attachment 86994 [details] from commit-queue.
> 
> Failed to run "['./Tools/Scripts/webkit-patch', '--status-host=queues.webkit.org', '--bot-id=eseidel-cq-sf', 'bu..." exit_code: 2
> 
> Last 500 characters of output:
> ......
> webarchive .....................
> webarchive/loading ....
> http/tests/appcache ...........................................................
> http/tests/cache ........
> http/tests/canvas/philip/tests ..........
> http/tests/canvas/webgl .
> http/tests/cookies .
> http/tests/cookies/delete-all-cookies.html -> failed
> 
> Exiting early after 1 failures. 22065 tests run.
> 563.74s total testing time
> 
> 22064 test cases (99%) succeeded
> 1 test case (<1%) had incorrect layout
> 14 test cases (<1%) had stderr output
> 
> Full output: http://queues.webkit.org/results/8254415

I can't reproduce this locally yet. Is it possible to view the layout test results generated by the commit queue?
Comment 11 Eric Seidel (no email) 2011-03-26 12:59:55 PDT
(In reply to comment #10)
> I can't reproduce this locally yet. Is it possible to view the layout test results generated by the commit queue?

Sadly, not easily.  I need to fix it to upload the failing results.
Comment 12 Anton D'Auria 2011-03-26 17:41:15 PDT
(In reply to comment #11)
> (In reply to comment #10)
> > I can't reproduce this locally yet. Is it possible to view the layout test results generated by the commit queue?
> 
> Sadly, not easily.  I need to fix it to upload the failing results.

I'll be grateful if you can post the diff this once, or modify the commit queue to upload failing results :)
Comment 13 Eric Seidel (no email) 2011-03-26 21:56:51 PDT
Sure thing.  Will post in a few hours once I'm in the office.
Comment 14 Anton D'Auria 2011-03-27 14:08:47 PDT
(In reply to comment #13)
> Sure thing.  Will post in a few hours once I'm in the office.

Eric, I think https://bugs.webkit.org/show_bug.cgi?id=57127 is failing for the same reason. In both, I'm hardcoding the origin URL of drt's httpd.
Comment 15 Eric Seidel (no email) 2011-04-12 11:32:26 PDT
Finally fixed the cq to upload failing diffs with bug 58348.
Comment 16 Alexey Proskuryakov 2013-10-03 11:55:34 PDT
Is this still needed?
Comment 17 BJ Burg 2016-03-31 16:39:47 PDT
Closing, we don't need to add new WK1 APIs.