author | Dorel Luca <dluca@mozilla.com> |
Wed, 29 Apr 2020 22:33:05 +0300 | |
changeset 526723 | bc0932b38478abd600cae2b23c5f78381e80d0e8 |
parent 526722 | ec461276de070160880705f4860c1bea4a7188ea |
child 526724 | 5da5581d43bdc40ab2cf82897ed0ef95543a259c |
child 526725 | 624e19601244e22289283325ef4349657e493df8 |
push id | 37361 |
push user | malexandru@mozilla.com |
push date | Wed, 29 Apr 2020 21:55:39 +0000 |
treeherder | mozilla-central@bc0932b38478 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
bugs | 1631799 |
milestone | 77.0a1 |
backs out | 6feb116adffe41e0ce0d27cb15bb81c10d764e6e |
first release with | nightly linux32
bc0932b38478
/
77.0a1
/
20200429215539
/
files
nightly linux64
bc0932b38478
/
77.0a1
/
20200429215539
/
files
nightly mac
bc0932b38478
/
77.0a1
/
20200429215539
/
files
nightly win32
bc0932b38478
/
77.0a1
/
20200429215539
/
files
nightly win64
bc0932b38478
/
77.0a1
/
20200429215539
/
files
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
releases | nightly linux32
77.0a1
/
20200429215539
/
pushlog to previous
nightly linux64
77.0a1
/
20200429215539
/
pushlog to previous
nightly mac
77.0a1
/
20200429215539
/
pushlog to previous
nightly win32
77.0a1
/
20200429215539
/
pushlog to previous
nightly win64
77.0a1
/
20200429215539
/
pushlog to previous
|
--- a/devtools/client/webconsole/actions/input.js +++ b/devtools/client/webconsole/actions/input.js @@ -61,26 +61,24 @@ function evaluateExpression(expression, if (!expression) { expression = hud.getInputSelection() || hud.getInputValue(); } if (!expression) { return null; } // We use the messages action as it's doing additional transformation on the message. - const { messages } = dispatch( + dispatch( messagesActions.messagesAdd([ new ConsoleCommand({ messageText: expression, timeStamp: Date.now(), }), ]) ); - const [consoleCommandMessage] = messages; - dispatch({ type: EVALUATE_EXPRESSION, expression, from, }); WebConsoleUtils.usageCount++; @@ -95,39 +93,16 @@ function evaluateExpression(expression, .evaluateJSAsync(expression, { frameActor: await webConsoleUI.getFrameActor(), selectedNodeActor: webConsoleUI.getSelectedNodeActorID(), selectedTargetFront: toolbox && toolbox.getSelectedTargetFront(), mapped, }) .then(onSettled, onSettled); - // Before Firefox 77, the response did not have a `startTime` property, so we're using - // the `resultID`, which does contain the server time at which the evaluation started - // (its shape is `${timestamp}-${someId}`). - const serverConsoleCommandTimestamp = - response.startTime || Number(response.resultID.replace(/\-\d*$/, "")); - - // In case of remote debugging, it might happen that the debuggee page does not have - // the exact same clock time as the client. This could cause some ordering issues - // where the result message is displayed *before* the expression that lead to it. - if (consoleCommandMessage.timeStamp > serverConsoleCommandTimestamp) { - // If we're in such case, we remove the original command message, and add it again, - // with the timestamp coming from the server. - dispatch(messagesActions.messageRemove(consoleCommandMessage.id)); - dispatch( - messagesActions.messagesAdd([ - new ConsoleCommand({ - messageText: expression, - timeStamp: serverConsoleCommandTimestamp, - }), - ]) - ); - } - return dispatch(onExpressionEvaluated(response)); }; } /** * The JavaScript evaluation response handler. * * @private
--- a/devtools/client/webconsole/actions/messages.js +++ b/devtools/client/webconsole/actions/messages.js @@ -19,17 +19,16 @@ const { MESSAGES_ADD, NETWORK_MESSAGE_UPDATE, NETWORK_UPDATE_REQUEST, MESSAGES_CLEAR, MESSAGES_CLEAR_LOGPOINT, MESSAGE_OPEN, MESSAGE_CLOSE, MESSAGE_TYPE, - MESSAGE_REMOVE, MESSAGE_UPDATE_PAYLOAD, PRIVATE_MESSAGES_CLEAR, } = require("devtools/client/webconsole/constants"); const defaultIdGenerator = new IdGenerator(); function messagesAdd(packets, idGenerator = null) { if (idGenerator == null) { @@ -125,23 +124,16 @@ function messageGetMatchingElements(id, function messageUpdatePayload(id, data) { return { type: MESSAGE_UPDATE_PAYLOAD, id, data, }; } -function messageRemove(id) { - return { - type: MESSAGE_REMOVE, - id, - }; -} - function networkMessageUpdate(packet, idGenerator = null, response) { if (idGenerator == null) { idGenerator = defaultIdGenerator; } const message = prepareMessage(packet, idGenerator); return { @@ -160,15 +152,14 @@ function networkUpdateRequest(id, data) } module.exports = { messagesAdd, messagesClear, messagesClearLogpoint, messageOpen, messageClose, - messageRemove, messageGetMatchingElements, messageUpdatePayload, networkMessageUpdate, networkUpdateRequest, privateMessagesClear, };
--- a/devtools/client/webconsole/constants.js +++ b/devtools/client/webconsole/constants.js @@ -22,17 +22,16 @@ const actionTypes = { FILTER_TOGGLE: "FILTER_TOGGLE", FILTERS_CLEAR: "FILTERS_CLEAR", FILTERBAR_DISPLAY_MODE_SET: "FILTERBAR_DISPLAY_MODE_SET", HISTORY_LOADED: "HISTORY_LOADED", INITIALIZE: "INITIALIZE", MESSAGE_CLOSE: "MESSAGE_CLOSE", MESSAGE_OPEN: "MESSAGE_OPEN", MESSAGE_UPDATE_PAYLOAD: "MESSAGE_UPDATE_PAYLOAD", - MESSAGE_REMOVE: "MESSAGE_REMOVE", MESSAGES_ADD: "MESSAGES_ADD", MESSAGES_CLEAR: "MESSAGES_CLEAR", MESSAGES_CLEAR_LOGPOINT: "MESSAGES_CLEAR_LOGPOINT", NETWORK_MESSAGE_UPDATE: "NETWORK_MESSAGE_UPDATE", NETWORK_UPDATE_REQUEST: "NETWORK_UPDATE_REQUEST", PERSIST_TOGGLE: "PERSIST_TOGGLE", PRIVATE_MESSAGES_CLEAR: "PRIVATE_MESSAGES_CLEAR", REMOVE_NOTIFICATION: "REMOVE_NOTIFICATION",
--- a/devtools/client/webconsole/reducers/messages.js +++ b/devtools/client/webconsole/reducers/messages.js @@ -644,24 +644,16 @@ function messages( filtersState, prefsState, uiState, // If the user disabled warning groups, we want the messages to be sorted by their // timestamps. forceTimestampSort: !prefsState.groupWarnings, }); - case constants.MESSAGE_REMOVE: - return removeMessagesFromState( - { - ...state, - }, - [action.id] - ); - case constants.FILTER_TOGGLE: case constants.FILTER_TEXT_SET: case constants.FILTERS_CLEAR: case constants.DEFAULT_FILTERS_RESET: case constants.SHOW_CONTENT_MESSAGES_TOGGLE: return setVisibleMessages({ messagesState: state, filtersState,
--- a/devtools/client/webconsole/test/browser/stub-generator-helpers.js +++ b/devtools/client/webconsole/test/browser/stub-generator-helpers.js @@ -272,20 +272,16 @@ function cleanTimeStamp(packet) { if (packet.timestamp) { packet.timestamp = uniqueTimeStamp; } if (packet.timeStamp) { packet.timeStamp = uniqueTimeStamp; } - if (packet.startTime) { - packet.startTime = uniqueTimeStamp; - } - if (packet?.message?.timeStamp) { packet.message.timeStamp = uniqueTimeStamp; } if (packet?.result?._grip?.preview?.timestamp) { packet.result._grip.preview.timestamp = uniqueTimeStamp; }
--- a/devtools/client/webconsole/test/node/fixtures/stubs/evaluationResult.js +++ b/devtools/client/webconsole/test/node/fixtures/stubs/evaluationResult.js @@ -31,17 +31,16 @@ rawPackets.set(`new Date(0)`, { "frozen": false, "sealed": false, "preview": { "timestamp": 0 } }, "actorID": "server0.conn0.child1/obj23" }, - "startTime": 1572867483805, "timestamp": 1572867483805 }); rawPackets.set(`asdf()`, { "resultID": "1573832025112-1", "errorMessageName": "JSMSG_NOT_DEFINED", "exception": { "_grip": { @@ -79,17 +78,16 @@ rawPackets.set(`asdf()`, { "source": "debugger eval code", "line": 1, "column": 1 }, "input": "asdf()", "result": { "type": "undefined" }, - "startTime": 1572867483805, "timestamp": 1572867483805 }); rawPackets.set(`1 + @`, { "resultID": "1573832025117-2", "errorMessageName": "JSMSG_ILLEGAL_CHARACTER", "exception": { "_grip": { @@ -118,17 +116,16 @@ rawPackets.set(`1 + @`, { "source": "debugger eval code", "line": 1, "column": 4 }, "input": "1 + @", "result": { "type": "undefined" }, - "startTime": 1572867483805, "timestamp": 1572867483805 }); rawPackets.set(`inspect({a: 1})`, { "resultID": "1573832025122-3", "helperResult": { "type": "inspectObject", "input": "inspect({a: 1})", @@ -160,41 +157,38 @@ rawPackets.set(`inspect({a: 1})`, { "actorID": "server0.conn0.child1/obj28" }, "forceExpandInConsole": false }, "input": "inspect({a: 1})", "result": { "type": "undefined" }, - "startTime": 1572867483805, "timestamp": 1572867483805 }); rawPackets.set(`cd(document)`, { "resultID": "1573832025125-4", "helperResult": { "type": "error", "message": "cdFunctionInvalidArgument" }, "input": "cd(document)", "result": { "type": "undefined" }, - "startTime": 1572867483805, "timestamp": 1572867483805 }); rawPackets.set(`undefined`, { "resultID": "1573832025127-5", "input": "undefined", "result": { "type": "undefined" }, - "startTime": 1572867483805, "timestamp": 1572867483805 }); rawPackets.set(`longString message Error`, { "resultID": "1573832025130-6", "exception": { "_grip": { "type": "object", @@ -247,17 +241,16 @@ rawPackets.set(`longString message Error "sourceId": "server0.conn0.child1/source31", "line": 1, "column": 7 }, "input": "throw new Error(\"Long error \".repeat(10000))", "result": { "type": "undefined" }, - "startTime": 1572867483805, "timestamp": 1572867483805 }); rawPackets.set(`eval throw ""`, { "resultID": "1573832025134-7", "exception": "", "exceptionMessage": "", "exceptionStack": [ @@ -274,17 +267,16 @@ rawPackets.set(`eval throw ""`, { "sourceId": "server0.conn0.child1/source24", "line": 1, "column": 1 }, "input": "throw \"\"", "result": { "type": "undefined" }, - "startTime": 1572867483805, "timestamp": 1572867483805 }); rawPackets.set(`eval throw "tomato"`, { "resultID": "1573832025137-8", "exception": "tomato", "exceptionMessage": "tomato", "exceptionStack": [ @@ -301,17 +293,16 @@ rawPackets.set(`eval throw "tomato"`, { "sourceId": "server0.conn0.child1/source24", "line": 1, "column": 1 }, "input": "throw \"tomato\"", "result": { "type": "undefined" }, - "startTime": 1572867483805, "timestamp": 1572867483805 }); const stubPackets = parsePacketsWithFronts(rawPackets); const stubPreparedMessages = new Map(); for (const [key, packet] of Array.from(stubPackets.entries())) {
--- a/devtools/client/webconsole/test/node/store/messages.test.js +++ b/devtools/client/webconsole/test/node/store/messages.test.js @@ -1111,35 +1111,9 @@ describe("Message reducer:", () => { expect(messages.size).toBe(2); // the second one being repeated 3 times const repeat = getAllRepeatById(getState()); expect(repeat[getFirstMessage(getState()).id]).toBe(3); expect(repeat[getLastMessage(getState()).id]).toBe(undefined); }); }); - - describe("messageRemove", () => { - it("removes the message from the store", () => { - const { dispatch, getState } = setupStore([ - "console.trace()", - "console.log(undefined)", - "console.trace()", - "console.log(undefined)", - ]); - - let expanded = getAllMessagesUiById(getState()); - expect(expanded.length).toBe(2); - - const secondTraceMessage = getMessageAt(getState(), 2); - dispatch(actions.messageRemove(secondTraceMessage.id)); - - const messages = getAllMessagesById(getState()); - // The messages was removed - expect(messages.size).toBe(3); - - // Its id was removed from the messagesUI property as well - expanded = getAllMessagesUiById(getState()); - expect(expanded.length).toBe(1); - expect(expanded.includes(secondTraceMessage.id)).toBeFalsy(); - }); - }); });
--- a/devtools/server/actors/webconsole.js +++ b/devtools/server/actors/webconsole.js @@ -1006,39 +1006,37 @@ const WebConsoleActor = ActorClassWithSp * * @param object request * The JSON request object received from the Web Console client. * @return object * The response packet to send to with the unique id in the * `resultID` field. */ evaluateJSAsync: async function(request) { - const startTime = Date.now(); // Use Date instead of UUID as this code is used by workers, which // don't have access to the UUID XPCOM component. // Also use a counter in order to prevent mixing up response when calling // evaluateJSAsync during the same millisecond. - const resultID = startTime + "-" + this._evalCounter++; + const resultID = Date.now() + "-" + this._evalCounter++; // Execute the evaluation in the next event loop in order to immediately // reply with the resultID. DevToolsUtils.executeSoon(async () => { try { // Execute the script that may pause. let response = this.evaluateJS(request); // Wait for any potential returned Promise. response = await this._maybeWaitForResponseResult(response); // Set the timestamp only now, so any messages logged in the expression will come // before the result. response.timestamp = Date.now(); // Finally, emit an unsolicited evaluationResult packet with the evaluation result. this.emit("evaluationResult", { type: "evaluationResult", resultID, - startTime, ...response, }); return; } catch (e) { const message = `Encountered error while waiting for Helper Result: ${e}`; DevToolsUtils.reportException("evaluateJSAsync", Error(message)); } });
--- a/devtools/shared/specs/webconsole.js +++ b/devtools/shared/specs/webconsole.js @@ -52,17 +52,16 @@ const webconsoleSpecPrototype = { exceptionMessage: Option(0, "nullable:string"), exceptionDocURL: Option(0, "nullable:string"), exceptionStack: Option(0, "nullable:json"), frame: Option(0, "nullable:json"), helperResult: Option(0, "nullable:json"), input: Option(0, "nullable:string"), notes: Option(0, "nullable:string"), result: Option(0, "nullable:json"), - startTime: Option(0, "number"), timestamp: Option(0, "string"), topLevelAwaitRejected: Option(0, "nullable:boolean"), }, fileActivity: { uri: Option(0, "string"), }, pageError: { pageError: Option(0, "json"),