Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(621)

Issue 518054: Deleting cookies by setting the expires attribute on them with an empty value... (Closed)

Created:
10 years, 11 months ago by ananta
Modified:
9 years, 6 months ago
Reviewers:
amit
CC:
chromium-reviews_googlegroups.com, brettw+cc_chromium.org, ben+cc_chromium.org, amit, jam, Paweł Hajdan Jr., darin (slow to review)
Visibility:
Public.

Description

Deleting cookies by setting the expires attribute on them with an empty value would not work in ChromeFrame with the host network stack enabled. When we receive a response in the host browser (IE) we send over the response headers which include the Set-Cookie header and a list of cookies retreived via the InternetGetCookie API. We call this API to retrieve the persistent cookies and send them over to Chrome. However this API returns session cookies as well as persistent cookies. There is no documented way to return only persistent cookies from IE. As a result we would end up setting duplicate cookies in Chrome, which caused this issu.e. To workaround this issue when we receive the response in the url request automation job which handles ChromeFrame network requests, we strip out duplicate cookies sent via InternetGetCookie. When a script deletes a cookie we now handle it correctly in IE and set the data to an empty string. However this does not delete the cookie. When such cookies show up in Chrome, we strip them out as well. Fixes bug http://code.google.com/p/chromium/issues/detail?id=30786 The changes to chrome_frame_npapi.cc/.h are to move the NPAPI functions to the chrome_frame namespace as they conflict with similar functions in NACL. Added the DeleteCookie function to the CookieStore interface, which I think missed out by oversight. Bug=30786 Test=Covered by ChromeFrame unit tests. I also added a unit test to test the newly added URLRequestAutomationJob::IsCookiePresentInCookieHeader function Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=35769

Patch Set 1 #

Patch Set 2 : '' #

Patch Set 3 : '' #

Patch Set 4 : '' #

Patch Set 5 : '' #

Patch Set 6 : '' #

Total comments: 16

Patch Set 7 : '' #

Patch Set 8 : '' #

Unified diffs Side-by-side diffs Delta from patch set Stats (+360 lines, -177 lines) Patch
M chrome/browser/automation/automation_profile_impl.cc View 1 2 3 4 5 6 7 1 chunk +5 lines, -0 lines 0 comments Download
M chrome/browser/automation/url_request_automation_job.h View 1 2 3 4 5 6 7 2 chunks +7 lines, -0 lines 0 comments Download
M chrome/browser/automation/url_request_automation_job.cc View 1 2 3 4 5 6 7 5 chunks +32 lines, -5 lines 0 comments Download
M chrome/browser/renderer_host/resource_message_filter.cc View 1 2 3 4 5 6 7 1 chunk +1 line, -6 lines 0 comments Download
M chrome_frame/chrome_frame.gyp View 1 2 3 4 5 6 7 2 chunks +5 lines, -0 lines 0 comments Download
M chrome_frame/chrome_frame_activex_base.h View 1 2 3 4 5 6 7 2 chunks +10 lines, -2 lines 0 comments Download
M chrome_frame/chrome_frame_npapi.cc View 1 2 3 4 5 6 7 2 chunks +0 lines, -150 lines 0 comments Download
A chrome_frame/chrome_frame_npapi_entrypoints.h View 1 chunk +39 lines, -0 lines 0 comments Download
M chrome_frame/chrome_frame_npapi_entrypoints.cc View 1 2 3 4 5 6 7 3 chunks +165 lines, -11 lines 0 comments Download
M chrome_frame/test/chrome_frame_unittests.cc View 1 2 3 4 5 6 7 2 chunks +18 lines, -3 lines 0 comments Download
A chrome_frame/test/data/fulltab_delete_cookie_test.html View 1 2 3 4 5 6 7 1 chunk +47 lines, -0 lines 0 comments Download
A chrome_frame/test/data/fulltab_delete_cookie_test.html.mock-http-headers View 1 chunk +3 lines, -0 lines 0 comments Download
M chrome_frame/test/html_util_unittests.cc View 1 2 3 4 5 6 7 3 chunks +24 lines, -0 lines 0 comments Download
M net/base/cookie_store.h View 1 2 3 4 5 6 7 1 chunk +4 lines, -0 lines 0 comments Download

Messages

Total messages: 4 (0 generated)
ananta
10 years, 11 months ago (2010-01-07 06:58:11 UTC) #1
amit
Thanks for digging into this bug and fixing it. LGTM with a few comments below. ...
10 years, 11 months ago (2010-01-07 15:36:13 UTC) #2
ananta
http://codereview.chromium.org/518054/diff/1009/4027 File chrome/browser/automation/url_request_automation_job.cc (right): http://codereview.chromium.org/518054/diff/1009/4027#newcode260 chrome/browser/automation/url_request_automation_job.cc:260: On 2010/01/07 15:36:13, amit wrote: > nit: remove empty ...
10 years, 11 months ago (2010-01-07 19:35:25 UTC) #3
amit
10 years, 11 months ago (2010-01-07 21:28:25 UTC) #4
OK, lgtm++

On Thu, Jan 7, 2010 at 11:35 AM,  <ananta@chromium.org> wrote:
>
> http://codereview.chromium.org/518054/diff/1009/4027
> File chrome/browser/automation/url_request_automation_job.cc (right):
>
> http://codereview.chromium.org/518054/diff/1009/4027#newcode260
> chrome/browser/automation/url_request_automation_job.cc:260:
> On 2010/01/07 15:36:13, amit wrote:
>>
>> nit: remove empty line
>
> Done.
>
> http://codereview.chromium.org/518054/diff/1009/4027#newcode261
> chrome/browser/automation/url_request_automation_job.cc:261:
> std::vector<std::string> response_cookies;
> On 2010/01/07 15:36:13, amit wrote:
>>
>> making this into a map or a set would simplify (or eliminate)
>> IsCookiePresentInCookieHeader.
>
> I did think about changing this. However making it a map would have its
> own complications like we would need to parse the cookie string again to
> get the key, which ideally would be the name. However vagaries with
> cookie formats, cause the name to be empty at times. An example would be
> a cookie without any attributes. I decided to leave this as is for now.
>
> http://codereview.chromium.org/518054/diff/1009/4027#newcode297
> chrome/browser/automation/url_request_automation_job.cc:297:
> TrimWhitespace(cookie_string, TRIM_LEADING, &cookie_string);
> On 2010/01/07 15:36:13, amit wrote:
>>
>> maybe we should trim from both ends after cookie_string.find succeeds.
>
> Done.
>
> http://codereview.chromium.org/518054/diff/1009/4019
> File chrome_frame/chrome_frame_activex_base.h (right):
>
> http://codereview.chromium.org/518054/diff/1009/4019#newcode530
> chrome_frame/chrome_frame_activex_base.h:530:
> net::CookieMonster::ParsedCookie parsed_cookie = cookie;
> On 2010/01/07 15:36:13, amit wrote:
>>
>> I think we should have a separate DeleteCookie IPC instead of
>
> propagating IE's
>>
>> ugliness.
>
> Unfortunately javascript cookie deletion occurs by means of a SetCookie
> call. We do have a DeleteCookie interface in the webkit API. I don't
> know under what scenarios that is called.
>
> http://codereview.chromium.org/518054/diff/1009/4018
> File chrome_frame/chrome_frame_npapi.h (right):
>
> http://codereview.chromium.org/518054/diff/1009/4018#newcode347
> chrome_frame/chrome_frame_npapi.h:347: namespace chrome_frame {
> On 2010/01/07 15:36:13, amit wrote:
>>
>> nice, now it would be even better of we move these into a separate
>> source/header.
>
> Done.
>
> http://codereview.chromium.org/518054/diff/1009/4020
> File chrome_frame/test/chrome_frame_unittests.cc (right):
>
> http://codereview.chromium.org/518054/diff/1009/4020#newcode1766
> chrome_frame/test/chrome_frame_unittests.cc:1766: ASSERT_TRUE(
> On 2010/01/07 15:36:13, amit wrote:
>>
>> nit: fit in less no of lines, I am not sure if this is more readable
>
> Done.
>
> http://codereview.chromium.org/518054/diff/1009/4020#newcode1773
> chrome_frame/test/chrome_frame_unittests.cc:1773: ASSERT_TRUE(
> On 2010/01/07 15:36:13, amit wrote:
>>
>> nit: should fit in a single line
>
> Done.
>
> http://codereview.chromium.org/518054/diff/1009/4021
> File chrome_frame/test/html_util_unittests.cc (right):
>
> http://codereview.chromium.org/518054/diff/1009/4021#newcode366
> chrome_frame/test/html_util_unittests.cc:366: TEST(HttpCookieTest,
> IdentifyDuplicateCookieTest) {
> On 2010/01/07 15:36:13, amit wrote:
>>
>> nice test, now jsut to be sure, do we need to add 'domain', 'expires'
>
> to the
>>
>> test cases?
>
> We could. We only compare the names of the cookies though. Additional
> attributes would be ignored.
>
> http://codereview.chromium.org/518054
>

Powered by Google App Engine
This is Rietveld 408576698