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

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: optional 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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 } 375 }
376 376
377 /** 377 /**
378 * @enum {number} 378 * @enum {number}
379 */ 379 */
380 WebInspector.Cookie.Type = { 380 WebInspector.Cookie.Type = {
381 Request: 0, 381 Request: 0,
382 Response: 1 382 Response: 1
383 }; 383 };
384 384
385 /**
386 * @enum {string}
387 */
388 WebInspector.Cookie.SameSiteMode = {
dgozman 2016/04/05 17:34:53 There should be auto-generated NetworkAgent.Cookie
Mike West 2016/04/05 17:55:10 Yeah. I'll just drop this entirely. Thanks!
389 Strict: "Strict",
390 Lax: "Lax",
391 };
392
385 WebInspector.Cookies = {} 393 WebInspector.Cookies = {}
386 394
387 /** 395 /**
388 * @param {function(!Array.<!WebInspector.Cookie>)} callback 396 * @param {function(!Array.<!WebInspector.Cookie>)} callback
389 */ 397 */
390 WebInspector.Cookies.getCookiesAsync = function(callback) 398 WebInspector.Cookies.getCookiesAsync = function(callback)
391 { 399 {
392 var allCookies = []; 400 var allCookies = [];
393 /** 401 /**
394 * @param {!WebInspector.Target} target 402 * @param {!WebInspector.Target} target
(...skipping 26 matching lines...) Expand all
421 var cookie = new WebInspector.Cookie(target, protocolCookie.name, protocolCo okie.value, null); 429 var cookie = new WebInspector.Cookie(target, protocolCookie.name, protocolCo okie.value, null);
422 cookie.addAttribute("domain", protocolCookie["domain"]); 430 cookie.addAttribute("domain", protocolCookie["domain"]);
423 cookie.addAttribute("path", protocolCookie["path"]); 431 cookie.addAttribute("path", protocolCookie["path"]);
424 cookie.addAttribute("port", protocolCookie["port"]); 432 cookie.addAttribute("port", protocolCookie["port"]);
425 if (protocolCookie["expires"]) 433 if (protocolCookie["expires"])
426 cookie.addAttribute("expires", protocolCookie["expires"]); 434 cookie.addAttribute("expires", protocolCookie["expires"]);
427 if (protocolCookie["httpOnly"]) 435 if (protocolCookie["httpOnly"])
428 cookie.addAttribute("httpOnly"); 436 cookie.addAttribute("httpOnly");
429 if (protocolCookie["secure"]) 437 if (protocolCookie["secure"])
430 cookie.addAttribute("secure"); 438 cookie.addAttribute("secure");
431 if (protocolCookie["sameSite"]) 439 if (protocolCookie["sameSite"] != undefined)
dgozman 2016/04/05 17:34:54 Omit comparison with undefined, just |if (protocol
432 cookie.addAttribute("sameSite"); 440 cookie.addAttribute("sameSite", protocolCookie["sameSite"]);
433 cookie.setSize(protocolCookie["size"]); 441 cookie.setSize(protocolCookie["size"]);
434 return cookie; 442 return cookie;
435 } 443 }
436 444
437 /** 445 /**
438 * @param {!WebInspector.Cookie} cookie 446 * @param {!WebInspector.Cookie} cookie
439 * @param {string} resourceURL 447 * @param {string} resourceURL
440 * @return {boolean} 448 * @return {boolean}
441 */ 449 */
442 WebInspector.Cookies.cookieMatchesResourceURL = function(cookie, resourceURL) 450 WebInspector.Cookies.cookieMatchesResourceURL = function(cookie, resourceURL)
(...skipping 10 matching lines...) Expand all
453 * @param {string} cookieDomain 461 * @param {string} cookieDomain
454 * @param {string} resourceDomain 462 * @param {string} resourceDomain
455 * @return {boolean} 463 * @return {boolean}
456 */ 464 */
457 WebInspector.Cookies.cookieDomainMatchesResourceDomain = function(cookieDomain, resourceDomain) 465 WebInspector.Cookies.cookieDomainMatchesResourceDomain = function(cookieDomain, resourceDomain)
458 { 466 {
459 if (cookieDomain.charAt(0) !== '.') 467 if (cookieDomain.charAt(0) !== '.')
460 return resourceDomain === cookieDomain; 468 return resourceDomain === cookieDomain;
461 return !!resourceDomain.match(new RegExp("^([^\\.]+\\.)*" + cookieDomain.sub string(1).escapeForRegExp() + "$", "i")); 469 return !!resourceDomain.match(new RegExp("^([^\\.]+\\.)*" + cookieDomain.sub string(1).escapeForRegExp() + "$", "i"));
462 } 470 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698