Bug 1307884 - Remove prune function; r=bgrins
MozReview-Commit-ID: B6VGrJOe0sk
--- a/devtools/client/webconsole/new-console-output/selectors/messages.js
+++ b/devtools/client/webconsole/new-console-output/selectors/messages.js
@@ -2,49 +2,44 @@
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const { l10n } = require("devtools/client/webconsole/new-console-output/utils/messages");
const { getAllFilters } = require("devtools/client/webconsole/new-console-output/selectors/filters");
-const { getLogLimit } = require("devtools/client/webconsole/new-console-output/selectors/prefs");
const { getGripPreviewItems } = require("devtools/client/shared/components/reps/reps");
const { getSourceNames } = require("devtools/client/shared/source-utils");
const {
MESSAGE_TYPE,
MESSAGE_SOURCE
} = require("devtools/client/webconsole/new-console-output/constants");
function getAllMessages(state) {
let messages = getAllMessagesById(state);
- let logLimit = getLogLimit(state);
let filters = getAllFilters(state);
let groups = getAllGroupsById(state);
let messagesUI = getAllMessagesUiById(state);
- return prune(
- messages.filter(message => {
- return (
- isInOpenedGroup(message, groups, messagesUI)
- && (
- isUnfilterable(message)
- || (
- matchLevelFilters(message, filters)
- && matchCssFilters(message, filters)
- && matchNetworkFilters(message, filters)
- && matchSearchFilters(message, filters)
- )
+ return messages.filter(message => {
+ return (
+ isInOpenedGroup(message, groups, messagesUI)
+ && (
+ isUnfilterable(message)
+ || (
+ matchLevelFilters(message, filters)
+ && matchCssFilters(message, filters)
+ && matchNetworkFilters(message, filters)
+ && matchSearchFilters(message, filters)
)
- );
- }),
- logLimit
- );
+ )
+ );
+ });
}
function getAllMessagesById(state) {
return state.messages.messagesById;
}
function getAllMessagesUiById(state) {
return state.messages.messagesUiById;
@@ -233,33 +228,13 @@ function getAllProps(grips) {
result = result.filter(grip =>
typeof grip != "object" &&
typeof grip != "undefined"
);
return [...new Set(result)];
}
-function prune(messages, logLimit) {
- let messageCount = messages.count();
- if (messageCount > logLimit) {
- // If the second non-pruned message is in a group,
- // we want to return the group as the first non-pruned message.
- let firstIndex = messages.size - logLimit;
- let groupId = messages.get(firstIndex + 1).groupId;
-
- if (groupId) {
- return messages.splice(0, firstIndex + 1)
- .unshift(
- messages.findLast((message) => message.id === groupId)
- );
- }
- return messages.splice(0, firstIndex);
- }
-
- return messages;
-}
-
exports.getAllMessages = getAllMessages;
exports.getAllMessagesUiById = getAllMessagesUiById;
exports.getAllMessagesTableDataById = getAllMessagesTableDataById;
exports.getAllGroupsById = getAllGroupsById;
exports.getCurrentGroup = getCurrentGroup;