зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1441817 - Fix Error when console.count packet is incomplete; r=miker.
This currently happens in the browser console. The packet we receive for console.count calls does not have the counter property which we usually consume to display the counter label and data. Here we prevent adding such messages, before a follow-up fix which should be about adding those information in the packet. For the record, it was not working either in the old frontend. MozReview-Commit-ID: 1SiFgAHIziI --HG-- extra : rebase_source : 46eb71dc69acf56df6577ebbb396365d395ae62a
This commit is contained in:
Родитель
ae03d9587c
Коммит
62b397f04c
|
@ -568,6 +568,18 @@ describe("Message reducer:", () => {
|
|||
const dirxmlMessage = getLastMessage(getState());
|
||||
expect(dirxmlMessage.level).toEqual(MESSAGE_TYPE.LOG);
|
||||
});
|
||||
|
||||
it("does not throw when adding incomplete console.count packet", () => {
|
||||
const { dispatch, getState } = setupStore();
|
||||
const packet = clonePacket(stubPackets.get(`console.count('bar')`));
|
||||
|
||||
// Remove counter information to mimick packet we receive in the browser console.
|
||||
delete packet.message.counter;
|
||||
|
||||
dispatch(actions.messagesAdd([packet]));
|
||||
// The message should not be added to the state.
|
||||
expect(getAllMessagesById(getState()).size).toBe(0);
|
||||
});
|
||||
});
|
||||
|
||||
describe("expandedMessageIds", () => {
|
||||
|
|
|
@ -86,9 +86,15 @@ function transformConsoleAPICallPacket(packet) {
|
|||
// Chrome RDP doesn't have a special type for count.
|
||||
type = MESSAGE_TYPE.LOG;
|
||||
let {counter} = message;
|
||||
let label = counter.label ? counter.label : l10n.getStr("noCounterLabel");
|
||||
messageText = `${label}: ${counter.count}`;
|
||||
parameters = null;
|
||||
|
||||
if (!counter) {
|
||||
// We don't show anything if we don't have counter data.
|
||||
type = MESSAGE_TYPE.NULL_MESSAGE;
|
||||
} else {
|
||||
let label = counter.label ? counter.label : l10n.getStr("noCounterLabel");
|
||||
messageText = `${label}: ${counter.count}`;
|
||||
parameters = null;
|
||||
}
|
||||
break;
|
||||
case "time":
|
||||
parameters = null;
|
||||
|
|
Загрузка…
Ссылка в новой задаче