Bug 1417446 - Remove MESSAGE_ADD action;r=bgrins.

This action is not used anywhere since we batch messages and thus use MESSAGES_ADD action.
The tests that were using it now use messagesAdd.

MozReview-Commit-ID: 9DvyrpR4ocC

--HG--
extra : rebase_source : 34d374cff5dddbe27652e6144df989617edc816f
extra : source : 5920bc28fb0437149ab789081d64db38ea183f41
This commit is contained in:
Nicolas Chevobbe 2018-01-10 15:53:46 +01:00
parent 7ab0b8fca5
commit 2b0630b677
6 changed files with 11 additions and 38 deletions

View File

@ -13,7 +13,6 @@ const { IdGenerator } = require("devtools/client/webconsole/new-console-output/u
const { batchActions } = require("devtools/client/shared/redux/middleware/debounce");
const {
MESSAGE_ADD,
MESSAGES_ADD,
NETWORK_MESSAGE_UPDATE,
NETWORK_UPDATE_REQUEST,
@ -51,25 +50,6 @@ function messagesAdd(packets, idGenerator = null) {
};
}
function messageAdd(packet, idGenerator = null) {
if (idGenerator == null) {
idGenerator = defaultIdGenerator;
}
let message = prepareMessage(packet, idGenerator);
const addMessageAction = {
type: MESSAGE_ADD,
message
};
if (message.type === MESSAGE_TYPE.CLEAR) {
return batchActions([
messagesClear(),
addMessageAction,
]);
}
return addMessageAction;
}
function messagesClear() {
return {
type: MESSAGES_CLEAR
@ -142,7 +122,6 @@ function networkUpdateRequest(id, data) {
}
module.exports = {
messageAdd,
messagesAdd,
messagesClear,
messageOpen,

View File

@ -13,7 +13,6 @@ const actionTypes = {
FILTER_TOGGLE: "FILTER_TOGGLE",
FILTERS_CLEAR: "FILTERS_CLEAR",
INITIALIZE: "INITIALIZE",
MESSAGE_ADD: "MESSAGE_ADD",
MESSAGE_CLOSE: "MESSAGE_CLOSE",
MESSAGE_OPEN: "MESSAGE_OPEN",
MESSAGE_TABLE_RECEIVE: "MESSAGE_TABLE_RECEIVE",

View File

@ -197,10 +197,6 @@ function messages(state = MessageState(), action, filtersState, prefsState) {
return limitTopLevelMessageCount(newState, logLimit);
case constants.MESSAGE_ADD:
newState = addMessage(state, filtersState, prefsState, action.message);
return limitTopLevelMessageCount(newState, logLimit);
case constants.MESSAGES_CLEAR:
return MessageState({
// Store all actors from removed messages. This array is used by

View File

@ -16,7 +16,6 @@ const {
BATCH_ACTIONS
} = require("devtools/client/shared/redux/middleware/debounce");
const {
MESSAGE_ADD,
MESSAGE_OPEN,
MESSAGES_ADD,
MESSAGES_CLEAR,
@ -133,7 +132,7 @@ function enableActorReleaser(hud) {
let type = action.type;
let proxy = hud ? hud.proxy : null;
if (proxy && ([MESSAGE_ADD, MESSAGES_ADD, MESSAGES_CLEAR].includes(type))) {
if (proxy && ([MESSAGES_ADD, MESSAGES_CLEAR].includes(type))) {
releaseActors(state.messages.removedActors, proxy);
// Reset `removedActors` in message reducer.

View File

@ -71,20 +71,20 @@ describe("Release actor enhancer:", () => {
}, { logLimit });
// Add a log message.
dispatch(actions.messageAdd(
stubPackets.get("console.log('myarray', ['red', 'green', 'blue'])")));
dispatch(actions.messagesAdd([
stubPackets.get("console.log('myarray', ['red', 'green', 'blue'])")]));
const firstMessage = getFirstMessage(getState());
const firstMessageActor = firstMessage.parameters[1].actor;
// Add an evaluation result message (see Bug 1408321).
const evaluationResultPacket = stubPackets.get("new Date(0)");
dispatch(actions.messageAdd(evaluationResultPacket));
dispatch(actions.messagesAdd([evaluationResultPacket]));
const secondMessageActor = evaluationResultPacket.result.actor;
// Add an assertion message.
const assertPacket = stubPackets.get("console.assert(false, {message: 'foobar'})");
dispatch(actions.messageAdd(assertPacket));
dispatch(actions.messagesAdd([assertPacket]));
const thirdMessageActor = assertPacket.message.arguments[0].actor;
// Add ${logLimit} messages so we prune the ones we added before.

View File

@ -20,7 +20,7 @@ describe("Testing UI", () => {
it("sidebar is toggled on and off", () => {
const packet = stubPackets.get("inspect({a: 1})");
const message = stubPreparedMessages.get("inspect({a: 1})");
store.dispatch(actions.messageAdd(packet));
store.dispatch(actions.messagesAdd([packet]));
const actorId = message.parameters[0].actor;
const messageId = getFirstMessage(store.getState()).id;
@ -36,7 +36,7 @@ describe("Testing UI", () => {
it("sidebar is hidden on clear", () => {
const packet = stubPackets.get("inspect({a: 1})");
const message = stubPreparedMessages.get("inspect({a: 1})");
store.dispatch(actions.messageAdd(packet));
store.dispatch(actions.messagesAdd([packet]));
const actorId = message.parameters[0].actor;
const messageId = getFirstMessage(store.getState()).id;
@ -54,7 +54,7 @@ describe("Testing UI", () => {
it("sidebar is shown with correct object", () => {
const packet = stubPackets.get("inspect({a: 1})");
const message = stubPreparedMessages.get("inspect({a: 1})");
store.dispatch(actions.messageAdd(packet));
store.dispatch(actions.messagesAdd([packet]));
const actorId = message.parameters[0].actor;
const messageId = getFirstMessage(store.getState()).id;
@ -67,7 +67,7 @@ describe("Testing UI", () => {
it("sidebar is not updated for the same object", () => {
const packet = stubPackets.get("inspect({a: 1})");
const message = stubPreparedMessages.get("inspect({a: 1})");
store.dispatch(actions.messageAdd(packet));
store.dispatch(actions.messagesAdd([packet]));
const actorId = message.parameters[0].actor;
const messageId = getFirstMessage(store.getState()).id;
@ -84,7 +84,7 @@ describe("Testing UI", () => {
it("sidebar shown and updated for new object", () => {
const packet = stubPackets.get("inspect({a: 1})");
const message = stubPreparedMessages.get("inspect({a: 1})");
store.dispatch(actions.messageAdd(packet));
store.dispatch(actions.messagesAdd([packet]));
const actorId = message.parameters[0].actor;
const messageId = getFirstMessage(store.getState()).id;
@ -95,7 +95,7 @@ describe("Testing UI", () => {
const newPacket = stubPackets.get("new Date(0)");
const newMessage = stubPreparedMessages.get("new Date(0)");
store.dispatch(actions.messageAdd(newPacket));
store.dispatch(actions.messagesAdd([newPacket]));
const newActorId = newMessage.parameters[0].actor;
const newMessageId = getLastMessage(store.getState()).id;