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

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

Issue 2550213002: [DevTools] Fix Cookie Sort (Closed)
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 return totalSize; 204 return totalSize;
205 } 205 }
206 206
207 /** 207 /**
208 * @param {!Array.<!SDK.Cookie>} cookies 208 * @param {!Array.<!SDK.Cookie>} cookies
209 */ 209 */
210 _sortCookies(cookies) { 210 _sortCookies(cookies) {
211 var sortDirection = this._dataGrid.isSortOrderAscending() ? 1 : -1; 211 var sortDirection = this._dataGrid.isSortOrderAscending() ? 1 : -1;
212 212
213 /** 213 /**
214 * @param {!SDK.Cookie} cookie
215 * @param {string} property
216 * @return {string} Value of the property or `name` if no such property exis ts
dgozman 2016/12/06 01:35:00 We don't describe the return value, just mention t
217 */
218 function getValue(cookie, property) {
219 return typeof cookie[property] === 'function' ? String(cookie[property]()) : String(cookie.name());
220 }
221
222 /**
214 * @param {string} property 223 * @param {string} property
215 * @param {!SDK.Cookie} cookie1 224 * @param {!SDK.Cookie} cookie1
216 * @param {!SDK.Cookie} cookie2 225 * @param {!SDK.Cookie} cookie2
217 */ 226 */
218 function compareTo(property, cookie1, cookie2) { 227 function compareTo(property, cookie1, cookie2) {
219 return sortDirection * 228 return sortDirection * getValue(cookie1, property).compareTo(getValue(cook ie2, property));
220 (String(cookie1[property] || cookie1['name'])).compareTo(String(cookie 2[property] || cookie2['name']));
221 } 229 }
222 230
223 /** 231 /**
224 * @param {!SDK.Cookie} cookie1 232 * @param {!SDK.Cookie} cookie1
225 * @param {!SDK.Cookie} cookie2 233 * @param {!SDK.Cookie} cookie2
226 */ 234 */
227 function numberCompare(cookie1, cookie2) { 235 function numberCompare(cookie1, cookie2) {
228 return sortDirection * (cookie1.size() - cookie2.size()); 236 return sortDirection * (cookie1.size() - cookie2.size());
229 } 237 }
230 238
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 this._nextSelectedCookie = neighbour.cookie; 306 this._nextSelectedCookie = neighbour.cookie;
299 cookie.remove(); 307 cookie.remove();
300 this._refresh(); 308 this._refresh();
301 } 309 }
302 310
303 _refresh() { 311 _refresh() {
304 if (this._refreshCallback) 312 if (this._refreshCallback)
305 this._refreshCallback(); 313 this._refreshCallback();
306 } 314 }
307 }; 315 };
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698