| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 = { |
| 389 Strict: "Strict", |
| 390 Lax: "Lax", |
| 391 NoRestriction: "NoRestriction" |
| 392 }; |
| 393 |
| 385 WebInspector.Cookies = {} | 394 WebInspector.Cookies = {} |
| 386 | 395 |
| 387 /** | 396 /** |
| 388 * @param {function(!Array.<!WebInspector.Cookie>)} callback | 397 * @param {function(!Array.<!WebInspector.Cookie>)} callback |
| 389 */ | 398 */ |
| 390 WebInspector.Cookies.getCookiesAsync = function(callback) | 399 WebInspector.Cookies.getCookiesAsync = function(callback) |
| 391 { | 400 { |
| 392 var allCookies = []; | 401 var allCookies = []; |
| 393 /** | 402 /** |
| 394 * @param {!WebInspector.Target} target | 403 * @param {!WebInspector.Target} target |
| (...skipping 27 matching lines...) Expand all Loading... |
| 422 cookie.addAttribute("domain", protocolCookie["domain"]); | 431 cookie.addAttribute("domain", protocolCookie["domain"]); |
| 423 cookie.addAttribute("path", protocolCookie["path"]); | 432 cookie.addAttribute("path", protocolCookie["path"]); |
| 424 cookie.addAttribute("port", protocolCookie["port"]); | 433 cookie.addAttribute("port", protocolCookie["port"]); |
| 425 if (protocolCookie["expires"]) | 434 if (protocolCookie["expires"]) |
| 426 cookie.addAttribute("expires", protocolCookie["expires"]); | 435 cookie.addAttribute("expires", protocolCookie["expires"]); |
| 427 if (protocolCookie["httpOnly"]) | 436 if (protocolCookie["httpOnly"]) |
| 428 cookie.addAttribute("httpOnly"); | 437 cookie.addAttribute("httpOnly"); |
| 429 if (protocolCookie["secure"]) | 438 if (protocolCookie["secure"]) |
| 430 cookie.addAttribute("secure"); | 439 cookie.addAttribute("secure"); |
| 431 if (protocolCookie["sameSite"]) | 440 if (protocolCookie["sameSite"]) |
| 432 cookie.addAttribute("sameSite"); | 441 cookie.addAttribute("sameSite", protocolCookie["sameSite"]); |
| 433 cookie.setSize(protocolCookie["size"]); | 442 cookie.setSize(protocolCookie["size"]); |
| 434 return cookie; | 443 return cookie; |
| 435 } | 444 } |
| 436 | 445 |
| 437 /** | 446 /** |
| 438 * @param {!WebInspector.Cookie} cookie | 447 * @param {!WebInspector.Cookie} cookie |
| 439 * @param {string} resourceURL | 448 * @param {string} resourceURL |
| 440 * @return {boolean} | 449 * @return {boolean} |
| 441 */ | 450 */ |
| 442 WebInspector.Cookies.cookieMatchesResourceURL = function(cookie, resourceURL) | 451 WebInspector.Cookies.cookieMatchesResourceURL = function(cookie, resourceURL) |
| (...skipping 10 matching lines...) Expand all Loading... |
| 453 * @param {string} cookieDomain | 462 * @param {string} cookieDomain |
| 454 * @param {string} resourceDomain | 463 * @param {string} resourceDomain |
| 455 * @return {boolean} | 464 * @return {boolean} |
| 456 */ | 465 */ |
| 457 WebInspector.Cookies.cookieDomainMatchesResourceDomain = function(cookieDomain,
resourceDomain) | 466 WebInspector.Cookies.cookieDomainMatchesResourceDomain = function(cookieDomain,
resourceDomain) |
| 458 { | 467 { |
| 459 if (cookieDomain.charAt(0) !== '.') | 468 if (cookieDomain.charAt(0) !== '.') |
| 460 return resourceDomain === cookieDomain; | 469 return resourceDomain === cookieDomain; |
| 461 return !!resourceDomain.match(new RegExp("^([^\\.]+\\.)*" + cookieDomain.sub
string(1).escapeForRegExp() + "$", "i")); | 470 return !!resourceDomain.match(new RegExp("^([^\\.]+\\.)*" + cookieDomain.sub
string(1).escapeForRegExp() + "$", "i")); |
| 462 } | 471 } |
| OLD | NEW |