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

Side by Side Diff: chrome/browser/extensions/api/cookies/cookies_helpers.cc

Issue 1868493002: Ignore cookies with invalid 'SameSite' attribute values. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Implements common functionality for the Chrome Extensions Cookies API. 5 // Implements common functionality for the Chrome Extensions Cookies API.
6 6
7 #include "chrome/browser/extensions/api/cookies/cookies_helpers.h" 7 #include "chrome/browser/extensions/api/cookies/cookies_helpers.h"
8 8
9 #include <stddef.h> 9 #include <stddef.h>
10 10
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 switch (canonical_cookie.SameSite()) { 84 switch (canonical_cookie.SameSite()) {
85 case net::CookieSameSite::DEFAULT_MODE: 85 case net::CookieSameSite::DEFAULT_MODE:
86 cookie.same_site = api::cookies::SAME_SITE_STATUS_NO_RESTRICTION; 86 cookie.same_site = api::cookies::SAME_SITE_STATUS_NO_RESTRICTION;
87 break; 87 break;
88 case net::CookieSameSite::LAX_MODE: 88 case net::CookieSameSite::LAX_MODE:
89 cookie.same_site = api::cookies::SAME_SITE_STATUS_LAX; 89 cookie.same_site = api::cookies::SAME_SITE_STATUS_LAX;
90 break; 90 break;
91 case net::CookieSameSite::STRICT_MODE: 91 case net::CookieSameSite::STRICT_MODE:
92 cookie.same_site = api::cookies::SAME_SITE_STATUS_STRICT; 92 cookie.same_site = api::cookies::SAME_SITE_STATUS_STRICT;
93 break; 93 break;
94 case net::CookieSameSite::INVALID_MODE:
mmenke 2016/04/06 15:16:30 It seems unfortunate that we need to expose this n
95 NOTREACHED();
96 cookie.same_site = api::cookies::SAME_SITE_STATUS_STRICT;
97 break;
94 } 98 }
95 99
96 cookie.session = !canonical_cookie.IsPersistent(); 100 cookie.session = !canonical_cookie.IsPersistent();
97 if (canonical_cookie.IsPersistent()) { 101 if (canonical_cookie.IsPersistent()) {
98 cookie.expiration_date.reset( 102 cookie.expiration_date.reset(
99 new double(canonical_cookie.ExpiryDate().ToDoubleT())); 103 new double(canonical_cookie.ExpiryDate().ToDoubleT()));
100 } 104 }
101 cookie.store_id = store_id; 105 cookie.store_id = store_id;
102 106
103 return cookie; 107 return cookie;
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 if (sub_domain == *details_->domain) 214 if (sub_domain == *details_->domain)
211 return true; 215 return true;
212 const size_t next_dot = sub_domain.find('.', 1); // Skip over leading dot. 216 const size_t next_dot = sub_domain.find('.', 1); // Skip over leading dot.
213 sub_domain.erase(0, next_dot); 217 sub_domain.erase(0, next_dot);
214 } 218 }
215 return false; 219 return false;
216 } 220 }
217 221
218 } // namespace cookies_helpers 222 } // namespace cookies_helpers
219 } // namespace extensions 223 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | content/browser/devtools/protocol/network_handler.cc » ('j') | net/cookies/cookie_constants.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698