| 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 {string} | 261 * @return {!NetworkAgent.CookieSameSite<string>} |
| 262 */ | 262 */ |
| 263 sameSite: function() | 263 sameSite: function() |
| 264 { | 264 { |
| 265 return this._attributes["samesite"]; | 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() |
| (...skipping 21 matching lines...) Expand all Loading... |
| 293 | 293 |
| 294 /** | 294 /** |
| 295 * @return {string} | 295 * @return {string} |
| 296 */ | 296 */ |
| 297 domain: function() | 297 domain: function() |
| 298 { | 298 { |
| 299 return this._attributes["domain"]; | 299 return this._attributes["domain"]; |
| 300 }, | 300 }, |
| 301 | 301 |
| 302 /** | 302 /** |
| 303 * @return {string} | 303 * @return {number} |
| 304 */ | 304 */ |
| 305 expires: function() | 305 expires: function() |
| 306 { | 306 { |
| 307 return this._attributes["expires"]; | 307 return this._attributes["expires"]; |
| 308 }, | 308 }, |
| 309 | 309 |
| 310 /** | 310 /** |
| 311 * @return {string} | 311 * @return {string} |
| 312 */ | 312 */ |
| 313 maxAge: function() | 313 maxAge: function() |
| 314 { | 314 { |
| 315 return this._attributes["max-age"]; | 315 return this._attributes["max-age"]; |
| 316 }, | 316 }, |
| 317 | 317 |
| 318 /** | 318 /** |
| 319 * @return {number} | 319 * @return {number} |
| 320 */ | 320 */ |
| 321 size: function() | 321 size: function() |
| 322 { | 322 { |
| 323 return this._size; | 323 return this._size; |
| 324 }, | 324 }, |
| 325 | 325 |
| 326 /** | 326 /** |
| 327 * @return {string} |
| 328 */ |
| 329 url: function() |
| 330 { |
| 331 return (this.secure() ? "https://" : "http://") + this.domain() + this.p
ath(); |
| 332 }, |
| 333 |
| 334 /** |
| 327 * @param {number} size | 335 * @param {number} size |
| 328 */ | 336 */ |
| 329 setSize: function(size) | 337 setSize: function(size) |
| 330 { | 338 { |
| 331 this._size = size; | 339 this._size = size; |
| 332 }, | 340 }, |
| 333 | 341 |
| 334 /** | 342 /** |
| 335 * @return {?Date} | 343 * @return {?Date} |
| 336 */ | 344 */ |
| (...skipping 14 matching lines...) Expand all Loading... |
| 351 /** | 359 /** |
| 352 * @return {!Object} | 360 * @return {!Object} |
| 353 */ | 361 */ |
| 354 attributes: function() | 362 attributes: function() |
| 355 { | 363 { |
| 356 return this._attributes; | 364 return this._attributes; |
| 357 }, | 365 }, |
| 358 | 366 |
| 359 /** | 367 /** |
| 360 * @param {string} key | 368 * @param {string} key |
| 361 * @param {string=} value | 369 * @param {string|number=} value |
| 362 */ | 370 */ |
| 363 addAttribute: function(key, value) | 371 addAttribute: function(key, value) |
| 364 { | 372 { |
| 365 this._attributes[key.toLowerCase()] = value; | 373 this._attributes[key.toLowerCase()] = value; |
| 366 }, | 374 }, |
| 367 | 375 |
| 368 /** | 376 /** |
| 369 * @param {function(?Protocol.Error)=} callback | 377 * @param {function(?Protocol.Error)=} callback |
| 370 */ | 378 */ |
| 371 remove: function(callback) | 379 remove: function(callback) |
| 372 { | 380 { |
| 373 this._target.networkAgent().deleteCookie(this.name(), (this.secure() ? "
https://" : "http://") + this.domain() + this.path(), callback); | 381 this._target.networkAgent().deleteCookie(this.name(), this.url(), callba
ck); |
| 382 }, |
| 383 |
| 384 save: function(callback) |
| 385 { |
| 386 var domain = this.domain(); |
| 387 // for cookies targeting single domain and no sub domains 'domain' field
should be sent empty |
| 388 if (!domain.startsWith(".")) |
| 389 domain = ''; |
| 390 this._target.networkAgent().setCookie(this.url(), this.name(), this.valu
e(), domain, this.path(), this.secure(), this.httpOnly(), this.sameSite(), this.
expires(), callback); |
| 374 } | 391 } |
| 375 } | 392 } |
| 376 | 393 |
| 377 /** | 394 /** |
| 378 * @enum {number} | 395 * @enum {number} |
| 379 */ | 396 */ |
| 380 WebInspector.Cookie.Type = { | 397 WebInspector.Cookie.Type = { |
| 381 Request: 0, | 398 Request: 0, |
| 382 Response: 1 | 399 Response: 1 |
| 383 }; | 400 }; |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 * @param {string} cookieDomain | 470 * @param {string} cookieDomain |
| 454 * @param {string} resourceDomain | 471 * @param {string} resourceDomain |
| 455 * @return {boolean} | 472 * @return {boolean} |
| 456 */ | 473 */ |
| 457 WebInspector.Cookies.cookieDomainMatchesResourceDomain = function(cookieDomain,
resourceDomain) | 474 WebInspector.Cookies.cookieDomainMatchesResourceDomain = function(cookieDomain,
resourceDomain) |
| 458 { | 475 { |
| 459 if (cookieDomain.charAt(0) !== ".") | 476 if (cookieDomain.charAt(0) !== ".") |
| 460 return resourceDomain === cookieDomain; | 477 return resourceDomain === cookieDomain; |
| 461 return !!resourceDomain.match(new RegExp("^([^\\.]+\\.)*" + cookieDomain.sub
string(1).escapeForRegExp() + "$", "i")); | 478 return !!resourceDomain.match(new RegExp("^([^\\.]+\\.)*" + cookieDomain.sub
string(1).escapeForRegExp() + "$", "i")); |
| 462 } | 479 } |
| OLD | NEW |