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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/components_lazy/CookiesTable.js

Issue 1615773005: Rename first-party-only cookies to same-site cookies. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Tests. Created 4 years, 10 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2009 Apple Inc. All rights reserved.
3 * Copyright (C) 2009 Joseph Pecoraro 3 * Copyright (C) 2009 Joseph Pecoraro
4 * Copyright (C) 2010 Google Inc. All rights reserved. 4 * Copyright (C) 2010 Google Inc. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 9 *
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 44
45 var columns = [ 45 var columns = [
46 {id: "name", title: WebInspector.UIString("Name"), sortable: true, discl osure: expandable, sort: WebInspector.DataGrid.Order.Ascending, longText: true, weight: 24}, 46 {id: "name", title: WebInspector.UIString("Name"), sortable: true, discl osure: expandable, sort: WebInspector.DataGrid.Order.Ascending, longText: true, weight: 24},
47 {id: "value", title: WebInspector.UIString("Value"), sortable: true, lon gText: true, weight: 34}, 47 {id: "value", title: WebInspector.UIString("Value"), sortable: true, lon gText: true, weight: 34},
48 {id: "domain", title: WebInspector.UIString("Domain"), sortable: true, w eight: 7}, 48 {id: "domain", title: WebInspector.UIString("Domain"), sortable: true, w eight: 7},
49 {id: "path", title: WebInspector.UIString("Path"), sortable: true, weigh t: 7}, 49 {id: "path", title: WebInspector.UIString("Path"), sortable: true, weigh t: 7},
50 {id: "expires", title: WebInspector.UIString("Expires / Max-Age"), sorta ble: true, weight: 7}, 50 {id: "expires", title: WebInspector.UIString("Expires / Max-Age"), sorta ble: true, weight: 7},
51 {id: "size", title: WebInspector.UIString("Size"), sortable: true, align : WebInspector.DataGrid.Align.Right, weight: 7}, 51 {id: "size", title: WebInspector.UIString("Size"), sortable: true, align : WebInspector.DataGrid.Align.Right, weight: 7},
52 {id: "httpOnly", title: WebInspector.UIString("HTTP"), sortable: true, a lign: WebInspector.DataGrid.Align.Center, weight: 7}, 52 {id: "httpOnly", title: WebInspector.UIString("HTTP"), sortable: true, a lign: WebInspector.DataGrid.Align.Center, weight: 7},
53 {id: "secure", title: WebInspector.UIString("Secure"), sortable: true, a lign: WebInspector.DataGrid.Align.Center, weight: 7}, 53 {id: "secure", title: WebInspector.UIString("Secure"), sortable: true, a lign: WebInspector.DataGrid.Align.Center, weight: 7},
54 {id: "firstPartyOnly", title: WebInspector.UIString("First-Party"), sort able: true, align: WebInspector.DataGrid.Align.Center, weight: 7} 54 {id: "sameSite", title: WebInspector.UIString("Same-Site"), sortable: tr ue, align: WebInspector.DataGrid.Align.Center, weight: 7}
55 ]; 55 ];
56 56
57 if (readOnly) 57 if (readOnly)
58 this._dataGrid = new WebInspector.DataGrid(columns); 58 this._dataGrid = new WebInspector.DataGrid(columns);
59 else 59 else
60 this._dataGrid = new WebInspector.DataGrid(columns, undefined, this._onD eleteCookie.bind(this), refreshCallback, this._onContextMenu.bind(this)); 60 this._dataGrid = new WebInspector.DataGrid(columns, undefined, this._onD eleteCookie.bind(this), refreshCallback, this._onContextMenu.bind(this));
61 61
62 this._dataGrid.setName("cookiesTable"); 62 this._dataGrid.setName("cookiesTable");
63 this._dataGrid.addEventListener(WebInspector.DataGrid.Events.SortingChanged, this._rebuildTable, this); 63 this._dataGrid.addEventListener(WebInspector.DataGrid.Events.SortingChanged, this._rebuildTable, this);
64 64
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 }, 137 },
138 138
139 _rebuildTable: function() 139 _rebuildTable: function()
140 { 140 {
141 var selectedCookie = this._nextSelectedCookie || this.selectedCookie(); 141 var selectedCookie = this._nextSelectedCookie || this.selectedCookie();
142 this._nextSelectedCookie = null; 142 this._nextSelectedCookie = null;
143 this._dataGrid.rootNode().removeChildren(); 143 this._dataGrid.rootNode().removeChildren();
144 for (var i = 0; i < this._data.length; ++i) { 144 for (var i = 0; i < this._data.length; ++i) {
145 var item = this._data[i]; 145 var item = this._data[i];
146 if (item.folderName) { 146 if (item.folderName) {
147 var groupData = {name: item.folderName, value: "", domain: "", p ath: "", expires: "", size: this._totalSize(item.cookies), httpOnly: "", secure: "", firstPartyOnly: ""}; 147 var groupData = {name: item.folderName, value: "", domain: "", p ath: "", expires: "", size: this._totalSize(item.cookies), httpOnly: "", secure: "", sameSite: ""};
148 var groupNode = new WebInspector.DataGridNode(groupData); 148 var groupNode = new WebInspector.DataGridNode(groupData);
149 groupNode.selectable = true; 149 groupNode.selectable = true;
150 this._dataGrid.rootNode().appendChild(groupNode); 150 this._dataGrid.rootNode().appendChild(groupNode);
151 groupNode.element().classList.add("row-group"); 151 groupNode.element().classList.add("row-group");
152 this._populateNode(groupNode, item.cookies, selectedCookie); 152 this._populateNode(groupNode, item.cookies, selectedCookie);
153 groupNode.expand(); 153 groupNode.expand();
154 } else 154 } else
155 this._populateNode(this._dataGrid.rootNode(), item.cookies, sele ctedCookie); 155 this._populateNode(this._dataGrid.rootNode(), item.cookies, sele ctedCookie);
156 } 156 }
157 }, 157 },
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 var comparator; 220 var comparator;
221 switch (this._dataGrid.sortColumnIdentifier()) { 221 switch (this._dataGrid.sortColumnIdentifier()) {
222 case "name": comparator = compareTo.bind(null, WebInspector.Cookie.p rototype.name); break; 222 case "name": comparator = compareTo.bind(null, WebInspector.Cookie.p rototype.name); break;
223 case "value": comparator = compareTo.bind(null, WebInspector.Cookie. prototype.value); break; 223 case "value": comparator = compareTo.bind(null, WebInspector.Cookie. prototype.value); break;
224 case "domain": comparator = compareTo.bind(null, WebInspector.Cookie .prototype.domain); break; 224 case "domain": comparator = compareTo.bind(null, WebInspector.Cookie .prototype.domain); break;
225 case "path": comparator = compareTo.bind(null, WebInspector.Cookie.p rototype.path); break; 225 case "path": comparator = compareTo.bind(null, WebInspector.Cookie.p rototype.path); break;
226 case "expires": comparator = expiresCompare; break; 226 case "expires": comparator = expiresCompare; break;
227 case "size": comparator = numberCompare.bind(null, WebInspector.Cook ie.prototype.size); break; 227 case "size": comparator = numberCompare.bind(null, WebInspector.Cook ie.prototype.size); break;
228 case "httpOnly": comparator = compareTo.bind(null, WebInspector.Cook ie.prototype.httpOnly); break; 228 case "httpOnly": comparator = compareTo.bind(null, WebInspector.Cook ie.prototype.httpOnly); break;
229 case "secure": comparator = compareTo.bind(null, WebInspector.Cookie .prototype.secure); break; 229 case "secure": comparator = compareTo.bind(null, WebInspector.Cookie .prototype.secure); break;
230 case "firstPartyOnly": comparator = compareTo.bind(null, WebInspecto r.Cookie.prototype.firstPartyOnly); break; 230 case "sameSite": comparator = compareTo.bind(null, WebInspector.Cook ie.prototype.sameSite); break;
231 default: compareTo.bind(null, WebInspector.Cookie.prototype.name); 231 default: compareTo.bind(null, WebInspector.Cookie.prototype.name);
232 } 232 }
233 233
234 cookies.sort(comparator); 234 cookies.sort(comparator);
235 }, 235 },
236 236
237 /** 237 /**
238 * @param {!WebInspector.Cookie} cookie 238 * @param {!WebInspector.Cookie} cookie
239 * @return {!WebInspector.DataGridNode} 239 * @return {!WebInspector.DataGridNode}
240 */ 240 */
(...skipping 13 matching lines...) Expand all
254 data.expires = Number.secondsToString(parseInt(cookie.maxAge(), 10)); 254 data.expires = Number.secondsToString(parseInt(cookie.maxAge(), 10));
255 else if (cookie.expires()) 255 else if (cookie.expires())
256 data.expires = new Date(cookie.expires()).toISOString(); 256 data.expires = new Date(cookie.expires()).toISOString();
257 else 257 else
258 data.expires = WebInspector.UIString("Session"); 258 data.expires = WebInspector.UIString("Session");
259 } 259 }
260 data.size = cookie.size(); 260 data.size = cookie.size();
261 const checkmark = "\u2713"; 261 const checkmark = "\u2713";
262 data.httpOnly = (cookie.httpOnly() ? checkmark : ""); 262 data.httpOnly = (cookie.httpOnly() ? checkmark : "");
263 data.secure = (cookie.secure() ? checkmark : ""); 263 data.secure = (cookie.secure() ? checkmark : "");
264 data.firstPartyOnly = (cookie.firstPartyOnly() ? checkmark : ""); 264 data.sameSite = (cookie.sameSite() ? checkmark : "");
265 265
266 var node = new WebInspector.DataGridNode(data); 266 var node = new WebInspector.DataGridNode(data);
267 node.cookie = cookie; 267 node.cookie = cookie;
268 node.selectable = true; 268 node.selectable = true;
269 return node; 269 return node;
270 }, 270 },
271 271
272 _onDeleteCookie: function(node) 272 _onDeleteCookie: function(node)
273 { 273 {
274 var cookie = node.cookie; 274 var cookie = node.cookie;
275 var neighbour = node.traverseNextNode() || node.traversePreviousNode(); 275 var neighbour = node.traverseNextNode() || node.traversePreviousNode();
276 if (neighbour) 276 if (neighbour)
277 this._nextSelectedCookie = neighbour.cookie; 277 this._nextSelectedCookie = neighbour.cookie;
278 cookie.remove(); 278 cookie.remove();
279 this._refresh(); 279 this._refresh();
280 }, 280 },
281 281
282 _refresh: function() 282 _refresh: function()
283 { 283 {
284 if (this._refreshCallback) 284 if (this._refreshCallback)
285 this._refreshCallback(); 285 this._refreshCallback();
286 }, 286 },
287 287
288 __proto__: WebInspector.VBox.prototype 288 __proto__: WebInspector.VBox.prototype
289 } 289 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698