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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/sdk/CookieParser.js

Issue 1827743002: SameSite: Teach devtools about the new 'samesite' syntax. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Feedback 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 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 251
252 /** 252 /**
253 * @return {boolean} 253 * @return {boolean}
254 */ 254 */
255 secure: function() 255 secure: function()
256 { 256 {
257 return "secure" in this._attributes; 257 return "secure" in this._attributes;
258 }, 258 },
259 259
260 /** 260 /**
261 * @return {boolean} 261 * @return {string}
262 */ 262 */
263 sameSite: function () 263 sameSite: function ()
264 { 264 {
265 return "samesite" in this._attributes; 265 return this._attributes["samesite"];
266 }, 266 },
267 267
268 /** 268 /**
269 * @return {boolean} 269 * @return {boolean}
270 */ 270 */
271 session: function() 271 session: function()
272 { 272 {
273 // RFC 2965 suggests using Discard attribute to mark session cookies, bu t this does not seem to be widely used. 273 // RFC 2965 suggests using Discard attribute to mark session cookies, bu t this does not seem to be widely used.
274 // Check for absence of explicitly max-age or expiry date instead. 274 // Check for absence of explicitly max-age or expiry date instead.
275 return !("expires" in this._attributes || "max-age" in this._attributes) ; 275 return !("expires" in this._attributes || "max-age" in this._attributes) ;
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 cookie.addAttribute("domain", protocolCookie["domain"]); 422 cookie.addAttribute("domain", protocolCookie["domain"]);
423 cookie.addAttribute("path", protocolCookie["path"]); 423 cookie.addAttribute("path", protocolCookie["path"]);
424 cookie.addAttribute("port", protocolCookie["port"]); 424 cookie.addAttribute("port", protocolCookie["port"]);
425 if (protocolCookie["expires"]) 425 if (protocolCookie["expires"])
426 cookie.addAttribute("expires", protocolCookie["expires"]); 426 cookie.addAttribute("expires", protocolCookie["expires"]);
427 if (protocolCookie["httpOnly"]) 427 if (protocolCookie["httpOnly"])
428 cookie.addAttribute("httpOnly"); 428 cookie.addAttribute("httpOnly");
429 if (protocolCookie["secure"]) 429 if (protocolCookie["secure"])
430 cookie.addAttribute("secure"); 430 cookie.addAttribute("secure");
431 if (protocolCookie["sameSite"]) 431 if (protocolCookie["sameSite"])
432 cookie.addAttribute("sameSite"); 432 cookie.addAttribute("sameSite", protocolCookie["sameSite"]);
433 cookie.setSize(protocolCookie["size"]); 433 cookie.setSize(protocolCookie["size"]);
434 return cookie; 434 return cookie;
435 } 435 }
436 436
437 /** 437 /**
438 * @param {!WebInspector.Cookie} cookie 438 * @param {!WebInspector.Cookie} cookie
439 * @param {string} resourceURL 439 * @param {string} resourceURL
440 * @return {boolean} 440 * @return {boolean}
441 */ 441 */
442 WebInspector.Cookies.cookieMatchesResourceURL = function(cookie, resourceURL) 442 WebInspector.Cookies.cookieMatchesResourceURL = function(cookie, resourceURL)
(...skipping 10 matching lines...) Expand all
453 * @param {string} cookieDomain 453 * @param {string} cookieDomain
454 * @param {string} resourceDomain 454 * @param {string} resourceDomain
455 * @return {boolean} 455 * @return {boolean}
456 */ 456 */
457 WebInspector.Cookies.cookieDomainMatchesResourceDomain = function(cookieDomain, resourceDomain) 457 WebInspector.Cookies.cookieDomainMatchesResourceDomain = function(cookieDomain, resourceDomain)
458 { 458 {
459 if (cookieDomain.charAt(0) !== '.') 459 if (cookieDomain.charAt(0) !== '.')
460 return resourceDomain === cookieDomain; 460 return resourceDomain === cookieDomain;
461 return !!resourceDomain.match(new RegExp("^([^\\.]+\\.)*" + cookieDomain.sub string(1).escapeForRegExp() + "$", "i")); 461 return !!resourceDomain.match(new RegExp("^([^\\.]+\\.)*" + cookieDomain.sub string(1).escapeForRegExp() + "$", "i"));
462 } 462 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698