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

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

Issue 2550213002: [DevTools] Fix Cookie Sort (Closed)
Patch Set: test feedback 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
« no previous file with comments | « third_party/WebKit/LayoutTests/inspector/components/cookies-table-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 efa8d8f82294463ea6c3b4cd018254fad137ef07..9fe4e6de1f9ff5d36fdb52d5d44006d2783d7b5c 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
@@ -211,13 +211,21 @@ Components.CookiesTable = class extends UI.VBox {
var sortDirection = this._dataGrid.isSortOrderAscending() ? 1 : -1;
/**
+ * @param {!SDK.Cookie} cookie
+ * @param {string} property
+ * @return {string}
+ */
+ function getValue(cookie, property) {
+ return typeof cookie[property] === 'function' ? String(cookie[property]()) : String(cookie.name());
+ }
+
+ /**
* @param {string} property
* @param {!SDK.Cookie} cookie1
* @param {!SDK.Cookie} cookie2
*/
function compareTo(property, cookie1, cookie2) {
- return sortDirection *
- (String(cookie1[property] || cookie1['name'])).compareTo(String(cookie2[property] || cookie2['name']));
+ return sortDirection * getValue(cookie1, property).compareTo(getValue(cookie2, property));
}
/**
« no previous file with comments | « third_party/WebKit/LayoutTests/inspector/components/cookies-table-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698