Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(699)

Unified Diff: third_party/WebKit/Source/devtools/front_end/sdk/CookieParser.js

Issue 2567873002: DevTools: Add ability to add and edit cookies (Closed)
Patch Set: Add front-end validation. Add `startEditingNextEditableColumnOfDataGridNode` method to DataGrid. Fi… Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);
}
};

Powered by Google App Engine
This is Rietveld 408576698