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..09705303bcd7e0b1f4758a6a1ef6e0981936eae9 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>} |
| */ |
| sameSite() { |
| return this._attributes['samesite']; |
| @@ -287,7 +287,7 @@ SDK.Cookie = class { |
| } |
| /** |
| - * @return {string} |
| + * @return {number} |
| */ |
| 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 |
| */ |
| 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)=} callback |
| + */ |
| + save(callback) { |
| + var domain = this.domain(); |
| + // for cookies targeting single domain and no sub domains 'domain' field should be sent empty |
| + if (!domain.startsWith('.')) |
|
kdzwinel
2016/12/11 22:07:07
@allada:
phulce
2016/12/12 17:58:40
really? that sounds kinda broken :/
|
| + domain = ''; |
| + this._target.networkAgent().setCookie(this.url(), this.name(), this.value(), domain, this.path(), this.secure(), |
| + this.httpOnly(), this.sameSite(), this.expires(), callback); |
| } |
| }; |