| Index: Source/devtools/front_end/resources/DirectoryContentView.js
|
| diff --git a/Source/devtools/front_end/resources/DirectoryContentView.js b/Source/devtools/front_end/resources/DirectoryContentView.js
|
| index 0719f8a7f8456452be32889f081748904c4da39f..33dec38c5ae2c6723a845e691bc0499f313a4066 100644
|
| --- a/Source/devtools/front_end/resources/DirectoryContentView.js
|
| +++ b/Source/devtools/front_end/resources/DirectoryContentView.js
|
| @@ -69,8 +69,10 @@ WebInspector.DirectoryContentView.prototype = {
|
|
|
| _sort: function()
|
| {
|
| - var column = /** @type {string} */ (this.sortColumnIdentifier());
|
| - this.sortNodes(WebInspector.DirectoryContentView.Node.comparator(column, !this.isSortOrderAscending()), false);
|
| + var column = this.sortColumnIdentifier();
|
| + if (!column)
|
| + return;
|
| + this.sortNodes(WebInspector.DirectoryContentView.Node.comparator(column), !this.isSortOrderAscending());
|
| },
|
|
|
| __proto__: WebInspector.DataGrid.prototype
|
| @@ -100,12 +102,10 @@ WebInspector.DirectoryContentView.Node = function(entry)
|
|
|
| /**
|
| * @param {string} column
|
| - * @param {boolean} reverse
|
| - * @return {function(!WebInspector.DirectoryContentView.Node, !WebInspector.DirectoryContentView.Node):number|undefined}
|
| + * @return {function(!WebInspector.DataGridNode, !WebInspector.DataGridNode):number}
|
| */
|
| -WebInspector.DirectoryContentView.Node.comparator = function(column, reverse)
|
| +WebInspector.DirectoryContentView.Node.comparator = function(column)
|
| {
|
| - var reverseFactor = reverse ? -1 : 1;
|
| const indexes = WebInspector.DirectoryContentView.columnIndexes;
|
|
|
| switch (column) {
|
| @@ -130,6 +130,8 @@ WebInspector.DirectoryContentView.Node.comparator = function(column, reverse)
|
| {
|
| return isDirectoryCompare(x, y) || modificationTimeCompare(x, y) || nameCompare(x, y);
|
| };
|
| + default:
|
| + return WebInspector.DataGrid.TrivialComparator;
|
| }
|
|
|
| function isDirectoryCompare(x, y)
|
| @@ -141,22 +143,22 @@ WebInspector.DirectoryContentView.Node.comparator = function(column, reverse)
|
|
|
| function nameCompare(x, y)
|
| {
|
| - return reverseFactor * x._entry.name.compareTo(y._entry.name);
|
| + return x._entry.name.compareTo(y._entry.name);
|
| }
|
|
|
| function typeCompare(x, y)
|
| {
|
| - return reverseFactor * (x._entry.mimeType || "").compareTo(y._entry.mimeType || "");
|
| + return (x._entry.mimeType || "").compareTo(y._entry.mimeType || "");
|
| }
|
|
|
| function sizeCompare(x, y)
|
| {
|
| - return reverseFactor * ((x._metadata ? x._metadata.size : 0) - (y._metadata ? y._metadata.size : 0));
|
| + return ((x._metadata ? x._metadata.size : 0) - (y._metadata ? y._metadata.size : 0));
|
| }
|
|
|
| function modificationTimeCompare(x, y)
|
| {
|
| - return reverseFactor * ((x._metadata ? x._metadata.modificationTime : 0) - (y._metadata ? y._metadata.modificationTime : 0));
|
| + return ((x._metadata ? x._metadata.modificationTime : 0) - (y._metadata ? y._metadata.modificationTime : 0));
|
| }
|
| }
|
|
|
|
|