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..d7666b9bc5bb41417d553a2c40fc263a4e64d5e5 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} Value of the property or `name` if no such property exists |
dgozman
2016/12/06 01:35:00
We don't describe the return value, just mention t
|
+ */ |
+ 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)); |
} |
/** |