Bug 1626286 - Assign the same timestamp to all WebConsole stubs. r=Honza.

Since we're going to re-order the packets in the webconsole messages
reducer based on the messages timestamps, the node tests are going
to fail, as stubs timeStamps are generated and we don't have much
control on them.
Assigning the same timestamp means we'll defer to order based on the
message id, which should follow the order of insertion. The only exception
is network messages, where the id needs to be the actor, which is a string.
For the tests that are using network messages and assert some order, we
simply reassign the timestamps so we can guarantee the order.

Differential Revision: https://phabricator.services.mozilla.com/D69966

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Nicolas Chevobbe 2020-04-08 13:50:23 +00:00
parent 5bbd5314ab
commit 738cfb9dd1
9 changed files with 328 additions and 321 deletions

View File

@ -25,280 +25,283 @@ function getCleanedPacket(key, packet) {
.replace(/\\\"/g, `\"`)
.replace(/\\\'/g, `\'`);
// If the stub already exist, we want to ignore irrelevant properties
// (actor, timeStamp, timer, ...) that might changed and "pollute"
// the diff resulting from this stub generation.
let res;
if (stubPackets.has(safeKey)) {
const existingPacket = stubPackets.get(safeKey);
res = Object.assign({}, packet, {
from: existingPacket.from,
});
cleanTimeStamp(packet);
// Clean root timestamp.
if (res.timestamp) {
res.timestamp = existingPacket.timestamp;
}
if (!stubPackets.has(safeKey)) {
return packet;
}
if (res.timeStamp) {
res.timeStamp = existingPacket.timeStamp;
}
// If the stub already exist, we want to ignore irrelevant properties (actor, timer, …)
// that might changed and "pollute" the diff resulting from this stub generation.
const existingPacket = stubPackets.get(safeKey);
const res = Object.assign({}, packet, {
from: existingPacket.from,
});
if (res.innerWindowID) {
res.innerWindowID = existingPacket.innerWindowID;
}
if (res.innerWindowID) {
res.innerWindowID = existingPacket.innerWindowID;
}
if (res.startedDateTime) {
res.startedDateTime = existingPacket.startedDateTime;
}
if (res.startedDateTime) {
res.startedDateTime = existingPacket.startedDateTime;
}
if (res.actor) {
res.actor = existingPacket.actor;
}
if (res.actor) {
res.actor = existingPacket.actor;
}
if (res.channelId) {
res.channelId = existingPacket.channelId;
}
if (res.channelId) {
res.channelId = existingPacket.channelId;
}
if (res.resultID) {
res.resultID = existingPacket.resultID;
}
if (res.resultID) {
res.resultID = existingPacket.resultID;
}
if (res.message) {
// Clean timeStamp on the message prop.
res.message.timeStamp = existingPacket.message.timeStamp;
if (res.message.timer) {
// Clean timer properties on the message.
// Those properties are found on console.time, timeLog and timeEnd calls,
// and those time can vary, which is why we need to clean them.
if ("duration" in res.message.timer) {
res.message.timer.duration = existingPacket.message.timer.duration;
}
}
// Clean innerWindowId on the message prop.
res.message.innerWindowID = existingPacket.message.innerWindowID;
if (Array.isArray(res.message.arguments)) {
res.message.arguments = res.message.arguments.map((argument, i) => {
if (!argument || typeof argument !== "object") {
return argument;
}
const newArgument = Object.assign({}, argument);
const existingArgument = existingPacket.message.arguments[i];
if (existingArgument && newArgument._grip) {
// Clean actor ids on each message.arguments item.
copyExistingActor(newArgument, existingArgument);
// `window`'s properties count can vary from OS to OS, so we
// clean the `ownPropertyLength` property from the grip.
if (newArgument._grip.class === "Window") {
newArgument._grip.ownPropertyLength =
existingArgument._grip.ownPropertyLength;
}
}
return newArgument;
});
}
if (res.message.sourceId) {
res.message.sourceId = existingPacket.message.sourceId;
}
if (Array.isArray(res.message.stacktrace)) {
res.message.stacktrace = res.message.stacktrace.map((frame, i) => {
const existingFrame = existingPacket.message.stacktrace[i];
if (frame && existingFrame && frame.sourceId) {
frame.sourceId = existingFrame.sourceId;
}
return frame;
});
if (res.message) {
if (res.message.timer) {
// Clean timer properties on the message.
// Those properties are found on console.time, timeLog and timeEnd calls,
// and those time can vary, which is why we need to clean them.
if ("duration" in res.message.timer) {
res.message.timer.duration = existingPacket.message.timer.duration;
}
}
// Clean innerWindowId on the message prop.
res.message.innerWindowID = existingPacket.message.innerWindowID;
if (res.result && res.result._grip && existingPacket.result) {
// Clean actor ids on evaluation result messages.
copyExistingActor(res.result, existingPacket.result);
if (res.result._grip.preview) {
if (res.result._grip.preview.timestamp) {
// Clean timestamp there too.
res.result._grip.preview.timestamp =
existingPacket.result._grip.preview.timestamp;
}
}
}
if (res.exception && existingPacket.exception) {
// Clean actor ids on exception messages.
copyExistingActor(res.exception, existingPacket.exception);
if (
res.exception._grip &&
res.exception._grip.preview &&
existingPacket.exception._grip &&
existingPacket.exception._grip.preview
) {
if (res.exception._grip.preview.timestamp) {
// Clean timestamp there too.
res.exception._grip.preview.timestamp =
existingPacket.exception._grip.preview.timestamp;
if (Array.isArray(res.message.arguments)) {
res.message.arguments = res.message.arguments.map((argument, i) => {
if (!argument || typeof argument !== "object") {
return argument;
}
if (
typeof res.exception._grip.preview.message === "object" &&
res.exception._grip.preview.message._grip.type === "longString" &&
typeof existingPacket.exception._grip.preview.message === "object" &&
existingPacket.exception._grip.preview.message._grip.type ===
"longString"
) {
copyExistingActor(
res.exception._grip.preview.message,
existingPacket.exception._grip.preview.message
);
}
}
const newArgument = Object.assign({}, argument);
const existingArgument = existingPacket.message.arguments[i];
if (
typeof res.exceptionMessage === "object" &&
res.exceptionMessage._grip &&
res.exceptionMessage._grip.type === "longString"
) {
copyExistingActor(
res.exceptionMessage,
existingPacket.exceptionMessage
);
}
}
if (existingArgument && newArgument._grip) {
// Clean actor ids on each message.arguments item.
copyExistingActor(newArgument, existingArgument);
if (res.eventActor) {
// Clean actor ids, timeStamp and startedDateTime on network messages.
res.eventActor.actor = existingPacket.eventActor.actor;
res.eventActor.startedDateTime =
existingPacket.eventActor.startedDateTime;
res.eventActor.timeStamp = existingPacket.eventActor.timeStamp;
}
if (res.pageError) {
// Clean timeStamp and innerWindowID on pageError messages.
res.pageError.timeStamp = existingPacket.pageError.timeStamp;
res.pageError.innerWindowID = existingPacket.pageError.innerWindowID;
if (
typeof res.pageError.errorMessage === "object" &&
res.pageError.errorMessage._grip &&
res.pageError.errorMessage._grip.type === "longString"
) {
copyExistingActor(
res.pageError.errorMessage,
existingPacket.pageError.errorMessage
);
}
if (res.pageError.sourceId) {
res.pageError.sourceId = existingPacket.pageError.sourceId;
}
if (Array.isArray(res.pageError.stacktrace)) {
res.pageError.stacktrace = res.pageError.stacktrace.map((frame, i) => {
const existingFrame = existingPacket.pageError.stacktrace[i];
if (frame && existingFrame && frame.sourceId) {
frame.sourceId = existingFrame.sourceId;
// `window`'s properties count can vary from OS to OS, so we
// clean the `ownPropertyLength` property from the grip.
if (newArgument._grip.class === "Window") {
newArgument._grip.ownPropertyLength =
existingArgument._grip.ownPropertyLength;
}
return frame;
});
}
}
return newArgument;
});
}
if (Array.isArray(res.exceptionStack)) {
res.exceptionStack = res.exceptionStack.map((frame, i) => {
const existingFrame = existingPacket.exceptionStack[i];
if (res.message.sourceId) {
res.message.sourceId = existingPacket.message.sourceId;
}
if (Array.isArray(res.message.stacktrace)) {
res.message.stacktrace = res.message.stacktrace.map((frame, i) => {
const existingFrame = existingPacket.message.stacktrace[i];
if (frame && existingFrame && frame.sourceId) {
frame.sourceId = existingFrame.sourceId;
}
return frame;
});
}
}
if (res.frame && existingPacket.frame) {
res.frame.sourceId = existingPacket.frame.sourceId;
}
if (res.result && res.result._grip && existingPacket.result) {
// Clean actor ids on evaluation result messages.
copyExistingActor(res.result, existingPacket.result);
}
if (res.packet) {
const override = {};
const keys = ["totalTime", "from", "contentSize", "transferredSize"];
keys.forEach(x => {
if (res.packet[x] !== undefined) {
override[x] = existingPacket.packet[key];
}
});
res.packet = Object.assign({}, res.packet, override);
}
if (res.networkInfo) {
if (res.networkInfo.timeStamp) {
res.networkInfo.timeStamp = existingPacket.networkInfo.timeStamp;
}
if (res.networkInfo.startedDateTime) {
res.networkInfo.startedDateTime =
existingPacket.networkInfo.startedDateTime;
}
if (res.networkInfo.totalTime) {
res.networkInfo.totalTime = existingPacket.networkInfo.totalTime;
}
if (res.networkInfo.actor) {
res.networkInfo.actor = existingPacket.networkInfo.actor;
}
if (res.networkInfo.request && res.networkInfo.request.headersSize) {
res.networkInfo.request.headersSize =
existingPacket.networkInfo.request.headersSize;
}
if (res.exception && existingPacket.exception) {
// Clean actor ids on exception messages.
copyExistingActor(res.exception, existingPacket.exception);
if (
res.exception._grip &&
res.exception._grip.preview &&
existingPacket.exception._grip &&
existingPacket.exception._grip.preview
) {
if (
res.networkInfo.response &&
res.networkInfo.response.headersSize !== undefined
typeof res.exception._grip.preview.message === "object" &&
res.exception._grip.preview.message._grip.type === "longString" &&
typeof existingPacket.exception._grip.preview.message === "object" &&
existingPacket.exception._grip.preview.message._grip.type ===
"longString"
) {
res.networkInfo.response.headersSize =
existingPacket.networkInfo.response.headersSize;
}
if (
res.networkInfo.response &&
res.networkInfo.response.bodySize !== undefined
) {
res.networkInfo.response.bodySize =
existingPacket.networkInfo.response.bodySize;
}
if (
res.networkInfo.response &&
res.networkInfo.response.transferredSize !== undefined
) {
res.networkInfo.response.transferredSize =
existingPacket.networkInfo.response.transferredSize;
copyExistingActor(
res.exception._grip.preview.message,
existingPacket.exception._grip.preview.message
);
}
}
if (res.updates && Array.isArray(res.updates)) {
res.updates.sort();
if (
typeof res.exceptionMessage === "object" &&
res.exceptionMessage._grip &&
res.exceptionMessage._grip.type === "longString"
) {
copyExistingActor(res.exceptionMessage, existingPacket.exceptionMessage);
}
}
if (res.helperResult) {
if (res.eventActor) {
// Clean actor ids and startedDateTime on network messages.
res.eventActor.actor = existingPacket.eventActor.actor;
res.eventActor.startedDateTime = existingPacket.eventActor.startedDateTime;
}
if (res.pageError) {
// Clean innerWindowID on pageError messages.
res.pageError.innerWindowID = existingPacket.pageError.innerWindowID;
if (
typeof res.pageError.errorMessage === "object" &&
res.pageError.errorMessage._grip &&
res.pageError.errorMessage._grip.type === "longString"
) {
copyExistingActor(
res.helperResult.object,
existingPacket.helperResult.object
res.pageError.errorMessage,
existingPacket.pageError.errorMessage
);
}
} else {
res = packet;
if (res.pageError.sourceId) {
res.pageError.sourceId = existingPacket.pageError.sourceId;
}
if (Array.isArray(res.pageError.stacktrace)) {
res.pageError.stacktrace = res.pageError.stacktrace.map((frame, i) => {
const existingFrame = existingPacket.pageError.stacktrace[i];
if (frame && existingFrame && frame.sourceId) {
frame.sourceId = existingFrame.sourceId;
}
return frame;
});
}
}
if (Array.isArray(res.exceptionStack)) {
res.exceptionStack = res.exceptionStack.map((frame, i) => {
const existingFrame = existingPacket.exceptionStack[i];
if (frame && existingFrame && frame.sourceId) {
frame.sourceId = existingFrame.sourceId;
}
return frame;
});
}
if (res.frame && existingPacket.frame) {
res.frame.sourceId = existingPacket.frame.sourceId;
}
if (res.packet) {
const override = {};
const keys = ["totalTime", "from", "contentSize", "transferredSize"];
keys.forEach(x => {
if (res.packet[x] !== undefined) {
override[x] = existingPacket.packet[key];
}
});
res.packet = Object.assign({}, res.packet, override);
}
if (res.networkInfo) {
if (res.networkInfo.startedDateTime) {
res.networkInfo.startedDateTime =
existingPacket.networkInfo.startedDateTime;
}
if (res.networkInfo.totalTime) {
res.networkInfo.totalTime = existingPacket.networkInfo.totalTime;
}
if (res.networkInfo.actor) {
res.networkInfo.actor = existingPacket.networkInfo.actor;
}
if (res.networkInfo.request && res.networkInfo.request.headersSize) {
res.networkInfo.request.headersSize =
existingPacket.networkInfo.request.headersSize;
}
if (
res.networkInfo.response &&
res.networkInfo.response.headersSize !== undefined
) {
res.networkInfo.response.headersSize =
existingPacket.networkInfo.response.headersSize;
}
if (
res.networkInfo.response &&
res.networkInfo.response.bodySize !== undefined
) {
res.networkInfo.response.bodySize =
existingPacket.networkInfo.response.bodySize;
}
if (
res.networkInfo.response &&
res.networkInfo.response.transferredSize !== undefined
) {
res.networkInfo.response.transferredSize =
existingPacket.networkInfo.response.transferredSize;
}
}
if (res.updates && Array.isArray(res.updates)) {
res.updates.sort();
}
if (res.helperResult) {
copyExistingActor(
res.helperResult.object,
existingPacket.helperResult.object
);
}
return res;
}
function cleanTimeStamp(packet) {
// We want to have the same timestamp for every stub, so they won't be re-sorted when
// adding them to the store.
const uniqueTimeStamp = 1572867483805;
if (packet.timestamp) {
packet.timestamp = uniqueTimeStamp;
}
if (packet.timeStamp) {
packet.timeStamp = uniqueTimeStamp;
}
if (packet?.message?.timeStamp) {
packet.message.timeStamp = uniqueTimeStamp;
}
if (packet?.result?._grip?.preview?.timestamp) {
packet.result._grip.preview.timestamp = uniqueTimeStamp;
}
if (packet?.exception?._grip?.preview?.timestamp) {
packet.exception._grip.preview.timestamp = uniqueTimeStamp;
}
if (packet?.eventActor?.timeStamp) {
packet.eventActor.timeStamp = uniqueTimeStamp;
}
if (packet?.pageError?.timeStamp) {
packet.pageError.timeStamp = uniqueTimeStamp;
}
if (packet?.networkInfo?.timeStamp) {
packet.networkInfo.timeStamp = uniqueTimeStamp;
}
}
function copyExistingActor(front1, front2) {
if (!front1 || !front2) {
return;

View File

@ -10,8 +10,7 @@ const {
stubPackets,
} = require("devtools/client/webconsole/test/node/fixtures/stubs/index");
const {
getFirstMessage,
getLastMessage,
clonePacket,
getMessageAt,
getPrivatePacket,
getWebConsoleUiMock,
@ -112,20 +111,21 @@ describe("WebConsoleWrapper", () => {
it("removes private packets from network request queue on dispatchPrivateMessagesClear", async () => {
const ncow = await getWebConsoleWrapper();
ncow
.getStore()
.dispatch(
messagesAdd([
stubPackets.get("GET request"),
getPrivatePacket("XHR GET request"),
getPrivatePacket("XHR POST request"),
])
);
const packet1 = clonePacket(stubPackets.get("GET request"));
const packet2 = clonePacket(getPrivatePacket("XHR GET request"));
const packet3 = clonePacket(getPrivatePacket("XHR POST request"));
// We need to reassign the timeStamp of the packet to guarantee the order.
packet1.timeStamp = packet1.timeStamp + 1;
packet2.timeStamp = packet2.timeStamp + 2;
packet3.timeStamp = packet3.timeStamp + 3;
ncow.getStore().dispatch(messagesAdd([packet1, packet2, packet3]));
const state = ncow.getStore().getState();
const publicId = getFirstMessage(state).id;
const publicId = getMessageAt(state, 0).id;
const privateXhrGetId = getMessageAt(state, 1).id;
const privateXhrPostId = getLastMessage(state).id;
const privateXhrPostId = getMessageAt(state, 2).id;
ncow.queuedRequestUpdates.push(
{ id: publicId },
{ id: privateXhrGetId },

View File

@ -37,7 +37,7 @@ rawPackets.set(`console.log('foobar', 'test')`, {
"private": false,
"sourceId": "server0.conn0.child1/source22",
"styles": [],
"timeStamp": 1572867478499,
"timeStamp": 1572867483805,
"timer": null,
"workerType": "none",
"category": "webdev",
@ -66,7 +66,7 @@ rawPackets.set(`console.log(undefined)`, {
"private": false,
"sourceId": "server0.conn0.child1/source22",
"styles": [],
"timeStamp": 1572867478640,
"timeStamp": 1572867483805,
"timer": null,
"workerType": "none",
"category": "webdev",
@ -93,7 +93,7 @@ rawPackets.set(`console.warn('danger, will robinson!')`, {
"private": false,
"sourceId": "server0.conn0.child1/source22",
"styles": [],
"timeStamp": 1572867478968,
"timeStamp": 1572867483805,
"timer": null,
"workerType": "none",
"category": "webdev",
@ -122,7 +122,7 @@ rawPackets.set(`console.log(NaN)`, {
"private": false,
"sourceId": "server0.conn0.child1/source22",
"styles": [],
"timeStamp": 1572867479180,
"timeStamp": 1572867483805,
"timer": null,
"workerType": "none",
"category": "webdev",
@ -151,7 +151,7 @@ rawPackets.set(`console.log(null)`, {
"private": false,
"sourceId": "server0.conn0.child1/source22",
"styles": [],
"timeStamp": 1572867479211,
"timeStamp": 1572867483805,
"timer": null,
"workerType": "none",
"category": "webdev",
@ -178,7 +178,7 @@ rawPackets.set(`console.log('鼬')`, {
"private": false,
"sourceId": "server0.conn0.child1/source22",
"styles": [],
"timeStamp": 1572867479994,
"timeStamp": 1572867483805,
"timer": null,
"workerType": "none",
"category": "webdev",
@ -202,7 +202,7 @@ rawPackets.set(`console.clear()`, {
"prefix": "",
"private": false,
"sourceId": "server0.conn0.child1/source22",
"timeStamp": 1572867480243,
"timeStamp": 1572867483805,
"timer": null,
"workerType": "none",
"styles": [],
@ -232,7 +232,7 @@ rawPackets.set(`console.count('bar')`, {
"prefix": "",
"private": false,
"sourceId": "server0.conn0.child1/source22",
"timeStamp": 1572867480460,
"timeStamp": 1572867483805,
"timer": null,
"workerType": "none",
"styles": [],
@ -286,7 +286,7 @@ rawPackets.set(`console.assert(false, {message: 'foobar'})`, {
"private": false,
"sourceId": "server0.conn0.child1/source30",
"styles": [],
"timeStamp": 1572867480691,
"timeStamp": 1572867483805,
"timer": null,
"stacktrace": [
{
@ -322,7 +322,7 @@ rawPackets.set(`console.log('úṇĩçödê țĕșť')`, {
"private": false,
"sourceId": "server0.conn0.child1/source22",
"styles": [],
"timeStamp": 1572867480913,
"timeStamp": 1572867483805,
"timer": null,
"workerType": "none",
"category": "webdev",
@ -363,7 +363,7 @@ rawPackets.set(`console.dirxml(window)`, {
"prefix": "",
"private": false,
"sourceId": "server0.conn0.child1/source22",
"timeStamp": 1572867481147,
"timeStamp": 1572867483805,
"timer": null,
"workerType": "none",
"styles": [],
@ -412,7 +412,7 @@ rawPackets.set(`console.log('myarray', ['red', 'green', 'blue'])`, {
"private": false,
"sourceId": "server0.conn0.child1/source22",
"styles": [],
"timeStamp": 1572867481361,
"timeStamp": 1572867483805,
"timer": null,
"workerType": "none",
"category": "webdev",
@ -452,7 +452,7 @@ rawPackets.set(`console.log('myregex', /a.b.c/)`, {
"private": false,
"sourceId": "server0.conn0.child1/source22",
"styles": [],
"timeStamp": 1572867481440,
"timeStamp": 1572867483805,
"timer": null,
"workerType": "none",
"category": "webdev",
@ -510,7 +510,7 @@ rawPackets.set(`console.table(['red', 'green', 'blue']);`, {
"prefix": "",
"private": false,
"sourceId": "server0.conn0.child1/source22",
"timeStamp": 1572867481889,
"timeStamp": 1572867483805,
"timer": null,
"workerType": "none",
"styles": [],
@ -577,7 +577,7 @@ rawPackets.set(`console.log('myobject', {red: 'redValue', green: 'greenValue', b
"private": false,
"sourceId": "server0.conn0.child1/source22",
"styles": [],
"timeStamp": 1572867481960,
"timeStamp": 1572867483805,
"timer": null,
"workerType": "none",
"category": "webdev",
@ -604,7 +604,7 @@ rawPackets.set(`console.debug('debug message');`, {
"private": false,
"sourceId": "server0.conn0.child1/source22",
"styles": [],
"timeStamp": 1572867482257,
"timeStamp": 1572867483805,
"timer": null,
"workerType": "none",
"category": "webdev",
@ -631,7 +631,7 @@ rawPackets.set(`console.info('info message');`, {
"private": false,
"sourceId": "server0.conn0.child1/source22",
"styles": [],
"timeStamp": 1572867482321,
"timeStamp": 1572867483805,
"timer": null,
"workerType": "none",
"category": "webdev",
@ -658,7 +658,7 @@ rawPackets.set(`console.error('error message');`, {
"private": false,
"sourceId": "server0.conn0.child1/source30",
"styles": [],
"timeStamp": 1572867482624,
"timeStamp": 1572867483805,
"timer": null,
"stacktrace": [
{
@ -720,7 +720,7 @@ rawPackets.set(`console.log('mymap')`, {
"private": false,
"sourceId": "server0.conn0.child1/source46",
"styles": [],
"timeStamp": 1572867482662,
"timeStamp": 1572867483805,
"timer": null,
"workerType": "none",
"category": "webdev",
@ -767,7 +767,7 @@ rawPackets.set(`console.log('myset')`, {
"private": false,
"sourceId": "server0.conn0.child1/source48",
"styles": [],
"timeStamp": 1572867483160,
"timeStamp": 1572867483805,
"timer": null,
"workerType": "none",
"category": "webdev",
@ -791,7 +791,7 @@ rawPackets.set(`console.trace()`, {
"prefix": "",
"private": false,
"sourceId": "server0.conn0.child1/source50",
"timeStamp": 1572867483200,
"timeStamp": 1572867483805,
"timer": null,
"stacktrace": [
{
@ -889,7 +889,7 @@ rawPackets.set(`console.trace('bar', {'foo': 'bar'}, [1,2,3])`, {
"prefix": "",
"private": false,
"sourceId": "server0.conn0.child1/source51",
"timeStamp": 1572867483279,
"timeStamp": 1572867483805,
"timer": null,
"stacktrace": [
{
@ -939,7 +939,7 @@ rawPackets.set(`console.time('bar')`, {
"prefix": "",
"private": false,
"sourceId": "server0.conn0.child1/source48",
"timeStamp": 1572867483516,
"timeStamp": 1572867483805,
"timer": {
"name": "bar"
},
@ -968,7 +968,7 @@ rawPackets.set(`timerAlreadyExists`, {
"prefix": "",
"private": false,
"sourceId": "server0.conn0.child1/source54",
"timeStamp": 1572867483518,
"timeStamp": 1572867483805,
"timer": {
"error": "timerAlreadyExists",
"name": "bar"
@ -998,7 +998,7 @@ rawPackets.set(`console.timeLog('bar') - 1`, {
"prefix": "",
"private": false,
"sourceId": "server0.conn0.child1/source54",
"timeStamp": 1572867483519,
"timeStamp": 1572867483805,
"timer": {
"duration": 4,
"name": "bar"
@ -1056,7 +1056,7 @@ rawPackets.set(`console.timeLog('bar') - 2`, {
"prefix": "",
"private": false,
"sourceId": "server0.conn0.child1/source46",
"timeStamp": 1572867483521,
"timeStamp": 1572867483805,
"timer": {
"duration": 5,
"name": "bar"
@ -1086,7 +1086,7 @@ rawPackets.set(`console.timeEnd('bar')`, {
"prefix": "",
"private": false,
"sourceId": "server0.conn0.child1/source54",
"timeStamp": 1572867483524,
"timeStamp": 1572867483805,
"timer": {
"duration": 9,
"name": "bar"
@ -1116,7 +1116,7 @@ rawPackets.set(`timeEnd.timerDoesntExist`, {
"prefix": "",
"private": false,
"sourceId": "server0.conn0.child1/source54",
"timeStamp": 1572867483526,
"timeStamp": 1572867483805,
"timer": {
"error": "timerDoesntExist",
"name": "bar"
@ -1146,7 +1146,7 @@ rawPackets.set(`timeLog.timerDoesntExist`, {
"prefix": "",
"private": false,
"sourceId": "server0.conn0.child1/source54",
"timeStamp": 1572867483527,
"timeStamp": 1572867483805,
"timer": {
"error": "timerDoesntExist",
"name": "bar"
@ -1235,7 +1235,7 @@ rawPackets.set(`console.table(['a', 'b', 'c'])`, {
"prefix": "",
"private": false,
"sourceId": "server0.conn0.child1/source48",
"timeStamp": 1572867484093,
"timeStamp": 1572867483805,
"timer": null,
"workerType": "none",
"styles": [],
@ -1263,7 +1263,7 @@ rawPackets.set(`console.group('bar')`, {
"private": false,
"sourceId": "server0.conn0.child1/source48",
"styles": [],
"timeStamp": 1572867484276,
"timeStamp": 1572867483805,
"timer": null,
"workerType": "none",
"category": "webdev",
@ -1287,7 +1287,7 @@ rawPackets.set(`console.groupEnd('bar')`, {
"prefix": "",
"private": false,
"sourceId": "server0.conn0.child1/source54",
"timeStamp": 1572867484277,
"timeStamp": 1572867483805,
"timer": null,
"workerType": "none",
"styles": [],
@ -1315,7 +1315,7 @@ rawPackets.set(`console.groupCollapsed('foo')`, {
"private": false,
"sourceId": "server0.conn0.child1/source48",
"styles": [],
"timeStamp": 1572867484325,
"timeStamp": 1572867483805,
"timer": null,
"workerType": "none",
"category": "webdev",
@ -1339,7 +1339,7 @@ rawPackets.set(`console.groupEnd('foo')`, {
"prefix": "",
"private": false,
"sourceId": "server0.conn0.child1/source54",
"timeStamp": 1572867484326,
"timeStamp": 1572867483805,
"timer": null,
"workerType": "none",
"styles": [],
@ -1365,7 +1365,7 @@ rawPackets.set(`console.group()`, {
"private": false,
"sourceId": "server0.conn0.child1/source48",
"styles": [],
"timeStamp": 1572867484564,
"timeStamp": 1572867483805,
"timer": null,
"workerType": "none",
"category": "webdev",
@ -1389,7 +1389,7 @@ rawPackets.set(`console.groupEnd()`, {
"prefix": "",
"private": false,
"sourceId": "server0.conn0.child1/source54",
"timeStamp": 1572867484565,
"timeStamp": 1572867483805,
"timer": null,
"workerType": "none",
"styles": [],
@ -1421,7 +1421,7 @@ rawPackets.set(`console.log(%cfoobar)`, {
"color:blue; font-size:1.3em; background:url('http://example.com/test'); position:absolute; top:10px; ",
"color:red; line-height: 1.5; background:url('http://example.com/test')"
],
"timeStamp": 1572867484724,
"timeStamp": 1572867483805,
"timer": null,
"workerType": "none",
"category": "webdev",
@ -1454,7 +1454,7 @@ rawPackets.set(`console.log("%cHello%c|%cWorld")`, {
"",
"color: blue"
],
"timeStamp": 1572867484739,
"timeStamp": 1572867483805,
"timer": null,
"workerType": "none",
"category": "webdev",
@ -1485,7 +1485,7 @@ rawPackets.set(`console.group(%cfoo%cbar)`, {
"color:blue;font-size:1.3em;background:url('http://example.com/test');position:absolute;top:10px",
"color:red;background:url('http://example.com/test')"
],
"timeStamp": 1572867484762,
"timeStamp": 1572867483805,
"timer": null,
"workerType": "none",
"category": "webdev",
@ -1509,7 +1509,7 @@ rawPackets.set(`console.groupEnd(%cfoo%cbar)`, {
"prefix": "",
"private": false,
"sourceId": "server0.conn0.child1/source54",
"timeStamp": 1572867484763,
"timeStamp": 1572867483805,
"timer": null,
"workerType": "none",
"styles": [],
@ -1541,7 +1541,7 @@ rawPackets.set(`console.groupCollapsed(%cfoo%cbaz)`, {
"color:blue;font-size:1.3em;background:url('http://example.com/test');position:absolute;top:10px",
"color:red;background:url('http://example.com/test')"
],
"timeStamp": 1572867484842,
"timeStamp": 1572867483805,
"timer": null,
"workerType": "none",
"category": "webdev",
@ -1565,7 +1565,7 @@ rawPackets.set(`console.groupEnd(%cfoo%cbaz)`, {
"prefix": "",
"private": false,
"sourceId": "server0.conn0.child1/source54",
"timeStamp": 1572867484842,
"timeStamp": 1572867483805,
"timer": null,
"workerType": "none",
"styles": [],
@ -1636,7 +1636,7 @@ rawPackets.set(`console.dir({C, M, Y, K})`, {
"prefix": "",
"private": false,
"sourceId": "server0.conn0.child1/source22",
"timeStamp": 1572867484881,
"timeStamp": 1572867483805,
"timer": null,
"workerType": "none",
"styles": [],
@ -1666,7 +1666,7 @@ rawPackets.set(`console.count | default: 1`, {
"prefix": "",
"private": false,
"sourceId": "server0.conn0.child1/source68",
"timeStamp": 1572867485168,
"timeStamp": 1572867483805,
"timer": null,
"workerType": "none",
"styles": [],
@ -1696,7 +1696,7 @@ rawPackets.set(`console.count | default: 2`, {
"prefix": "",
"private": false,
"sourceId": "server0.conn0.child1/source68",
"timeStamp": 1572867485169,
"timeStamp": 1572867483805,
"timer": null,
"workerType": "none",
"styles": [],
@ -1726,7 +1726,7 @@ rawPackets.set(`console.count | test counter: 1`, {
"prefix": "",
"private": false,
"sourceId": "server0.conn0.child1/source68",
"timeStamp": 1572867485170,
"timeStamp": 1572867483805,
"timer": null,
"workerType": "none",
"styles": [],
@ -1756,7 +1756,7 @@ rawPackets.set(`console.count | test counter: 2`, {
"prefix": "",
"private": false,
"sourceId": "server0.conn0.child1/source68",
"timeStamp": 1572867485171,
"timeStamp": 1572867483805,
"timer": null,
"workerType": "none",
"styles": [],
@ -1786,7 +1786,7 @@ rawPackets.set(`console.count | default: 3`, {
"prefix": "",
"private": false,
"sourceId": "server0.conn0.child1/source68",
"timeStamp": 1572867485172,
"timeStamp": 1572867483805,
"timer": null,
"workerType": "none",
"styles": [],
@ -1811,7 +1811,7 @@ rawPackets.set(`console.count | clear`, {
"prefix": "",
"private": false,
"sourceId": "server0.conn0.child1/source68",
"timeStamp": 1572867485175,
"timeStamp": 1572867483805,
"timer": null,
"workerType": "none",
"styles": [],
@ -1841,7 +1841,7 @@ rawPackets.set(`console.count | default: 4`, {
"prefix": "",
"private": false,
"sourceId": "server0.conn0.child1/source68",
"timeStamp": 1572867485176,
"timeStamp": 1572867483805,
"timer": null,
"workerType": "none",
"styles": [],
@ -1871,7 +1871,7 @@ rawPackets.set(`console.count | test counter: 3`, {
"prefix": "",
"private": false,
"sourceId": "server0.conn0.child1/source68",
"timeStamp": 1572867485187,
"timeStamp": 1572867483805,
"timer": null,
"workerType": "none",
"styles": [],
@ -1901,7 +1901,7 @@ rawPackets.set(`console.countReset | test counter: 0`, {
"prefix": "",
"private": false,
"sourceId": "server0.conn0.child1/source68",
"timeStamp": 1572867485188,
"timeStamp": 1572867483805,
"timer": null,
"workerType": "none",
"styles": [],
@ -1931,7 +1931,7 @@ rawPackets.set(`console.countReset | counterDoesntExist`, {
"prefix": "",
"private": false,
"sourceId": "server0.conn0.child1/source68",
"timeStamp": 1572867485195,
"timeStamp": 1572867483805,
"timer": null,
"workerType": "none",
"styles": [],
@ -1959,7 +1959,7 @@ rawPackets.set(`console.log escaped characters`, {
"private": false,
"sourceId": "server0.conn0.child1/source22",
"styles": [],
"timeStamp": 1572867485291,
"timeStamp": 1572867483805,
"timer": null,
"workerType": "none",
"category": "webdev",

View File

@ -29,7 +29,7 @@ rawPackets.set(`Unknown property such-unknown-property. Declaration dropp
"columnNumber": 27,
"category": "CSS Parser",
"innerWindowID": 8589934593,
"timeStamp": 1572867894874,
"timeStamp": 1572867483805,
"warning": true,
"error": false,
"info": false,
@ -53,7 +53,7 @@ rawPackets.set(`Error in parsing value for padding-top. Declaration dropp
"columnNumber": 18,
"category": "CSS Parser",
"innerWindowID": 8589934593,
"timeStamp": 1572867895090,
"timeStamp": 1572867483805,
"warning": true,
"error": false,
"info": false,

View File

@ -36,7 +36,7 @@ rawPackets.set(`new Date(0)`, {
},
"actorID": "server0.conn0.child1/obj23"
},
"timestamp": 1573832025019
"timestamp": 1572867483805
});
rawPackets.set(`asdf()`, {
@ -83,7 +83,7 @@ rawPackets.set(`asdf()`, {
"result": {
"type": "undefined"
},
"timestamp": 1573832025112
"timestamp": 1572867483805
});
rawPackets.set(`1 + @`, {
@ -121,7 +121,7 @@ rawPackets.set(`1 + @`, {
"result": {
"type": "undefined"
},
"timestamp": 1573832025117
"timestamp": 1572867483805
});
rawPackets.set(`inspect({a: 1})`, {
@ -162,7 +162,7 @@ rawPackets.set(`inspect({a: 1})`, {
"result": {
"type": "undefined"
},
"timestamp": 1573832025123
"timestamp": 1572867483805
});
rawPackets.set(`cd(document)`, {
@ -175,7 +175,7 @@ rawPackets.set(`cd(document)`, {
"result": {
"type": "undefined"
},
"timestamp": 1573832025126
"timestamp": 1572867483805
});
rawPackets.set(`undefined`, {
@ -184,7 +184,7 @@ rawPackets.set(`undefined`, {
"result": {
"type": "undefined"
},
"timestamp": 1573832025128
"timestamp": 1572867483805
});
rawPackets.set(`longString message Error`, {
@ -246,7 +246,7 @@ rawPackets.set(`longString message Error`, {
"result": {
"type": "undefined"
},
"timestamp": 1573832025130
"timestamp": 1572867483805
});
rawPackets.set(`eval throw ""`, {
@ -272,7 +272,7 @@ rawPackets.set(`eval throw ""`, {
"result": {
"type": "undefined"
},
"timestamp": 1573832025134
"timestamp": 1572867483805
});
rawPackets.set(`eval throw "tomato"`, {
@ -298,7 +298,7 @@ rawPackets.set(`eval throw "tomato"`, {
"result": {
"type": "undefined"
},
"timestamp": 1573832025138
"timestamp": 1572867483805
});

View File

@ -20,7 +20,7 @@ const {
const rawPackets = new Map();
rawPackets.set(`GET request`, {
"_type": "NetworkEvent",
"timeStamp": 1572865594542,
"timeStamp": 1572867483805,
"node": null,
"actor": "server0.conn0.netEvent4",
"discardRequestBody": true,
@ -102,7 +102,7 @@ rawPackets.set(`GET request update`, {
rawPackets.set(`XHR GET request`, {
"_type": "NetworkEvent",
"timeStamp": 1572865594909,
"timeStamp": 1572867483805,
"node": null,
"actor": "server0.conn0.netEvent20",
"discardRequestBody": true,
@ -184,7 +184,7 @@ rawPackets.set(`XHR GET request update`, {
rawPackets.set(`XHR POST request`, {
"_type": "NetworkEvent",
"timeStamp": 1572865595007,
"timeStamp": 1572867483805,
"node": null,
"actor": "server0.conn0.netEvent36",
"discardRequestBody": true,

View File

@ -30,7 +30,7 @@ rawPackets.set(`ReferenceError: asdf is not defined`, {
"columnNumber": 5,
"category": "content javascript",
"innerWindowID": 8589934593,
"timeStamp": 1573832650066,
"timeStamp": 1572867483805,
"warning": false,
"error": true,
"info": false,
@ -99,7 +99,7 @@ rawPackets.set(`SyntaxError: redeclaration of let a`, {
"columnNumber": 9,
"category": "content javascript",
"innerWindowID": 8589934593,
"timeStamp": 1573832650228,
"timeStamp": 1572867483805,
"warning": false,
"error": true,
"info": false,
@ -164,7 +164,7 @@ rawPackets.set(`TypeError longString message`, {
"columnNumber": 7,
"category": "content javascript",
"innerWindowID": 8589934593,
"timeStamp": 1573832650682,
"timeStamp": 1572867483805,
"warning": false,
"error": true,
"info": false,
@ -218,7 +218,7 @@ rawPackets.set(`throw ""`, {
"columnNumber": 1,
"category": "content javascript",
"innerWindowID": 8589934593,
"timeStamp": 1573832650688,
"timeStamp": 1572867483805,
"warning": false,
"error": true,
"info": false,
@ -272,7 +272,7 @@ rawPackets.set(`throw "tomato"`, {
"columnNumber": 1,
"category": "content javascript",
"innerWindowID": 8589934593,
"timeStamp": 1573832650692,
"timeStamp": 1572867483805,
"warning": false,
"error": true,
"info": false,

View File

@ -1101,9 +1101,9 @@ describe("Message reducer:", () => {
const packet3 = clonePacket(stubPackets.get(key1));
// Repeat ID must be the same even if the timestamp is different.
packet1.message.timeStamp = 1;
packet2.message.timeStamp = 2;
packet3.message.timeStamp = 3;
packet1.message.timeStamp = packet1.message.timeStamp + 1;
packet2.message.timeStamp = packet2.message.timeStamp + 2;
packet3.message.timeStamp = packet3.message.timeStamp + 3;
dispatch(actions.messagesAdd([packet1, packet2, packet3]));
// There is still only two messages being logged,

View File

@ -176,6 +176,10 @@ describe("private messages", () => {
actor: privateActor,
};
// We need to reassign the timeStamp of the packet to guarantee the order.
publicPacket.timeStamp = publicPacket.timeStamp + 1;
privatePacket.timeStamp = privatePacket.timeStamp + 2;
dispatch(actions.messagesAdd([publicPacket, privatePacket]));
let networkUpdates = getAllNetworkMessagesUpdateById(getState());