Chromium Code Reviews| Index: third_party/WebKit/Source/devtools/front_end/components_lazy/CookiesTable.js |
| diff --git a/third_party/WebKit/Source/devtools/front_end/components_lazy/CookiesTable.js b/third_party/WebKit/Source/devtools/front_end/components_lazy/CookiesTable.js |
| index 4017093594261f4b3c8394e76c4e44ad1e8fcab8..7614ba7a8e4a031a6e63fc9016447274a9213948 100644 |
| --- a/third_party/WebKit/Source/devtools/front_end/components_lazy/CookiesTable.js |
| +++ b/third_party/WebKit/Source/devtools/front_end/components_lazy/CookiesTable.js |
| @@ -193,9 +193,15 @@ WebInspector.CookiesTable.prototype = { |
| { |
| var sortDirection = this._dataGrid.isSortOrderAscending() ? 1 : -1; |
| - function compareTo(getter, cookie1, cookie2) |
| + /** |
| + * @param {string} property |
| + * @param {!WebInspector.Cookie} cookie1 |
| + * @param {!WebInspector.Cookie} cookie2 |
| + */ |
| + function compareTo(property, cookie1, cookie2) |
| { |
| - return sortDirection * (getter.apply(cookie1) + "").compareTo(getter.apply(cookie2) + ""); |
| + return sortDirection * (String(cookie1[property] || cookie1["name"])).compareTo( |
| + String(cookie2[property] || cookie2["name"])); |
| } |
| function numberCompare(getter, cookie1, cookie2) |
| @@ -219,18 +225,10 @@ WebInspector.CookiesTable.prototype = { |
| } |
| var comparator; |
| - switch (this._dataGrid.sortColumnId()) { |
| - case "name": comparator = compareTo.bind(null, WebInspector.Cookie.prototype.name); break; |
| - case "value": comparator = compareTo.bind(null, WebInspector.Cookie.prototype.value); break; |
| - case "domain": comparator = compareTo.bind(null, WebInspector.Cookie.prototype.domain); break; |
| - case "path": comparator = compareTo.bind(null, WebInspector.Cookie.prototype.path); break; |
| - case "expires": comparator = expiresCompare; break; |
| - case "size": comparator = numberCompare.bind(null, WebInspector.Cookie.prototype.size); break; |
|
dgozman
2016/11/01 00:04:07
numberCompare!
|
| - case "httpOnly": comparator = compareTo.bind(null, WebInspector.Cookie.prototype.httpOnly); break; |
| - case "secure": comparator = compareTo.bind(null, WebInspector.Cookie.prototype.secure); break; |
| - case "sameSite": comparator = compareTo.bind(null, WebInspector.Cookie.prototype.sameSite); break; |
| - default: compareTo.bind(null, WebInspector.Cookie.prototype.name); |
| - } |
| + if (this._dataGrid.sortColumnId() === "expires") |
| + comparator = expiresCompare; |
| + else |
| + compareTo.bind(null, this._dataGrid.sortColumnId()); |
|
dgozman
2016/11/01 00:04:07
comparator =
|
| cookies.sort(comparator); |
| }, |