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

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

Issue 2215773002: Add ability to add/edit cookie in Chrome Dev Tool (front-end) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Manage cookie flags from the context menu Created 4 years, 4 months 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 ac604a7705180aa798410af82aafd6c1d1a7ac30..54363764042490632a033da926ad00bff0ac2556 100644
--- a/third_party/WebKit/Source/devtools/front_end/sdk/CookieParser.js
+++ b/third_party/WebKit/Source/devtools/front_end/sdk/CookieParser.js
@@ -258,7 +258,7 @@ WebInspector.Cookie.prototype = {
},
/**
- * @return {string}
+ * @return {!NetworkAgent.CookieSameSite<string>}
*/
sameSite: function()
{
@@ -300,7 +300,7 @@ WebInspector.Cookie.prototype = {
},
/**
- * @return {string}
+ * @return {number}
*/
expires: function()
{
@@ -324,6 +324,14 @@ WebInspector.Cookie.prototype = {
},
/**
+ * @return {string}
+ */
+ url: function()
+ {
+ return (this.secure() ? "https://" : "http://") + this.domain() + this.path();
+ },
+
+ /**
* @param {number} size
*/
setSize: function(size)
@@ -358,7 +366,7 @@ WebInspector.Cookie.prototype = {
/**
* @param {string} key
- * @param {string=} value
+ * @param {string|number=} value
*/
addAttribute: function(key, value)
{
@@ -370,7 +378,16 @@ WebInspector.Cookie.prototype = {
*/
remove: function(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);
+ },
+
+ save: function(callback)
+ {
+ var domain = this.domain();
+ // for cookies targeting single domain and no sub domains 'domain' field should be sent empty
+ 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);
}
}

Powered by Google App Engine
This is Rietveld 408576698