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 118b790caf17b8b40b0319b7bd598ef44427c787..6bb620e1b1d10a7912a5ddfb39ee63ac678e3951 100644 |
| --- a/third_party/WebKit/Source/devtools/front_end/sdk/CookieParser.js |
| +++ b/third_party/WebKit/Source/devtools/front_end/sdk/CookieParser.js |
| @@ -250,10 +250,11 @@ SDK.Cookie = class { |
| } |
| /** |
| - * @return {string} |
| + * @return {!Protocol.Network.CookieSameSite} |
| */ |
| sameSite() { |
| - return this._attributes['samesite']; |
| + // TODO(allada) This should not rely on _attributes and instead store them individually. |
| + return /** @type {!Protocol.Network.CookieSameSite} */ (this._attributes['samesite']); |
| } |
| /** |
| @@ -287,7 +288,7 @@ SDK.Cookie = class { |
| } |
| /** |
| - * @return {string} |
| + * @return {number} |
| */ |
| expires() { |
| return this._attributes['expires']; |
| @@ -307,6 +308,10 @@ SDK.Cookie = class { |
| return this._size; |
| } |
| + url() { |
| + return (this.secure() ? 'https://' : 'http://') + this.domain() + this.path(); |
| + } |
| + |
| /** |
| * @param {number} size |
| */ |
| @@ -349,8 +354,21 @@ 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 |
|
dgozman
2017/01/20 01:54:51
You should swallow Protocol.Error in this method,
|
| + */ |
| + save(callback) { |
| + var domain = this.domain(); |
| + if (!domain.startsWith('.')) |
| + domain = ''; |
| + var expires = undefined; |
| + if (this.expires()) |
| + expires = Math.floor(Date.parse(this.expires()) / 1000); |
| + this._target.networkAgent().setCookie(this.url(), this.name(), this.value(), domain, this.path(), this.secure(), |
| + this.httpOnly(), this.sameSite(), expires, callback); |
| } |
| }; |