Chromium Code Reviews| Index: third_party/WebKit/Source/devtools/front_end/sdk/CookieParser.js |
| diff --git a/third_party/WebKit/Source/devtools/front_end/sdk/CookieParser.js b/third_party/WebKit/Source/devtools/front_end/sdk/CookieParser.js |
| index 9554d691646b9aa711e433cacb464ee80e21285c..8bcb40ef01dda60f25ac70a587c1f4726643fbef 100644 |
| --- a/third_party/WebKit/Source/devtools/front_end/sdk/CookieParser.js |
| +++ b/third_party/WebKit/Source/devtools/front_end/sdk/CookieParser.js |
| @@ -250,7 +250,7 @@ SDK.Cookie = class { |
| } |
| /** |
| - * @return {string} |
| + * @return {!Protocol.Network.CookieSameSite<string>} |
|
dgozman
2016/12/14 17:20:21
Never seen this syntax. What does it mean?
kdzwinel
2016/12/15 12:38:50
AFAIK it means that we will return a 'Protocol.Net
allada
2016/12/15 23:45:52
Lets focus on making this work for now. Please add
|
| */ |
| sameSite() { |
| return this._attributes['samesite']; |
|
allada
2016/12/15 23:45:52
change this to:
return /** @type {!Protocol.Networ
|
| @@ -287,7 +287,7 @@ SDK.Cookie = class { |
| } |
| /** |
| - * @return {string} |
| + * @return {number} |
|
allada
2016/12/15 23:45:52
We also parse headers out of this from network pan
kdzwinel
2016/12/19 01:55:04
`expires` comes as a number from the back-end (`Ne
allada
2016/12/23 00:37:11
Ok, lets keep it a number since 'expires' already
|
| */ |
| expires() { |
| return this._attributes['expires']; |
| @@ -307,6 +307,10 @@ SDK.Cookie = class { |
| return this._size; |
| } |
| + url() { |
| + return (this.secure() ? 'https://' : 'http://') + this.domain() + this.path(); |
| + } |
| + |
| /** |
| * @param {number} size |
| */ |
| @@ -339,7 +343,7 @@ SDK.Cookie = class { |
| /** |
| * @param {string} key |
| - * @param {string=} value |
| + * @param {string|number=} value |
|
allada
2016/12/15 23:45:52
I have some code that is going to be changing this
|
| */ |
| addAttribute(key, value) { |
| this._attributes[key.toLowerCase()] = value; |
| @@ -349,8 +353,19 @@ SDK.Cookie = class { |
| * @param {function(?Protocol.Error)=} callback |
| */ |
| remove(callback) { |
| - this._target.networkAgent().deleteCookie( |
| - this.name(), (this.secure() ? 'https://' : 'http://') + this.domain() + this.path(), callback); |
| + this._target.networkAgent().deleteCookie(this.name(), this.url(), callback); |
| + } |
| + |
| + /** |
| + * @param {function(?Protocol.Error, boolean)=} callback |
| + */ |
| + save(callback) { |
| + var domain = this.domain(); |
| + // for cookies targeting single domain and no sub domains 'domain' field should be sent empty |
|
allada
2016/12/15 23:45:52
I would suggest removing this code as it is not re
|
| + if (!domain.startsWith('.')) |
| + domain = ''; |
| + this._target.networkAgent().setCookie(this.url(), this.name(), this.value(), domain, this.path(), this.secure(), |
| + this.httpOnly(), this.sameSite(), this.expires(), callback); |
| } |
| }; |